* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
    background: linear-gradient(180deg, #14532d 0%, #166534 40%, #0f172a 100%);
    min-height: 100vh;
    min-height: 100dvh;
    color: #ecfccb;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.wrap { max-width: 560px; margin: 0 auto; }
.head { text-align: center; margin-bottom: 12px; }
.head h1 { font-size: 1.55rem; margin-bottom: 10px; text-shadow: 0 2px 4px rgba(0,0,0,0.35); }
.stats {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.stat {
    background: rgba(0,0,0,0.28);
    padding: 8px 12px;
    border-radius: 8px;
    min-width: 4.5rem;
    border: 2px solid transparent;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.stat.stat-side.is-active {
    border-color: rgba(190, 242, 100, 0.65);
    box-shadow: 0 0 0 1px rgba(190, 242, 100, 0.25) inset;
    background: rgba(0,0,0,0.42);
}
.stat.wide { min-width: 11rem; }
.stat .lbl { opacity: 0.88; margin-right: 6px; font-size: 0.88rem; }
.stat span:last-child {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}
.canvas-wrap {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}
#board {
    display: block;
    width: 100%;
    max-width: min(100vw - 24px, 480px);
    height: auto;
    aspect-ratio: 1;
    background: #14532d;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.4);
    border: 3px solid rgba(255,255,255,0.14);
    touch-action: none;
    cursor: pointer;
    outline: none;
}
#board:focus-visible {
    box-shadow: 0 0 0 3px rgba(190, 242, 100, 0.55), 0 8px 28px rgba(0,0,0,0.4);
}
.toolbar {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.btn {
    padding: 10px 22px;
    border: none;
    border-radius: 8px;
    background: rgba(255,255,255,0.14);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: rgba(255,255,255,0.24); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible {
    outline: 2px solid #bef264;
    outline-offset: 2px;
}
.hint {
    text-align: center;
    font-size: 0.84rem;
    opacity: 0.9;
    margin-top: 12px;
    line-height: 1.55;
}
