#math-practice-app * { margin:0; padding:0; box-sizing:border-box; }
#math-practice-app {
    --bg1:#f4f8ff;
    --bg2:#edf4fb;
    --surface:rgba(255,255,255,.88);
    --card:#ffffff;
    --card-soft:#f8fafc;
    --text:#0f172a;
    --muted:#64748b;
    --border:#dbe5f0;
    --primary:#2563eb;
    --primary-dark:#1d4ed8;
    --green:#16a34a;
    --green-soft:#ecfdf5;
    --red:#dc2626;
    --red-soft:#fef2f2;
    --amber:#d97706;
    --amber-soft:#fff7ed;
    --purple:#7c3aed;
    font-family:'Inter',system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
    width:100%;
    padding:22px;
    color:var(--text);
    background:
        radial-gradient(circle at top left, rgba(37,99,235,.10), transparent 34%),
        radial-gradient(circle at bottom right, rgba(124,58,237,.08), transparent 30%),
        linear-gradient(145deg,var(--bg1),var(--bg2));
    transition:.25s ease;
}
#math-practice-app button,
#math-practice-app input { font:inherit; }
#math-practice-app .is-hidden { display:none !important; }

#math-practice-app .app-wrapper {
    position:relative;
    max-width:1180px;
    margin:0 auto;
    padding:34px;
    background:var(--surface);
    border:1px solid rgba(255,255,255,.75);
    border-radius:34px;
    box-shadow:0 24px 70px rgba(15,23,42,.14);
    backdrop-filter:blur(16px);
    -webkit-backdrop-filter:blur(16px);
}

#math-practice-app .header {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:20px;
    margin-bottom:28px;
}
#math-practice-app .eyebrow,
#math-practice-app .step-label,
#math-practice-app .results-kicker {
    display:inline-block;
    text-transform:uppercase;
    letter-spacing:.12em;
    font-size:12px;
    font-weight:800;
    color:var(--primary);
    margin-bottom:7px;
}
#math-practice-app .header h1 {
    font-size:clamp(26px,4vw,38px);
    line-height:1.08;
    letter-spacing:-.04em;
    color:var(--text);
}
#math-practice-app .header h1 i { color:var(--primary); margin-right:8px; }
#math-practice-app .header-subtitle {
    margin-top:8px;
    color:var(--muted);
    font-size:15px;
}
#math-practice-app .dark-toggle {
    width:46px;
    height:46px;
    border:none;
    border-radius:50%;
    cursor:pointer;
    color:#fff;
    background:#172033;
    box-shadow:0 8px 18px rgba(15,23,42,.16);
    transition:.18s ease;
}
#math-practice-app .dark-toggle:hover { transform:translateY(-2px); }

#math-practice-app .resume-banner {
    display:flex;
    align-items:center;
    gap:15px;
    padding:16px 18px;
    margin-bottom:24px;
    border:1px solid #bfdbfe;
    border-radius:20px;
    background:linear-gradient(135deg,#eff6ff,#eef2ff);
    box-shadow:0 8px 24px rgba(37,99,235,.08);
}
#math-practice-app .resume-icon {
    width:44px;height:44px;border-radius:14px;
    display:grid;place-items:center;
    background:#dbeafe;color:var(--primary);font-size:19px;
}
#math-practice-app .resume-copy { flex:1; min-width:0; }
#math-practice-app .resume-copy strong { display:block; margin-bottom:3px; }
#math-practice-app .resume-copy span { color:var(--muted); font-size:14px; }
#math-practice-app .resume-actions { display:flex; gap:8px; flex-wrap:wrap; }

#math-practice-app .setup-hero {
    display:grid;
    grid-template-columns:minmax(0,1.45fr) minmax(300px,.8fr);
    gap:30px;
    align-items:center;
    padding:30px;
    margin-bottom:24px;
    border-radius:28px;
    color:#fff;
    background:
        radial-gradient(circle at 80% 20%,rgba(255,255,255,.18),transparent 22%),
        linear-gradient(135deg,#173b68,#2563eb 58%,#6d4dd8);
    box-shadow:0 18px 40px rgba(37,99,235,.22);
}
#math-practice-app .hero-pill {
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding:7px 12px;
    border-radius:999px;
    margin-bottom:14px;
    background:rgba(255,255,255,.15);
    border:1px solid rgba(255,255,255,.20);
    font-size:13px;
    font-weight:700;
}
#math-practice-app .setup-hero h2 {
    font-size:clamp(25px,4vw,40px);
    line-height:1.08;
    letter-spacing:-.035em;
    margin-bottom:10px;
}
#math-practice-app .setup-hero p {
    max-width:650px;
    line-height:1.6;
    color:rgba(255,255,255,.84);
}
#math-practice-app .hero-stat-grid {
    display:grid;
    grid-template-columns:minmax(150px, 190px);
    justify-self:end;
    align-self:center;
    width:max-content;
}
#math-practice-app .hero-stat {
    min-height:112px;
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    text-align:center;
    padding:14px;
    border-radius:18px;
    background:rgba(255,255,255,.12);
    border:1px solid rgba(255,255,255,.18);
}
#math-practice-app .hero-stat strong { font-size:30px; line-height:1; }
#math-practice-app .hero-stat span { margin-top:8px; font-size:12px; color:rgba(255,255,255,.78); }

