/* ═══════════════════════════════════════════════
   MATH BLITZ — kid-friendly timed arithmetic game
═══════════════════════════════════════════════ */
.blitz-page {
    background: linear-gradient(160deg, #eef2ff 0%, #fef3c7 100%);
    min-height: calc(100vh - 250px);
    padding: 40px 0 60px;
}
.blitz-shell {
    max-width: 640px;
    margin: 0 auto;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, .12);
    padding: 28px 24px 32px;
}
.blitz-title {
    text-align: center;
    font-weight: 800;
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    color: #1e293b;
    margin-bottom: 4px;
}
.blitz-subtitle {
    text-align: center;
    color: #64748b;
    font-size: 1rem;
    margin-bottom: 24px;
}
.blitz-screen { display: none; }
.blitz-screen.active { display: block; animation: blitz-fade .25s ease; }
@keyframes blitz-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Setup screen ── */
.blitz-step-label {
    font-weight: 700;
    font-size: 0.95rem;
    color: #334155;
    margin: 18px 0 10px;
}
.blitz-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.blitz-choice-grid.blitz-ops { grid-template-columns: repeat(3, 1fr); }
.blitz-choice-btn {
    border: 3px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 16px;
    padding: 18px 10px;
    font-weight: 800;
    font-size: 1.15rem;
    color: #334155;
    cursor: pointer;
    transition: transform .15s, border-color .15s, background .15s;
    text-align: center;
}
.blitz-choice-btn .blitz-choice-icon { display: block; font-size: 1.8rem; margin-bottom: 6px; }
.blitz-choice-btn:hover { transform: translateY(-2px); border-color: #a5b4fc; }
.blitz-choice-btn.selected {
    border-color: #6366f1;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #4338ca;
    transform: translateY(-2px);
}
.blitz-nickname {
    width: 100%;
    border: 3px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e293b;
}
.blitz-nickname:focus { outline: none; border-color: #a5b4fc; }
.blitz-btn-primary {
    width: 100%;
    margin-top: 24px;
    border: none;
    border-radius: 16px;
    padding: 16px;
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 8px 20px rgba(22,163,74,.3);
    cursor: pointer;
    transition: transform .15s, opacity .15s;
}
.blitz-btn-primary:hover:not(:disabled) { transform: translateY(-2px); }
.blitz-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.blitz-btn-secondary {
    width: 100%;
    margin-top: 12px;
    border: 3px solid #e2e8f0;
    border-radius: 16px;
    padding: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #334155;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, transform .15s;
}
.blitz-btn-secondary:hover { border-color: #a5b4fc; transform: translateY(-2px); }

/* ── Play screen ── */
.blitz-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.blitz-stat { text-align: center; flex: 1; min-width: 70px; }
.blitz-stat .blitz-stat-num { font-weight: 800; font-size: 1.4rem; color: #1e293b; line-height: 1; }
.blitz-stat .blitz-stat-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; font-weight: 700; }
.blitz-timer-wrap { flex: 1.2; min-width: 100px; }
.blitz-timer-bar {
    height: 14px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
    margin-bottom: 4px;
}
.blitz-timer-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #22c55e, #4ade80);
    transition: width 1s linear, background .3s;
    width: 100%;
}
.blitz-timer-fill.blitz-warn { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.blitz-timer-fill.blitz-danger { background: linear-gradient(90deg, #dc2626, #f87171); }
.blitz-timer-num { text-align: center; font-weight: 800; font-size: 1rem; color: #334155; }

.blitz-question-card {
    background: linear-gradient(135deg, #1e293b, #334155);
    border-radius: 20px;
    padding: 36px 20px;
    text-align: center;
    margin-bottom: 22px;
    position: relative;
    overflow: hidden;
}
.blitz-question-card.blitz-correct { animation: blitz-flash-green .5s ease; }
.blitz-question-card.blitz-wrong { animation: blitz-shake .4s ease; }
@keyframes blitz-flash-green {
    0% { background: linear-gradient(135deg, #16a34a, #22c55e); }
    100% { background: linear-gradient(135deg, #1e293b, #334155); }
}
@keyframes blitz-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); background: linear-gradient(135deg, #b91c1c, #dc2626); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}
.blitz-question-text {
    font-size: clamp(2.2rem, 8vw, 3rem);
    font-weight: 800;
    color: #fff;
    letter-spacing: .02em;
}
.blitz-question-eq { color: #94a3b8; font-size: 1.4rem; margin-left: 8px; }

.blitz-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}
.blitz-option-btn {
    border: none;
    border-radius: 16px;
    padding: 22px 10px;
    font-size: 1.6rem;
    font-weight: 800;
    color: #1e293b;
    background: #f1f5f9;
    cursor: pointer;
    transition: transform .12s, box-shadow .12s;
    box-shadow: 0 3px 0 #cbd5e1;
}
.blitz-option-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 5px 0 #cbd5e1; }
.blitz-option-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #cbd5e1; }
.blitz-option-btn:disabled { cursor: not-allowed; }
.blitz-option-btn.blitz-pick-correct { background: #bbf7d0; color: #166534; box-shadow: 0 3px 0 #4ade80; }
.blitz-option-btn.blitz-pick-wrong { background: #fecaca; color: #991b1b; box-shadow: 0 3px 0 #f87171; }

/* ── End screen ── */
.blitz-stars {
    text-align: center;
    font-size: 2.6rem;
    letter-spacing: 6px;
    margin: 6px 0 18px;
    color: #e2e8f0;
}
.blitz-stars .blitz-star-on { color: #fbbf24; }
.blitz-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 6px;
}
.blitz-summary-item {
    text-align: center;
    background: #f8fafc;
    border-radius: 14px;
    padding: 16px 6px;
}
.blitz-summary-item .blitz-summary-num { font-weight: 800; font-size: 1.5rem; color: #1e293b; }
.blitz-summary-item .blitz-summary-label { font-size: .72rem; color: #94a3b8; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

.blitz-leaderboard-link { text-align: center; margin-top: 14px; }
.blitz-leaderboard-link a { color: #4f46e5; font-weight: 700; text-decoration: none; }
.blitz-leaderboard-link a:hover { text-decoration: underline; }

.blitz-error-banner {
    background: #fef2f2;
    border: 2px solid #fecaca;
    color: #991b1b;
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: 16px;
    display: none;
}
.blitz-error-banner.active { display: block; }

/* ── Leaderboard page ── */
.blitz-lb-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.blitz-lb-filters select {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 12px;
    font-weight: 600;
    color: #334155;
}
.blitz-lb-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.blitz-lb-table tr { background: #f8fafc; }
.blitz-lb-table td { padding: 12px 14px; font-weight: 600; color: #334155; }
.blitz-lb-table td:first-child { border-radius: 12px 0 0 12px; font-weight: 800; color: #6366f1; }
.blitz-lb-table td:last-child { border-radius: 0 12px 12px 0; text-align: right; }
.blitz-lb-empty { text-align: center; color: #94a3b8; padding: 30px 0; font-weight: 600; }

@media (max-width: 480px) {
    .blitz-shell { padding: 22px 16px 26px; border-radius: 18px; }
    .blitz-options-grid { gap: 10px; }
    .blitz-option-btn { font-size: 1.35rem; padding: 18px 8px; }
}

/* ── Fullscreen mobile play (see base.css body.game-page rules) ── */
@media (max-width: 991.98px) {
    body.game-page .blitz-page { min-height: 100dvh; padding: 0; }
    body.game-page .blitz-page .container { max-width: none; padding: 0; }
    body.game-page .blitz-shell {
        max-width: none;
        min-height: 100dvh;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 54px 16px 16px;
        display: flex;
        flex-direction: column;
    }
    body.game-page .blitz-subtitle { display: none; }
    body.game-page .blitz-screen.active {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        justify-content: center;
    }
}
