.game-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    margin: 20px auto;
    max-width: 660px;
    width: 95%;
}
.nav-back { color: var(--text-secondary); text-decoration: none; font-weight: 600; transition: color 0.3s; }
.nav-back:hover { color: var(--text-primary); }
.nav-title { font-size: 1.25rem; font-weight: 800; }

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto 40px;
    padding: 0 16px;
    width: 100%;
    max-width: 660px;
}

/* ── Setup screen ────────────────────────────────────────── */
.setup-panel {
    width: 100%;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
}
.setup-panel.hidden { display: none; }
.setup-emoji { font-size: 3rem; }
.setup-title { font-size: 1.6rem; font-weight: 800; margin: 0; }
.setup-desc { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; margin: 0; }

.cat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
}
.cat-btn {
    background: var(--surface-color);
    border: 1.5px solid var(--glass-border);
    border-radius: 10px;
    padding: 10px 4px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    font-family: inherit;
}
.cat-btn:hover { border-color: rgba(56,189,248,0.5); background: rgba(56,189,248,0.08); }
.cat-btn.selected { border-color: #38bdf8; background: rgba(56,189,248,0.15); color: #38bdf8; }

.or-div { color: var(--text-secondary); font-size: 0.85rem; }
.word-input {
    width: 100%;
    box-sizing: border-box;
    background: var(--surface-color);
    border: 1.5px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
}
.word-input:focus { outline: none; border-color: rgba(56,189,248,0.6); }
.word-input::placeholder { color: var(--text-secondary); opacity: 0.6; }

.timer-row {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.timer-sel {
    background: var(--surface-color);
    border: 1.5px solid var(--glass-border);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: inherit;
    cursor: pointer;
}

.score-row {
    display: flex;
    gap: 32px;
    padding: 12px 24px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}
.score-row strong { color: var(--text-primary); font-size: 1.2rem; }
.setup-start { padding: 14px 40px; font-size: 1.1rem; width: 100%; margin-top: 4px; }

/* ── Word reveal screen ──────────────────────────────────── */
.reveal-panel {
    width: 100%;
    padding: 40px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.reveal-panel.hidden { display: none; }
.reveal-hint { color: var(--text-secondary); font-size: 0.9rem; margin: 0; }
.reveal-word {
    font-size: clamp(3rem, 15vw, 6rem);
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: 0.05em;
}
.reveal-countdown {
    font-size: 3rem;
    font-weight: 800;
    color: #38bdf8;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Draw screen ─────────────────────────────────────────── */
.draw-screen { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.draw-screen.hidden { display: none; }

.draw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}
.draw-word-hint { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.draw-word-label { font-size: 0.8rem; color: var(--text-secondary); flex-shrink: 0; }
.draw-word-text {
    font-weight: 800;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.draw-timer { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
#draw-timer-bar-wrap {
    width: 80px;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
}
#draw-timer-bar {
    height: 100%;
    width: 100%;
    background: #38bdf8;
    border-radius: 3px;
    transition: width 1s linear, background 0.5s;
}
#draw-timer-bar.warning { background: #f59e0b; }
#draw-timer-bar.danger  { background: #ef4444; }
.draw-timer-num { font-size: 1rem; font-weight: 700; min-width: 28px; text-align: right; }

/* Canvas */
.canvas-wrap {
    width: 100%;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    touch-action: none;
    cursor: crosshair;
    line-height: 0;
}
#draw-canvas {
    display: block;
    width: 100%;
    height: auto;
    touch-action: none;
}

/* Toolbox */
.toolbox {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    width: 100%;
    box-sizing: border-box;
}

.color-palette {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.color-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.1s;
    flex-shrink: 0;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: white; transform: scale(1.2); }

.brush-btns {
    display: flex;
    gap: 6px;
}
.sz-btn {
    background: var(--surface-color);
    border: 1.5px solid var(--glass-border);
    border-radius: 8px;
    padding: 6px 10px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s;
}
.sz-btn.active { border-color: #38bdf8; color: #38bdf8; }
.sz-btn:hover { border-color: rgba(56,189,248,0.5); }

.tool-actions { display: flex; gap: 8px; margin-left: auto; }
.tool-btn {
    background: var(--surface-color);
    border: 1.5px solid var(--glass-border);
    border-radius: 8px;
    padding: 7px 12px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: border-color 0.15s;
}
.tool-btn:hover { border-color: rgba(255,255,255,0.3); color: var(--text-primary); }
.correct-tool-btn { border-color: rgba(56,189,248,0.4); color: #38bdf8; }
.correct-tool-btn:hover { border-color: #38bdf8; }

/* ── Result overlay ──────────────────────────────────────── */
.result-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,15,30,0.92);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: 24px;
}
.result-overlay.hidden { display: none; }
.result-box {
    width: 100%;
    max-width: 400px;
    padding: 36px 28px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.result-emoji { font-size: 3rem; }
.result-word-text { font-size: 2rem; font-weight: 800; margin: 0; color: var(--text-primary); }
.result-btns { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; width: 100%; }
.result-btns .btn-primary, .result-btns .btn-secondary { padding: 12px 24px; font-size: 1rem; }

@media (max-width: 480px) {
    .cat-grid { grid-template-columns: repeat(2, 1fr); }
    .tool-actions { margin-left: 0; }
    .toolbox { justify-content: center; }
}
