/* ═══════════════════════════════════════════════
   LCM RUSH — timed Least Common Multiple game
═══════════════════════════════════════════════ */
.lr-page {
    background: linear-gradient(160deg, #ecfdf5 0%, #eef2ff 100%);
    min-height: calc(100vh - 250px);
    padding: 40px 0 60px;
}
.lr-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;
}
.lr-title {
    text-align: center;
    font-weight: 800;
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    color: #1e293b;
    margin-bottom: 4px;
}
.lr-subtitle {
    text-align: center;
    color: #64748b;
    font-size: 1rem;
    margin-bottom: 24px;
}
.lr-screen { display: none; }
.lr-screen.active { display: block; animation: lr-fade .25s ease; }
@keyframes lr-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Setup screen ── */
.lr-step-label {
    font-weight: 700;
    font-size: 0.95rem;
    color: #334155;
    margin: 18px 0 10px;
}

.lr-nickname {
    width: 100%;
    border: 3px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e293b;
}
.lr-nickname:focus { outline: none; border-color: #6ee7b7; }
.lr-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;
}
.lr-btn-primary:hover:not(:disabled) { transform: translateY(-2px); }
.lr-btn-primary:disabled { opacity: .5; cursor: not-allowed; }

/* ── Play screen ── */
.lr-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.lr-stat { text-align: center; flex: 1; min-width: 60px; }
.lr-stat .lr-stat-num { font-weight: 800; font-size: 1.3rem; color: #1e293b; line-height: 1; }
.lr-stat .lr-stat-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; font-weight: 700; }
.lr-stat-time .lr-stat-num { color: #059669; font-variant-numeric: tabular-nums; }

.lr-question-card {
    background: linear-gradient(135deg, #1e293b, #334155);
    border-radius: 20px;
    padding: 28px 14px;
    text-align: center;
    margin-bottom: 18px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.lr-question-card.lr-correct { animation: lr-flash-green .5s ease; }
.lr-question-card.lr-wrong { animation: lr-shake .4s ease; }
@keyframes lr-flash-green {
    0% { background: linear-gradient(135deg, #16a34a, #22c55e); }
    100% { background: linear-gradient(135deg, #1e293b, #334155); }
}
@keyframes lr-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); }
}
.lr-question-label {
    font-size: .85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #94a3b8;
    margin-bottom: 8px;
}
.lr-question-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}
.lr-num {
    font-size: clamp(2.2rem, 9vw, 3.2rem);
    font-weight: 800;
    color: #fff;
    letter-spacing: .01em;
    line-height: 1;
}
.lr-num-sep { color: #fbbf24; font-size: clamp(1.4rem, 5vw, 2rem); font-weight: 700; }

.lr-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}
.lr-option-btn {
    border: none;
    border-radius: 16px;
    padding: 20px 8px;
    font-size: clamp(1.1rem, 5vw, 1.6rem);
    font-weight: 800;
    color: #1e293b;
    background: #f1f5f9;
    cursor: pointer;
    transition: transform .12s, box-shadow .12s;
    box-shadow: 0 3px 0 #cbd5e1;
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.15;
}
.lr-option-btn.lr-long-number { font-size: clamp(.85rem, 3.6vw, 1.15rem); }
.lr-option-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 5px 0 #cbd5e1; }
.lr-option-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #cbd5e1; }
.lr-option-btn:disabled { cursor: not-allowed; }
.lr-option-btn.lr-pick-correct { background: #bbf7d0; color: #166534; box-shadow: 0 3px 0 #4ade80; }
.lr-option-btn.lr-pick-wrong { background: #fecaca; color: #991b1b; box-shadow: 0 3px 0 #f87171; }

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

.lr-review-label {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #94a3b8;
    margin: 20px 0 8px;
}
.lr-review {
    max-height: 220px;
    overflow-y: auto;
    border: 2px solid #f1f5f9;
    border-radius: 14px;
    padding: 6px;
}
.lr-review-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 600;
    font-size: .85rem;
    color: #334155;
}
.lr-review-row:nth-child(odd) { background: #f8fafc; }
.lr-review-question { flex: 1.1; white-space: nowrap; }
.lr-review-answers { color: #64748b; font-weight: 700; font-size: .78rem; text-align: right; }
.lr-review-icon { font-weight: 800; width: 1.4em; text-align: center; flex-shrink: 0; }
.lr-review-row.lr-review-correct .lr-review-icon { color: #16a34a; }
.lr-review-row.lr-review-wrong .lr-review-icon { color: #dc2626; }

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

.lr-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;
}
.lr-error-banner.active { display: block; }

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

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

/* ── Fullscreen mobile play (see base.css body.game-page rules) ──
   The game area (numbers, options, timer, score) should fill as close to
   100% of the viewport as possible, with the options grid — not the site
   chrome — owning most of the screen. */
@media (max-width: 991.98px) {
    body.game-page .lr-page { min-height: 100dvh; padding: 0; }
    body.game-page .lr-page .container { max-width: none; padding: 0; }
    body.game-page .lr-shell {
        max-width: none;
        height: 100dvh;
        overflow: hidden;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        padding: calc(54px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
        display: flex;
        flex-direction: column;
    }
    body.game-page .lr-title,
    body.game-page .lr-subtitle { display: none; }
    body.game-page .lr-screen.active {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        justify-content: flex-start;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    /* Play screen: hud stays a thin strip, question card + options grid
       split the remaining space so the buttons genuinely dominate the
       viewport instead of floating in empty space. */
    body.game-page #lr-play.active {
        overflow-y: hidden;
    }
    body.game-page .lr-hud { flex: 0 0 auto; margin-bottom: 10px; }
    body.game-page .lr-question-card {
        flex: 1;
        min-height: 0;
        margin-bottom: 12px;
        padding: 14px;
    }
    body.game-page .lr-num { font-size: clamp(2.4rem, 13vw, 3.6rem); }
    body.game-page .lr-options-grid {
        flex: 1.3;
        min-height: 0;
        grid-template-rows: 1fr 1fr;
    }
    body.game-page .lr-option-btn {
        min-height: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}