#math-practice-app .mode-grid {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:18px;
    margin-bottom:22px;
}
#math-practice-app .mode-card {
    position:relative;
    display:flex;
    align-items:flex-start;
    gap:17px;
    width:100%;
    padding:22px;
    text-align:left;
    border:2px solid var(--border);
    border-radius:24px;
    background:var(--card);
    color:var(--text);
    cursor:pointer;
    box-shadow:0 10px 24px rgba(15,23,42,.05);
    transition:.18s ease;
}
#math-practice-app .mode-card:hover {
    transform:translateY(-3px);
    border-color:#93c5fd;
    box-shadow:0 16px 34px rgba(37,99,235,.10);
}
#math-practice-app .mode-card.selected {
    border-color:var(--primary);
    box-shadow:0 0 0 4px rgba(37,99,235,.08),0 16px 34px rgba(37,99,235,.10);
}
#math-practice-app .mode-icon {
    flex:0 0 52px;
    width:52px;height:52px;border-radius:17px;
    display:grid;place-items:center;font-size:21px;
}
#math-practice-app .mode-icon.practice { background:#dcfce7;color:#15803d; }
#math-practice-app .mode-icon.exam { background:#ffedd5;color:#c2410c; }
#math-practice-app .mode-card-copy { flex:1; min-width:0; }
#math-practice-app .mode-card-heading {
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
    margin-bottom:7px;
}
#math-practice-app .mode-card h3 { font-size:21px; }
#math-practice-app .mode-card p { color:var(--muted); line-height:1.5; font-size:14px; }
#math-practice-app .mode-badge {
    padding:5px 9px;border-radius:999px;font-size:11px;font-weight:800;
}
#math-practice-app .mode-badge.green { background:#dcfce7;color:#166534; }
#math-practice-app .mode-badge.amber { background:#ffedd5;color:#9a3412; }
#math-practice-app .mode-features {
    display:flex;flex-wrap:wrap;gap:8px 14px;
    margin-top:13px;color:#475569;font-size:13px;
}
#math-practice-app .mode-features span { display:inline-flex;align-items:center;gap:6px; }
#math-practice-app .mode-features i { color:var(--primary); }
#math-practice-app .mode-check {
    position:absolute;right:14px;top:14px;
    width:26px;height:26px;border-radius:50%;
    display:grid;place-items:center;
    background:#dbeafe;color:var(--primary);
    opacity:0;transform:scale(.7);transition:.18s;
}
#math-practice-app .mode-card.selected .mode-check { opacity:1;transform:scale(1); }

#math-practice-app .config-panel {
    padding:26px;
    border:1px solid var(--border);
    border-radius:26px;
    background:var(--card);
    box-shadow:0 12px 30px rgba(15,23,42,.05);
}
#math-practice-app .config-heading {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:18px;
    margin-bottom:20px;
}
#math-practice-app .config-heading h3,
#math-practice-app .exam-readiness h3 { font-size:22px; margin-bottom:5px; }
#math-practice-app .config-heading p,
#math-practice-app .exam-readiness p { color:var(--muted); line-height:1.5; font-size:14px; }
#math-practice-app .section-actions { display:flex;gap:8px; }
#math-practice-app .mini-btn {
    border:1px solid var(--border);
    background:var(--card-soft);
    color:#334155;
    padding:8px 11px;
    border-radius:11px;
    font-size:13px;
    font-weight:700;
    cursor:pointer;
}
#math-practice-app .section-loading { color:var(--muted);padding:18px 0; }
#math-practice-app .section-grid {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:11px;
}
#math-practice-app .section-chip {
    position:relative;
    display:flex;
    align-items:center;
    gap:11px;
    padding:14px 15px;
    min-height:58px;
    border:1.5px solid var(--border);
    border-radius:16px;
    background:var(--card-soft);
    color:#334155;
    cursor:pointer;
    transition:.16s ease;
    text-align:left;
}
#math-practice-app .section-chip:hover { border-color:#93c5fd;transform:translateY(-1px); }
#math-practice-app .section-chip.selected {
    border-color:var(--primary);
    background:#eff6ff;
    color:#1e40af;
    box-shadow:0 0 0 3px rgba(37,99,235,.06);
}
#math-practice-app .section-chip .section-check {
    flex:0 0 22px;width:22px;height:22px;border-radius:7px;
    display:grid;place-items:center;
    border:1.5px solid #cbd5e1;background:#fff;color:#fff;font-size:11px;
}
#math-practice-app .section-chip.selected .section-check { background:var(--primary);border-color:var(--primary); }
#math-practice-app .section-chip .section-name { font-size:14px;font-weight:700;line-height:1.3; }
#math-practice-app .config-footer {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:16px;
    margin-top:24px;
    padding-top:20px;
    border-top:1px solid var(--border);
}
#math-practice-app .selection-summary { color:var(--muted);font-size:14px; }

#math-practice-app .exam-readiness {
    display:flex;gap:18px;align-items:flex-start;margin-bottom:20px;
}
#math-practice-app .exam-readiness-icon {
    flex:0 0 56px;width:56px;height:56px;border-radius:18px;
    display:grid;place-items:center;background:#fff7ed;color:#c2410c;font-size:23px;
}
#math-practice-app .exam-rule-grid {
    display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;
}
#math-practice-app .exam-rule-grid > div {
    padding:17px;border:1px solid #fed7aa;border-radius:17px;background:#fffaf5;
}
#math-practice-app .exam-rule-grid i { color:#ea580c;font-size:18px;margin-bottom:10px;display:block; }
#math-practice-app .exam-rule-grid strong { display:block;font-size:15px;margin-bottom:3px; }
#math-practice-app .exam-rule-grid span { color:var(--muted);font-size:12px; }

