/* ============================================
   onlyMATHs — Game Play Styles
   ============================================ */

/* ── Game Page Layout ───────────────────────── */
.game-page {
    padding-top: 100px;
    padding-bottom: 60px;
    min-height: 100vh;
}

.game-header {
    text-align: center;
    margin-bottom: 48px;
}
.game-header__icon { font-size: 2.5rem; margin-bottom: 12px; }
.game-header__title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -.02em;
    margin-bottom: 6px;
}
.game-header__desc {
    font-size: .95rem;
    color: var(--text-secondary);
}

/* ── Setup Panel (before game starts) ───────── */
.game-setup {
    max-width: 540px;
    margin: 0 auto;
    text-align: center;
}
.game-setup__options {
    display: flex;
    flex-direction: column;
    gap: 28px;
    margin-bottom: 36px;
}
.game-setup__group label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ── Game HUD ───────────────────────────────── */
.game-hud {
    display: none;
    max-width: 640px;
    margin: 0 auto;
}
.game-hud.active { display: block; }

.game-hud__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    margin-bottom: 32px;
}

.hud-stat {
    text-align: center;
    min-width: 70px;
}
.hud-stat__value {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
}
.hud-stat__label {
    font-size: .7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-top: 2px;
}

.hud-stat--timer .hud-stat__value { color: var(--cyan); }
.hud-stat--score .hud-stat__value { color: var(--accent); }
.hud-stat--streak .hud-stat__value { color: var(--amber); }
.hud-stat--combo .hud-stat__value { color: var(--emerald); }

/* Timer progress bar */
.timer-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-surface);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 32px;
}
.timer-bar__fill {
    height: 100%;
    background: var(--gradient-accent);
    border-radius: 4px;
    transition: width .3s linear;
    box-shadow: 0 0 12px var(--accent-glow);
}
.timer-bar__fill.warning { background: var(--amber); box-shadow: 0 0 12px rgba(251,191,36,.4); }
.timer-bar__fill.danger  { background: var(--rose);  box-shadow: 0 0 12px rgba(251,113,133,.4); }

/* ── Question Area ──────────────────────────── */
.question-area {
    text-align: center;
    margin-bottom: 32px;
    padding: 48px 32px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    position: relative;
    overflow: hidden;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.question-area::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(108,99,255,.05) 0%, transparent 50%);
    pointer-events: none;
}

.question__prompt {
    font-size: .8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 20px;
}
.question__text {
    font-family: var(--font-mono);
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -.02em;
    margin-bottom: 8px;
    transition: transform .2s var(--ease-spring);
    position: relative;
}
.question__text.shake {
    animation: shake .4s ease;
}
.question__text.pop {
    animation: pop .3s var(--ease-spring);
}
.question__hint {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Answer input */
.answer-area {
    max-width: 400px;
    margin: 0 auto;
}
.answer-input-wrap {
    position: relative;
    margin-bottom: 16px;
}
.answer-input {
    width: 100%;
    padding: 18px 24px;
    background: var(--bg-surface);
    border: 2px solid var(--glass-border);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    outline: none;
    transition: border-color var(--duration), box-shadow var(--duration);
    -moz-appearance: textfield;
}
.answer-input::-webkit-outer-spin-button,
.answer-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.answer-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}
.answer-input.correct {
    border-color: var(--emerald);
    box-shadow: 0 0 0 4px rgba(52,211,153,.2);
    animation: correctPulse .4s ease;
}
.answer-input.wrong {
    border-color: var(--rose);
    box-shadow: 0 0 0 4px rgba(251,113,133,.2);
    animation: wrongShake .4s ease;
}

.answer-hint {
    font-size: .78rem;
    color: var(--text-muted);
    text-align: center;
}

