/* ── Layout ──────────────────────────────────────────── */
.game-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    margin: 20px auto;
    max-width: 780px;
    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: 780px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 14px 20px;
    margin-bottom: 16px;
    gap: 12px;
}

.team-score {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 80px;
}
.team-icon { font-size: 1.4rem; }
.remain-count { font-size: 2rem; font-weight: 800; }
.team-label { font-size: 0.85rem; color: var(--text-secondary); }
.red-team { color: #fca5a5; }
.blue-team { color: #93c5fd; justify-content: flex-end; }

.header-center {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ── Board ────────────────────────────────────────────── */
.cn-board {
    width: 100%;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
}

/* ── Operative bar ────────────────────────────────────── */
.operative-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    gap: 12px;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
    border: 1px solid var(--glass-border);
}
.operative-bar.hidden { display: none; }

.clue-display { font-size: 1rem; font-weight: 600; flex: 1; line-height: 1.4; }
.guesses-badge { font-size: 0.8rem; color: var(--text-secondary); margin-left: 8px; white-space: nowrap; }
.end-turn-btn { padding: 8px 16px; font-size: 0.9rem; flex-shrink: 0; }

/* ── Word Grid ────────────────────────────────────────── */
.word-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.word-card {
    background: var(--surface-color);
    border: 2px solid var(--glass-border);
    border-radius: 10px;
    padding: 14px 6px;
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s, border-color 0.15s, background 0.2s;
    user-select: none;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.word-card:not(.revealed):hover {
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.word-card .key-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: none;
}

/* Revealed states */
.word-card.revealed {
    cursor: default;
    border-width: 0;
    transform: none;
}
.word-card.revealed:hover { transform: none; }
.word-card.revealed.red      { background: #dc2626; color: white; }
.word-card.revealed.blue     { background: #2563eb; color: white; }
.word-card.revealed.neutral  { background: #475569; color: #cbd5e1; }
.word-card.revealed.assassin { background: #0f172a; color: #ef4444; border: 2px solid #ef4444; }

/* Status message */
.status-msg {
    min-height: 1.2rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ── Win overlay ──────────────────────────────────────── */
.cn-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    text-align: center;
    padding: 32px;
}
.cn-overlay.hidden { display: none; }

/* ── Handoff + Spy overlays ───────────────────────────── */
.handoff-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 30, 0.98);
    backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 400;
    padding: 24px;
    overflow-y: auto;
}
.handoff-overlay.hidden { display: none; }

.handoff-box {
    width: 100%;
    max-width: 480px;
    padding: 32px 28px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Spy key view */
.spy-keyview { width: 100%; }
.spy-keygrid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin: 10px 0 16px;
    width: 100%;
}
.spy-key-cell {
    padding: 7px 3px;
    border-radius: 5px;
    text-align: center;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.3;
    word-break: break-all;
}
.spy-key-cell.sk-red      { background: #dc2626; color: #fff; }
.spy-key-cell.sk-blue     { background: #2563eb; color: #fff; }
.spy-key-cell.sk-neutral  { background: #3b4a5a; color: #94a3b8; }
.spy-key-cell.sk-assassin { background: #0f172a; color: #ef4444; border: 1px solid #ef4444; }
.spy-key-cell.sk-revealed { opacity: 0.25; text-decoration: line-through; }

/* Clue input form */
.clue-form { width: 100%; text-align: left; }
.clue-inputs { display: flex; gap: 8px; }
.clue-input {
    flex: 1;
    background: var(--surface-color);
    border: 1.5px solid var(--glass-border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
}
.clue-input.clue-num { flex: 0 0 72px; text-align: center; }
.clue-input:focus { outline: none; border-color: rgba(56, 189, 248, 0.6); }
.clue-input::placeholder { color: var(--text-secondary); opacity: 0.6; }

/* Handoff clue preview */
.handoff-clue-preview {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 14px 20px;
    margin: 16px 0;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    width: 100%;
}

/* ── Rules ────────────────────────────────────────────── */
.rules-hint {
    width: 100%;
    margin-top: 16px;
    padding: 14px 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

@media (max-width: 480px) {
    .word-card { font-size: 0.68rem; padding: 10px 4px; min-height: 48px; }
    .word-grid { gap: 5px; }
    .spy-key-cell { font-size: 0.55rem; padding: 5px 2px; }
    .handoff-box { padding: 24px 16px; }
}