#math-practice-app .btn {
    border:none;border-radius:14px;padding:10px 16px;
    font-weight:800;cursor:pointer;transition:.16s ease;
    display:inline-flex;align-items:center;justify-content:center;gap:8px;
}
#math-practice-app .btn:hover { transform:translateY(-1px); }
#math-practice-app .btn:disabled { opacity:.45;cursor:not-allowed;transform:none; }
#math-practice-app .btn-primary { background:var(--primary);color:#fff;box-shadow:0 8px 18px rgba(37,99,235,.20); }
#math-practice-app .btn-primary:hover { background:var(--primary-dark); }
#math-practice-app .btn-exam { background:linear-gradient(135deg,#ea580c,#f59e0b);color:#fff;box-shadow:0 8px 18px rgba(234,88,12,.18); }
#math-practice-app .btn-ghost { background:#eef2f7;color:#334155; }
#math-practice-app .btn-large { padding:13px 20px;border-radius:15px; }
#math-practice-app .btn.compact { padding:9px 12px;font-size:13px; }

#math-practice-app .inline-alert {
    padding:12px 14px;border-radius:13px;margin-top:14px;font-size:13px;
}
#math-practice-app .inline-alert.error { background:#fef2f2;color:#991b1b;border:1px solid #fecaca; }

#math-practice-app .quiz-toolbar {
    display:flex;justify-content:space-between;align-items:center;gap:16px;
    padding:14px 16px;margin-bottom:14px;border:1px solid var(--border);
    border-radius:20px;background:var(--card);
    box-shadow:0 8px 20px rgba(15,23,42,.04);
}
#math-practice-app .quiz-toolbar-left,
#math-practice-app .quiz-toolbar-right { display:flex;align-items:center;gap:10px;flex-wrap:wrap; }
#math-practice-app .active-mode-badge {
    display:inline-flex;align-items:center;gap:7px;
    padding:8px 11px;border-radius:999px;font-size:12px;font-weight:800;
}
#math-practice-app .active-mode-badge.practice { background:#dcfce7;color:#166534; }
#math-practice-app .active-mode-badge.exam { background:#ffedd5;color:#9a3412; }
#math-practice-app .active-sections-label { color:var(--muted);font-size:13px;max-width:520px; }
#math-practice-app .score-badge {
    background:#172033;
    padding:7px 9px;
    border-radius:999px;
    color:#fff;
    display:flex;align-items:center;gap:7px;
}
#math-practice-app .score-item {
    display:inline-flex;align-items:center;gap:4px;
    padding:3px 8px;border-radius:999px;background:#243047;font-size:13px;font-weight:800;
}
#math-practice-app .result-icon {
    width:19px;height:19px;border-radius:50%;display:grid;place-items:center;font-size:11px;color:#fff;
}
#math-practice-app .score-item.correct .result-icon { background:#22c55e; }
#math-practice-app .score-item.incorrect .result-icon { background:#ef4444; }
#math-practice-app .exam-timer {
    display:inline-flex;align-items:center;gap:8px;
    min-width:106px;justify-content:center;
    padding:9px 13px;border-radius:13px;
    background:#fff7ed;color:#9a3412;font-weight:900;font-variant-numeric:tabular-nums;
}
#math-practice-app .exam-timer.warning { background:#fff1f2;color:#be123c;animation:timerPulse 1s infinite; }
@keyframes timerPulse { 50% { transform:scale(1.025); } }

#math-practice-app .question-status-row {
    display:flex;justify-content:space-between;align-items:center;gap:12px;
    margin:0 2px 10px;color:var(--muted);font-size:13px;font-weight:700;
}
#math-practice-app .answered-status { margin-left:8px;color:var(--primary); }
#math-practice-app .section-status {
    padding:5px 9px;border-radius:999px;background:#eef2ff;color:#4338ca;font-size:11px;
}
#math-practice-app .progress-container {
    width:100%;height:7px;background:#e2e8f0;border-radius:99px;overflow:hidden;margin-bottom:20px;
}
#math-practice-app .progress-bar {
    width:0;height:100%;border-radius:99px;
    background:linear-gradient(90deg,#2563eb,#7c3aed);
    transition:width .25s ease;
}

#math-practice-app .question-card {
    padding:30px 32px;
    border:1px solid rgba(203,213,225,.75);
    border-radius:26px;
    background:var(--card);
    box-shadow:0 14px 34px rgba(15,23,42,.06);
}
#math-practice-app .q-meta {
    display:flex;flex-wrap:wrap;gap:8px 15px;margin-bottom:16px;color:var(--muted);font-size:12px;
}
#math-practice-app .meta-item { display:flex;align-items:center;gap:5px; }
#math-practice-app .meta-label { color:#94a3b8; }
#math-practice-app .meta-value { font-weight:700; }
#math-practice-app .badge {
    padding:4px 9px;border-radius:999px;background:#eef2ff;color:#4338ca;font-size:11px;
}
#math-practice-app .badge-section { background:#e0f2fe;color:#075985; }
#math-practice-app .q-text {
    color:var(--text);
    font-size:20px;
    font-weight:650;
    line-height:1.62;
    margin-bottom:23px;
}
#math-practice-app .q-text img {
    display:block !important;max-width:100% !important;height:auto !important;
    margin:18px auto !important;border-radius:16px !important;
    box-shadow:0 5px 16px rgba(15,23,42,.08) !important;
}
#math-practice-app .image-caption {
    display:block;text-align:center;color:var(--muted);font-style:italic;font-size:13px;margin:5px 0 12px;
}