/* Answer feedback overlay */
.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 4rem;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: transform .3s var(--ease-spring), opacity .3s;
}
.feedback.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Streak banner */
.streak-banner {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 10px 28px;
    border-radius: 30px;
    background: linear-gradient(135deg, rgba(251,191,36,.15) 0%, rgba(251,191,36,.05) 100%);
    border: 1px solid rgba(251,191,36,.3);
    color: var(--amber);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: .9rem;
    z-index: 50;
    opacity: 0;
    transition: opacity .3s, transform .3s var(--ease-spring);
    white-space: nowrap;
}
.streak-banner.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── End Screen ─────────────────────────────── */
.game-end {
    display: none;
    max-width: 540px;
    margin: 0 auto;
    text-align: center;
}
.game-end.active { display: block; }

.game-end__card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 48px 40px;
    position: relative;
    overflow: hidden;
}
.game-end__card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--gradient-accent);
}

.game-end__emoji { font-size: 4rem; margin-bottom: 16px; }
.game-end__title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 8px;
}
.game-end__subtitle {
    font-size: .95rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.game-end__stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 36px;
}
.end-stat {
    padding: 20px;
    background: var(--bg-surface);
    border-radius: var(--border-radius);
    border: 1px solid var(--glass-border);
}
.end-stat__value {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 700;
}
.end-stat__label {
    font-size: .75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-top: 4px;
}
.end-stat--score .end-stat__value { color: var(--accent); }
.end-stat--correct .end-stat__value { color: var(--emerald); }
.end-stat--wrong .end-stat__value { color: var(--rose); }
.end-stat--streak .end-stat__value { color: var(--amber); }

.game-end__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Animations ─────────────────────────────── */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-8px); }
    40%      { transform: translateX(8px); }
    60%      { transform: translateX(-6px); }
    80%      { transform: translateX(6px); }
}

@keyframes pop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.08); }
    100% { transform: scale(1); }
}

@keyframes correctPulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.02); }
    100% { transform: scale(1); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-6px); }
    50%      { transform: translateX(6px); }
    75%      { transform: translateX(-4px); }
}

