/* ============================================
   WORD GAME - Fullscreen Glass Stage
   ============================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    min-height: 100%;
    overscroll-behavior: none;
    touch-action: manipulation;
    overflow-y: auto;
}

:root {
    --bg-base: #1c2a1c;
    --bg-deep: #12190f;
    --glass-bg: rgba(38, 54, 31, 0.52);
    --glass-border: rgba(200, 162, 74, 0.14);
    --glass-highlight: rgba(200, 162, 74, 0.08);
    --text-primary: #e9dfc4;
    --text-secondary: rgba(233, 223, 196, 0.74);
    --text-muted: rgba(233, 223, 196, 0.48);
    --accent-cyan: #e6c877;
    --accent-blue: #7a4324;
    --accent-amber: #f59e0b;
    --accent-green: #22c55e;
    --accent-red: #fb7185;
    --font-main: 'Outfit', sans-serif;
    --shadow-card: 0 28px 60px rgba(10, 13, 8, 0.4);
}

body {
    font-family: var(--font-main);
    color: var(--text-primary);
    background:
        radial-gradient(circle at 16% 18%, rgba(230, 200, 119, 0.22), transparent 34%),
        radial-gradient(circle at 84% 14%, rgba(122, 67, 36, 0.24), transparent 30%),
        radial-gradient(circle at 50% 84%, rgba(245, 158, 11, 0.16), transparent 26%),
        linear-gradient(145deg, var(--bg-base) 0%, var(--bg-deep) 100%);
    overflow: hidden;
    position: relative;
}

#particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.ambient {
    position: fixed;
    width: 28rem;
    height: 28rem;
    border-radius: 999px;
    filter: blur(70px);
    opacity: 0.22;
    z-index: 0;
    pointer-events: none;
}

.ambient-one {
    top: -7rem;
    left: -7rem;
    background: linear-gradient(135deg, rgba(230, 200, 119, 0.9), rgba(122, 67, 36, 0.7));
}

.ambient-two {
    right: -8rem;
    bottom: -9rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.76), rgba(122, 67, 36, 0.64));
}

.glass-panel {
    background: linear-gradient(180deg, rgba(200, 162, 74, 0.05), rgba(200, 162, 74, 0.02));
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1.8rem;
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.glass-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--glass-highlight), transparent 42%);
    pointer-events: none;
}

.wordgame-stage {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 1.25rem;
}

.board-surface {
    width: 100%;
    min-height: calc(100vh - 2.5rem);
    padding: clamp(1.2rem, 2vw, 1.6rem);
    display: grid;
    grid-template-rows: auto 1fr auto auto auto auto;
    gap: 0.75rem;
}

.question-wrap,
.letters-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 1.5rem;
    background: rgba(200, 162, 74, 0.04);
    border: 1px solid rgba(200, 162, 74, 0.08);
}

.question-wrap {
    min-height: 14vh;
    padding: clamp(1rem, 2.5vw, 2rem);
    background: linear-gradient(135deg, rgba(230, 200, 119, 0.14), rgba(122, 67, 36, 0.08));
    justify-content: flex-start;
    text-align: left;
}

.question-text {
    width: 100%;
    max-width: 100%;
    font-size: clamp(1.8rem, 3.2vw, 3.6rem);
    line-height: 1.12;
    font-weight: 800;
    letter-spacing: -0.04em;
    text-wrap: pretty;
}

.letters-wrap {
    min-height: 0;
    padding: clamp(1rem, 2vw, 1.6rem);
    background: linear-gradient(180deg, rgba(18, 25, 15, 0.46), rgba(18, 25, 15, 0.74));
}

.letters-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    width: 100%;
}

.letter-slot {
    width: clamp(78px, 6vw, 108px);
    height: clamp(102px, 8vw, 138px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1.35rem;
    background:
        linear-gradient(180deg, rgba(200, 162, 74, 0.08), rgba(200, 162, 74, 0.02)),
        rgba(200, 162, 74, 0.04);
    border: 1px solid rgba(200, 162, 74, 0.12);
    box-shadow: inset 0 1px 0 rgba(200, 162, 74, 0.08), 0 16px 28px rgba(10, 13, 8, 0.28);
    font-size: clamp(2.4rem, 4vw, 4.2rem);
    font-weight: 900;
    color: transparent;
    cursor: pointer;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.letter-slot:hover:not(.revealed) {
    transform: translateY(-4px);
    border-color: rgba(230, 200, 119, 0.34);
    box-shadow: inset 0 1px 0 rgba(200, 162, 74, 0.08), 0 20px 32px rgba(10, 13, 8, 0.34);
}

.letter-slot.revealed {
    background: linear-gradient(135deg, rgba(230, 200, 119, 0.82), rgba(122, 67, 36, 0.76));
    border-color: rgba(230, 200, 119, 0.44);
    color: #fff;
    transform: translateY(-4px);
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.stat-card {
    padding: 1.2rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    align-items: flex-start;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.stat-value {
    font-size: clamp(2.8rem, 4.8vw, 5rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.05em;
    font-variant-numeric: tabular-nums;
}

.stat-value.timer {
    color: #fde68a;
    text-shadow: 0 0 26px rgba(245, 158, 11, 0.28);
}

.stat-value.timer.warning {
    color: #fecdd3;
    text-shadow: 0 0 26px rgba(251, 113, 133, 0.35);
    animation: timerPulse 0.95s infinite alternate;
}

.stat-value.score {
    color: #86efac;
    text-shadow: 0 0 26px rgba(34, 197, 94, 0.28);
}

@keyframes timerPulse {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(1.04);
        opacity: 0.82;
    }
}

.status-banner {
    padding: 1rem 1.15rem;
    color: var(--text-secondary);
    line-height: 1.5;
    text-align: center;
    background: rgba(18, 25, 15, 0.56);
}

.round-result-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(10, 13, 8, 0.72);
    backdrop-filter: blur(18px);
}

.round-result-overlay[hidden] {
    display: none !important;
}

.round-result-card {
    width: min(100%, 40rem);
    padding: clamp(1.8rem, 4vw, 3rem);
    text-align: center;
    display: grid;
    gap: 0.85rem;
}

.round-result-kicker {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.round-result-title {
    font-size: clamp(2.4rem, 5vw, 4.6rem);
    font-weight: 900;
    letter-spacing: -0.05em;
}

.round-result-message {
    color: var(--text-secondary);
    font-size: clamp(1rem, 2vw, 1.3rem);
    line-height: 1.45;
}

.round-result-score-label {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.round-result-score {
    color: #86efac;
    font-size: clamp(3rem, 6vw, 5.6rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.06em;
}

/* Solo Control Panel */
.solo-controls {
    margin-top: 1.25rem;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: rgba(38, 54, 31, 0.55);
    border: 1px solid var(--glass-border);
    border-radius: 1.4rem;
}