#math-practice-app .options-grid { display:flex;flex-direction:column;gap:11px;margin-top:18px; }
#math-practice-app .option-item {
    display:flex;align-items:center;gap:14px;
    padding:15px 18px;border:2px solid var(--border);border-radius:17px;
    background:var(--card-soft);color:var(--text);cursor:pointer;
    transition:.14s ease;font-size:17px;font-weight:600;
}
#math-practice-app .option-item:hover:not(.disabled) { border-color:#93c5fd;background:#eff6ff;transform:translateX(3px); }
#math-practice-app .option-item .letter {
    flex:0 0 34px;width:34px;height:34px;border-radius:50%;
    display:grid;place-items:center;background:#e2e8f0;color:#1e293b;font-weight:900;
}
#math-practice-app .option-item .option-content { flex:1;min-width:0;line-height:1.45; }
#math-practice-app .option-item.correct { border-color:#22c55e;background:#f0fdf4; }
#math-practice-app .option-item.correct .letter { background:#22c55e;color:#fff; }
#math-practice-app .option-item.incorrect { border-color:#ef4444;background:#fef2f2; }
#math-practice-app .option-item.incorrect .letter { background:#ef4444;color:#fff; }
#math-practice-app .option-item.selected-exam {
    border-color:var(--primary);background:#eff6ff;box-shadow:0 0 0 3px rgba(37,99,235,.07);
}
#math-practice-app .option-item.selected-exam .letter { background:var(--primary);color:#fff; }
#math-practice-app .option-item.disabled { cursor:default; }
#math-practice-app .option-item .fa-check,
#math-practice-app .option-item .fa-times { margin-left:auto;font-size:19px; }
#math-practice-app .option-item .fa-check { color:#16a34a; }
#math-practice-app .option-item .fa-times { color:#dc2626; }

#math-practice-app .hint-toggle-wrapper {
    display:flex;align-items:center;gap:8px;
    margin:15px 0 6px;color:var(--primary);font-weight:800;font-size:14px;cursor:pointer;
}
#math-practice-app .hint-text-box {
    display:none;margin:8px 0 16px;padding:14px 16px;border-left:4px solid var(--primary);
    border-radius:12px;background:#eff6ff;color:#334155;line-height:1.5;font-size:14px;
}
#math-practice-app .hint-text-box.show { display:block; }
#math-practice-app .explanation-box {
    display:none;margin-top:19px;padding:18px 20px;border-left:5px solid var(--primary);
    border-radius:15px;background:#f1f5f9;color:#334155;line-height:1.55;
}
#math-practice-app .explanation-box.show { display:block; }
#math-practice-app .explanation-box strong { display:block;color:var(--text);margin-bottom:6px; }

#math-practice-app .nav-controls {
    display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:20px;
}
#math-practice-app .nav-controls button {
    border:none;border-radius:999px;padding:11px 20px;
    background:#e2e8f0;color:#1e293b;font-weight:800;cursor:pointer;
}
#math-practice-app .nav-controls button.primary-btn { background:var(--primary);color:#fff; }
#math-practice-app .nav-controls button:disabled { opacity:.4;cursor:not-allowed; }
#math-practice-app .nav-counter { color:var(--muted);font-size:14px;font-weight:800; }
#math-practice-app .exam-submit-wrap { display:flex;justify-content:flex-end;margin-top:14px; }

#math-practice-app .results-card {
    max-width:760px;margin:20px auto 0;padding:38px;
    text-align:center;border:1px solid var(--border);border-radius:30px;background:var(--card);
    box-shadow:0 18px 45px rgba(15,23,42,.08);
}
#math-practice-app .results-icon {
    width:74px;height:74px;margin:0 auto 15px;border-radius:23px;
    display:grid;place-items:center;background:#fef3c7;color:#d97706;font-size:32px;
}
#math-practice-app .results-card h2 { font-size:32px;letter-spacing:-.03em;margin-bottom:7px; }
#math-practice-app .results-card > p { color:var(--muted); }
#math-practice-app .result-score-ring {
    width:170px;height:170px;border-radius:50%;margin:25px auto;
    display:flex;flex-direction:column;align-items:center;justify-content:center;
    background:linear-gradient(#fff,#fff) padding-box,
               linear-gradient(135deg,#2563eb,#7c3aed) border-box;
    border:10px solid transparent;
    box-shadow:0 12px 28px rgba(37,99,235,.12);
}
#math-practice-app .result-score-ring strong { font-size:40px;line-height:1; }
#math-practice-app .result-score-ring span { margin-top:7px;color:var(--muted);font-size:13px;font-weight:800; }
#math-practice-app .result-stat-grid {
    display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:0 auto 22px;
}
#math-practice-app .result-stat-grid > div {
    padding:16px;border:1px solid var(--border);border-radius:16px;background:var(--card-soft);
}
#math-practice-app .result-stat-grid span { display:block;color:var(--muted);font-size:12px;margin-bottom:4px; }
#math-practice-app .result-stat-grid strong { font-size:23px; }
#math-practice-app .section-breakdown {
    margin:20px 0;text-align:left;
}
#math-practice-app .section-breakdown h3 { margin-bottom:10px;font-size:16px; }
#math-practice-app .breakdown-row {
    display:grid;grid-template-columns:minmax(150px,1fr) auto;gap:12px;
    padding:9px 0;border-bottom:1px solid var(--border);font-size:13px;
}
#math-practice-app .breakdown-row span:last-child { font-weight:800;color:#334155; }
#math-practice-app .results-actions { margin-top:22px; }

#math-practice-app .loading-overlay {
    position:absolute;inset:0;z-index:30;
    display:grid;place-items:center;padding:22px;
    background:rgba(241,245,249,.72);backdrop-filter:blur(6px);border-radius:34px;
}
#math-practice-app .loading-card {
    min-width:min(360px,90vw);padding:26px;border-radius:22px;background:#fff;
    display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center;
    box-shadow:0 20px 50px rgba(15,23,42,.16);
}
#math-practice-app .loading-card i { font-size:30px;color:var(--primary);margin-bottom:4px; }
#math-practice-app .loading-card span { color:var(--muted);font-size:13px; }