@keyframes scorePopIn {
    0%   { transform: scale(0) rotate(-10deg); opacity: 0; }
    60%  { transform: scale(1.2) rotate(3deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* Score pop notification */
.score-pop {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 800;
    color: var(--emerald);
    pointer-events: none;
    z-index: 100;
    animation: scoreFloat 1s var(--ease-out) forwards;
}
.score-pop.wrong { color: var(--rose); }

@keyframes scoreFloat {
    0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -120%) scale(1.5); }
}

/* ── Number pad (mobile) ────────────────────── */
.numpad {
    display: none;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 320px;
    margin: 20px auto 0;
}
.numpad__key {
    padding: 16px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    transition: background var(--duration), transform .15s;
    -webkit-tap-highlight-color: transparent;
}
.numpad__key:active {
    transform: scale(.95);
    background: var(--bg-card-hover);
}
.numpad__key--wide { grid-column: span 2; }
.numpad__key--accent {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.numpad__key--danger {
    color: var(--rose);
}

@media (max-width: 768px) {
    .numpad { display: grid; }
}

/* ── Countdown overlay ──────────────────────── */
.countdown-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 26, .9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.countdown-overlay.active { display: flex; }

.countdown-number {
    font-family: var(--font-mono);
    font-size: 8rem;
    font-weight: 900;
    color: var(--accent);
    text-shadow: 0 0 60px var(--accent-glow);
    animation: countPulse .8s var(--ease-spring);
}
@keyframes countPulse {
    0%   { transform: scale(2); opacity: 0; }
    50%  { transform: scale(.9); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* ══════════════════════════════════════════
   LEVEL ROADMAP  (Arithmetic Game setup)
══════════════════════════════════════════ */
.level-roadmap {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin: 1.2rem 0 .6rem;
}

.level-roadmap__item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .7rem 1rem;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 12px;
    transition: background .2s;
}
.level-roadmap__item:hover {
    background: rgba(255,255,255,.07);
}

.level-roadmap__badge {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: .85rem;
    letter-spacing: .04em;
    opacity: .9;
}
.level-roadmap__badge--1 { background: rgba(16,185,129,.18); color: var(--emerald); border: 1px solid rgba(16,185,129,.3); }
.level-roadmap__badge--2 { background: rgba(34,211,238,.18); color: var(--cyan);    border: 1px solid rgba(34,211,238,.3); }
.level-roadmap__badge--3 { background: rgba(245,158,11,.18); color: var(--amber);   border: 1px solid rgba(245,158,11,.3); }
.level-roadmap__badge--4 { background: rgba(244,63,94,.18);  color: var(--rose);    border: 1px solid rgba(244,63,94,.3);  }

.level-roadmap__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.level-roadmap__info strong {
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .03em;
    color: var(--text-primary);
}
.level-roadmap__info span {
    font-size: .72rem;
    color: var(--text-muted);
}

.level-roadmap__arrow {
    text-align: center;
    font-size: .75rem;
    color: rgba(255,255,255,.2);
    line-height: 1;
    padding: .1rem 0;
    user-select: none;
}

.game-setup__hint {
    text-align: center;
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: .3rem;
    font-style: italic;
    opacity: .8;
}

/* ══════════════════════════════════════════
   HUD  —  level / lives stats
══════════════════════════════════════════ */
.hud-stat--level .hud-stat__value   { color: var(--emerald); }

/* ══════════════════════════════════════════
   LEVEL-UP OVERLAY
══════════════════════════════════════════ */
.levelup-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(10,14,26,.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.levelup-overlay.active { display: flex; }

.levelup-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .8rem;
    padding: 2.5rem 3.5rem;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 24px;
    box-shadow: 0 0 80px rgba(108,99,255,.25);
    animation: levelUpPop .5s var(--ease-spring) forwards;
    text-align: center;
}

.levelup-card__tag {
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .18em;
    color: var(--accent);
    text-transform: uppercase;
    background: rgba(108,99,255,.15);
    border: 1px solid rgba(108,99,255,.3);
    padding: .25rem .75rem;
    border-radius: 999px;
}

.levelup-card__num {
    font-family: var(--font-mono);
    font-size: 6rem;
    font-weight: 900;
    line-height: 1;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px rgba(108,99,255,.5));
}

.levelup-card__desc {
    font-size: .9rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: .02em;
}

@keyframes levelUpPop {
    0%   { transform: scale(.4) translateY(30px); opacity: 0; }
    65%  { transform: scale(1.08) translateY(-4px); opacity: 1; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* ── Score pop (correct / wrong feedback) ── */
.score-pop {
    position: fixed;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 800;
    color: var(--emerald);
    text-shadow: 0 0 20px rgba(16,185,129,.6);
    pointer-events: none;
    animation: scorePop .9s ease forwards;
    z-index: 250;
}
.score-pop.wrong {
    color: var(--rose);
    text-shadow: 0 0 20px rgba(244,63,94,.6);
}

@keyframes scorePop {
    0%   { opacity: 1; transform: translate(-50%, -50%) scale(.8); }
    30%  { opacity: 1; transform: translate(-50%, -70%) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -100%) scale(1); }
}

/* ── Answer input feedback states ── */
#answerInput.correct {
    border-color: var(--emerald) !important;
    box-shadow: 0 0 0 3px rgba(16,185,129,.2), inset 0 0 20px rgba(16,185,129,.05) !important;
}
#answerInput.wrong {
    border-color: var(--rose) !important;
    box-shadow: 0 0 0 3px rgba(244,63,94,.2), inset 0 0 20px rgba(244,63,94,.05) !important;
}

/* ── Question text animations ── */
.question__text.pop {
    animation: questionPop .35s var(--ease-spring);
}
.question__text.shake {
    animation: questionShake .4s ease;
}

@keyframes questionPop {
    0%   { transform: scale(.92); opacity: .6; }
    60%  { transform: scale(1.04); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes questionShake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-8px); }
    40%       { transform: translateX(8px); }
    60%       { transform: translateX(-5px); }
    80%       { transform: translateX(5px); }
}