.solo-top-row {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    align-items: center;
}

.theme-input {
    flex: 1;
    min-width: 200px;
    padding: 0.85rem 1.2rem;
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    background: rgba(200, 162, 74, 0.08);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: all 0.25s ease;
}

.theme-input:focus {
    border-color: #e6c877;
    background: rgba(200, 162, 74, 0.12);
    box-shadow: 0 0 0 3px rgba(230, 200, 119, 0.2);
}

.btn-primary, .btn-secondary {
    padding: 0.85rem 1.4rem;
    border-radius: 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.25s ease;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #c8a24a, #e6c877);
    color: #fff;
    box-shadow: 0 4px 14px rgba(200, 162, 74, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(200, 162, 74, 0.45);
}

.btn-secondary {
    background: rgba(200, 162, 74, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(200, 162, 74, 0.18);
    transform: translateY(-2px);
}

.solo-action-bar {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.6rem;
}

.action-btn {
    padding: 0.85rem 0.4rem;
    border-radius: 0.9rem;
    border: 1px solid var(--glass-border);
    background: rgba(200, 162, 74, 0.06);
    color: var(--text-primary);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

.action-btn:hover {
    transform: translateY(-2px);
    background: rgba(200, 162, 74, 0.14);
}

.action-btn:active {
    transform: scale(0.96);
}

.btn-reveal:hover { border-color: #fde047; background: rgba(253, 224, 71, 0.15); color: #fef08a; }
.btn-correct:hover { border-color: #4ade80; background: rgba(74, 222, 128, 0.18); color: #86efac; }
.btn-pass:hover { border-color: #fb923c; background: rgba(251, 146, 60, 0.15); color: #fdba74; }
.btn-timer:hover { border-color: #c8a24a; background: rgba(200, 162, 74, 0.15); color: #e6c877; }
.btn-nav:hover { border-color: #e6c877; background: rgba(230, 200, 119, 0.15); color: #e6c877; }

@media (max-width: 900px) {
    .board-surface {
        min-height: calc(100vh - 2rem);
        padding: 1rem;
    }

    .question-wrap {
        min-height: 22vh;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
    }

    .solo-action-bar {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    body {
        overflow-y: auto;
    }

    .wordgame-stage {
        min-height: 100vh;
        padding: 0.8rem;
    }

    .board-surface {
        min-height: calc(100vh - 1.6rem);
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .letters-container {
        gap: 0.7rem;
    }

    .solo-action-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .solo-top-row {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary, .theme-input {
        width: 100%;
    }
}