#math-practice-app.dark-mode {
    --bg1:#07111f;
    --bg2:#0d1727;
    --surface:rgba(15,23,42,.90);
    --card:#111c2e;
    --card-soft:#0b1422;
    --text:#f1f5f9;
    --muted:#9aa9bd;
    --border:#2b3a4f;
    background:
        radial-gradient(circle at top left,rgba(37,99,235,.16),transparent 32%),
        linear-gradient(145deg,var(--bg1),var(--bg2));
}
#math-practice-app.dark-mode .app-wrapper { border-color:#1e293b; }
#math-practice-app.dark-mode .mode-card,
#math-practice-app.dark-mode .config-panel,
#math-practice-app.dark-mode .quiz-toolbar,
#math-practice-app.dark-mode .question-card,
#math-practice-app.dark-mode .results-card { box-shadow:none; }
#math-practice-app.dark-mode .mode-card p,
#math-practice-app.dark-mode .config-heading p,
#math-practice-app.dark-mode .exam-readiness p,
#math-practice-app.dark-mode .selection-summary,
#math-practice-app.dark-mode .active-sections-label,
#math-practice-app.dark-mode .question-status-row { color:var(--muted); }
#math-practice-app.dark-mode .mode-features,
#math-practice-app.dark-mode .section-chip { color:#cbd5e1; }
#math-practice-app.dark-mode .section-chip.selected,
#math-practice-app.dark-mode .option-item.selected-exam { background:#12264a;color:#bfdbfe; }
#math-practice-app.dark-mode .mini-btn,
#math-practice-app.dark-mode .btn-ghost { background:#1e293b;color:#e2e8f0;border-color:#334155; }
#math-practice-app.dark-mode .exam-rule-grid > div { background:#21150c;border-color:#7c2d12; }
#math-practice-app.dark-mode .hint-text-box { background:#0d2446;color:#cbd5e1; }
#math-practice-app.dark-mode .explanation-box { background:#0b1422;color:#cbd5e1; }
#math-practice-app.dark-mode .explanation-box strong { color:#f8fafc; }
#math-practice-app.dark-mode .option-item.correct { background:#052e16; }
#math-practice-app.dark-mode .option-item.incorrect { background:#450a0a; }
#math-practice-app.dark-mode .section-chip .section-check { background:#0f172a;border-color:#475569; }
#math-practice-app.dark-mode .section-chip.selected .section-check { background:var(--primary); }
#math-practice-app.dark-mode .resume-banner { background:#0c2346;border-color:#1d4ed8; }
#math-practice-app.dark-mode .loading-overlay { background:rgba(2,6,23,.70); }
#math-practice-app.dark-mode .loading-card { background:#111827;color:#f8fafc; }
#math-practice-app.dark-mode .result-score-ring {
    background:linear-gradient(#111c2e,#111c2e) padding-box,
               linear-gradient(135deg,#60a5fa,#a78bfa) border-box;
}
#math-practice-app.dark-mode .breakdown-row span:last-child { color:#e2e8f0; }

@media (max-width:900px) {
    #math-practice-app .setup-hero { grid-template-columns:1fr; }
    #math-practice-app .mode-grid { grid-template-columns:1fr; }
    #math-practice-app .section-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    #math-practice-app .exam-rule-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:640px) {
    #math-practice-app { padding:10px; }
    #math-practice-app .app-wrapper { padding:18px;border-radius:24px; }
    #math-practice-app .header { align-items:flex-start; }
    #math-practice-app .setup-hero { padding:22px;border-radius:22px; }
    #math-practice-app .hero-stat-grid {
        grid-template-columns:minmax(145px, 180px);
        justify-self:end;
        width:max-content;
    }
    #math-practice-app .hero-stat { min-height:90px;padding:10px; }
    #math-practice-app .hero-stat strong { font-size:24px; }
    #math-practice-app .mode-card { padding:18px; }
    #math-practice-app .config-panel { padding:18px; }
    #math-practice-app .config-heading,
    #math-practice-app .config-footer,
    #math-practice-app .quiz-toolbar { flex-direction:column;align-items:stretch; }
    #math-practice-app .section-grid { grid-template-columns:1fr; }
    #math-practice-app .exam-rule-grid { grid-template-columns:1fr 1fr; }
    #math-practice-app .quiz-toolbar-right { justify-content:space-between; }
    #math-practice-app .question-card { padding:22px 17px; }
    #math-practice-app .q-text { font-size:17px; }
    #math-practice-app .option-item { font-size:15px;padding:13px 14px; }
    #math-practice-app .nav-controls button { padding:10px 14px;font-size:13px; }
    #math-practice-app .result-stat-grid { grid-template-columns:1fr; }
    #math-practice-app .results-card { padding:26px 18px; }
    #math-practice-app .resume-banner { align-items:flex-start;flex-wrap:wrap; }
}


/* ============================================================
   Question-count badges and CSEC exam blueprint
   ============================================================ */
#math-practice-app .section-chip-copy {
    display:flex;
    flex:1;
    min-width:0;
    flex-direction:column;
    gap:4px;
}
#math-practice-app .section-question-count {
    color:var(--muted);
    font-size:11px;
    font-weight:700;
}
#math-practice-app .section-chip.selected .section-question-count {
    color:#3b82f6;
}
#math-practice-app .exam-blueprint-panel {
    margin-top:18px;
    padding:18px;
    border:1px solid var(--border);
    border-radius:20px;
    background:var(--card-soft);
}
#math-practice-app .exam-blueprint-heading {
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:14px;
    margin-bottom:14px;
}
#math-practice-app .exam-blueprint-heading h4 {
    font-size:18px;
    color:var(--text);
}
#math-practice-app .blueprint-note {
    display:inline-flex;
    align-items:center;
    gap:6px;
    padding:6px 9px;
    border-radius:999px;
    background:#eef2ff;
    color:#4338ca;
    font-size:11px;
    font-weight:800;
    white-space:nowrap;
}
#math-practice-app .exam-blueprint-grid {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:9px;
}
#math-practice-app .blueprint-section-item {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
    min-height:46px;
    padding:10px 12px;
    border:1px solid var(--border);
    border-radius:13px;
    background:var(--card);
    color:var(--text);
    font-size:12px;
    font-weight:700;
}
#math-practice-app .blueprint-section-item strong {
    flex:0 0 30px;
    width:30px;
    height:30px;
    display:grid;
    place-items:center;
    border-radius:10px;
    background:#ffedd5;
    color:#9a3412;
    font-size:13px;
}
#math-practice-app .exam-blueprint-total {
    display:flex;
    justify-content:flex-end;
    align-items:center;
    gap:10px;
    margin-top:12px;
    padding-top:12px;
    border-top:1px solid var(--border);
    font-size:13px;
}
#math-practice-app .exam-blueprint-total span { color:var(--muted); }
#math-practice-app .exam-blueprint-total strong { color:var(--text); }
#math-practice-app.dark-mode .blueprint-note { background:#27235a;color:#c4b5fd; }
#math-practice-app.dark-mode .section-chip.selected .section-question-count { color:#93c5fd; }
#math-practice-app.dark-mode .blueprint-section-item strong { background:#431407;color:#fdba74; }

@media (max-width:900px) {
    #math-practice-app .exam-blueprint-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:640px) {
    #math-practice-app .exam-blueprint-heading { flex-direction:column; }
    #math-practice-app .exam-blueprint-grid { grid-template-columns:1fr; }
    #math-practice-app .blueprint-note { white-space:normal; }
}

/* ============================================================
   EXAM RESULTS — COLLAPSIBLE QUESTION REVIEW
   ============================================================ */
#math-practice-app .results-card {
    max-width:980px;
}

#math-practice-app .exam-review-heading {
    display:flex;
    justify-content:space-between;
    align-items:flex-end;
    gap:16px;
    margin:30px 0 14px;
    padding-top:24px;
    border-top:1px solid var(--border);
    text-align:left;
}
#math-practice-app .exam-review-heading h3 {
    margin:0 0 5px;
    font-size:22px;
    color:var(--text);
}
#math-practice-app .exam-review-heading p {
    color:var(--muted);
    font-size:14px;
    line-height:1.5;
}
#math-practice-app .exam-review-accordion {
    display:flex;
    flex-direction:column;
    gap:12px;
}
#math-practice-app .exam-review-section {
    overflow:hidden;
    border:1px solid var(--border);
    border-radius:18px;
    background:var(--card);
}
#math-practice-app .section-review-toggle {
    width:100%;
    border:0;
    padding:16px 18px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:18px;
    background:var(--card);
    color:var(--text);
    text-align:left;
    cursor:pointer;
    transition:.16s ease;
}
#math-practice-app .section-review-toggle:hover,
#math-practice-app .section-review-toggle.open {
    background:var(--card-soft);
}
#math-practice-app .section-review-main {
    display:flex;
    align-items:center;
    gap:12px;
    min-width:0;
}
#math-practice-app .section-review-main > span:last-child {
    min-width:0;
}
#math-practice-app .section-review-main strong {
    display:block;
    font-size:15px;
    line-height:1.3;
}
#math-practice-app .section-review-main small {
    display:block;
    margin-top:3px;
    color:var(--muted);
    font-size:12px;
    font-weight:700;
}
#math-practice-app .section-review-chevron {
    flex:0 0 30px;
    width:30px;
    height:30px;
    border-radius:10px;
    display:grid;
    place-items:center;
    background:#eef2ff;
    color:#4338ca;
    transition:.18s ease;
}
#math-practice-app .section-review-toggle.open .section-review-chevron {
    transform:rotate(90deg);
}
#math-practice-app .section-review-score {
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:7px;
    flex-wrap:wrap;
}
#math-practice-app .section-review-score > strong {
    min-width:48px;
    text-align:right;
    font-size:16px;
}
#math-practice-app .section-score-pill {
    min-width:38px;
    padding:5px 8px;
    border-radius:999px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:4px;
    font-size:11px;
    font-weight:900;
}
#math-practice-app .section-score-pill.correct {
    background:#dcfce7;
    color:#166534;
}
#math-practice-app .section-score-pill.incorrect {
    background:#fee2e2;
    color:#991b1b;
}
#math-practice-app .section-score-pill.unanswered {
    background:#f1f5f9;
    color:#475569;
}
#math-practice-app .section-review-panel {
    padding:0 16px 16px;
    border-top:1px solid var(--border);
    background:var(--card-soft);
}
#math-practice-app .section-review-panel[hidden] {
    display:none !important;
}

#math-practice-app .exam-review-question {
    position:relative;
    margin-top:16px;
    padding:20px;
    border:1px solid var(--border);
    border-left-width:6px;
    border-radius:17px;
    background:var(--card);
    text-align:left;
    box-shadow:0 5px 18px rgba(15,23,42,.04);
}
#math-practice-app .exam-review-question.correct {
    border-left-color:#22c55e;
    background:linear-gradient(90deg,rgba(34,197,94,.07),var(--card) 18%);
}
#math-practice-app .exam-review-question.incorrect {
    border-left-color:#ef4444;
    background:linear-gradient(90deg,rgba(239,68,68,.07),var(--card) 18%);
}
#math-practice-app .exam-review-question.unanswered {
    border-left-color:#f59e0b;
    background:linear-gradient(90deg,rgba(245,158,11,.08),var(--card) 18%);
}
#math-practice-app .exam-review-question-head {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    margin-bottom:8px;
}
#math-practice-app .exam-review-number {
    font-weight:900;
    font-size:13px;
    color:var(--text);
}
#math-practice-app .exam-review-status {
    display:inline-flex;
    align-items:center;
    gap:6px;
    padding:6px 9px;
    border-radius:999px;
    font-size:11px;
    font-weight:900;
}
#math-practice-app .exam-review-status.correct {
    background:#dcfce7;
    color:#166534;
}
#math-practice-app .exam-review-status.incorrect {
    background:#fee2e2;
    color:#991b1b;
}
#math-practice-app .exam-review-status.unanswered {
    background:#fef3c7;
    color:#92400e;
}
#math-practice-app .exam-review-topic {
    display:inline-block;
    margin-bottom:10px;
    color:var(--muted);
    font-size:11px;
    font-weight:800;
    text-transform:uppercase;
    letter-spacing:.05em;
}
#math-practice-app .exam-review-question-text {
    color:var(--text);
    font-size:16px;
    font-weight:650;
    line-height:1.6;
}
#math-practice-app .review-media {
    margin-top:14px;
    text-align:center;
}
#math-practice-app .review-media img {
    display:block;
    max-width:100%;
    height:auto;
    margin:0 auto;
    border-radius:14px;
    box-shadow:0 4px 14px rgba(15,23,42,.08);
}
#math-practice-app .review-image-caption {
    display:block;
    margin-top:6px;
    color:var(--muted);
    font-size:12px;
    font-style:italic;
}
#math-practice-app .exam-review-answer-grid {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:10px;
    margin-top:17px;
}
#math-practice-app .review-answer-box {
    padding:12px 13px;
    border:1px solid var(--border);
    border-radius:13px;
    background:var(--card-soft);
}
#math-practice-app .review-answer-box.student-answer.correct {
    border-color:#86efac;
    background:#f0fdf4;
}
#math-practice-app .review-answer-box.student-answer.incorrect {
    border-color:#fca5a5;
    background:#fef2f2;
}
#math-practice-app .review-answer-box.student-answer.unanswered {
    border-color:#fcd34d;
    background:#fffbeb;
}
#math-practice-app .review-answer-box.correct-answer {
    border-color:#86efac;
    background:#f0fdf4;
}
#math-practice-app .review-answer-label {
    display:block;
    margin-bottom:6px;
    color:var(--muted);
    font-size:10px;
    font-weight:900;
    text-transform:uppercase;
    letter-spacing:.07em;
}
#math-practice-app .review-answer-content {
    display:flex;
    align-items:flex-start;
    gap:8px;
    color:var(--text);
    font-size:14px;
    font-weight:700;
    line-height:1.45;
}
#math-practice-app .review-answer-letter {
    flex:0 0 25px;
    width:25px;
    height:25px;
    border-radius:50%;
    display:grid;
    place-items:center;
    background:#e2e8f0;
    color:#1e293b;
    font-size:11px;
    font-weight:900;
}
#math-practice-app .student-answer.correct .review-answer-letter,
#math-practice-app .correct-answer .review-answer-letter {
    background:#22c55e;
    color:#fff;
}
#math-practice-app .student-answer.incorrect .review-answer-letter {
    background:#ef4444;
    color:#fff;
}
#math-practice-app .review-answer-text {
    min-width:0;
    flex:1;
}
#math-practice-app .review-answer-empty {
    color:var(--muted);
    font-style:italic;
    font-weight:700;
}
#math-practice-app .review-explanation {
    margin-top:13px;
    padding:14px 15px;
    border-radius:13px;
    background:#f8fafc;
    border:1px solid #e2e8f0;
}
#math-practice-app .review-explanation-title {
    display:flex;
    align-items:center;
    gap:7px;
    margin-bottom:6px;
    color:#92400e;
    font-size:12px;
    font-weight:900;
}
#math-practice-app .review-explanation-title i {
    color:#f59e0b;
}
#math-practice-app .review-explanation-text {
    color:#334155;
    font-size:14px;
    line-height:1.6;
}

#math-practice-app.dark-mode .section-review-chevron {
    background:#1e293b;
    color:#a5b4fc;
}
#math-practice-app.dark-mode .section-score-pill.correct,
#math-practice-app.dark-mode .exam-review-status.correct {
    background:#052e16;
    color:#86efac;
}
#math-practice-app.dark-mode .section-score-pill.incorrect,
#math-practice-app.dark-mode .exam-review-status.incorrect {
    background:#450a0a;
    color:#fca5a5;
}
#math-practice-app.dark-mode .section-score-pill.unanswered {
    background:#1e293b;
    color:#cbd5e1;
}
#math-practice-app.dark-mode .exam-review-status.unanswered {
    background:#422006;
    color:#fcd34d;
}
#math-practice-app.dark-mode .exam-review-question.correct {
    background:linear-gradient(90deg,rgba(34,197,94,.10),var(--card) 18%);
}
#math-practice-app.dark-mode .exam-review-question.incorrect {
    background:linear-gradient(90deg,rgba(239,68,68,.10),var(--card) 18%);
}
#math-practice-app.dark-mode .exam-review-question.unanswered {
    background:linear-gradient(90deg,rgba(245,158,11,.10),var(--card) 18%);
}
#math-practice-app.dark-mode .review-answer-box.student-answer.correct,
#math-practice-app.dark-mode .review-answer-box.correct-answer {
    background:#052e16;
    border-color:#166534;
}
#math-practice-app.dark-mode .review-answer-box.student-answer.incorrect {
    background:#450a0a;
    border-color:#991b1b;
}
#math-practice-app.dark-mode .review-answer-box.student-answer.unanswered {
    background:#422006;
    border-color:#92400e;
}
#math-practice-app.dark-mode .review-answer-letter {
    background:#334155;
    color:#e2e8f0;
}
#math-practice-app.dark-mode .review-explanation {
    background:#0b1422;
    border-color:#334155;
}
#math-practice-app.dark-mode .review-explanation-text {
    color:#cbd5e1;
}

@media (max-width:700px) {
    #math-practice-app .section-review-toggle {
        align-items:flex-start;
        padding:14px;
    }
    #math-practice-app .section-review-score {
        max-width:150px;
    }
    #math-practice-app .exam-review-answer-grid {
        grid-template-columns:1fr;
    }
    #math-practice-app .section-review-panel {
        padding:0 10px 10px;
    }
    #math-practice-app .exam-review-question {
        padding:16px 13px;
    }
}

/* ============================================================
   EXAM QUESTION NAVIGATOR
   ============================================================ */
#math-practice-app .exam-navigator {
    margin:0 0 20px;
    border:1px solid var(--border);
    border-radius:20px;
    background:var(--card);
    box-shadow:0 8px 22px rgba(15,23,42,.045);
    overflow:hidden;
}

#math-practice-app .exam-navigator-toggle {
    width:100%;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
    padding:14px 16px;
    border:0;
    background:transparent;
    color:var(--text);
    cursor:pointer;
    text-align:left;
}

#math-practice-app .exam-navigator-heading {
    min-width:0;
    display:flex;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
}

#math-practice-app .exam-navigator-title {
    display:inline-flex;
    align-items:center;
    gap:8px;
    font-size:14px;
    font-weight:900;
}

#math-practice-app .exam-navigator-title i { color:var(--primary); }

#math-practice-app .exam-nav-summary {
    color:var(--muted);
    font-size:12px;
    font-weight:750;
}

#math-practice-app .exam-navigator-chevron {
    color:var(--muted);
    transition:transform .18s ease;
}

#math-practice-app .exam-navigator.collapsed .exam-navigator-chevron {
    transform:rotate(180deg);
}

#math-practice-app .exam-navigator.collapsed .exam-navigator-body {
    display:none;
}

#math-practice-app .exam-navigator-body {
    padding:13px 16px 16px;
    border-top:1px solid var(--border);
}

#math-practice-app .exam-navigator-legend {
    display:flex;
    flex-wrap:wrap;
    gap:10px 17px;
    margin-bottom:12px;
    color:var(--muted);
    font-size:11px;
    font-weight:700;
}

#math-practice-app .exam-navigator-legend span {
    display:inline-flex;
    align-items:center;
    gap:6px;
}

#math-practice-app .legend-swatch {
    display:inline-block;
    width:12px;
    height:12px;
    border-radius:4px;
    border:1.5px solid #cbd5e1;
    background:#f8fafc;
}

#math-practice-app .legend-swatch.answered {
    border-color:#60a5fa;
    background:#dbeafe;
}

#math-practice-app .legend-swatch.current {
    border-color:var(--primary);
    background:var(--primary);
    box-shadow:0 0 0 2px rgba(37,99,235,.13);
}

#math-practice-app .exam-question-grid {
    display:grid;
    grid-template-columns:repeat(15,minmax(0,1fr));
    gap:7px;
}

#math-practice-app .exam-nav-question {
    min-width:0;
    height:38px;
    padding:0;
    border:1.5px solid #cbd5e1;
    border-radius:10px;
    background:#f8fafc;
    color:#475569;
    font-size:12px;
    font-weight:850;
    cursor:pointer;
    transition:transform .12s ease, border-color .12s ease, background .12s ease, color .12s ease, box-shadow .12s ease;
}

#math-practice-app .exam-nav-question:hover {
    transform:translateY(-1px);
    border-color:#93c5fd;
}

#math-practice-app .exam-nav-question.answered {
    border-color:#60a5fa;
    background:#dbeafe;
    color:#1d4ed8;
}

#math-practice-app .exam-nav-question.current {
    border-color:var(--primary);
    background:var(--primary);
    color:#fff;
    box-shadow:0 0 0 3px rgba(37,99,235,.14);
}

#math-practice-app.dark-mode .exam-navigator {
    box-shadow:none;
}

#math-practice-app.dark-mode .exam-nav-question.unanswered,
#math-practice-app.dark-mode .legend-swatch.unanswered {
    border-color:#475569;
    background:#0b1422;
    color:#94a3b8;
}

#math-practice-app.dark-mode .exam-nav-question.answered,
#math-practice-app.dark-mode .legend-swatch.answered {
    border-color:#3b82f6;
    background:#102b52;
    color:#bfdbfe;
}

#math-practice-app.dark-mode .exam-nav-question.current,
#math-practice-app.dark-mode .legend-swatch.current {
    border-color:#60a5fa;
    background:#2563eb;
    color:#fff;
}

@media (max-width:900px) {
    #math-practice-app .exam-question-grid {
        grid-template-columns:repeat(10,minmax(0,1fr));
    }
}

@media (max-width:640px) {
    #math-practice-app .exam-navigator-toggle {
        padding:13px 14px;
    }

    #math-practice-app .exam-navigator-body {
        padding:12px 13px 14px;
    }

    #math-practice-app .exam-question-grid {
        grid-template-columns:repeat(6,minmax(0,1fr));
        gap:6px;
    }

    #math-practice-app .exam-nav-question {
        height:36px;
        border-radius:9px;
    }
}
