        /* ── GLOBAL RESET ── */
        *, *::before, *::after { box-sizing: border-box; }

        /* ══════════════════════════════════════════════════════════════
           DESIGN TOKEN SYSTEM — Foundation for all UI
           ══════════════════════════════════════════════════════════════ */

        :root {
            /* ── TYPOGRAPHY ── */
            --font-ui:      'DM Sans', system-ui, sans-serif;
            --font-body:    'Source Serif 4', Georgia, serif;
            --font-mono:    'JetBrains Mono', 'Courier New', monospace;

            --text-xs:      0.75rem;
            --text-sm:      0.875rem;
            --text-base:    1rem;
            --text-lg:      1.125rem;
            --text-xl:      1.25rem;
            --text-2xl:     1.5rem;
            --text-3xl:     1.875rem;
            --text-4xl:     2.25rem;
            --text-2xs:     0.65rem;
            --text-equation: 1.1rem;

            --leading-tight:  1.3;
            --leading-snug:   1.5;
            --leading-normal: 1.65;
            --leading-relaxed: 1.8;

            --tracking-tight: -0.02em;
            --tracking-normal: 0;
            --tracking-wide:  0.04em;
            --tracking-wider: 0.08em;

            /* ── SPACING (8-point grid) ── */
            --space-1:  0.25rem;
            --space-2:  0.5rem;
            --space-3:  0.75rem;
            --space-4:  1rem;
            --space-5:  1.25rem;
            --space-6:  1.5rem;
            --space-8:  2rem;
            --space-10: 2.5rem;
            --space-12: 3rem;
            --space-16: 4rem;

            /* ── BORDER RADIUS ── */
            --radius-sm:  4px;
            --radius-md:  8px;
            --radius-lg:  12px;
            --radius-xl:  16px;
            --radius-2xl: 20px;
            --radius-full: 9999px;

            /* ── SHADOWS ── */
            --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
            --shadow-sm: 0 1px 4px rgba(0,0,0,0.08);
            --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
            --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
            --shadow-xl: 0 16px 40px rgba(0,0,0,0.16);

            /* ── TRANSITIONS ── */
            --transition-fast:   0.12s ease;
            --transition-base:   0.2s ease;
            --transition-slow:   0.35s ease;

            /* ── LIGHT THEME (default) ── */
            --color-bg-page:        #f1f5f9;
            --color-bg-card:        #ffffff;
            --color-bg-card-hover:  #f8fafc;
            --color-bg-subtle:      #f8fafc;
            --color-bg-sunken:      #f1f5f9;

            --color-text-primary:   #0f172a;
            --color-text-secondary: #334155;
            --color-text-muted:     #64748b;
            --color-text-faint:     #6b7a8d;
            --color-text-inverse:   #f8fafc;

            --color-border:         #e2e8f0;
            --color-border-strong:  #cbd5e1;
            --color-border-focus:   #2563eb;

            --color-primary:        #2563eb;
            --color-primary-hover:  #1d4ed8;
            --color-primary-light:  #eff6ff;
            --color-primary-muted:  #bfdbfe;

            --color-success:        #059669;
            --color-success-light:  #ecfdf5;
            --color-success-muted:  #a7f3d0;

            --color-warning:        #d97706;
            --color-warning-light:  #fffbeb;
            --color-warning-muted:  #fde68a;

            --color-danger:         #dc2626;
            --color-danger-light:   #fef2f2;
            --color-danger-muted:   #fecaca;

            --color-nav-bg:         #0f172a;
            --color-nav-text:       #94a3b8;
            --color-nav-text-hover: #f1f5f9;
            --color-nav-active-bg:  #1e293b;
            --color-nav-active-text:#ffffff;
            --color-nav-accent:     #2563eb;

            /* Legacy aliases — used by existing dark-card components */
            --accent: var(--color-primary);
            --border: var(--color-border);
            --bg-subtle: var(--color-bg-subtle);
            --navy-deep:#07111f; --navy:#0a1628; --navy-mid:#112040; --navy-light:#1a3060;
            --amber:#f0a500; --amber-light:#ffc740; --green:#00c896; --red:#ff4d6a;
            --blue-src:#4a9eff; --silver:#c8d4e8; --silver-dim:#7a90b0;
            --font-ui-legacy:'IBM Plex Sans',sans-serif; --font-mono-legacy:'IBM Plex Mono',monospace;
        }

        /* ── DARK THEME ── */
        [data-theme="dark"] {
            --color-bg-page:        #0f172a;
            --color-bg-card:        #1e293b;
            --color-bg-card-hover:  #253347;
            --color-bg-subtle:      #1e293b;
            --color-bg-sunken:      #0f172a;

            --color-text-primary:   #f1f5f9;
            --color-text-secondary: #cbd5e1;
            --color-text-muted:     #94a3b8;
            --color-text-faint:     #64748b;
            --color-text-inverse:   #0f172a;

            --color-border:         #334155;
            --color-border-strong:  #475569;
            --color-border-focus:   #3b82f6;

            --color-primary:        #3b82f6;
            --color-primary-hover:  #2563eb;
            --color-primary-light:  #1e3a5f;
            --color-primary-muted:  #1d4ed8;

            --color-success:        #10b981;
            --color-success-light:  #064e3b;
            --color-success-muted:  #065f46;

            --color-warning:        #f59e0b;
            --color-warning-light:  #451a03;
            --color-warning-muted:  #78350f;

            --color-danger:         #ef4444;
            --color-danger-light:   #450a0a;
            --color-danger-muted:   #7f1d1d;

            --color-nav-bg:         #020617;
            --color-nav-text:       #64748b;
            --color-nav-text-hover: #e2e8f0;
            --color-nav-active-bg:  #0f172a;
            --color-nav-active-text:#ffffff;
            --color-nav-accent:     #3b82f6;

            --shadow-sm: 0 1px 4px rgba(0,0,0,0.3);
            --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
            --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
        }

        /* ── HIGH CONTRAST THEME ── */
        [data-theme="high-contrast"] {
            --color-bg-page:        #000000;
            --color-bg-card:        #0a0a0a;
            --color-bg-card-hover:  #111111;
            --color-bg-subtle:      #111111;
            --color-bg-sunken:      #000000;

            --color-text-primary:   #ffffff;
            --color-text-secondary: #e5e5e5;
            --color-text-muted:     #cccccc;
            --color-text-faint:     #aaaaaa;

            --color-border:         #555555;
            --color-border-strong:  #888888;
            --color-border-focus:   #ffffff;

            --color-primary:        #60a5fa;
            --color-primary-hover:  #93c5fd;
            --color-primary-light:  #1e3a5f;

            --color-success:        #34d399;
            --color-success-light:  #022c22;

            --color-warning:        #fbbf24;
            --color-warning-light:  #1c1003;

            --color-danger:         #f87171;
            --color-danger-light:   #1c0202;
        }

        /* ── SEPIA THEME ── */
        [data-theme="sepia"] {
            --color-bg-page:        #f4ede4;
            --color-bg-card:        #faf6f1;
            --color-bg-card-hover:  #f7f0e8;
            --color-bg-subtle:      #ede8e0;
            --color-bg-sunken:      #e8e0d4;

            --color-text-primary:   #2c1810;
            --color-text-secondary: #4a3020;
            --color-text-muted:     #7a6050;
            --color-text-faint:     #a08070;

            --color-border:         #d4c4b0;
            --color-border-strong:  #b8a090;

            --color-primary:        #8b4513;
            --color-primary-hover:  #6b3510;
            --color-primary-light:  #f0e8dc;

            --color-nav-bg:         #2c1810;
            --color-nav-text:       #a08070;
            --color-nav-text-hover: #f4ede4;
            --color-nav-active-bg:  #3d2418;
            --color-nav-active-text:#f4ede4;
            --color-nav-accent:     #8b4513;
        }

        /* ── FOCUS THEME ── */
        [data-theme="focus"] {
            --color-bg-page:        #fafafa;
            --color-bg-card:        #ffffff;
            --color-bg-card-hover:  #f5f5f5;
            --color-bg-subtle:      #f5f5f5;
            --color-bg-sunken:      #eeeeee;

            --color-text-primary:   #111111;
            --color-text-secondary: #333333;
            --color-text-muted:     #666666;
            --color-text-faint:     #999999;

            --color-border:         #e0e0e0;
            --color-border-strong:  #cccccc;

            --color-primary:        #1a56db;
            --color-primary-hover:  #1347c0;
            --color-primary-light:  #eef2ff;

            --color-success:        #057a55;
            --color-warning:        #c27803;
            --color-danger:         #c81e1e;

            --color-nav-bg:         #111111;
            --color-nav-text:       #888888;
            --color-nav-text-hover: #f5f5f5;
            --color-nav-active-bg:  #222222;
            --color-nav-active-text:#ffffff;
            --color-nav-accent:     #1a56db;
        }

        /* ── FONT SIZE MODES ── */
        [data-fontsize="small"]  { --text-base: 0.875rem; --text-lg: 1rem;     --text-xl: 1.125rem; }
        [data-fontsize="medium"] { --text-base: 1rem;     --text-lg: 1.125rem; --text-xl: 1.25rem;  }
        [data-fontsize="large"]  { --text-base: 1.125rem; --text-lg: 1.25rem;  --text-xl: 1.5rem;   }
        [data-fontsize="xl"]     { --text-base: 1.25rem;  --text-lg: 1.5rem;   --text-xl: 1.75rem;  }

        /* ── LINE SPACING MODES ── */
        [data-spacing="compact"]  { --leading-normal: 1.5;  --leading-relaxed: 1.65; }
        [data-spacing="normal"]   { --leading-normal: 1.65; --leading-relaxed: 1.8;  }
        [data-spacing="relaxed"]  { --leading-normal: 1.8;  --leading-relaxed: 2.0;  }

        /* ── REDUCE MOTION ── */
        @media (prefers-reduced-motion: reduce) {
            *, *::before, *::after {
                animation-duration: 0.01ms !important;
                transition-duration: 0.01ms !important;
            }
        }
        [data-reduce-motion="true"] *,
        [data-reduce-motion="true"] *::before,
        [data-reduce-motion="true"] *::after {
            animation-duration: 0.01ms !important;
            transition-duration: 0.01ms !important;
        }

        /* ── BASE ELEMENT STYLES ── */
        html, body {
            width: 100%;
            height: 100vh;
            margin: 0;
            padding: 0;
            overflow: hidden;
        }
        body {
            font-family: var(--font-ui);
            font-size: var(--text-base);
            line-height: var(--leading-normal);
            color: var(--color-text-primary);
            background: var(--color-bg-page);
            -webkit-font-smoothing: antialiased;
            transition: background var(--transition-slow), color var(--transition-slow);
        }

        h1, h2, h3, h4, h5, h6 {
            font-family: var(--font-ui);
            font-weight: 600;
            line-height: var(--leading-tight);
            letter-spacing: var(--tracking-tight);
            color: var(--color-text-primary);
        }

        .question-text,
        .practice-question-text,
        .exam-question-text {
            font-family: var(--font-body);
            font-size: var(--text-base);
            line-height: var(--leading-relaxed);
            color: var(--color-text-primary);
        }

        .answer-choice,
        .formula,
        .solution-value,
        code {
            font-family: var(--font-mono);
        }

        /* ══════════════════════════════════════════════════════════════
           COMPONENT LIBRARY — Reusable UI primitives
           ══════════════════════════════════════════════════════════════ */

        /* ── TASK 1: Button System ── */
        .btn {
            display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
            font-family: var(--font-ui); font-weight: 700; border: 1.5px solid transparent;
            border-radius: var(--radius-md); cursor: pointer;
            transition: all var(--transition-fast);
            line-height: 1.4; white-space: nowrap;
        }
        .btn:disabled { opacity: 0.4; cursor: not-allowed; }
        .btn-sm  { font-size: var(--text-xs);  padding: 0.35rem 0.75rem; }
        .btn-md  { font-size: var(--text-sm);  padding: 0.55rem 1.1rem; }
        .btn-lg  { font-size: var(--text-base); padding: 0.7rem 1.5rem; }
        .btn-primary {
            background: var(--color-primary); color: var(--color-text-inverse);
            border-color: var(--color-primary);
        }
        .btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
        .btn-secondary {
            background: var(--color-bg-card); color: var(--color-text-secondary);
            border-color: var(--color-border);
        }
        .btn-secondary:hover:not(:disabled) { border-color: var(--color-primary); color: var(--color-primary); }
        .btn-ghost {
            background: transparent; color: var(--color-text-muted);
            border-color: transparent;
        }
        .btn-ghost:hover:not(:disabled) { background: var(--color-bg-subtle); color: var(--color-text-primary); }
        .btn-danger {
            background: var(--color-danger); color: var(--color-text-inverse);
            border-color: var(--color-danger);
        }
        .btn-danger:hover:not(:disabled) { background: #b91c1c; border-color: #b91c1c; }
        .btn-success {
            background: var(--color-success); color: var(--color-text-inverse);
            border-color: var(--color-success);
        }
        .btn-success:hover:not(:disabled) { background: #047857; border-color: #047857; }

        /* ── TASK 2: Badge / Pill System ── */
        .badge {
            display: inline-flex; align-items: center; gap: 0.25rem;
            font-family: var(--font-mono); font-size: 0.65rem; font-weight: 700;
            padding: 3px 8px; border-radius: var(--radius-sm);
            text-transform: uppercase; letter-spacing: 1px; line-height: 1.3;
        }
        .badge-easy   { background: var(--color-success-light); color: #065f46; }
        .badge-medium { background: var(--color-warning-light); color: #92400e; }
        .badge-hard   { background: var(--color-danger-light);  color: #991b1b; }
        .badge-exam   { background: #ede9fe; color: #5b21b6; }
        .badge-concept { background: var(--color-primary-light); color: var(--color-primary); }
        .badge-math   { background: #fff7ed; color: #ea580c; }
        [data-theme="dark"] .badge-easy   { background: #064e3b; color: #a7f3d0; }
        [data-theme="dark"] .badge-medium { background: #78350f; color: #fde68a; }
        [data-theme="dark"] .badge-hard   { background: #7f1d1d; color: #fecaca; }
        [data-theme="dark"] .badge-exam   { background: #3b0764; color: #c4b5fd; }

        /* Solution type badge (CALCULATION / CONCEPTUAL) */
        .sol-type-badge {
            display: inline-block; font-size: var(--text-xs); font-weight: 700;
            text-transform: uppercase; letter-spacing: var(--tracking-wider);
            padding: 3px 10px; border-radius: var(--radius-sm);
            margin: var(--space-2) var(--space-5) var(--space-3);
        }
        .sol-type-badge.math    { background: var(--color-primary-light); color: var(--color-primary); }
        .sol-type-badge.concept { background: var(--color-primary-light); color: var(--color-primary); }
        [data-theme="dark"] .sol-type-badge.math    { background: #1e1b4b; color: #a5b4fc; }
        [data-theme="dark"] .sol-type-badge.concept { background: #1e1b4b; color: #a5b4fc; }

        /* ── DARK MODE READABILITY — light text on dark tinted backgrounds ── */
        /* Answer buttons: correct/wrong */
        [data-theme="dark"] .qz-ans-btn.correct { color: #6ee7b7; }
        [data-theme="dark"] .qz-ans-btn.correct .qz-ans-letter { color: #6ee7b7; }
        [data-theme="dark"] .qz-ans-btn.correct .qz-ans-text { color: #6ee7b7; }
        [data-theme="dark"] .qz-ans-btn.wrong { color: #fca5a5; }
        [data-theme="dark"] .qz-ans-btn.wrong .qz-ans-letter { color: #fca5a5; }
        [data-theme="dark"] .qz-ans-btn.wrong .qz-ans-text { color: #fca5a5; }
        /* Practice answer buttons */
        [data-theme="dark"] .prac-opt-btn.correct { background: var(--color-success-light); border-color: var(--color-success); color: #6ee7b7; }
        [data-theme="dark"] .prac-opt-btn.correct .prac-opt-letter { background: var(--color-success-muted); color: #6ee7b7; border-color: var(--color-success-muted); }
        [data-theme="dark"] .prac-opt-btn.wrong { background: var(--color-danger-light); border-color: var(--color-danger); color: #fca5a5; }
        [data-theme="dark"] .prac-opt-btn.wrong .prac-opt-letter { background: var(--color-danger-muted); color: #fca5a5; border-color: var(--color-danger-muted); }
        /* Feedback banners */
        [data-theme="dark"] .qz-feedback-correct { color: #6ee7b7; }
        [data-theme="dark"] .qz-feedback-incorrect { color: #fca5a5; }
        /* Difficulty badges */
        [data-theme="dark"] .diff-badge.easy { color: #6ee7b7; }
        [data-theme="dark"] .diff-badge.medium { color: #fcd34d; }
        [data-theme="dark"] .diff-badge.hard { color: #fca5a5; }
        [data-theme="dark"] .diff-badge.exam { background: #2e1065; color: #c4b5fd; }
        /* Difficulty pills */
        [data-theme="dark"] .diff-pill.easy { color: #6ee7b7 !important; }
        [data-theme="dark"] .diff-pill.medium { color: #fcd34d !important; }
        [data-theme="dark"] .diff-pill.hard { color: #fca5a5 !important; }
        [data-theme="dark"] .diff-pill.exam { background: #2e1065; color: #c4b5fd !important; }
        /* Solution panel sections */
        [data-theme="dark"] .sol-trap-text { color: #fca5a5; }
        [data-theme="dark"] .sol-trap-item { border-left-color: #f87171; }
        [data-theme="dark"] .sol-concept-text { color: #e2e8f0; }
        [data-theme="dark"] .sol-section-hd.trap { color: #f87171; }
        [data-theme="dark"] .sol-section-hd.concept { color: #fbbf24; }
        [data-theme="dark"] .sol-section-hd.ref { color: #5eead4; }
        [data-theme="dark"] .sol-result-banner.correct { color: #6ee7b7; }
        [data-theme="dark"] .sol-result-banner.incorrect { color: #fca5a5; }
        [data-theme="dark"] .sol-ref-pill { color: #5eead4; border-color: #134e4a; background: #042f2e; }
        /* Confidence buttons */
        [data-theme="dark"] .conf-btn.conf-green { color: #6ee7b7; border-color: #065f46; }
        [data-theme="dark"] .conf-btn.conf-yellow { color: #fcd34d; border-color: #92400e; }
        [data-theme="dark"] .conf-btn.conf-red { color: #fca5a5; border-color: #991b1b; }
        /* Reference manual badges + subject labels */
        [data-theme="dark"] .ref-manual-badge.free { background:#064e3b; color:#6ee7b7; border-color:#065f46; }
        [data-theme="dark"] .ref-manual-badge.purchase { background:#451a03; color:#fcd34d; border-color:#92400e; }
        [data-theme="dark"] .ref-manual-subj { color:#94a3b8; }
        /* ── GLOBAL: all remaining hardcoded dark text colors ── */
        /* Green accents (#065f46, #059669) → light green */
        [data-theme="dark"] .flash-badge-correct,
        [data-theme="dark"] .lec-score-good,
        [data-theme="dark"] .fq-bd-diff-easy { color: #34d399; }
        /* Red accents (#991b1b, #dc2626) → light red */
        [data-theme="dark"] .fq-bd-diff-hard { color: #f87171; }
        /* Amber/brown accents (#92400e, #854d0e, #d97706, #ea580c) → light amber */
        [data-theme="dark"] .fq-bd-diff-medium { color: #fbbf24; }
        [data-theme="dark"] .insight-label.exam { color: #fbbf24; }
        /* Purple accents (#7c3aed, #3b0764) → light purple */
        [data-theme="dark"] .fq-bd-diff-exam-level { color: #a78bfa; }
        [data-theme="dark"] .insight-label.why { color: #a78bfa; }
        [data-theme="dark"] .mode-btn.active.concept-mode { color: #a78bfa; }
        /* Teal accents (#0d9488) → light teal */
        [data-theme="dark"] .sol-hd-vars { color: #5eead4; }
        [data-theme="dark"] .prac-sol-section-label.ref { color: #5eead4; }
        /* Blue accents (#0369a1) → light blue */
        [data-theme="dark"] .insight-label.model { color: #7dd3fc; }
        /* Near-black body text (#1c1917, #1e293b) → light gray */
        [data-theme="dark"] .lec-ref-card-title,
        [data-theme="dark"] .lec-ref-card-desc,
        [data-theme="dark"] .lec-ref-tag { color: var(--color-text-primary); }
        /* Dark gray text (#57534e, #475569) → medium gray */
        [data-theme="dark"] .lec-ref-subject { color: var(--color-text-secondary); }
        /* Lecture concept/practice section labels */
        [data-theme="dark"] .concept-sol-section-label,
        [data-theme="dark"] .prac-sol-section-label { color: var(--color-text-primary); }
        /* Exam badge on dark */
        [data-theme="dark"] .diff-badge.exam { background: #2e1065; color: #c4b5fd; }

        /* ── TASK 3: Card System ── */
        .card {
            background: var(--color-bg-card); border: 1px solid var(--color-border);
            border-radius: var(--radius-lg); overflow: hidden;
            box-shadow: var(--shadow-xs);
            transition: border-color var(--transition-base), box-shadow var(--transition-base);
        }
        .card-hover:hover {
            border-color: var(--color-primary-muted);
            box-shadow: var(--shadow-md);
            transform: translateY(-2px);
        }
        .card-body    { padding: var(--space-4) var(--space-5); }
        .card-body-sm { padding: var(--space-3) var(--space-4); }
        .card-body-lg { padding: var(--space-6) var(--space-8); }
        .card-header {
            display: flex; align-items: center; gap: var(--space-2);
            padding: var(--space-3) var(--space-4);
            border-bottom: 1px solid var(--color-border);
            flex-wrap: wrap;
        }

        /* ── TASK 4: Answer Choice Buttons ── */
        .answer-choice-btn {
            display: flex; align-items: flex-start; gap: var(--space-3);
            width: 100%; text-align: left;
            background: var(--color-bg-subtle); border: 1.5px solid var(--color-border);
            border-radius: var(--radius-md); padding: 0.65rem 1rem;
            font-size: var(--text-sm); color: var(--color-text-secondary);
            cursor: pointer; line-height: 1.5;
            transition: all var(--transition-fast);
        }
        .answer-choice-btn:hover:not(:disabled) {
            background: var(--color-primary-light); border-color: var(--color-primary-muted);
            color: var(--color-primary-hover);
        }
        .answer-choice-btn:disabled { cursor: default; }
        .answer-choice-btn.correct {
            background: var(--color-success-light); border-color: var(--color-success-muted);
            color: #065f46; font-weight: 600;
        }
        .answer-choice-btn.wrong {
            background: var(--color-danger-light); border-color: var(--color-danger-muted);
            color: #991b1b;
        }
        .choice-letter {
            display: flex; align-items: center; justify-content: center;
            width: 24px; height: 24px; border-radius: var(--radius-full);
            border: 2px solid var(--color-border-strong);
            font-family: var(--font-mono); font-size: 0.7rem; font-weight: 800;
            flex-shrink: 0; color: var(--color-text-muted);
            transition: all var(--transition-fast);
        }
        .answer-choice-btn:hover:not(:disabled) .choice-letter {
            border-color: var(--color-primary); color: var(--color-primary);
        }
        .answer-choice-btn.correct .choice-letter {
            background: var(--color-success); border-color: var(--color-success);
            color: var(--color-text-inverse);
        }
        .answer-choice-btn.wrong .choice-letter {
            background: var(--color-danger); border-color: var(--color-danger);
            color: var(--color-text-inverse);
        }

        /* ── TASK 5: Progress Bars ── */
        .progress-track {
            width: 100%; height: 8px;
            background: var(--color-bg-sunken); border-radius: var(--radius-full);
            overflow: hidden;
        }
        .progress-track-sm { height: 6px; }
        .progress-track-lg { height: 8px; }
        .progress-fill {
            height: 100%; border-radius: var(--radius-full);
            transition: width 0.4s ease;
            background: var(--color-primary);
        }
        .progress-fill-success { background: var(--color-success); }
        .progress-fill-warning { background: var(--color-warning); }
        .progress-fill-danger  { background: var(--color-danger); }
        .progress-fill-gradient { background: linear-gradient(90deg, var(--color-primary), var(--color-success)); }

        /* ── TASK 6: Form Inputs & Selects ── */
        .form-input, .form-select {
            font-family: var(--font-ui); font-size: var(--text-sm);
            color: var(--color-text-primary);
            background: var(--color-bg-card); border: 1px solid var(--color-border);
            border-radius: var(--radius-md); padding: 0.5rem 0.75rem;
            outline: none;
            transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
        }
        .form-input:focus, .form-select:focus {
            border-color: var(--color-border-focus);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
        }
        .form-input::placeholder { color: var(--color-text-faint); }

        /* ══════════════════════════════════════════════════════════════
           UI-3: SIDEBAR, HEADER, STATS, SUBJECT CARDS
           ══════════════════════════════════════════════════════════════ */

        /* ── TASK 1: Sidebar Navigation ── */
        .sidebar {
            width: 220px; flex-shrink: 0;
            height: 100vh; position: fixed;
            left: 0; top: 0; bottom: 0;
            background: var(--color-nav-bg);
            border-right: 1px solid rgba(255,255,255,0.06);
            display: flex; flex-direction: column; z-index: 50;
            overflow-y: auto;
        }
        .sidebar-logo {
            padding: var(--space-5);
            display: flex; align-items: center; gap: var(--space-3);
            border-left: 3px solid var(--color-primary);
        }
        .sidebar-logo-icon {
            width: 32px; height: 32px; border-radius: var(--radius-md);
            background: var(--color-primary); display: flex;
            align-items: center; justify-content: center;
            color: white; font-size: 1rem; flex-shrink: 0;
        }
        .sidebar-logo-text {
            font-family: var(--font-ui); font-size: var(--text-lg);
            font-weight: 600; color: white;
            letter-spacing: var(--tracking-tight);
        }
        .sidebar-section-label {
            font-size: var(--text-xs); font-weight: 700;
            letter-spacing: var(--tracking-wider);
            text-transform: uppercase;
            color: var(--color-nav-text);
            padding: var(--space-5) var(--space-4) var(--space-2);
            margin-top: var(--space-4);
        }
        .sidebar-link {
            padding: var(--space-3) var(--space-4);
            border-radius: var(--radius-md);
            margin: 2px var(--space-2);
            font-size: var(--text-sm); font-weight: 500;
            color: var(--color-nav-text);
            display: flex; align-items: center; gap: var(--space-3);
            transition: all var(--transition-fast);
            cursor: pointer; text-decoration: none;
            border-left: 3px solid transparent;
        }
        .sidebar-link:hover {
            background: rgba(255,255,255,0.06);
            color: var(--color-nav-text-hover);
        }
        .sidebar-link.active {
            background: var(--color-nav-active-bg);
            color: var(--color-nav-active-text);
            border-left-color: var(--color-nav-accent);
            font-weight: 600;
        }
        .sidebar-link iconify-icon { font-size: 1.1rem; flex-shrink: 0; }
        .sidebar-user {
            padding: var(--space-4) var(--space-5); margin-top: auto;
            border-top: 1px solid rgba(255,255,255,0.06);
            display: flex; align-items: center; gap: var(--space-3);
        }
        .sidebar-user-avatar {
            width: 34px; height: 34px; border-radius: var(--radius-full);
            background: var(--color-primary); display: flex;
            align-items: center; justify-content: center;
            color: white; font-size: var(--text-sm); font-weight: 700;
            flex-shrink: 0;
        }
        .sidebar-user-name { font-size: var(--text-sm); font-weight: 600; color: white; }
        .sidebar-user-role { font-size: 0.65rem; color: var(--color-nav-text); text-transform: uppercase; letter-spacing: 0.5px; }
        .main-content {
            margin-left: 220px;
            width: calc(100vw - 220px);
            height: 100vh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        /* ── TASK 2: Dashboard Header ── */
        .dash-header {
            position: sticky; top: 0; z-index: 40;
            background: var(--color-bg-card);
            border-bottom: 1px solid var(--color-border);
            padding: var(--space-4) var(--space-8);
            display: flex; align-items: center; justify-content: space-between;
            backdrop-filter: blur(12px);
            flex-shrink: 0;
        }
        .dash-header-title {
            font-size: var(--text-2xl); font-weight: 700;
            letter-spacing: var(--tracking-tight);
            color: var(--color-text-primary);
        }
        .dash-header-right { display: flex; align-items: center; gap: var(--space-3); }
        .dash-search {
            max-width: 14rem; width: 100%;
            background: var(--color-bg-subtle, #f2f4f6); border: 1.5px solid var(--color-border, #e0e3e5);
            border-radius: var(--radius-md, 10px); padding: 0.45rem 0.75rem 0.45rem 2.25rem;
            font-family: var(--font-ui, 'Inter', sans-serif); font-size: 0.8rem;
            color: var(--color-text-primary, #191c1e); outline: none;
            transition: border-color 0.15s;
        }
        .dash-search:focus { border-color: var(--color-border-focus, #0058be); box-shadow: 0 0 0 3px rgba(0,88,190,0.1); }
        .dash-search::placeholder { color: var(--color-text-faint, #94a3b8); font-size: 0.8rem; }
        .dash-search-wrap { position: relative; }
        .dash-search-wrap iconify-icon {
            position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
            color: var(--color-text-faint); font-size: 1rem;
        }
        /* ── Search dropdown ── */
        .search-dropdown {
            display: none; position: absolute; top: 100%; left: 0; right: 0;
            background: var(--color-bg-card); border: 1px solid var(--color-border);
            border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
            max-height: 400px; overflow-y: auto; z-index: 100; margin-top: 4px;
        }
        .search-result-item {
            display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px;
            cursor: pointer; border-bottom: 1px solid var(--color-border);
            transition: background 0.1s;
        }
        .search-result-item:last-child { border-bottom: none; }
        .search-result-item:hover { background: var(--color-bg-subtle); }
        .search-result-icon { font-size: var(--text-sm); flex-shrink: 0; margin-top: 2px; }
        .search-result-title {
            font-size: var(--text-sm); color: var(--color-text-primary); font-weight: 500;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        }
        .search-result-meta {
            font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 2px;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        }
        .search-empty {
            padding: 16px; text-align: center; color: var(--color-text-muted);
            font-size: var(--text-sm);
        }
        .dash-icon-btn {
            width: 36px; height: 36px; border-radius: var(--radius-md);
            display: flex; align-items: center; justify-content: center;
            background: transparent; border: 1px solid transparent;
            color: var(--color-text-muted); cursor: pointer;
            transition: all var(--transition-fast);
        }
        .dash-icon-btn:hover {
            background: var(--color-bg-subtle);
            color: var(--color-text-primary);
            border-color: var(--color-border);
        }
        .dash-icon-btn iconify-icon { font-size: 1.15rem; }

        /* ── TASK 5: Dashboard Stats Row ── */
        .dash-stats-row {
            display: grid; grid-template-columns: repeat(5, 1fr);
            gap: var(--space-4);
        }
        .dash-stat-card {
            background: var(--color-bg-card);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-lg);
            padding: var(--space-5) var(--space-6);
            transition: box-shadow var(--transition-base);
        }
        .dash-stat-card:hover { box-shadow: var(--shadow-sm); }
        .dash-stat-card--goal { display: flex; flex-direction: column; align-items: center; justify-content: center; }
        .dash-stat-value {
            font-size: var(--text-3xl); font-weight: 700;
            font-family: var(--font-mono); color: var(--color-text-primary);
            line-height: 1.1; margin-bottom: var(--space-1);
        }
        .dash-stat-label {
            font-size: var(--text-xs); text-transform: uppercase;
            letter-spacing: var(--tracking-wider);
            color: var(--color-text-muted); font-weight: 600;
        }
        .dash-stat-detail {
            font-size: 0.7rem; color: var(--color-text-faint);
            margin-top: var(--space-2);
        }
        /* Daily Goal Progress Ring */
        .daily-goal-ring {
            position: relative;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            margin-bottom: var(--space-2);
        }
        .daily-goal-text {
            position: absolute;
            font-family: var(--font-mono);
            font-size: var(--text-sm);
            font-weight: 700;
            color: var(--color-text-primary);
        }
        #daily-goal-arc {
            transition: stroke-dashoffset 0.6s ease, stroke 0.3s ease;
        }

        /* ── TASK 3: Subject Cards — colored accent ── */
        .dash-subj-card {
            position: relative; overflow: hidden;
            border-radius: var(--radius-xl);
            transition: all var(--transition-base);
        }
        .dash-subj-card::before {
            content: ''; position: absolute;
            left: 0; top: 0; bottom: 0; width: 4px;
            border-radius: 4px 0 0 4px;
            background: var(--subj-accent, var(--color-primary));
        }
        .dash-subj-card:hover {
            box-shadow: var(--shadow-lg);
            transform: translateY(-3px);
        }
        .dash-subj-num {
            background: color-mix(in srgb, var(--subj-accent, var(--color-primary)) 15%, transparent);
            color: var(--subj-accent, var(--color-primary));
        }
        .dash-subj-progress-wrap {
            flex: 1; min-width: 3.75rem; max-width: 7.5rem;
            height: 4px; background: var(--color-bg-sunken);
            border-radius: var(--radius-full); overflow: hidden;
        }
        .dash-subj-progress-fill {
            height: 100%; border-radius: var(--radius-full);
            background: var(--subj-accent, var(--color-primary));
            transition: width 0.4s ease;
        }

        /* ── TASK 4: Chapter rows inside subject ── */
        .dash-ch-num {
            width: 32px; height: 32px; border-radius: var(--radius-md);
            background: var(--color-bg-subtle);
            font-size: var(--text-xs); font-weight: 700;
            color: var(--color-text-muted);
            display: flex; align-items: center; justify-content: center;
            flex-shrink: 0;
        }

        /* Legacy compat — keep old class working */
        .sidebar-active {
            color: var(--accent);
            font-weight: 600;
            background-color: var(--color-primary-light);
        }

        .content-fade-in {
            animation: fadeIn 0.5s ease-out forwards;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to   { opacity: 1; transform: translateY(0); }
        }

        .custom-scrollbar::-webkit-scrollbar { width: 4px; }
        .custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
        .custom-scrollbar::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 10px; }

        /* App shell — replaces Tailwind flex min-h-screen */
        .app-shell { display: flex; height: 100vh; overflow: hidden; }

        /* Page sections — only dashboard shown by default */
        .page-section { display: none; }
        .page-section.active { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; width: 100%; box-sizing: border-box; }

        /* Standardized page inner wrappers */
        .page-inner {
            padding: clamp(1.5rem, 3vw, 3rem);
            max-width: 72rem;
            margin: 0 auto;
            width: 100%;
            box-sizing: border-box;
        }
        .page-inner--narrow { max-width: 48rem; }
        .page-inner--wide { max-width: 96rem; }

        /* Section titles */
        .section-title {
            font-size: var(--text-2xl);
            font-weight: 700;
            color: var(--color-text-primary);
            margin: 0 0 var(--space-6);
        }

        /* Notes grid — 2-column on desktop */
        .notes-grid {
            display: grid;
            grid-template-columns: repeat(1, 1fr);
            gap: 1.5rem;
        }
        @media (min-width: 768px) {
            .notes-grid { grid-template-columns: repeat(2, 1fr); }
        }

        /* Modal overlay + dialog (extracted from inline styles) */
        .modal-overlay {
            display: none;
            position: fixed;
            inset: 0;
            z-index: 9999;
            background: rgba(0,0,0,0.5);
            align-items: center;
            justify-content: center;
            overflow-y: auto;
        }
        .modal-dialog {
            max-width: 620px;
            width: 92%;
            margin: 20px;
            background: var(--color-bg-card);
            border-radius: 16px;
            max-height: 90vh;
            overflow-y: auto;
            padding: 28px;
            box-shadow: var(--shadow-xl);
        }

        /* Debug toast container */
        .toast-container {
            position: fixed;
            bottom: 20px;
            right: 20px;
            z-index: 99999;
            display: flex;
            flex-direction: column;
            gap: 8px;
            max-width: 400px;
            pointer-events: none;
        }

        /* Sidebar link active state applied via JS */
        .nav-link { transition: background 0.15s, color 0.15s; }
        .nav-link:hover { background: var(--color-bg-subtle); color: var(--color-text-primary); }

        /* Practice Problems MCQ Cards */
        .prob-q-card { background:var(--color-bg-subtle); border:1px solid var(--color-border); border-radius:var(--radius-lg);
            padding:18px; margin-top:16px; }
        .prob-q-text { font-size:clamp(0.84rem, 1.2vw, 0.94rem); color:var(--color-text-primary); line-height:1.7; margin-bottom:14px; font-weight:500; }
        .prob-given {
            font-size: var(--text-sm); color: var(--color-text-secondary);
            background: var(--color-bg-sunken); border-left: 3px solid var(--color-warning);
            border-radius: var(--radius-md); padding: var(--space-4) var(--space-5);
            margin-bottom: var(--space-5); line-height: 1.8; font-family: var(--font-mono);
        }
        .prob-given-label {
            font-size: var(--text-xs); font-weight: 800; text-transform: uppercase;
            letter-spacing: 1.5px; color: var(--color-warning); margin-bottom: var(--space-2);
        }
        .prob-choices { display:grid; grid-template-columns:1fr 1fr; gap:7px; margin-bottom:12px; }
        .prob-choice { background:var(--color-bg-card); border:1px solid var(--color-border); border-radius:var(--radius-md); padding:9px 12px;
            font-size:0.82rem; color:var(--color-text-secondary); line-height:1.4; }
        .prob-choice.interactive { cursor:pointer; transition:all .15s; }
        .prob-choice.interactive:hover { background:var(--color-bg-sunken); border-color:var(--color-text-faint); }
        .prob-choice.selected-correct { background:var(--color-success-light); border-color:#86efac; color:#166534; font-weight:600; }
        .prob-choice.selected-wrong { background:var(--color-danger-light); border-color:var(--color-danger-muted); color:#991b1b; font-weight:600; }
        .prob-choice.revealed-correct { background:var(--color-success-light); border-color:#86efac; color:#166534; font-weight:600; }
        .prob-choice.disabled { pointer-events:none; opacity:0.7; }
        .prob-reveal-btn { font-size:var(--text-xs); font-weight:700; color:var(--color-primary); background:var(--color-primary-light);
            border:1px solid var(--color-primary-muted); border-radius:7px; padding:6px 14px; cursor:pointer; transition:all .15s; }
        .prob-reveal-btn:hover { background:#dbeafe; }
        .prob-sol-panel { display:none; margin-top:12px; background:var(--color-bg-card); border-left:3px solid var(--color-primary);
            border-radius:0 10px 10px 0; padding:14px 16px; }
        .prob-sol-panel.open { display:block; }
        .prob-sol-label { font-size:var(--text-2xs); font-weight:800; letter-spacing:2px; text-transform:uppercase;
            color:var(--color-primary); margin-bottom:8px; }
        .prob-sol-step { font-size:var(--text-sm); color:var(--color-text-secondary); line-height:1.8; font-family:var(--font-mono); }
        .prob-sol-answer { font-size:var(--text-sm); font-weight:700; color:var(--color-success); margin-top:8px; }
        .diff-tag-easy { background:var(--color-success-light); color:#166534; font-size:var(--text-2xs); font-weight:800;
            padding:2px 8px; border-radius:var(--radius-sm); text-transform:uppercase; letter-spacing:1px; }
        .diff-tag-med { background:var(--color-warning-light); color:#92400e; font-size:var(--text-2xs); font-weight:800;
            padding:2px 8px; border-radius:var(--radius-sm); text-transform:uppercase; letter-spacing:1px; }
        .diff-tag-hard { background:var(--color-danger-light); color:#991b1b; font-size:var(--text-2xs); font-weight:800;
            padding:2px 8px; border-radius:var(--radius-sm); text-transform:uppercase; letter-spacing:1px; }

        /* ── QUESTION BANK / QUIZ / EXAM pages ── */
        .qb-filter-bar { display:flex; flex-wrap:wrap; gap:10px; align-items:center;
            background:var(--color-bg-subtle); border:1px solid var(--color-border); border-radius:10px; padding:14px 18px; }
        .qb-filter-bar select, .qb-filter-bar input {
            background:var(--color-bg-card); border:1px solid var(--color-border); border-radius:6px; color:var(--color-text-primary);
            padding:7px 12px; font-size:0.83rem; outline:none; }
        .qb-filter-bar select:focus, .qb-filter-bar input:focus { border-color:var(--color-primary); }
        .qb-filter-bar input { flex:1; min-width:180px; }
        .qb-diff-group { display:flex; gap:4px; }
        .qb-diff-btn { font-size:var(--text-xs); padding:7px 12px; border-radius:6px; cursor:pointer;
            background:var(--color-bg-card); border:1px solid var(--color-border); color:var(--color-text-muted); transition:all .15s; }
        .qb-diff-btn:hover { border-color:var(--color-primary); color:var(--color-primary); }
        .qb-diff-btn.active { background:var(--color-primary); color:var(--color-text-inverse); border-color:var(--color-primary); font-weight:600; }
        .qb-diff-btn.easy.active { background:var(--color-success); border-color:var(--color-success); }
        .qb-diff-btn.medium.active { background:var(--color-warning); border-color:var(--color-warning); }
        .qb-diff-btn.hard.active { background:var(--color-danger); border-color:var(--color-danger); }
        .qb-diff-btn.exam-lv.active { background:#8b5cf6; border-color:#8b5cf6; }
        .qb-card { background:var(--color-bg-card); border:1px solid var(--color-bg-sunken); border-radius:var(--radius-lg);
            margin-bottom:12px; overflow:hidden; box-shadow:var(--shadow-xs); transition:border-color .2s; }
        .qb-card:hover { border-color:var(--color-primary-muted); }
        .qb-card-head { display:flex; align-items:center; gap:8px; padding:12px 16px 0; flex-wrap:wrap; }
        .diff-badge { font-size:var(--text-2xs); font-weight:700; padding:3px 8px; border-radius:var(--radius-sm); text-transform:uppercase; }
        .diff-badge.easy { background:var(--color-success-light); color:#065f46; }
        .diff-badge.medium { background:var(--color-warning-light); color:#92400e; }
        .diff-badge.hard { background:var(--color-danger-light); color:#991b1b; }
        .diff-badge.exam { background:#ede9fe; color:#5b21b6; }
        .src-badge { font-size:var(--text-2xs); color:var(--color-text-faint); background:var(--color-bg-subtle); padding:3px 8px; border-radius:var(--radius-sm); }
        .topic-tag { font-size:var(--text-xs); color:var(--color-primary); font-weight:500; margin-left:auto; }
        .qb-q-id { font-size:var(--text-2xs); color:var(--color-border-strong); font-family:var(--font-mono); }
        .qb-card-body { padding:12px 16px 16px; }
        .qb-question-text { font-family:var(--font-ui); font-size:clamp(0.9375rem, 1.3vw, 1.0625rem); font-weight:500; line-height:1.8; color:var(--color-text-primary); margin-bottom:14px; }
        .qb-img-wrap { margin-bottom:14px; border:1px solid var(--color-border); border-radius:var(--radius-md); overflow:hidden; max-width:33.75rem; }
        .qb-img-wrap img { width:100%; display:block; }
        .qb-img-wrap .img-caption { font-size:0.65rem; color:var(--color-text-faint); padding:6px 10px; background:var(--color-bg-subtle); }
        .qb-answers { display:grid; grid-template-columns:1fr 1fr; gap:7px; margin-bottom:12px; }
        .qb-ans-btn { background:var(--color-bg-subtle); border:1px solid var(--color-border); border-radius:var(--radius-md); padding:9px 12px;
            font-size:var(--text-sm); color:var(--color-text-secondary); cursor:pointer; text-align:left; transition:all .15s; line-height:1.4; }
        .qb-ans-btn:hover:not(:disabled) { background:var(--color-primary-light); border-color:var(--color-primary-muted); color:#1e40af; }
        .qb-ans-btn.correct { background:var(--color-success-light); border-color:var(--color-success-muted); color:#065f46; font-weight:600; }
        .qb-ans-btn.wrong { background:var(--color-danger-light); border-color:var(--color-danger-muted); color:#991b1b; }
        .qb-ans-btn:disabled { cursor:default; }
        .qb-action-row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
        .qb-show-sol { background:var(--color-bg-card); border:1px solid var(--color-border); color:var(--color-text-secondary); border-radius:6px;
            padding:6px 14px; font-size:var(--text-xs); cursor:pointer; transition:all .15s; }
        .qb-show-sol:hover { border-color:var(--color-primary); color:var(--color-primary); }
        .qb-reset-q { background:var(--color-bg-card); border:1px solid var(--color-border); color:var(--color-text-faint); border-radius:6px;
            padding:6px 10px; font-size:var(--text-xs); cursor:pointer; }
        .qb-known-badge { font-size:var(--text-xs); font-weight:600; margin-left:auto; }
        .qb-known-badge.correct-lbl { color:var(--color-success); }
        .qb-known-badge.wrong-lbl { color:var(--color-danger); }
        .qb-solution-panel { display:none; margin-top:12px; background:var(--color-bg-subtle); border-radius:10px;
            padding:0; border-left:3px solid var(--color-primary); overflow:hidden; }
        .qb-solution-panel.screen-visible { display:block; }
        .qb-sol-label { font-size:var(--text-2xs); font-weight:700; letter-spacing:2px; text-transform:uppercase;
            color:var(--color-primary); margin-bottom:7px; }
        .qb-sol-text { font-size:var(--text-sm); color:var(--color-text-secondary); line-height:1.7; }

        /* Enhanced Solution Breakdown */
        .sol-breakdown {
            font-size: var(--text-sm); color: var(--color-text-secondary);
            line-height: 2.0;
            margin: var(--space-4) var(--space-8) var(--space-6);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-lg); overflow: hidden;
        }

        /* Result banner (correct/incorrect) */
        .sol-result-banner {
            padding: var(--space-4) var(--space-5);
            font-weight: 600; font-size: var(--text-sm);
            display: flex; align-items: center; gap: var(--space-3);
        }
        .sol-result-banner.correct {
            background: var(--color-success-light);
            border-bottom: 1px solid var(--color-success-muted);
            color: var(--color-success);
        }
        .sol-result-banner.incorrect {
            background: var(--color-danger-light);
            border-bottom: 1px solid var(--color-danger-muted);
            color: var(--color-danger);
        }

        /* GIVEN VARIABLES section */
        .sol-section { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--color-border); }
        .sol-section:last-child { border-bottom: none; }
        .sol-section.sol-given-section {
            background: var(--color-bg-sunken);
            font-family: var(--font-mono); font-size: var(--text-sm);
        }

        /* KEY FORMULA section */
        .sol-section.sol-formula-section {
            border-left: 4px solid var(--color-primary);
            background: var(--color-primary-light);
            padding: 14px 18px;
            font-family: var(--font-mono);
        }

        /* STEP-BY-STEP section */
        .sol-section.sol-steps-section {
            padding: var(--space-5) var(--space-6);
            font-family: var(--font-mono);
        }

        /* KEY CONCEPT section */
        .sol-section.sol-concept-section {
            background: var(--color-warning-light);
            border-left: 4px solid var(--color-warning);
        }

        /* COMMON TRAP section */
        .sol-section.sol-trap-section {
            background: var(--color-danger-light);
            border-left: 4px solid var(--color-danger);
            line-height: 1.7;
        }

        /* REFERENCE section */
        .sol-section.sol-ref-section {
            background: var(--color-bg-subtle);
            font-size: var(--text-xs); color: var(--color-text-muted);
            font-style: italic; border-top: 1px solid var(--color-border);
        }

        /* Reference tables inside solutions — force dark text on colored row backgrounds */
        .sol-ref-table, .sol-ref-table th, .sol-ref-table td {
            color: #1e293b !important;
        }
        .sol-ref-table th {
            font-weight: 700;
        }

        .sol-section-hd { display: flex; align-items: center; gap: 6px; font-size: 0.65rem; font-weight: 700;
            letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 8px; }
        .sol-section-hd.step { color: var(--color-primary); }
        .sol-section-hd.concept { color: var(--color-warning); }
        .sol-section-hd.trap { color: var(--color-danger); }
        .sol-section-hd.ref { color: var(--color-text-muted); }
        .sol-step-list { padding: 0; margin: 0; }
        .sol-step-item {
            display: flex; align-items: flex-start;
            padding: 8px 4px;
            border-bottom: 0.5px solid var(--color-border);
            cursor: pointer;
            border-radius: 6px;
            transition: background 0.2s;
        }
        .sol-step-item:hover { background: var(--color-bg-hover, rgba(0,0,0,0.03)); }
        .sol-step-item:last-child { border-bottom: none; }
        /* SVG diagram highlight when solution step is hovered */
        g.dp.svg-hl { filter: drop-shadow(0 0 6px var(--color-primary, #2563eb)); }
        g.dp.svg-hl > * { opacity: 1 !important; }
        @keyframes svg-pulse { 0%,100% { filter: drop-shadow(0 0 4px var(--color-primary)); } 50% { filter: drop-shadow(0 0 10px var(--color-primary)); } }
        g.dp.svg-hl-pulse { animation: svg-pulse 1.2s ease-in-out 2; }
        .sol-step-num {
            display: inline-flex; align-items: center; justify-content: center;
            width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
            background: var(--color-primary); color: #fff;
            font-size: var(--text-2xs); font-weight: 700; margin-right: 0.5rem; margin-top: 2px;
        }
        .sol-step-text { flex: 1; min-width: 0; overflow-wrap: break-word; }
        /* Gold-standard solution step sub-elements */
        .sol-thinking {
            display: block;
            color: var(--color-text-secondary);
            font-style: italic;
            margin: 4px 0 8px;
            line-height: 1.6;
            font-size: var(--text-sm);
            padding-left: 4px;
            border-left: 2px solid var(--color-primary-light, #dbeafe);
        }
        .sol-formula-inline {
            display: inline-block;
            margin: 2px 0;
            font-family: var(--font-mono, 'IBM Plex Mono', monospace);
        }
        .sol-formula-text {
            font-size: 0.95em;
            white-space: pre-wrap;
        }
        .sol-result {
            color: var(--color-primary);
        }
        .sol-approach {
            display: block;
            color: var(--color-text-secondary);
            font-style: italic;
            padding: 8px 12px;
            margin-bottom: 8px;
            background: var(--color-bg-subtle);
            border-radius: 6px;
            border-left: 3px solid var(--color-primary);
            line-height: 1.6;
            font-size: var(--text-sm);
        }
        .sol-concept-text { color: var(--color-text-secondary); line-height: 1.7; font-size: var(--text-sm); }
        .sol-concept-text strong { color: var(--color-text-primary); }
        .sol-trap-text { color: #991b1b; line-height: 1.6; font-size: var(--text-sm); }
        .sol-trap-item { margin-bottom: 0.5rem; padding-left: 0.75rem; border-left: 2px solid var(--color-danger); }
        .sol-trap-item:last-child { margin-bottom: 0; }
        .sol-ref-pills { display: flex; flex-wrap: wrap; gap: 6px; }
        .sol-ref-pill { display: inline-flex; align-items: center; gap: 4px; background: #f0fdfa;
            border: 1px solid #99f6e4; color: #0f766e; border-radius: 6px; padding: 4px 10px;
            font-size: 0.72rem; font-weight: 600; }
        .sol-ref-pill .sol-ref-icon { font-size: 0.85rem; }

        /* SVG Diagram Container */
        .question-diagram {
            position: relative; margin: 0 0 var(--space-5) 0;
            border-radius: var(--radius-lg); overflow: visible;
            border: 1px solid var(--color-border);
            background: var(--color-bg-subtle);
            padding: var(--space-4);
        }
        .question-diagram svg { width: 100%; max-width: 30rem; max-height: 250px; object-fit: contain; display: block; margin: 0 auto; }
        .diagram-zoom-btn {
            position: absolute; top: var(--space-2); right: var(--space-2);
            z-index: 5;
        }
        .qb-ans-unknown { font-size:var(--text-xs); color:var(--color-text-faint); background:var(--color-bg-subtle); border:1px dashed var(--color-border);
            border-radius:var(--radius-md); padding:10px 14px; margin-bottom:12px; text-align:center; }
        .qb-load-more { display:block; width:100%; background:var(--color-bg-card); border:1px dashed var(--color-border-strong); color:var(--color-text-faint);
            border-radius:var(--radius-md); padding:13px; font-size:0.83rem; cursor:pointer; margin-top:6px; transition:all .15s; }
        .qb-load-more:hover { border-color:var(--color-primary); color:var(--color-primary); }

        /* Quiz — page container */
        #page-quiz > div {
            width: 100%;
            max-width: 56rem;
            margin: 0 auto;
            padding: 1.5rem 2rem;
            box-sizing: border-box;
        }

        /* Quiz — mode card grid */
        #qz-mode-select .grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 1rem;
        }

        /* Quiz — filter row */
        .qb-filter-bar {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.625rem;
            align-items: center;
        }
        .qb-filter-bar select,
        .qb-filter-bar input {
            width: 100%;
            padding: 0.625rem 1rem;
            font-size: 0.875rem;
            color: var(--color-text-primary);
            background: var(--color-bg-card);
            border: 1.5px solid var(--color-border);
            border-radius: var(--radius-md);
            box-sizing: border-box;
        }

        /* Quiz */
        .qz-mode-card { background:var(--color-bg-card); border:1px solid var(--color-bg-sunken); border-radius:14px; padding:22px;
            cursor:pointer; transition:all .2s; box-shadow:var(--shadow-xs); }
        .qz-mode-card:hover { border-color:var(--color-primary-muted); box-shadow:var(--shadow-md); transform:translateY(-2px); }
        .qz-mode-icon { font-size:1.8rem; margin-bottom:10px; }
        .qz-mode-title { font-weight:700; font-size:clamp(0.9rem, 1.4vw, 1.1rem); color:var(--color-text-primary); margin-bottom:5px; }
        .qz-mode-desc { font-size:clamp(0.72rem, 1vw, 0.84rem); color:var(--color-text-muted); line-height:1.55; }
        .qz-active { display:none; }
        .qz-active.screen-visible { display:block; }
        .qz-progress-bar-wrap { background:var(--color-bg-sunken); border-radius:4px; height:8px; margin-bottom:18px; overflow:hidden; }
        .qz-progress-bar { height:100%; background:var(--color-primary); border-radius:4px; transition:width .4s; }
        .qz-question-card { background:var(--color-bg-card); border:1px solid var(--color-bg-sunken); border-radius:14px;
            padding:24px; margin-bottom:16px; box-shadow:var(--shadow-xs); }
        .qz-q-text { font-family:var(--font-ui); font-size:clamp(0.9375rem, 1.3vw, 1.0625rem); font-weight:500; line-height:1.8; color:var(--color-text-primary); margin-bottom:18px; }
        .qz-answers { display:flex; flex-direction:column; gap:12px; padding:0 2px; margin-bottom:16px; }
        .qz-ans-btn { background:var(--color-bg-card); border:0.5px solid var(--color-border); border-radius:8px; padding:14px 18px;
            font-size:var(--text-sm); color:var(--color-text-secondary); cursor:pointer; text-align:left; transition:all .15s; line-height:1.65;
            display:flex; align-items:flex-start; gap:12px; width:100%; font-family:var(--font-ui); }
        .qz-ans-btn:hover:not(:disabled) { background:var(--color-bg-subtle); border-color:var(--color-border-strong, var(--color-border)); }
        .qz-ans-btn.correct { background:var(--color-success-light); border:2px solid var(--color-success); color:#065f46; }
        .qz-ans-btn.correct .qz-ans-letter { background:var(--color-success-muted); color:#065f46; border-color:var(--color-success-muted); }
        .qz-ans-btn.wrong { background:var(--color-danger-light); border:2px solid var(--color-danger); color:#991b1b; }
        .qz-ans-btn.wrong .qz-ans-letter { background:var(--color-danger-muted); color:#991b1b; border-color:var(--color-danger-muted); }
        .qz-ans-btn:disabled { cursor:default; }
        .qz-ans-letter {
            width:28px; height:28px; border-radius:50%; flex-shrink:0;
            display:flex; align-items:center; justify-content:center;
            background:var(--color-bg-subtle); border:1px solid var(--color-border);
            font-size:var(--text-xs); font-weight:500; color:var(--color-text-secondary); transition:all .15s;
        }
        .qz-ans-text { min-width:0; flex:1; overflow-wrap:break-word; word-wrap:break-word; font-size:var(--text-sm); line-height:1.65; }
        .qz-sol-box { display:none; background:var(--color-bg-subtle); border-left:3px solid var(--color-primary); border-radius:10px;
            padding:12px 16px; margin-top:16px; margin-bottom:16px; font-size:var(--text-sm); color:var(--color-text-secondary); line-height:1.7;
            word-wrap:break-word; overflow-wrap:break-word; }
        .qz-sol-box.screen-visible { display:block; }
        .qz-feedback-banner { padding:10px 16px; border-radius:8px; font-weight:600; font-size:clamp(0.82rem, 1.2vw, 0.95rem); margin-bottom:8px; }
        .qz-feedback-correct { background:var(--color-success-light); color:var(--color-success); border-left:3px solid var(--color-success); }
        .qz-feedback-incorrect { background:var(--color-danger-light); color:var(--color-danger); border-left:3px solid var(--color-danger); }
        .qz-sol-panel { display:none; margin-top:8px; padding:12px 16px; width:100%; max-width:100%;
            box-sizing:border-box; word-wrap:break-word; overflow-wrap:break-word; }
        .qz-sol-panel.screen-visible { display:block; }
        .qz-sol-panel .sol-breakdown { max-width:100%; overflow-wrap:break-word; }
        .qz-sol-box .sol-breakdown { margin-left: 0; margin-right: 0; }
        .qz-next-btn, .qz-finish-btn { background:var(--color-primary); color:var(--color-text-inverse); border:none; border-radius:var(--radius-md);
            padding:10px 24px; font-size:0.85rem; font-weight:700; cursor:pointer; transition:background .15s; }
        .qz-next-btn:hover, .qz-finish-btn:hover { background:var(--color-primary-hover); }
        .qz-next-btn:disabled { background:var(--color-primary-muted); cursor:not-allowed; }
        .qz-back-btn { background:var(--color-bg-card); border:1px solid var(--color-border); color:var(--color-text-muted); border-radius:var(--radius-md);
            padding:10px 16px; font-size:0.83rem; cursor:pointer; }
        .qz-results { display:none; }
        .qz-results.screen-visible { display:block; }
        .qz-score-ring { width:120px; height:120px; border-radius:50%; margin:0 auto 14px; display:flex;
            align-items:center; justify-content:center; flex-direction:column; border:4px solid; }
        .qz-score-ring.pass { border-color:var(--color-success); background:var(--color-success-light); }
        .qz-score-ring.fail { border-color:var(--color-danger); background:var(--color-danger-light); }
        .qz-score-pct { font-size:clamp(1.5rem, 3vw, 2rem); font-weight:800; line-height:1; color:var(--color-text-primary); }
        .qz-score-lbl { font-size:0.6rem; letter-spacing:2px; text-transform:uppercase; color:var(--color-text-muted); }
        .qz-topic-table { width:100%; border-collapse:collapse; margin-bottom:20px; }
        .qz-topic-table th { font-size:0.65rem; letter-spacing:2px; text-transform:uppercase;
            color:var(--color-text-faint); text-align:left; padding:8px 12px; border-bottom:1px solid var(--color-bg-sunken); }
        .qz-topic-table td { padding:9px 12px; font-size:0.83rem; border-bottom:1px solid var(--color-bg-subtle); color:var(--color-text-secondary); }
        .qz-topic-table .t-bar { height:6px; background:var(--color-bg-sunken); border-radius:3px; overflow:hidden; min-width:80px; }
        .qz-topic-table .t-fill { height:100%; border-radius:3px; }
        .qz-retry-btn { background:var(--color-primary); color:var(--color-text-inverse); border:none; border-radius:var(--radius-md);
            padding:10px 24px; font-size:0.85rem; font-weight:700; cursor:pointer; margin-right:8px; }
        .qz-review-btn { background:var(--color-bg-card); border:1px solid var(--color-primary-muted); color:var(--color-primary);
            border-radius:var(--radius-md); padding:10px 20px; font-size:0.83rem; cursor:pointer; }

        /* ══════════════════════════════════════════════════════════════
           EXAM SIMULATOR — Immersive Dark Mode Layout
        ══════════════════════════════════════════════════════════════ */
        .exam-page-wrap { padding:0; }
        /* Mutual exclusion: all three hidden by default, .screen-visible reveals */
        #ex-pre { display: none; }
        #ex-pre.screen-visible {
            display: flex !important;
            position: relative;
            width: 100%;
            height: 100%;
            min-height: calc(100vh - 200px);
        }

        #ex-active { display: none; }
        #ex-results { display: none; }

        /* TASK 1: Full-screen exam takeover — theme-aware */
        #ex-active.screen-visible {
            position: fixed !important;
            top: 0 !important;
            left: 0 !important;
            right: 0 !important;
            bottom: 0 !important;
            width: 100%;
            height: 100vh;
            height: 100dvh;
            z-index: 9999 !important;
            display: flex !important;
            flex-direction: column;
            background: var(--color-bg-page);
            color: var(--color-text-primary);
            font-family: var(--font-ui);
            overflow: hidden;
            overflow-x: hidden;
        }
        /* Hide sidebar + header, expand main during exam */
        body.exam-active .sidebar,
        body.exam-active #sidebar {
            display: none !important;
        }
        body.exam-active .dash-header {
            display: none !important;
        }
        body.exam-active .main-content,
        body.exam-active #main-content {
            margin-left: 0 !important;
            width: 100% !important;
        }
        /* Full CBT lock-down mode — hide everything except exam UI */
        body.exam-lockdown .main-nav,
        body.exam-lockdown .bottom-nav,
        body.exam-lockdown .fab-btn,
        body.exam-lockdown .formula-fab,
        body.exam-lockdown .formula-slide-panel,
        body.exam-lockdown .skip-link,
        body.exam-lockdown .search-dropdown,
        body.exam-lockdown .offline-banner {
            display: none !important;
        }
        body.exam-lockdown {
            overflow: hidden;
        }
        /* CBT Calculator — floating draggable */
        .ex-calculator-wrap {
            position: fixed; bottom: 80px; right: 20px; z-index: 9999;
            width: 280px; background: var(--color-card-bg); border: 1px solid var(--color-border);
            border-radius: var(--radius-lg); box-shadow: 0 8px 32px rgba(0,0,0,0.25);
            display: none; flex-direction: column;
        }
        .ex-calculator-wrap.visible { display: flex; }
        .ex-calc-header {
            display: flex; justify-content: space-between; align-items: center;
            padding: 8px 12px; background: var(--color-primary); color: #fff;
            border-radius: var(--radius-lg) var(--radius-lg) 0 0;
            cursor: move; font-weight: 700; font-size: var(--text-sm);
        }
        .ex-calc-display {
            background: #1e293b; color: #e2e8f0; font-family: var(--font-mono);
            font-size: 1.4rem; text-align: right; padding: 12px 14px;
            min-height: 48px; word-break: break-all; border-bottom: 1px solid var(--color-border);
        }
        .ex-calc-grid {
            display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
            padding: 6px;
        }
        .ex-calc-btn {
            padding: 10px 4px; border: none; border-radius: var(--radius-sm);
            font-size: var(--text-sm); font-weight: 600; cursor: pointer;
            background: var(--color-bg-subtle); color: var(--color-text-primary);
            transition: background 0.15s;
        }
        .ex-calc-btn:hover { background: var(--color-primary-light); }
        .ex-calc-btn.op { background: #dbeafe; color: #1e40af; }
        .ex-calc-btn.eq { background: var(--color-primary); color: #fff; }
        .ex-calc-btn.fn { background: #f0fdf4; color: #166534; font-size: 0.7rem; }
        .ex-calc-btn.wide { grid-column: span 2; }
        /* CBT Reference Panel — slide-in from right */
        .ex-ref-panel {
            position: fixed; top: 0; right: -450px; width: 450px; height: 100vh;
            background: var(--color-card-bg); border-left: 2px solid var(--color-border);
            box-shadow: -4px 0 24px rgba(0,0,0,0.15); z-index: 9998;
            transition: right 0.3s ease; display: flex; flex-direction: column;
            overflow: hidden;
        }
        .ex-ref-panel.visible { right: 0; }
        .ex-ref-header {
            display: flex; justify-content: space-between; align-items: center;
            padding: 12px 16px; background: #1e3a5f; color: #fff;
            font-weight: 700; flex-shrink: 0;
        }
        .ex-ref-search {
            padding: 8px 16px; border-bottom: 1px solid var(--color-border);
            flex-shrink: 0;
        }
        .ex-ref-search input {
            width: 100%; padding: 8px 12px; border: 1px solid var(--color-border);
            border-radius: var(--radius-sm); font-size: var(--text-sm);
        }
        .ex-ref-body {
            flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px;
            font-size: var(--text-sm); line-height: 1.7;
        }
        .ex-ref-body .MathJax { font-size: 0.9em !important; }
        .ex-ref-math { overflow-x: auto; max-width: 100%; }
        .ex-ref-section { margin-bottom: 20px; }
        .ex-ref-section h3 {
            font-size: var(--text-base); color: var(--color-primary);
            border-bottom: 1px solid var(--color-border); padding-bottom: 4px;
            margin-bottom: 8px;
        }
        .ex-ref-formula {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 6px 0;
            border-bottom: 1px dotted var(--color-border);
            font-size: var(--text-sm);
        }
        .ex-ref-label {
            min-width: 80px;
            font-weight: 600;
            color: var(--color-text-secondary);
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.03em;
        }
        .ex-ref-math {
            flex: 1;
            color: var(--color-text-primary);
        }

        /* ═══════════════════════════════════════════════════════════════
           PROBLEM 1: Header bar — 3-section layout, nothing cut off
           ═══════════════════════════════════════════════════════════════ */
        .ex-header-bar {
            height: 3rem;
            flex-shrink: 0;
            background: var(--color-nav-bg);
            border-bottom: 1px solid var(--color-border);
            display: flex;
            align-items: center;
            padding: 0 1.5rem;
            gap: 0.75rem;
            width: 100%;
            box-sizing: border-box;
            overflow: visible;
        }
        .ex-header-left {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            flex-shrink: 0;
            min-width: 0;
        }
        .ex-header-wordmark {
            font-size: var(--text-sm); font-weight: 700;
            color: var(--color-nav-text-hover); letter-spacing: var(--tracking-wide);
            white-space: nowrap;
        }
        .ex-header-center {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.2rem;
            min-width: 0;
        }
        .ex-header-right {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            flex-shrink: 0;
        }

        .ex-timer, #ex-timer {
            font-family: var(--font-mono);
            font-size: clamp(1rem, 1.8vw, 1.375rem);
            font-weight: 700;
            color: var(--color-primary); background: var(--color-primary-light);
            font-variant-numeric: tabular-nums; letter-spacing: 0.06em;
            border-radius: var(--radius-md); padding: var(--space-1) var(--space-4);
            white-space: nowrap; border: none;
        }
        .ex-timer.warning { color: var(--color-danger); background: var(--color-danger-light); animation: pulse-warn 1s infinite; }
        @keyframes pulse-warn { 0%,100%{opacity:1} 50%{opacity:.7} }

        .ex-progress-wrap {
            display: flex; align-items: center; gap: var(--space-3);
        }
        .ex-progress-label, #ex-progress-label {
            font-size: clamp(0.625rem, 0.9vw, 0.75rem);
            color: var(--color-text-muted); font-weight: 500; white-space: nowrap;
        }

        .ex-flagged-btn {
            background: transparent; border: 1px solid var(--color-warning); color: var(--color-warning); border-radius: var(--radius-md);
            padding: var(--space-2) var(--space-3); font-size: var(--text-sm); cursor: pointer; transition: all .15s;
            white-space: nowrap;
        }
        .ex-flagged-btn:hover { background: var(--color-warning-light); }
        #ex-flagged-count-badge {
            display: inline-flex; align-items: center; justify-content: center;
            min-width: 16px; height: 16px; background: var(--color-warning); color: var(--color-bg-page);
            border-radius: 8px; font-size: 0.6rem; font-weight: 700; margin-left: 3px; padding: 0 4px;
        }
        .ex-flagged-dropdown-wrap { position: relative; }
        .ex-flagged-dropdown {
            display: none; position: absolute; top: calc(100% + 0.5rem); right: 0;
            min-width: 280px; background: var(--color-bg-card);
            border: 1px solid var(--color-border); border-radius: var(--radius-lg);
            box-shadow: var(--shadow-lg); z-index: 10000;
            overflow: hidden; max-height: 320px; overflow-y: auto;
        }
        .ex-flagged-dropdown.open { display: block; }
        .ex-flagged-item {
            display: flex; align-items: center; gap: 0.75rem;
            width: 100%; text-align: left; background: none; border: none;
            padding: 0.75rem 1rem; font-size: 0.875rem;
            color: var(--color-text-primary); cursor: pointer;
            border-bottom: 1px solid var(--color-border);
            transition: background var(--transition-fast);
        }
        .ex-flagged-item:last-child { border-bottom: none; }
        .ex-flagged-item:hover { background: var(--color-bg-subtle); }
        .flag-item-num {
            font-size: 0.75rem; font-weight: 700; font-family: var(--font-mono);
            color: var(--color-warning); background: var(--color-warning-light, rgba(217,119,6,0.1));
            padding: 0.2rem 0.5rem; border-radius: var(--radius-sm); flex-shrink: 0;
        }
        .flag-item-topic {
            font-size: 0.875rem; color: var(--color-text-primary);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .flag-dropdown-empty {
            padding: 1rem; text-align: center;
            font-size: 0.875rem; color: var(--color-text-muted);
        }

        .ex-tool-btn {
            background: var(--color-bg-subtle); color: var(--color-text-primary); border: 1px solid var(--color-border);
            border-radius: var(--radius-md); padding: var(--space-1) var(--space-3);
            font-size: var(--text-xs); font-weight: 600; cursor: pointer;
            transition: all .15s; white-space: nowrap;
        }
        .ex-tool-btn:hover { background: var(--color-primary-light); border-color: var(--color-primary); }
        .ex-submit-btn {
            background: var(--color-danger); color: var(--color-bg-page); border: none; border-radius: var(--radius-md);
            padding: var(--space-2) var(--space-4); font-size: var(--text-sm); font-weight: 600;
            cursor: pointer; transition: all .15s; white-space: nowrap;
        }
        .ex-submit-btn:hover { opacity: 0.85; }

        /* ═══════════════════════════════════════════════════════════════
           PROBLEM 2: Question area — panels no overflow
           ═══════════════════════════════════════════════════════════════ */
        .ex-question-area {
            flex: 1 1 0%;
            display: flex;
            align-items: stretch;
            padding: 0.875rem 1.5rem;
            gap: 1rem;
            width: 100%;
            min-height: 0;
            overflow: hidden;
            box-sizing: border-box;
        }

        /* Single layout (no diagram) — full width centered */
        .ex-question-area.single-layout {
            justify-content: center;
            align-items: flex-start;
            padding: 1.5rem 2rem;
        }
        .ex-question-area.single-layout .ex-right-panel {
            max-width: 860px;
            width: 100%;
            flex: none;
            margin: 0 auto;
        }

        /* Split layout — left panel (diagram) */
        .ex-left-panel {
            flex: 0 0 calc(45% - 0.5rem);
            max-width: calc(45% - 0.5rem);
            min-width: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 1rem;
            background: var(--color-bg-card);
            border: 1px solid var(--color-border);
            border-radius: 0.75rem;
            overflow: hidden;
            box-sizing: border-box;
            position: relative;
        }

        /* Split layout — right panel (question + choices) */
        .ex-right-panel {
            flex: 0 0 calc(55% - 0.5rem);
            max-width: calc(55% - 0.5rem);
            min-width: 0;
            display: flex;
            flex-direction: column;
            overflow-y: auto;
            padding: 1.125rem 1.25rem;
            background: var(--color-bg-card);
            border: 1px solid var(--color-border);
            border-radius: 0.75rem;
            box-sizing: border-box;
        }

        /* ═══════════════════════════════════════════════════════════════
           PROBLEM 4: SVG diagram fills left panel
           ═══════════════════════════════════════════════════════════════ */
        .ex-left-panel .question-diagram,
        #ex-left-panel .question-diagram {
            width: 100%;
            height: 100%;
            min-height: 200px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: transparent;
            border: none;
            padding: 0;
        }
        .ex-left-panel .question-diagram svg,
        #ex-left-panel svg {
            width: 100% !important;
            height: auto !important;
            max-width: 100% !important;
            max-height: calc(100vh - 10rem);
            display: block;
        }
        /* SVG inherits theme text color */
        .ex-left-panel svg text { fill: var(--color-text-primary); }
        .ex-left-panel svg line, .ex-left-panel svg path[stroke] { stroke: var(--color-text-secondary); }
        .ex-left-panel .diagram-zoom-btn {
            position: absolute; bottom: var(--space-3); right: var(--space-3);
        }

        /* OLD diagram wrap — kept for backwards compat */
        .ex-diagram-wrap {
            width: 100%; max-height: 320px; overflow: auto;
            display: flex; align-items: center; justify-content: center;
            background: var(--color-bg-subtle); border: 1px solid var(--color-border);
            border-radius: var(--radius-md); padding: 1rem; margin-bottom: 1rem;
        }
        .ex-diagram-wrap svg { width: 100%; height: auto; max-height: 300px; }

        /* ═══════════════════════════════════════════════════════════════
           Meta row (chapter / difficulty / NCEES tags)
           ═══════════════════════════════════════════════════════════════ */
        .ex-q-meta {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin-bottom: 1rem;
            flex-shrink: 0;
            flex-wrap: wrap;
        }
        #ex-chapter-tag, .ex-chapter-tag {
            font-size: clamp(0.625rem, 0.9vw, 0.75rem);
            font-weight: 700;
            padding: 0.25rem clamp(0.5rem, 0.8vw, 0.75rem);
            border-radius: 0.25rem;
            letter-spacing: 0.04em;
        }
        #ex-diff-badge {
            font-size: clamp(0.625rem, 0.9vw, 0.75rem);
            font-weight: 700;
            padding: 0.25rem clamp(0.5rem, 0.8vw, 0.75rem);
            border-radius: 0.25rem;
            text-transform: uppercase;
            letter-spacing: 0.06em;
        }
        #ex-ncees-tag, .ex-ncees-tag {
            font-size: clamp(0.625rem, 0.9vw, 0.75rem);
            color: var(--color-text-muted);
            flex: 1;
        }

        /* CBT-style question header */
        .ex-q-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 1rem;
            padding-bottom: 0.75rem;
            border-bottom: 1px solid var(--color-border);
        }
        .ex-q-number {
            font-size: clamp(0.875rem, 1.2vw, 1rem);
            font-weight: 600;
            color: var(--color-text-primary);
            letter-spacing: 0.01em;
        }
        .ex-mark-review {
            display: flex;
            align-items: center;
            gap: 0.375rem;
            cursor: pointer;
            font-size: 0.8125rem;
            color: var(--color-text-secondary);
            user-select: none;
        }
        .ex-mark-review input[type="checkbox"] {
            width: 16px;
            height: 16px;
            accent-color: var(--color-warning, #d97706);
            cursor: pointer;
        }
        .ex-mark-review:has(input:checked) span {
            color: var(--color-warning, #d97706);
            font-weight: 600;
        }

        /* ═══════════════════════════════════════════════════════════════
           PROBLEM 5: Question text — scales with viewport
           ═══════════════════════════════════════════════════════════════ */
        #ex-q-text, .ex-q-text {
            font-family: var(--font-ui);
            font-size: clamp(0.9375rem, 1.3vw, 1.0625rem);
            font-weight: 500;
            line-height: 1.8;
            color: var(--color-text-primary);
            margin-bottom: 1.25rem;
            font-family: var(--font-ui);
            flex-shrink: 0;
        }

        /* Given block */
        .ex-given-block {
            background: var(--color-warning-light, rgba(217,119,6,0.1));
            border-left: 2px solid var(--color-warning);
            border-radius: 0 0.375rem 0.375rem 0;
            padding: 0.625rem 0.875rem;
            margin-bottom: 1rem;
            flex-shrink: 0;
        }
        .ex-given-block p,
        .ex-given-block span {
            font-size: 0.8125rem;
            font-family: var(--font-mono);
            color: var(--color-text-secondary);
            line-height: 1.7;
            margin: 0;
        }

        /* ═══════════════════════════════════════════════════════════════
           Answer buttons — scale with viewport
           ═══════════════════════════════════════════════════════════════ */
        .ex-answers-list {
            display: flex; flex-direction: column; gap: 12px; padding: 0 2px;
        }
        .ex-answers-list.single-col { /* no change needed */ }

        .ex-ans-btn {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            width: 100%;
            padding: 12px 16px;
            background: var(--color-bg-card);
            border: 1.5px solid var(--color-border);
            border-radius: 6px;
            cursor: pointer;
            text-align: left;
            font-size: 14px;
            line-height: 1.65;
            color: var(--color-text-primary);
            font-family: var(--font-ui);
            transition: border-color 0.15s, background 0.15s;
        }
        .ex-ans-btn:hover {
            background: var(--color-bg-subtle);
            border-color: #94a3b8;
        }
        .ex-ans-letter {
            width: 28px; height: 28px;
            border-radius: 50%;
            border: 1px solid var(--color-border);
            display: flex; align-items: center; justify-content: center;
            background: var(--color-bg-subtle);
            font-size: var(--text-xs); font-weight: 500;
            color: var(--color-text-secondary);
            flex-shrink: 0;
            font-family: var(--font-ui);
            transition: all 0.15s;
        }
        .ex-ans-text {
            min-width: 0; flex: 1;
            overflow-wrap: break-word; word-wrap: break-word;
            font-size: var(--text-sm); line-height: 1.65;
        }
        .ex-ans-btn:hover .ex-ans-letter { border-color: var(--color-border-strong, var(--color-border)); color: var(--color-text-primary); }
        .ex-ans-btn.selected {
            background: #eff6ff; border: 2px solid #2563eb;
        }
        .ex-ans-btn.selected .ex-ans-letter {
            background: #2563eb; border-color: #2563eb; color: #fff;
        }

        /* Reference line at bottom */
        #ex-q-reference, .ex-q-reference {
            margin-top: auto;
            padding-top: 0.75rem;
            border-top: 1px solid var(--color-border);
            font-size: clamp(0.625rem, 0.8vw, 0.6875rem);
            color: var(--color-text-faint, var(--color-text-muted));
            font-style: italic;
            flex-shrink: 0;
        }

        /* ═══════════════════════════════════════════════════════════════
           PROBLEM 3: Bottom bar — pill scroll, Next always visible
           ═══════════════════════════════════════════════════════════════ */
        .ex-bottom-bar {
            height: 3rem;
            flex-shrink: 0;
            background: var(--color-bg-card);
            border-top: 1px solid var(--color-border);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0 1.5rem;
            gap: 0.75rem;
            width: 100%;
            box-sizing: border-box;
        }
        .ex-nav-arrow {
            flex-shrink: 0; white-space: nowrap; padding: 0.3rem clamp(0.625rem, 1vw, 1rem);
            background: var(--color-bg-subtle); border: 1px solid var(--color-border);
            border-radius: var(--radius-md); color: var(--color-text-secondary);
            font-size: clamp(0.75rem, 1vw, 0.875rem); cursor: pointer; transition: all .15s;
        }
        .ex-nav-arrow:hover { border-color: var(--color-primary); color: var(--color-primary); }
        .ex-nav-next {
            background: var(--color-primary); color: var(--color-text-inverse); border: none;
            padding: 0.3rem clamp(0.625rem, 1vw, 1rem); font-weight: 600;
        }
        .ex-nav-next:hover { opacity: 0.85; }

        .ex-pill-scroll {
            display: flex;
            gap: 0.25rem;
            overflow-x: auto;
            max-width: min(24rem, 50vw);
            flex-shrink: 0;
            align-items: center;
            scroll-behavior: smooth;
            -ms-overflow-style: none;
            scrollbar-width: none;
        }
        .ex-pill-scroll::-webkit-scrollbar { display: none; }

        .ex-pill {
            width: clamp(1.625rem, 2vw, 1.875rem);
            height: clamp(1.625rem, 2vw, 1.875rem);
            border-radius: 50%;
            font-size: clamp(0.5625rem, 0.7vw, 0.6875rem);
            font-weight: 700;
            flex-shrink: 0;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.12s;
            border: 1px solid var(--color-border-strong);
            color: var(--color-text-muted);
            background: var(--color-bg-card);
            font-family: var(--font-mono);
        }
        .ex-pill:hover { border-color: var(--color-primary); }
        .ex-pill.answered { background: var(--color-success); color: var(--color-text-inverse); border: none; }
        .ex-pill.flagged { background: var(--color-warning); color: var(--color-text-inverse); border: none; }
        .ex-pill.current { border: 2px solid var(--color-primary); color: var(--color-primary); background: var(--color-primary-light); }
        .ex-pill.answered.current { border: 2px solid var(--color-primary); }

        .ex-flag-pill-btn {
            flex-shrink: 0; margin-left: 0.5rem; white-space: nowrap;
            background: transparent; border: 1px solid var(--color-warning); color: var(--color-warning);
            border-radius: var(--radius-md); padding: 0.3rem clamp(0.625rem, 1vw, 1rem);
            font-size: clamp(0.75rem, 1vw, 0.875rem); cursor: pointer; transition: all .15s;
        }
        .ex-flag-pill-btn:hover, .ex-flag-pill-btn.flagged { background: var(--color-warning-light); border-color: var(--color-warning); color: var(--color-warning); }

        /* ── Question Navigation Grid ── */
        .ex-nav-grid {
            display: none;
            grid-template-columns: repeat(10, 1fr);
            gap: 4px;
            padding: 0 1.5rem;
            background: var(--color-bg-subtle);
            border-top: 1px solid var(--color-border);
            flex-shrink: 0;
            overflow-y: auto;
            max-height: 0;
            opacity: 0;
            transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
        }
        .ex-nav-grid.grid-visible {
            display: grid;
            max-height: 220px;
            opacity: 1;
            padding: 12px 1.5rem;
        }
        .ex-grid-btn {
            width: 100%;
            aspect-ratio: 1;
            border: 2px solid var(--color-border);
            border-radius: 4px;
            background: var(--color-bg-card);
            font-size: var(--text-xs);
            font-weight: 600;
            font-family: var(--font-mono);
            cursor: pointer;
            transition: all 0.15s;
            color: var(--color-text-muted);
            padding: 0;
            line-height: 1;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .ex-grid-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
        .ex-grid-btn.visited { border-color: var(--color-primary); color: var(--color-primary); }
        .ex-grid-btn.answered { border-color: var(--color-success); background: var(--color-success-light); color: var(--color-success); }
        .ex-grid-btn.flagged { border-color: var(--color-warning); background: var(--color-warning-light); color: var(--color-warning); }
        .ex-grid-btn.answered.flagged { border-color: var(--color-warning); background: var(--color-warning-light); color: var(--color-warning); }
        .ex-grid-btn.current { border-color: var(--color-primary); background: var(--color-primary-light); color: var(--color-primary); font-weight: 700; box-shadow: 0 0 0 2px var(--color-primary); }

        .ex-grid-toggle {
            flex-shrink: 0;
            font-size: clamp(0.75rem, 1vw, 0.875rem);
            padding: 0.3rem clamp(0.625rem, 1vw, 1rem);
            border-radius: var(--radius-md);
            background: var(--color-bg-subtle);
            border: 1px solid var(--color-border);
            color: var(--color-text-muted);
            cursor: pointer;
            transition: all 0.15s;
            white-space: nowrap;
        }
        .ex-grid-toggle:hover { border-color: var(--color-primary); color: var(--color-primary); }
        .ex-grid-toggle.active { background: var(--color-primary-light); border-color: var(--color-primary); color: var(--color-primary); }

        /* ── Timer Warning Levels ── */
        .ex-timer.warning-persistent {
            color: var(--color-warning);
            background: var(--color-warning-light);
            animation: pulse-warn 1.5s infinite;
        }
        .ex-timer.urgent {
            color: #fff;
            background: var(--color-danger);
            animation: pulse-urgent 0.6s infinite;
        }
        @keyframes pulse-urgent { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.8;transform:scale(1.05)} }

        /* ── Timer Warning Notification ── */
        .ex-timer-warning {
            position: absolute;
            top: 3.5rem;
            left: 50%;
            transform: translateX(-50%) translateY(-10px);
            padding: 8px 20px;
            border-radius: var(--radius-md);
            font-size: var(--text-sm);
            font-weight: 600;
            z-index: 100;
            opacity: 0;
            transition: opacity 0.3s ease, transform 0.3s ease;
            pointer-events: none;
            white-space: nowrap;
            box-shadow: var(--shadow-lg);
        }
        .ex-timer-warning.visible {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }
        .ex-timer-warning-info {
            background: var(--color-primary-light);
            color: var(--color-primary);
            border: 1px solid var(--color-primary);
        }
        .ex-timer-warning-warn {
            background: var(--color-warning-light);
            color: var(--color-warning);
            border: 1px solid var(--color-warning);
        }
        .ex-timer-warning-urgent {
            background: var(--color-danger-light);
            color: var(--color-danger);
            border: 1px solid var(--color-danger);
            animation: pulse-urgent 0.6s infinite;
        }

        /* ── Grid responsive: 8 columns on narrow screens ── */
        @media (max-width: 600px) {
            .ex-nav-grid { grid-template-columns: repeat(8, 1fr); }
            .ex-grid-btn { font-size: 0.6rem; }
        }

        /* TASK 5: Submit modal — glass effect */
        .ex-modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            width: 100%;
            height: 100vh;
            z-index: 10001;
            background: rgba(0,0,0,0.7);
            backdrop-filter: blur(8px);
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .ex-modal-card {
            background: var(--color-bg-card); border: 1px solid var(--color-border);
            border-radius: var(--radius-2xl); padding: var(--space-10);
            text-align: center; max-width: 25rem; width: 90%;
            box-shadow: var(--shadow-xl); animation: modal-in .3s ease;
        }
        @keyframes modal-in { from{opacity:0;transform:scale(.9)} to{opacity:1;transform:scale(1)} }
        .ex-modal-icon {
            font-size: 3rem; margin-bottom: 0.5rem;
            width: 64px; height: 64px; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            margin: 0 auto var(--space-4);
            animation: icon-scale-in 0.4s ease 0.2s both;
        }
        .ex-modal-icon.pass { background: var(--color-success-light); color: var(--color-success); }
        .ex-modal-icon.fail { background: var(--color-danger-light); color: var(--color-danger); }
        @keyframes icon-scale-in { from{transform:scale(0);opacity:0} to{transform:scale(1);opacity:1} }
        .ex-modal-title { font-size: var(--text-2xl); font-weight: 700; color: var(--color-text-primary); margin-bottom: 1rem; }
        .ex-modal-score {
            font-size: clamp(2.5rem, 5vw, 3.5rem); font-weight: 800; font-family: var(--font-mono);
            letter-spacing: -2px; line-height: 1;
        }
        .ex-modal-score.pass { color: var(--color-success); }
        .ex-modal-score.fail { color: var(--color-danger); }
        .ex-modal-pct { font-size: 1.1rem; color: var(--color-text-muted); margin: 0.5rem 0; }
        .ex-modal-verdict { font-size: 1rem; font-weight: 700; margin: 0.5rem 0; }
        .ex-modal-verdict.pass { color: var(--color-success); }
        .ex-modal-verdict.fail { color: var(--color-danger); }
        .ex-modal-time { font-size: 0.85rem; color: var(--color-text-faint, var(--color-text-muted)); margin: 1rem 0; }
        .ex-modal-results-btn {
            background: var(--color-primary); color: var(--color-text-inverse); border: none; border-radius: var(--radius-md);
            padding: 12px 28px; font-size: 0.95rem; font-weight: 700; cursor: pointer;
            transition: all .15s; width: 100%;
        }
        .ex-modal-results-btn:hover { background: var(--color-primary-hover); }

        /* TASK 6: Results screen — full-screen takeover */
        #ex-results.screen-visible {
            position: fixed !important;
            inset: 0 !important;
            z-index: 9999 !important;
            display: flex !important;
            flex-direction: column;
            height: 100vh;
            height: 100dvh;
            background: var(--color-bg-page);
            color: var(--color-text-primary);
            overflow-y: auto;
        }

        /* Results top bar */
        .exr-topbar {
            height: 3rem; flex-shrink: 0;
            background: var(--color-nav-bg);
            display: flex; align-items: center;
            padding: 0 1.5rem;
            justify-content: space-between;
            border-bottom: 1px solid var(--color-border);
        }
        .exr-topbar-title {
            font-size: var(--text-sm); font-weight: 700;
            color: var(--color-nav-text-hover); letter-spacing: var(--tracking-wide);
            white-space: nowrap;
        }
        .exr-topbar-actions { display: flex; gap: 0.5rem; }

        /* Results buttons */
        .exr-btn {
            border: none; border-radius: var(--radius-md);
            padding: 0.5rem 1.25rem; font-size: 0.875rem; font-weight: 600;
            cursor: pointer; transition: all 0.15s; white-space: nowrap;
        }
        .exr-btn-primary {
            background: var(--color-primary); color: var(--color-text-inverse);
        }
        .exr-btn-primary:hover { opacity: 0.85; }
        .exr-btn-secondary {
            background: var(--color-bg-card); border: 1px solid var(--color-border);
            color: var(--color-text-primary);
        }
        .exr-btn-secondary:hover { background: var(--color-bg-subtle); }
        .exr-btn-flex { flex: 1; text-align: center; }

        /* Results hero score card */
        .exr-hero {
            max-width: 860px; margin: 2rem auto 0;
            width: calc(100% - 4rem);
            background: var(--color-bg-card);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-xl);
            padding: 2.5rem;
            text-align: center;
        }
        .exr-score {
            font-size: clamp(3rem, 6vw, 5rem);
            font-weight: 800; font-family: var(--font-mono);
            line-height: 1; letter-spacing: -2px;
        }
        .exr-pct {
            font-size: 1.125rem; font-weight: 600; margin-top: 0.5rem;
        }
        .exr-verdict {
            font-size: 1rem; font-weight: 500; margin-top: 0.5rem;
        }
        .exr-time {
            font-size: 0.875rem; color: var(--color-text-muted); margin-top: 0.5rem;
        }

        /* 4 stat pills */
        .exr-stats-row {
            display: flex; gap: 1rem; justify-content: center;
            margin-top: 1.5rem; flex-wrap: wrap;
        }
        .exr-stat-pill {
            background: var(--color-bg-subtle);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-lg);
            padding: 0.875rem 1.5rem;
            text-align: center; min-width: 100px;
        }
        .exr-stat-val {
            font-size: 1.5rem; font-weight: 700; font-family: var(--font-mono);
        }
        .exr-stat-lbl {
            font-size: 0.6875rem; font-weight: 700;
            text-transform: uppercase; letter-spacing: 0.08em;
            color: var(--color-text-muted); margin-top: 0.25rem;
        }

        /* Actions row */
        .exr-actions-row {
            max-width: 860px; margin: 1.5rem auto;
            width: calc(100% - 4rem);
            display: flex; gap: 1rem;
        }

        /* Breakdown section */
        .exr-breakdown {
            max-width: 860px; margin: 0 auto 2rem;
            width: calc(100% - 4rem);
        }
        .exr-breakdown-title {
            font-size: 1.125rem; font-weight: 700;
            color: var(--color-text-primary);
            margin-bottom: 1rem;
        }

        /* Score bar in area rows */
        .exr-area-right {
            display: flex; align-items: center; gap: 0.75rem;
        }
        .exr-area-bar {
            width: 120px; height: 6px;
            background: var(--color-border);
            border-radius: 3px; overflow: hidden;
        }
        .exr-area-bar-sm { width: 80px; }
        .exr-area-bar-fill {
            height: 100%; border-radius: 3px;
            transition: width 0.3s;
        }

        /* Wrong answer label */
        .exr-wrong-answer {
            font-size: 0.78rem; color: var(--color-danger);
            margin-bottom: 6px;
        }

        /* NCEES area breakdown — collapsible accordion */
        .ex-area-section {
            margin-bottom: var(--space-2); border: 1px solid var(--color-border);
            border-radius: var(--radius-lg); overflow: hidden;
        }
        .ex-area-header {
            display: flex; align-items: center; justify-content: space-between;
            padding: var(--space-4) var(--space-5); cursor: pointer;
            transition: background .15s; background: var(--color-bg-card);
        }
        .ex-area-header:hover { background: var(--color-bg-subtle); }
        .ex-area-title { font-size: 0.88rem; font-weight: 700; color: var(--color-text-primary); }
        .ex-area-score { font-size: 0.82rem; font-weight: 600; }
        .ex-area-score-badge {
            display: inline-flex; padding: 2px 8px; border-radius: var(--radius-sm);
            font-size: 0.72rem; font-weight: 700;
        }
        .ex-area-score-badge.good { background: var(--color-success-light); color: var(--color-success); }
        .ex-area-score-badge.mid { background: var(--color-warning-light); color: var(--color-warning); }
        .ex-area-score-badge.low { background: var(--color-danger-light); color: var(--color-danger); }
        .ex-area-score-badge.none { background: var(--color-bg-subtle); color: var(--color-text-muted); }
        .ex-area-pct-dot {
            width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-left: 8px;
        }
        .ex-area-chevron { font-size: 0.7rem; color: var(--color-text-faint); transition: transform .2s; margin-left: var(--space-3); }
        .ex-area-chevron.open { transform: rotate(180deg); }
        .ex-area-body { display: none; padding: 0; }
        .ex-area-body.open { display: block; }

        .ex-ch-header {
            display: flex; align-items: center; justify-content: space-between;
            padding: 10px 20px; cursor: pointer; background: var(--color-bg-card);
            border-top: 1px solid var(--color-border);
        }
        .ex-ch-header:hover { background: var(--color-bg-subtle); }
        .ex-ch-title { font-size: 0.8rem; font-weight: 600; color: var(--color-text-secondary); }
        .ex-ch-score { font-size: 0.78rem; font-weight: 600; }
        .ex-ch-body { display: none; padding: 0 20px 8px; }
        .ex-ch-body.open { display: block; }

        .ex-q-row {
            display: flex; align-items: flex-start; gap: 8px; padding: 8px 0;
            border-bottom: 1px solid var(--color-bg-subtle); font-size: 0.82rem;
        }
        .ex-q-row:last-child { border-bottom: none; }
        .ex-q-result-icon { flex-shrink: 0; font-size: 0.9rem; margin-top: 1px; }
        .ex-q-row-text { flex: 1; color: var(--color-text-secondary); line-height: 1.5; }
        .ex-q-show-sol-btn {
            flex-shrink: 0; background: none; border: 1px solid var(--color-border); color: var(--color-primary);
            border-radius: 6px; padding: 4px 10px; font-size: 0.7rem; cursor: pointer; transition: all .15s;
        }
        .ex-q-show-sol-btn:hover { background: var(--color-primary-light); }
        .ex-q-sol-wrap { display: none; margin: 8px 0 8px 28px; }
        .ex-q-sol-wrap.open { display: block; }
        .ex-review-q-text { font-family:var(--font-ui); font-size:clamp(0.9375rem, 1.3vw, 1.0625rem); font-weight:500; line-height:1.8; margin-bottom:12px; }
        .ex-review-choices { display:flex; flex-direction:column; gap:6px; margin-bottom:12px; }
        .ex-review-choice { padding:8px 14px; border-radius:8px; font-size:0.875rem; border:1px solid var(--color-border); }
        .ex-review-choice.ex-correct { background:var(--color-success-light); border-left:3px solid var(--color-success); }
        .ex-review-choice.ex-wrong { background:var(--color-danger-light); border-left:3px solid var(--color-danger); }

        /* ── EXAM SOLUTION MODAL ─────────────────────────────────── */
        .ex-sol-overlay {
            position: fixed; inset: 0; z-index: 9999;
            background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
            display: flex; align-items: center; justify-content: center;
            opacity: 0; transition: opacity 0.15s ease;
        }
        .ex-sol-overlay.visible { opacity: 1; }
        .ex-sol-modal {
            position: relative;
            width: 92vw; max-width: 800px; max-height: 90vh;
            overflow-y: auto;
            background: var(--color-bg-card); border-radius: 16px;
            padding: 1.5rem 2rem 2rem;
            box-shadow: 0 8px 32px rgba(0,0,0,0.2);
        }
        .ex-sol-close {
            position: absolute; top: 12px; right: 12px;
            width: 32px; height: 32px; border-radius: 50%;
            border: none; background: var(--color-bg-subtle);
            font-size: 1.25rem; line-height: 1; cursor: pointer;
            color: var(--color-text-muted); transition: all 0.15s;
            display: flex; align-items: center; justify-content: center;
        }
        .ex-sol-close:hover { background: var(--color-danger-light); color: var(--color-danger); }
        .ex-sol-header { margin-bottom: 16px; }
        .ex-sol-qnum {
            font-size: 0.8125rem; font-weight: 700; color: var(--color-primary);
            display: block; margin-bottom: 2px;
        }
        .ex-sol-chapter { font-size: 0.75rem; color: var(--color-text-muted); }
        .ex-sol-qtext {
            font-size: clamp(0.9375rem, 1.3vw, 1.0625rem); font-weight: 500;
            line-height: 1.8; color: var(--color-text-primary); margin-bottom: 16px;
        }
        .ex-sol-diagram { margin-bottom: 16px; }
        .ex-sol-choices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
        .ex-sol-choice {
            display: flex; align-items: flex-start; gap: 12px;
            padding: 14px 18px; border-radius: 8px; font-size: 14px; line-height: 1.65;
            border: 1px solid var(--color-border); color: var(--color-text-secondary);
        }
        .ex-sol-choice-ltr {
            width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
            display: flex; align-items: center; justify-content: center;
            background: var(--color-bg-subtle); border: 1px solid var(--color-border);
            font-size: 12px; font-weight: 500; color: var(--color-text-secondary);
        }
        .ex-sol-choice-text { min-width: 0; flex: 1; overflow-wrap: break-word; }
        .ex-sol-correct {
            background: #E1F5EE; border: 2px solid #0F6E56; color: #04342C;
        }
        .ex-sol-correct .ex-sol-choice-ltr { background: #9FE1CB; color: #04342C; border-color: #9FE1CB; }
        .ex-sol-wrong {
            background: #FCEBEB; border: 2px solid #A32D2D; color: #501313;
        }
        .ex-sol-wrong .ex-sol-choice-ltr { background: #F7C1C1; color: #501313; border-color: #F7C1C1; }
        .ex-sol-wrong-indicator {
            font-size: 0.8125rem; font-weight: 600; color: var(--color-danger);
            margin-bottom: 16px;
        }

        /* (old results actions removed — replaced by exr-actions-row) */

        /* ─────────────────────────────────────────────────────────────────
           SUBJECT NAVIGATION — light-card style matching dashboard UI
        ───────────────────────────────────────────────────────────────── */
        .subj-filter-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:28px; }
        .subj-filter-card { background:var(--color-bg-card); border:1px solid var(--color-bg-sunken); border-radius:var(--radius-lg);
            padding:14px 16px; cursor:pointer; transition:all .2s;
            box-shadow:var(--shadow-xs); }
        .subj-filter-card:hover { border-color:var(--color-primary-muted); box-shadow:var(--shadow-md);
            transform:translateY(-2px); }
        .subj-filter-card.active { border-color:var(--color-primary); background:var(--color-primary-light); }
        .sfc-num { font-family:var(--font-mono); font-size:0.65rem; color:var(--color-primary);
            letter-spacing:2px; text-transform:uppercase; margin-bottom:4px; }
        .sfc-name { font-size:0.82rem; font-weight:700; color:var(--color-text-primary); line-height:1.3; }
        .sfc-meta { font-family:var(--font-mono); font-size:0.58rem; color:var(--color-text-muted); margin-top:4px; }
        .sfc-bar { height:3px; background:var(--color-bg-sunken); border-radius:2px; margin-top:8px; }
        .sfc-fill { height:100%; background:linear-gradient(90deg,var(--color-primary),var(--color-success)); border-radius:2px; }

        /* ── Dashboard Subject Expandable Cards ── */
        .dash-subj-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; margin-bottom:28px; }
        .dash-subj-card { background:var(--color-bg-card); border:1px solid var(--color-bg-sunken); border-radius:var(--radius-lg);
            overflow:hidden; box-shadow:var(--shadow-xs); transition:all .2s; }
        .dash-subj-card:hover { border-color:var(--color-primary-muted); box-shadow:var(--shadow-md); }
        .dash-subj-card.expanded { border-color:var(--color-primary); }
        .dash-subj-hd { display:flex; align-items:center; gap:12px; padding:14px 16px;
            cursor:pointer; transition:background .15s; }
        .dash-subj-hd:hover { background:var(--color-bg-subtle); }
        .dash-subj-num { font-family:var(--font-mono); font-size:0.6rem; color:var(--color-primary);
            letter-spacing:2px; text-transform:uppercase; background:var(--color-primary-light); border-radius:var(--radius-sm);
            padding:3px 8px; flex-shrink:0; }
        .dash-subj-title { font-size:0.85rem; font-weight:700; color:var(--color-text-primary); flex:1; line-height:1.3; }
        .dash-subj-weight { font-family:var(--font-mono); font-size:0.6rem; color:var(--color-text-faint); flex-shrink:0; }
        .dash-subj-arrow { color:var(--color-text-faint); font-size:0.75rem; transition:transform .2s; flex-shrink:0; }
        .dash-subj-card.expanded .dash-subj-arrow { transform:rotate(90deg); }
        .dash-subj-body { display:none; border-top:1px solid var(--color-bg-sunken); padding:12px 16px; }
        .dash-subj-card.expanded .dash-subj-body { display:block; }
        .dash-ch-row { display:flex; align-items:center; gap:10px; padding:8px 0;
            border-bottom:1px solid var(--color-bg-subtle); }
        .dash-ch-row:last-child { border-bottom:none; }
        .dash-ch-name { font-size:0.8rem; color:var(--color-text-secondary); flex:1; line-height:1.4; cursor:pointer; transition:color 0.15s; }
        .dash-ch-name:hover { color:var(--color-primary); text-decoration:underline; }
        .dash-ch-row.dash-ch-complete { background:var(--color-success-light); border-left:3px solid var(--color-success); padding-left:7px; }
        .mod-ch-row.mod-ch-complete { background:var(--color-success-light); }
        .dash-subj-passed {
            font-size:0.6rem; font-weight:700; letter-spacing:1px;
            color:var(--color-success); background:var(--color-success-light);
            padding:2px 8px; border-radius:var(--radius-sm);
            margin-left:8px; flex-shrink:0;
        }
        .dash-ch-badge { font-family:var(--font-mono); font-size:0.6rem; font-weight:700;
            padding:3px 8px; border-radius:var(--radius-sm); white-space:nowrap; }
        .dash-ch-badge.taken { background:var(--color-success-light); color:#065f46; }
        .dash-ch-badge.not-taken { background:var(--color-bg-subtle); color:var(--color-text-faint); border:1px solid var(--color-border); }
        .dash-ch-quiz-btn { font-family:var(--font-mono); font-size:0.58rem; letter-spacing:1px;
            text-transform:uppercase; padding:3px 10px; border-radius:var(--radius-sm);
            background:var(--color-primary-light); border:1px solid var(--color-primary-muted); color:var(--color-primary);
            cursor:pointer; transition:all .15s; white-space:nowrap; }
        .dash-ch-quiz-btn:hover { background:#dbeafe; }
        .dash-subj-summary { display:flex; align-items:center; gap:8px; padding:10px 0 4px;
            border-top:1px solid var(--color-bg-sunken); margin-top:8px; }
        .dash-subj-summary-label { font-family:var(--font-mono); font-size:0.58rem;
            color:var(--color-text-faint); text-transform:uppercase; letter-spacing:1px; }
        .dash-subj-final-btn { font-family:var(--font-mono); font-size:0.62rem; letter-spacing:1px;
            text-transform:uppercase; padding:5px 14px; border-radius:5px;
            background:var(--color-primary); border:none; color:var(--color-text-inverse); cursor:pointer;
            transition:all .15s; margin-left:auto; }
        .dash-subj-final-btn:hover { background:var(--color-primary-hover); }
        .dash-subj-pct { font-family:var(--font-mono); font-size:0.7rem; font-weight:700; }
        .dash-subj-pct.good { color:var(--color-success); }
        .dash-subj-pct.mid { color:var(--color-warning); }
        .dash-subj-pct.low { color:var(--color-danger); }
        .dash-subj-pct.none { color:var(--color-text-faint); }

        /* ── Dashboard Reference Manuals Grid ── */
        .ref-manual-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; }
        @media(max-width:768px){ .ref-manual-grid { grid-template-columns:1fr; } }
        .ref-manual-card { display:flex; align-items:flex-start; gap:14px; padding:18px 20px;
            background:var(--color-bg-card); border:1px solid var(--color-bg-sunken); border-radius:var(--radius-lg);
            box-shadow:var(--shadow-xs); cursor:pointer; transition:all .2s;
            flex-wrap:wrap; }
        .ref-manual-card:hover { border-color:var(--color-primary-muted); box-shadow:var(--shadow-md);
            transform:translateY(-1px); }
        .ref-manual-card.expanded { border-color:var(--color-primary-muted); box-shadow:var(--shadow-md); }
        .ref-manual-icon { width:36px; height:36px; border-radius:8px; display:flex;
            align-items:center; justify-content:center; flex-shrink:0; font-size:1rem; }
        .ref-manual-title { font-size:0.85rem; font-weight:700; color:var(--color-text-primary); line-height:1.3; margin-bottom:4px; }
        .ref-manual-desc { font-size:0.72rem; color:var(--color-text-muted); line-height:1.5; }
        .ref-manual-foot { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:8px; }
        .ref-manual-badge { display:inline-flex; align-items:center; gap:3px;
            font-family:var(--font-mono); font-size:0.55rem; font-weight:700;
            letter-spacing:1px; text-transform:uppercase; padding:2px 7px; border-radius:var(--radius-sm); }
        .ref-manual-badge.web { background:var(--color-primary-light); color:var(--color-primary); }
        .ref-manual-badge.free { background:var(--color-success-light); color:#065f46; text-decoration:none; cursor:pointer; transition:all .15s; }
        .ref-manual-badge.free:hover { background:var(--color-success-muted); }
        .ref-manual-badge.purchase { background:var(--color-warning-light); color:#92400e; text-decoration:none; cursor:pointer; transition:all .15s; }
        .ref-manual-badge.purchase:hover { background:var(--color-warning-muted); }
        .ref-manual-subj { font-family:var(--font-mono); font-size:0.55rem;
            color:var(--color-text-faint); letter-spacing:0.5px; }
        .ref-manual-detail { width:100%; overflow:hidden; max-height:0; opacity:0;
            transition:max-height .3s ease, opacity .2s ease, margin .2s ease; margin-top:0; }
        .ref-manual-card.expanded .ref-manual-detail { max-height:300px; opacity:1; margin-top:10px; }
        .ref-manual-detail-inner { background:var(--color-bg-subtle); border:1px solid var(--color-border); border-radius:var(--radius-md);
            padding:12px 14px; font-size:0.72rem; color:var(--color-text-secondary); line-height:1.6; }
        .ref-manual-detail-row { display:flex; gap:6px; margin-bottom:4px; }
        .ref-manual-detail-row:last-child { margin-bottom:0; }
        .ref-manual-detail-label { font-family:var(--font-mono); font-size:0.6rem;
            font-weight:700; color:var(--color-text-muted); text-transform:uppercase; letter-spacing:0.5px;
            min-width:90px; flex-shrink:0; }
        .ref-manual-detail-val { font-size:0.7rem; color:var(--color-text-primary); }
        .ref-manual-detail-val code { background:var(--color-border); padding:1px 5px; border-radius:3px;
            font-family:var(--font-mono); font-size:0.6rem; color:var(--color-text-secondary); }
        .ref-manual-chevron { color:var(--color-text-faint); font-size:0.85rem; flex-shrink:0; margin-top:2px;
            transition:transform .2s; }
        .ref-manual-card.expanded .ref-manual-chevron { transform:rotate(180deg); }

        /* lecture chapter card hidden state */
        .lec-ch-card.lec-hidden { display:none; }

        /* ─────────────────────────────────────────────────────────────────
           MODULE 1 — PROGRESS TRACKER
        ───────────────────────────────────────────────────────────────── */
        .prog-tracker-wrap { background:var(--color-bg-card); border:1px solid var(--color-bg-sunken); border-radius:var(--radius-lg);
            padding:22px 24px; margin-top:8px; box-shadow:var(--shadow-xs); }
        .prog-tracker-hd { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
        .prog-tracker-title { font-family:var(--font-mono); font-size:0.65rem; letter-spacing:3px;
            text-transform:uppercase; color:var(--color-primary); }
        .prog-stat-row { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin-bottom:16px; }
        .prog-stat { text-align:center; background:var(--color-bg-subtle); border:1px solid var(--color-bg-sunken); border-radius:10px; padding:12px 8px; }
        .prog-stat-n { font-family:var(--font-mono); font-size:1.6rem; font-weight:700; line-height:1; }
        .prog-stat-n.n-green { color:var(--color-success); }
        .prog-stat-n.n-amber { color:var(--color-warning); }
        .prog-stat-n.n-red { color:var(--color-danger); }
        .prog-stat-n.n-silver { color:var(--color-text-faint); }
        .prog-stat-l { font-family:var(--font-mono); font-size:0.58rem; color:var(--color-text-muted);
            text-transform:uppercase; letter-spacing:1px; margin-top:3px; }
        .prog-recent-title { font-family:var(--font-mono); font-size:0.58rem; letter-spacing:2px;
            text-transform:uppercase; color:var(--color-text-faint); margin-bottom:8px; }
        .prog-item { display:flex; align-items:center; gap:10px; padding:8px 12px;
            background:var(--color-bg-subtle); border-radius:6px; margin-bottom:5px; cursor:pointer; transition:background 0.15s; }
        .prog-item:hover { background:var(--color-border); }
        .prog-item-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
        .prog-item-dot.d-green { background:var(--color-success); }
        .prog-item-dot.d-amber { background:var(--color-warning); }
        .prog-item-dot.d-red { background:var(--color-danger); }
        .prog-item-dot.d-silver { background:var(--color-text-faint); }
        .prog-item-q { font-size:0.78rem; color:var(--color-text-primary); flex:1; line-height:1.4; }
        .prog-item-tag { font-family:var(--font-mono); font-size:0.58rem; color:var(--color-text-muted); white-space:nowrap; }
        .prog-item-remove { background:none; border:none; color:var(--color-text-faint); cursor:pointer; font-size:1rem; padding:2px 6px; border-radius:var(--radius-sm); transition:color 0.15s,background 0.15s; flex-shrink:0; }
        .prog-item-remove:hover { color:var(--color-danger); background:var(--color-danger-light); }

        /* ─────────────────────────────────────────────────────────────────
        /* ─────────────────────────────────────────────────────────────────
           MODULE 3 — RETRY / REVIEW WIRING (btn styles use existing .qz-retry-btn)
        ───────────────────────────────────────────────────────────────── */
        .qz-review-list { display:none; margin-top:20px; }
        .qz-review-list.screen-visible { display:block; }
        .qz-review-item { background:var(--color-bg-subtle); border:1px solid var(--color-border); border-radius:10px;
            padding:16px; margin-bottom:12px; }
        .qz-review-item.correct-item { border-left:3px solid var(--color-success); }
        .qz-review-item.wrong-item { border-left:3px solid var(--color-danger); }
        .qz-review-q { font-size:0.87rem; color:var(--color-text-primary); line-height:1.6; margin-bottom:8px; }
        .qz-review-ans { font-size:0.8rem; margin-bottom:3px; }
        .qz-review-sol { font-size:0.78rem; color:var(--color-text-secondary); margin-top:8px; line-height:1.7;
            border-top:1px solid var(--color-bg-sunken); padding-top:8px; }

        /* ─────────────────────────────────────────────────────────────────
           MODULE 4 — SUBJECT FINAL QUIZ MODAL
        ───────────────────────────────────────────────────────────────── */
        .fq-modal-overlay { display:none; position:fixed; inset:0; background:rgba(15,23,42,.6);
            backdrop-filter:blur(4px); z-index:1000; align-items:center; justify-content:center; padding:20px; }
        .fq-modal-overlay.open { display:flex; }
        .fq-modal { background:var(--color-bg-card); border:1px solid var(--color-border); border-radius:var(--radius-xl);
            width:100%; max-width:48.75rem; max-height:90vh; overflow-y:auto; position:relative;
            box-shadow:var(--shadow-xl); }
        .fq-modal::-webkit-scrollbar { width:4px; }
        .fq-modal::-webkit-scrollbar-thumb { background:var(--color-border-strong); border-radius:2px; }
        .fq-modal-hd { background:var(--color-bg-subtle); padding:18px 22px;
            display:flex; align-items:center; gap:16px; border-bottom:2px solid var(--color-primary); }
        .fq-modal-title { font-family:var(--font-mono); font-size:0.75rem; letter-spacing:3px;
            text-transform:uppercase; color:var(--color-primary); flex:1; }
        .fq-timer { font-family:var(--font-mono); font-size:1.1rem; font-weight:700; color:var(--color-success);
            background:var(--color-success-light); border:1px solid var(--color-success-muted);
            border-radius:6px; padding:5px 14px; }
        .fq-timer.warning { color:var(--color-danger); border-color:var(--color-danger-muted);
            background:var(--color-danger-light); }
        .fq-close-btn { background:none; border:1px solid var(--color-border); color:var(--color-text-faint);
            border-radius:6px; padding:5px 10px; cursor:pointer; font-size:0.8rem; transition:all .15s; }
        .fq-close-btn:hover { border-color:var(--color-danger); color:var(--color-danger); }
        .fq-modal-body { padding:22px; }
        .fq-progress { display:flex; align-items:center; gap:12px; margin-bottom:18px; }
        .fq-prog-bar { flex:1; height:4px; background:var(--color-bg-sunken); border-radius:2px; }
        .fq-prog-fill { height:100%; background:linear-gradient(90deg,var(--color-primary),var(--color-success));
            border-radius:2px; transition:width .4s; }
        .fq-prog-label { font-family:var(--font-mono); font-size:0.6rem; color:var(--color-text-faint); white-space:nowrap; }
        .fq-q-card { background:var(--color-bg-subtle); border:1px solid var(--color-border);
            border-radius:10px; padding:20px; }
        .fq-q-num { font-family:var(--font-mono); font-size:0.6rem; letter-spacing:3px;
            text-transform:uppercase; color:var(--color-primary); margin-bottom:8px; }
        .fq-difficulty-badge {
            display: inline-block;
            font-size: 0.65rem;
            font-weight: 700;
            letter-spacing: 0.08em;
            padding: 2px 8px;
            border-radius: 4px;
            margin-right: 6px;
            vertical-align: middle;
            font-family: var(--font-mono);
        }
        .fq-diff-easy { background: #dcfce7; color: #059669; }
        .fq-diff-medium { background: #fef9c3; color: #b45309; }
        .fq-diff-hard { background: #fee2e2; color: #dc2626; }
        .fq-diff-exam-level { background: #ede9fe; color: #7c3aed; }
        .fq-topic-tag {
            display: inline-block;
            font-size: 0.65rem;
            font-weight: 500;
            color: var(--color-text-muted);
            background: var(--color-bg-sunken);
            border: 1px solid var(--color-border);
            padding: 2px 8px;
            border-radius: var(--radius-sm);
            vertical-align: middle;
            font-family: var(--font-mono);
        }
        .fq-result-breakdown {
            margin-top: 16px;
            text-align: left;
            max-height: 280px;
            overflow-y: auto;
            padding: 0 4px;
        }
        .fq-breakdown-title {
            font-size: 0.7rem;
            font-weight: 700;
            letter-spacing: 0.08em;
            color: var(--color-text-muted);
            text-transform: uppercase;
            margin: 12px 0 6px;
            font-family: var(--font-mono);
        }
        .fq-breakdown-title-2 { margin-top: 16px; }
        .fq-breakdown-row {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 5px;
            font-size: 0.72rem;
            font-family: var(--font-mono);
        }
        .fq-bd-topic {
            width: 160px;
            flex-shrink: 0;
            color: var(--color-text-secondary);
            font-size: 0.68rem;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .fq-bd-bar-wrap {
            flex: 1;
            height: 8px;
            background: var(--color-bg-sunken);
            border-radius: var(--radius-sm);
            overflow: hidden;
        }
        .fq-bd-bar {
            display: block;
            height: 100%;
            border-radius: 4px;
            transition: width 0.4s ease;
        }
        .fq-bd-pass { background: var(--color-success); }
        .fq-bd-fail { background: var(--color-danger); }
        .fq-bd-pct {
            width: 72px;
            text-align: right;
            flex-shrink: 0;
            font-weight: 600;
            font-size: 0.68rem;
        }
        .fq-bd-diff-easy { color: #059669; }
        .fq-bd-diff-medium { color: #b45309; }
        .fq-bd-diff-hard { color: #dc2626; }
        .fq-bd-diff-exam-level { color: #7c3aed; }
        .fq-q-text { font-family:var(--font-ui); font-size:clamp(0.9375rem, 1.3vw, 1.0625rem); font-weight:500; color:var(--color-text-primary); line-height:1.8; margin-bottom:16px; }
        .fq-opts { display:flex; flex-direction:column; gap:10px; padding:0 2px; }
        .fq-opt { background:var(--color-bg-card); border:0.5px solid var(--color-border);
            border-radius:8px; padding:14px 18px; cursor:pointer; font-size:14px;
            color:var(--color-text-secondary); text-align:left; transition:all .15s;
            display:flex; align-items:flex-start; gap:12px; width:100%; font-family:var(--font-ui); line-height:1.65; }
        .fq-opt:hover:not(:disabled) { background:var(--color-bg-subtle); border-color:var(--color-border-strong, var(--color-border)); }
        .fq-opt.correct { background:#E1F5EE; border:2px solid #0F6E56; color:#04342C; }
        .fq-opt.correct .fq-opt-ltr { background:#9FE1CB; color:#04342C; border-color:#9FE1CB; }
        .fq-opt.wrong { background:#FCEBEB; border:2px solid #A32D2D; color:#501313; }
        .fq-opt.wrong .fq-opt-ltr { background:#F7C1C1; color:#501313; border-color:#F7C1C1; }
        .fq-opt:disabled { cursor:default; }
        .fq-opt-ltr {
            width:28px; height:28px; border-radius:50%; flex-shrink:0;
            display:flex; align-items:center; justify-content:center;
            background:var(--color-bg-subtle); border:1px solid var(--color-border);
            font-size:12px; font-weight:500; color:var(--color-text-secondary); transition:all .15s;
        }
        .fq-opt-text { min-width:0; flex:1; overflow-wrap:break-word; word-wrap:break-word; font-size:14px; line-height:1.65; }
        .fq-exp { display:none; margin-top:12px; background:var(--color-bg-subtle);
            border-left:3px solid var(--color-primary); border-radius:10px; padding:0;
            font-size:0.83rem; color:var(--color-text-secondary); line-height:1.7; overflow:hidden; }
        .fq-exp.screen-visible { display:block; }
        .fq-nav-row { display:flex; align-items:center; justify-content:space-between; margin-top:16px; }
        .fq-btn { font-family:var(--font-mono); font-size:0.7rem; letter-spacing:1px;
            text-transform:uppercase; padding:9px 18px; border-radius:6px; border:none;
            cursor:pointer; transition:all .2s; }
        .fq-btn-amber { background:var(--color-primary); color:var(--color-text-inverse); }
        .fq-btn-amber:hover { background:var(--color-primary-hover); }
        .fq-btn-outline { background:transparent; border:1px solid var(--color-border);
            color:var(--color-text-muted); }
        .fq-btn-outline:hover { border-color:var(--color-primary); color:var(--color-primary); }
        .fq-btn:disabled { opacity:.4; cursor:not-allowed; }
        .fq-result { padding:24px; text-align:center; }
        .fq-result-score { font-family:var(--font-mono); font-size:3.5rem; font-weight:700;
            color:var(--color-primary); line-height:1; margin-bottom:6px; }
        .fq-result-label { color:var(--color-text-muted); font-size:0.85rem; margin-bottom:16px; }
        .fq-result-verdict { font-size:1rem; font-weight:700; margin-bottom:16px; }
        .fq-result-verdict.pass { color:var(--color-success); }
        .fq-result-verdict.fail { color:var(--color-danger); }

        /* ─────────────────────────────────────────────────────────────────
           MODULE 6 — FORMULA ENGINE (MathJax + card layout)
        ───────────────────────────────────────────────────────────────── */
        .formula-section-hd { font-family:var(--font-mono); font-size:0.65rem; letter-spacing:3px;
            text-transform:uppercase; color:var(--color-primary); border-bottom:1px solid var(--color-border);
            padding-bottom:8px; margin:28px 0 14px; }
        .formula-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; margin-bottom:8px; }
        .formula-card { background:var(--color-bg-subtle); border:1px solid var(--color-border);
            border-radius:10px; padding:16px 18px; transition:all .2s;
            overflow-x:auto; max-width:100%; }
        .formula-card:hover { border-color:var(--color-primary-muted); box-shadow:var(--shadow-sm); }
        .formula-card-name { font-family:var(--font-mono); font-size:0.6rem; letter-spacing:2px;
            text-transform:uppercase; color:var(--color-text-faint); margin-bottom:10px; }
        .formula-latex { font-size:1rem; color:var(--color-text-primary); text-align:center; min-height:36px;
            overflow-x:auto; max-width:100%; }
        .formula-note { font-size:0.74rem; color:var(--color-text-muted); margin-top:8px; line-height:1.5; }
        .formula-ref { font-family:var(--font-mono); font-size:0.58rem; color:var(--color-primary);
            margin-top:6px; }

        /* Solution GIVEN / KEY FORMULA blocks */
        .sol-hd-vars { color: #0d9488; }
        .sol-hd-formula { color: var(--color-primary); }
        .sol-vars-grid {
            display: grid;
            grid-template-columns: auto auto 1fr;
            gap: 4px 10px;
            padding: 4px 0;
        }
        .sol-var-row { display: contents; }
        .sol-var-key {
            font-family: var(--font-mono);
            font-weight: 700;
            font-size: 0.8rem;
            color: #0d9488;
        }
        .sol-var-eq { color: var(--color-text-muted); font-size: 0.8rem; }
        .sol-var-val { font-size: 0.8rem; color: var(--color-text-primary); }
        .sfx-equation {
            font-size: var(--text-equation);
            color: var(--color-text-primary);
            text-align: center;
            overflow-x: auto;
            max-width: 100%;
            padding: var(--space-2) 0;
            margin: var(--space-2) 0;
        }

        /* subject launch btn on lecture cards */
        .lec-launch-btn { font-family:var(--font-mono); font-size:var(--text-2xs); letter-spacing:1px;
            text-transform:uppercase; padding:5px 12px; border-radius:5px;
            background:var(--color-primary-light); border:1px solid var(--color-primary-muted);
            color:var(--color-primary); cursor:pointer; transition:all .15s; white-space:nowrap; }
        .lec-launch-btn:hover { background:#dbeafe; }

        /* ── LECTURE MODULE ACCORDION ── */
        .lec-mod-body { display:none; border-top:1px solid var(--color-bg-sunken); }
        .lec-mod-body.open { display:block; }

        /* Lecture Detail Components */
        .lec-formula-box { background:var(--color-bg-subtle); border:1px solid var(--color-border); border-left:3px solid var(--color-primary);
            border-radius:0 8px 8px 0; padding:14px 18px; margin:12px 0; }
        .lec-example-box { background:var(--color-success-light); border:1px solid var(--color-success-muted); border-radius:10px; padding:18px; margin:14px 0; }
        .lec-mistake-box { background:var(--color-danger-light); border:1px solid var(--color-danger-muted); border-radius:10px; padding:14px 18px; margin:14px 0; }
        .lec-summary-box { background:var(--color-primary-light); border:1px solid var(--color-primary-muted); border-radius:10px; padding:14px 18px; margin:14px 0; }
        .lec-section-hd { font-size:0.72rem; font-weight:800; color:var(--color-text-primary); text-transform:uppercase;
            letter-spacing:1px; border-bottom:2px solid var(--color-primary); padding-bottom:6px; margin-bottom:14px; }

        /* ══════════════════════════════════════════
           SLIDE LECTURE SYSTEM
        ══════════════════════════════════════════ */

        /* Mode Switcher Bar */
        .mode-switcher {
            display: flex; gap: 6px; background: var(--color-bg-sunken); border-radius: var(--radius-lg);
            padding: 5px; border: 1px solid var(--color-border);
        }
        .mode-btn {
            display: flex; align-items: center; gap: 6px;
            padding: 7px 16px; border-radius: var(--radius-md); border: none;
            font-size: var(--text-xs); font-weight: 700; cursor: pointer;
            transition: all 0.2s; color: var(--color-text-muted); background: transparent;
            font-family: var(--font-ui); letter-spacing: 0.02em;
        }
        .mode-btn:hover { background: var(--color-bg-card); color: var(--color-text-primary); }
        .mode-btn.active { background: var(--color-bg-card); color: var(--color-primary); box-shadow: var(--shadow-sm); }
        .mode-btn.active.prac-mode { color: var(--color-success); }
        .mode-btn.active.concept-mode { color: #7c3aed; }

        /* ── Concept Quiz (card + header defined in PRACTICE MODE section below) ── */
        .concept-insight-panel {
            display:none; margin-top:12px; border-radius:10px; overflow:hidden;
            border: 1px solid var(--color-border);
        }
        .concept-insight-panel.screen-visible { display:block; }
        .insight-section { padding:12px 16px; border-bottom:1px solid var(--color-bg-sunken); }
        .insight-section:last-child { border-bottom:none; }
        .insight-label {
            font-size:0.6rem; font-weight:800; letter-spacing:2px;
            text-transform:uppercase; margin-bottom:6px;
        }
        .insight-label.why   { color:#7c3aed; }
        .insight-label.model { color:#0369a1; }
        .insight-label.exam  { color:#d97706; }
        .concept-tag {
            display:inline-flex; align-items:center; gap:4px;
            background:#f0fdf4; border:1px solid #bbf7d0;
            color:#065f46; border-radius:5px;
            padding:2px 8px; font-size:0.68rem; font-weight:700;
        }

        /* ─── SLIDE VIEWPORT ─── */
        #slide-viewport { display: none; }
        #slide-viewport.active { display: flex; flex-direction: column; min-height: 0; }
        #prac-viewport { display: none; }
        #prac-viewport.active { display: block; }
        #concept-viewport { display: none; }
        #concept-viewport.active { display: block; }

        /* Slide Card */
        .slide-card {
            max-width: 53.75rem; margin: 0 auto;
            background: var(--color-bg-card); border: 1px solid var(--color-border);
            border-radius: var(--radius-xl); padding: 0;
            overflow: hidden; box-shadow: var(--shadow-md);
            position: relative; transition: opacity 0.25s ease, transform 0.25s ease;
        }
        .slide-card.slide-exit-left  { opacity: 0; transform: translateX(-32px); }
        .slide-card.slide-exit-right { opacity: 0; transform: translateX(32px); }
        .slide-card.slide-enter      { opacity: 0; transform: translateY(12px); }
        .slide-card.slide-enter-done { opacity: 1; transform: translateY(0); }

        /* Slide Header Band — dark bar */
        .slide-header {
            display: flex; align-items: center; justify-content: space-between;
            gap: 12px; padding: var(--space-4) var(--space-6);
            background: var(--color-nav-bg); color: white;
            font-size: var(--text-sm); font-weight: 500;
        }
        .slide-header-left {
            display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0;
        }

        .slide-type-icon {
            width: 38px; height: 38px; border-radius: 10px;
            display: flex; align-items: center; justify-content: center;
            font-size: 1.1rem; flex-shrink: 0;
        }
        .type-overview  .slide-type-icon { background: #dbeafe; color: #2563eb; }
        .type-why       .slide-type-icon { background: #ede9fe; color: #7c3aed; }
        .type-principle .slide-type-icon { background: #d1fae5; color: #059669; }
        .type-applications .slide-type-icon { background: #ede9fe; color: #7c3aed; }
        .type-equation  .slide-type-icon { background: #ffedd5; color: #ea580c; }
        .type-steps     .slide-type-icon { background: #dbeafe; color: #1d4ed8; }
        .type-example   .slide-type-icon { background: #d1fae5; color: #16a34a; }
        .type-tip       .slide-type-icon { background: #fef3c7; color: #d97706; }
        .type-practice  .slide-type-icon { background: #f3e8ff; color: #9333ea; }

        .slide-header-meta { flex: 1; min-width: 0; }
        .slide-type-label {
            font-size: 0.62rem; font-weight: 800; text-transform: uppercase;
            letter-spacing: 2.5px; margin-bottom: 2px; color: rgba(255,255,255,0.6);
        }

        .slide-title {
            font-family: var(--font-ui);
            font-size: 1.05rem; font-weight: 700;
            color: white; letter-spacing: -0.02em;
        }
        .slide-header-counter {
            font-family: var(--font-mono); font-size: var(--text-xs);
            color: rgba(255,255,255,0.5); white-space: nowrap;
        }

        /* Slide Body */
        .slide-body {
            padding: var(--space-8) var(--space-10); font-size: 0.88rem;
            color: var(--color-text-secondary); line-height: 1.8;
            min-height: 25rem;
        }
        .slide-body p { margin-bottom: 0.75rem; }
        .slide-body p:last-child { margin-bottom: 0; }

        /* Highlight Boxes inside slides */
        .slide-formula-box {
            background: var(--color-bg-sunken); border: 1px solid var(--color-border);
            border-left: 4px solid var(--color-primary);
            border-radius: 0 var(--radius-md) var(--radius-md) 0;
            padding: var(--space-5) var(--space-6); margin: var(--space-6) 0;
            font-family: var(--font-mono); font-size: var(--text-base);
            overflow-x: auto;
        }
        .slide-formula-name {
            font-size: 0.6rem; font-weight: 800;
            letter-spacing: 2.5px; text-transform: uppercase;
            color: var(--color-primary); margin-bottom: 8px;
        }
        .slide-formula-eq {
            font-size: 1.05rem; color: var(--color-text-primary);
            font-weight: 500; margin-bottom: 8px;
        }
        .slide-formula-vars {
            font-size: 0.78rem; color: var(--color-text-secondary); line-height: 1.7;
        }
        .slide-formula-usage {
            font-size: 0.78rem; color: var(--color-text-muted);
            font-style: italic; margin-top: 6px;
            border-top: 1px solid var(--color-border); padding-top: 8px;
        }
        .slide-example-box {
            background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-bg-card) 100%);
            border: 1px solid var(--color-primary-muted);
            border-radius: var(--radius-lg); padding: var(--space-6); margin: var(--space-6) 0;
        }
        .slide-example-label {
            font-size: 0.6rem; font-weight: 800;
            letter-spacing: 2.5px; text-transform: uppercase;
            color: var(--color-primary); margin-bottom: 8px;
            display: inline-block; padding: 3px 10px;
            background: var(--color-primary); color: var(--color-text-inverse);
            border-radius: var(--radius-sm);
        }
        .slide-tip-box {
            background: var(--color-warning-light); border: 1px solid var(--color-warning-muted, #fde68a);
            border-left: 4px solid var(--color-warning);
            border-radius: 0 var(--radius-md) var(--radius-md) 0;
            padding: var(--space-4) var(--space-5); margin: var(--space-4) 0;
        }
        .slide-tip-label {
            font-size: 0.6rem; font-weight: 800;
            letter-spacing: 2.5px; text-transform: uppercase;
            color: var(--color-warning); margin-bottom: 6px;
        }
        .slide-why-box {
            background: #faf5ff; border: 1px solid #ddd6fe;
            border-radius: var(--radius-md); padding: var(--space-4) var(--space-5);
            margin: var(--space-4) 0;
        }

        /* Slide step list */
        .slide-step-list { list-style: none; padding: 0; margin: 10px 0; counter-reset: slide-step; }
        .slide-step-list li {
            position: relative; padding: 10px 0 10px 44px;
            border-bottom: 1px solid var(--color-bg-sunken); line-height: 1.7;
        }
        .slide-step-list li:last-child { border-bottom: none; }
        .slide-step-list li::before {
            counter-increment: slide-step; content: counter(slide-step);
            position: absolute; left: 0; top: 10px;
            width: 26px; height: 26px; border-radius: 50%;
            background: var(--color-primary-light); color: var(--color-primary);
            font-size: 0.72rem; font-weight: 800;
            display: flex; align-items: center; justify-content: center;
        }

        /* Progress bar */
        .slide-progress-wrap {
            display: flex; align-items: center; gap: 12px; margin: 14px 0;
        }
        .slide-progress-track {
            flex: 1; height: 4px; background: var(--color-bg-sunken);
            border-radius: var(--radius-sm); overflow: hidden;
        }
        .slide-progress-fill {
            height: 100%; background: var(--color-primary);
            border-radius: var(--radius-sm); transition: width 0.3s ease;
        }
        .slide-progress-label {
            font-size: 0.72rem; font-weight: 700;
            color: var(--color-text-muted); white-space: nowrap;
        }

        /* Principle Title (inside slide body) */
        .slide-principle-title {
            font-size: var(--text-2xl); font-weight: 700;
            letter-spacing: var(--tracking-tight);
            margin-bottom: var(--space-6); padding-bottom: var(--space-4);
            border-bottom: 2px solid var(--color-border);
            color: var(--color-text-primary);
        }

        /* Slide Navigation */
        .slide-nav {
            display: flex; align-items: center;
            justify-content: space-between;
            padding: var(--space-4) var(--space-6);
            border-top: 1px solid var(--color-border);
            background: var(--color-bg-subtle);
        }
        .slide-nav-btn {
            display: inline-flex; align-items: center; gap: 8px;
            padding: 9px 20px; border-radius: var(--radius-md);
            border: 1px solid var(--color-border); background: var(--color-bg-card);
            font-size: var(--text-sm); font-weight: 700;
            color: var(--color-text-secondary); cursor: pointer;
            transition: all var(--transition-fast); font-family: var(--font-ui);
        }
        .slide-nav-btn:hover:not(:disabled) {
            border-color: var(--color-primary); color: var(--color-primary);
            box-shadow: var(--shadow-sm);
        }
        .slide-nav-btn:disabled { opacity: 0.35; cursor: default; }
        .slide-nav-btn.primary {
            background: var(--color-primary); border-color: var(--color-primary); color: var(--color-text-inverse);
        }
        .slide-nav-btn.primary:hover:not(:disabled) {
            background: var(--color-primary-hover); border-color: var(--color-primary-hover); color: var(--color-text-inverse);
        }

        /* Dot indicators */
        .slide-dots { display: flex; gap: 5px; align-items: center; }
        .slide-dot {
            width: 7px; height: 7px; border-radius: 50%;
            background: var(--color-border); transition: all 0.2s; cursor: pointer;
        }
        .slide-dot.active { background: var(--color-primary); width: 20px; border-radius: var(--radius-sm); }
        .slide-dot:hover:not(.active) { background: var(--color-text-faint); }

        /* Keyboard hint */
        .kbd-hint {
            font-size: 0.62rem; color: var(--color-text-faint);
            display: flex; align-items: center; gap: 4px;
        }
        .kbd {
            display: inline-flex; align-items: center;
            background: var(--color-bg-subtle); border: 1px solid var(--color-border);
            border-radius: var(--radius-sm); padding: 1px 5px;
            font-family: var(--font-mono);
            font-size: 0.6rem; color: var(--color-text-muted);
        }

        /* Keyboard shortcut overlay kbd element */
        kbd {
            display: inline-block; padding: 2px 8px;
            font-family: var(--font-mono); font-size: var(--text-xs);
            background: var(--color-bg-subtle); border: 1px solid var(--color-border);
            border-radius: 4px; box-shadow: 0 1px 0 var(--color-border);
            min-width: 24px; text-align: center;
        }

        /* Practice mini-quiz in slide */
        .slide-practice-option {
            display: block; width: 100%; text-align: left;
            padding: 10px 16px; border: 1px solid var(--color-border);
            border-radius: var(--radius-md); background: var(--color-bg-subtle);
            font-size: 0.83rem; color: var(--color-text-secondary);
            cursor: pointer; margin-bottom: 7px;
            transition: all 0.15s; line-height: 1.5;
            font-family: var(--font-ui);
        }
        .slide-practice-option:hover:not(:disabled) {
            border-color: var(--color-primary-muted); background: var(--color-primary-light); color: #1e40af;
        }
        .slide-practice-option.correct {
            background: var(--color-success-light); border-color: var(--color-success-muted); color: #065f46; font-weight: 600;
        }
        .slide-practice-option.wrong {
            background: var(--color-danger-light); border-color: var(--color-danger-muted); color: #991b1b;
        }
        .slide-practice-option:disabled { cursor: default; }
        .slide-practice-feedback {
            display: none; margin-top: 12px;
            padding: 12px 16px; border-radius: 8px;
            font-size: 0.82rem; line-height: 1.6;
        }
        .slide-practice-feedback.correct {
            background: var(--color-success-light); border: 1px solid var(--color-success-muted); color: #065f46; display: block;
        }
        .slide-practice-feedback.wrong {
            background: var(--color-danger-light); border: 1px solid var(--color-danger-muted); color: #991b1b; display: block;
        }

        /* Practice-only mode */
        .prac-card {
            background: var(--color-bg-card); border: 1px solid var(--color-bg-sunken);
            border-radius: 14px; padding: 22px;
            margin-bottom: 14px; box-shadow: var(--shadow-sm);
        }

        /* ── MCQ inside principle slides ── */
        .mcq-options { display:flex; flex-direction:column; gap:7px; margin-bottom:10px; }
        .mcq-opt-btn {
            display:flex; align-items:flex-start; gap:10px;
            background:var(--color-bg-subtle); border:1px solid var(--color-border); border-radius:9px;
            padding:10px 14px; font-size:0.84rem; color:var(--color-text-secondary);
            cursor:pointer; text-align:left; line-height:1.5;
            transition:all 0.15s; font-family:var(--font-ui); width:100%;
        }
        .mcq-opt-btn:hover:not(:disabled) { background:var(--color-primary-light); border-color:var(--color-primary-muted); color:#1e40af; }
        .mcq-opt-btn.mcq-correct { background:var(--color-success-light); border-color:var(--color-success-muted); color:#065f46; font-weight:600; }
        .mcq-opt-btn.mcq-wrong   { background:var(--color-danger-light); border-color:var(--color-danger-muted); color:#991b1b; }
        .mcq-opt-btn:disabled    { cursor:default; }
        .mcq-opt-letter { font-weight:800; font-size:0.75rem; min-width:18px; flex-shrink:0; padding-top:1px; }
        .mcq-feedback { margin-top:10px; }
        .mcq-result-badge {
            padding:9px 14px; border-radius:8px;
            font-size:0.83rem; font-weight:600; line-height:1.5;
        }
        .mcq-result-badge.correct { background:var(--color-success-light); color:#065f46; border:1px solid var(--color-success-muted); }
        .mcq-result-badge.wrong   { background:var(--color-danger-light); color:#991b1b; border:1px solid var(--color-danger-muted); }

        /* ── Quiz Navigation Bar (practice + concept) ── */
        .prac-paginator, .quiz-nav {
            max-width: 52rem; margin: 0 auto var(--space-8);
            display: flex; align-items: center; justify-content: space-between;
            padding: var(--space-3) var(--space-4);
            background: var(--color-bg-card); border: 1px solid var(--color-border);
            border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
        }
        .prac-page-btn {
            display: inline-flex; align-items: center; gap: 6px;
            padding: 0.55rem 1.1rem; border-radius: var(--radius-md);
            border: 1px solid var(--color-border); background: var(--color-bg-card);
            font-size: var(--text-sm); font-weight: 700;
            color: var(--color-text-secondary); cursor: pointer;
            transition: all var(--transition-fast); font-family: var(--font-ui);
        }
        .prac-page-btn:hover:not(:disabled) { border-color: var(--color-primary); color: var(--color-primary); }
        .prac-page-btn:disabled { opacity: 0.35; cursor: default; }
        .prac-page-btn.primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-text-inverse); }
        .prac-page-btn.primary:hover:not(:disabled) { background: var(--color-primary-hover); }
        .prac-page-counter { font-size: var(--text-sm); font-weight: 700; color: var(--color-text-faint); font-family: var(--font-mono); }
        .prac-progress-bar { height: 8px; background: var(--color-bg-sunken); border-radius: var(--radius-sm); margin-bottom: 16px; overflow: hidden; }
        .prac-progress-fill { height: 100%; background: var(--color-primary); border-radius: var(--radius-sm); transition: width 0.3s; }

        /* ── Cross-Topic Connection links ── */
        .cross-topic-link {
            display:flex; align-items:flex-start; gap:10px;
            padding:10px 12px; border-radius:var(--radius-md); cursor:pointer;
            border:1px solid var(--color-border); background:var(--color-bg-card);
            transition:all 0.15s; margin-bottom:7px; text-align:left; width:100%;
        }
        .cross-topic-link:hover { border-color:var(--color-primary); background:var(--color-primary-light); }
        .cross-topic-link-arrow { color:var(--color-primary); font-weight:800; flex-shrink:0; padding-top:1px; }
        .cross-topic-link-topic { font-size:0.84rem; font-weight:700; color:var(--color-text-primary); }
        .cross-topic-link-desc  { font-size:0.76rem; color:var(--color-text-muted); margin-top:2px; }

        /* ── Solution panel inside practice ── */
        .prac-sol-panel {
            display:none; margin-top:16px;
            background:var(--color-bg-subtle); border-radius:10px; overflow:hidden;
        }
        .prac-sol-panel.screen-visible { display:block; }
        .prac-sol-section { padding:12px 14px; border-bottom:1px solid var(--color-border); }
        .prac-sol-section:last-child { border-bottom:none; }
        .prac-sol-section-label {
            font-size:0.6rem; font-weight:800; letter-spacing:2px;
            text-transform:uppercase; margin-bottom:6px;
        }
        .prac-sol-section-label.steps  { color:var(--color-primary); }
        .prac-sol-section-label.ref    { color:#0d9488; }
        .prac-sol-section-label.trap   { color:var(--color-danger); }
        .prac-sol-section-label.tip    { color:var(--color-warning); }

        /* Back button */
        .lec-back-btn {
            display: inline-flex; align-items: center; gap: 6px;
            background: var(--color-bg-card); border: 1px solid var(--color-border);
            color: var(--color-text-muted); border-radius: 10px;
            padding: 8px 16px; font-size: var(--text-xs); font-weight: 700;
            cursor: pointer; transition: all 0.15s;
            font-family: var(--font-ui);
        }
        .lec-back-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }

        /* ── KEY PRINCIPLE SLIDE ENHANCEMENTS ── */
        .principle-section {
            background: #f0fdf4; border: 1px solid #bbf7d0;
            border-radius: 12px; padding: 16px 20px; margin-bottom: 14px;
        }
        .principle-section-label {
            font-size: 0.6rem; font-weight: 800; letter-spacing: 2.5px;
            text-transform: uppercase; color: #059669; margin-bottom: 6px;
        }
        .reallife-section {
            background: #faf5ff; border: 1px solid #ddd6fe;
            border-left: 4px solid #7c3aed;
            border-radius: 0 10px 10px 0; padding: 14px 18px; margin-bottom: 14px;
        }
        .reallife-label {
            font-size: 0.6rem; font-weight: 800; letter-spacing: 2.5px;
            text-transform: uppercase; color: #7c3aed; margin-bottom: 6px;
        }
        .real-life-example {
            background: #faf5ff; border: 1px solid #ddd6fe;
            border-left: 4px solid #7c3aed;
            border-radius: 0 10px 10px 0; padding: 14px 18px; margin-bottom: 14px;
        }
        .rle-header {
            display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
        }
        .rle-icon { font-size: 0.9rem; }
        .rle-label {
            font-size: 0.6rem; font-weight: 800; letter-spacing: 2.5px;
            text-transform: uppercase; color: #7c3aed;
        }
        .rle-text {
            font-size: 0.85rem; color: #3b0764; line-height: 1.8; margin: 0;
        }

        /* ── Lecture Tab — Full Content Sections ──────── */
        .lecture-section-title {
            font-size: 0.72rem;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--color-primary);
            margin: 1.5rem 0 0.5rem;
            padding-bottom: 0.25rem;
            border-bottom: 2px solid var(--color-border);
        }
        .lecture-standards {
            display: flex;
            flex-wrap: wrap;
            gap: 0.4rem;
            margin-bottom: 1rem;
        }
        .lecture-standard-tag {
            background: var(--color-primary-light);
            color: var(--color-primary-hover);
            border: 1px solid var(--color-primary-muted);
            border-radius: 4px;
            padding: 0.2rem 0.6rem;
            font-size: 0.78rem;
            font-family: var(--font-mono);
        }
        .lecture-formulas {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
            margin-bottom: 1rem;
        }
        .lecture-formula-card {
            background: #fff7ed;
            border: 1px solid #fed7aa;
            border-left: 4px solid #f0a500;
            border-radius: 6px;
            padding: 0.75rem 1rem;
            overflow-x: auto;
            max-width: 100%;
        }
        .lecture-formula-card .lfc-name {
            font-size: 0.72rem;
            font-weight: 700;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: #92400e;
            margin-bottom: 0.35rem;
        }
        .lecture-formula-card .lfc-equation {
            font-family: var(--font-mono);
            font-size: 0.88rem;
            color: #1c1917;
            margin-bottom: 0.3rem;
            overflow-x: auto;
            max-width: 100%;
        }
        .lecture-formula-card .lfc-variables {
            font-size: 0.78rem;
            color: #57534e;
            margin-bottom: 0.25rem;
        }
        .lecture-formula-card .lfc-usage {
            font-size: 0.78rem;
            color: #92400e;
            font-style: italic;
        }
        .lecture-mistakes {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            margin-bottom: 1rem;
        }
        .mistake-item {
            background: #fef2f2;
            border: 1px solid #fecaca;
            border-left: 4px solid #dc2626;
            border-radius: 6px;
            padding: 0.6rem 0.9rem;
            font-size: 0.84rem;
            color: #1c1917;
        }
        .mistake-item::before {
            content: '\26A0  ';
            color: #dc2626;
            font-weight: 700;
        }
        .lecture-summary {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            margin-bottom: 1rem;
        }
        .summary-item {
            background: #f0fdf4;
            border: 1px solid #bbf7d0;
            border-left: 4px solid #059669;
            border-radius: 6px;
            padding: 0.6rem 0.9rem;
            font-size: 0.84rem;
            color: #1c1917;
        }
        .summary-item::before {
            content: '\2713  ';
            color: #059669;
            font-weight: 700;
        }
        .lecture-example {
            background: var(--color-bg-subtle);
            border: 1px solid var(--color-border);
            border-left: 4px solid #7c3aed;
            border-radius: 6px;
            padding: 0.9rem 1rem;
            margin-bottom: 1rem;
        }
        .lecture-example .lex-label {
            font-size: 0.72rem;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: #7c3aed;
            margin-bottom: 0.5rem;
        }
        .lecture-example .lex-problem {
            font-size: 0.88rem;
            color: #1c1917;
            margin-bottom: 0.5rem;
        }
        .lecture-example .lex-solution {
            font-size: var(--text-sm);
            color: var(--color-text-secondary);
            border-top: 1px solid var(--color-border);
            padding-top: 0.5rem;
            margin-top: 0.5rem;
        }

        .principle-example-box {
            background: #fff7ed; border: 1px solid #fed7aa;
            border-radius: 10px; padding: 14px 18px; margin-bottom: 14px;
        }
        .principle-example-label {
            font-size: 0.6rem; font-weight: 800; letter-spacing: 2.5px;
            text-transform: uppercase; color: #ea580c; margin-bottom: 8px;
        }
        .reveal-btn {
            display: inline-flex; align-items: center; gap: 6px;
            background: var(--color-bg-card); border: 1px solid var(--color-border);
            color: var(--color-text-secondary); border-radius: 8px;
            padding: 10px 20px; font-size: 0.8125rem; font-weight: 700;
            cursor: pointer; margin-top: 12px; transition: all 0.15s;
            font-family: var(--font-ui);
        }
        .reveal-btn:hover { border-color: #ea580c; color: #ea580c; }
        .reveal-btn.green:hover { border-color: #059669; color: #059669; }
        .solution-reveal {
            display: none; margin-top: 12px;
            background: var(--color-bg-subtle); border-left: 3px solid #ea580c;
            border-radius: 0 8px 8px 0; padding: 14px 16px;
        }
        .solution-reveal.screen-visible { display: block; }

        /* ── REFLECTION / CONFIDENCE PANEL ── */
        .reflection-panel { margin-top:16px; padding:16px; background:var(--color-bg-subtle); border-radius:var(--radius-lg); border:1px solid var(--color-border); }
        .conf-btn { padding:6px 16px; border-radius:var(--radius-md); border:1px solid var(--color-border); cursor:pointer; font-size:0.8rem; font-weight:600; transition:all 0.15s; background:var(--color-bg-card); }
        .conf-btn.conf-green { color:#166534; } .conf-btn.conf-green:hover, .conf-btn.conf-green.active { background:#dcfce7; border-color:#86efac; }
        .conf-btn.conf-yellow { color:#854d0e; } .conf-btn.conf-yellow:hover, .conf-btn.conf-yellow.active { background:#fef9c3; border-color:#fde047; }
        .conf-btn.conf-red { color:#991b1b; } .conf-btn.conf-red:hover, .conf-btn.conf-red.active { background:#fee2e2; border-color:#fca5a5; }
        .conf-btn.active { outline:2px solid currentColor; outline-offset:2px; }

        /* ── SVG ZOOM MODAL ── */
        .svg-zoom-overlay {
            position: fixed;
            top: 0; left: 0;
            width: 100vw; height: 100vh;
            background: rgba(0,0,0,0.7);
            backdrop-filter: blur(4px);
            z-index: 9999;
            display: flex; align-items: center; justify-content: center;
        }
        [data-theme="dark"] .svg-zoom-overlay {
            background: rgba(0,0,0,0.85);
        }
        [data-theme="dark"] .svg-zoom-exam-tip {
            background: var(--color-warning-light);
            border-left-color: var(--color-warning);
        }
        [data-theme="dark"] .svg-zoom-exam-tip-label,
        [data-theme="dark"] .svg-zoom-exam-tip-text {
            color: var(--color-warning);
        }
        .svg-zoom-modal {
            width: 90vw; max-width: 900px;
            height: auto; max-height: 90vh;
            background: var(--color-bg-card);
            border-radius: 14px;
            padding: 12px 12px 16px;
            overflow-y: auto;
            position: relative;
            display: flex; flex-direction: column;
            margin: auto;
            box-shadow: 0 8px 32px rgba(0,0,0,0.15);
        }
        .svg-zoom-close {
            position: absolute; top: 12px; right: 12px;
            z-index: 1;
            width: 32px; height: 32px;
            border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            font-size: 18px; line-height: 1;
            cursor: pointer;
        }
        .svg-zoom-content {
            flex: 1 1 auto;
            min-height: 0;
            position: relative;
        }
        .svg-zoom-pan-wrap {
            overflow: hidden;
            width: 100%;
            max-height: 70vh;
            display: flex;
            align-items: center;
            justify-content: center;
            touch-action: none;
        }
        .svg-zoom-pan-wrap svg {
            width: 100%; height: auto;
            display: block;
            margin: 0 auto;
            transition: transform 0.05s ease-out;
            will-change: transform;
        }
        .svg-zoom-level {
            position: absolute;
            top: 8px; right: 8px;
            background: var(--color-bg-card, #fff);
            border: 1px solid var(--color-border, #e2e8f0);
            border-radius: 6px;
            padding: 2px 8px;
            font-size: 11px;
            font-weight: 500;
            color: var(--color-text-secondary, #475569);
            pointer-events: none;
            opacity: 0.8;
            z-index: 2;
        }
        .svg-zoom-footer {
            flex: 0 0 auto;
            display: flex; flex-direction: column;
            gap: 8px;
            padding-top: 10px;
            border-top: 0.5px solid var(--color-border, #e2e8f0);
            margin-top: 10px;
            width: 100%;
            box-sizing: border-box;
            overflow: hidden;
        }
        .svg-zoom-footer * {
            max-width: 100%;
            overflow-wrap: break-word;
            word-break: break-word;
        }
        .svg-zoom-legend {
            max-height: 150px;
            overflow-y: auto;
        }
        .svg-zoom-legend-header {
            font-size: var(--text-xs);
            font-weight: 500;
            color: var(--color-text-secondary, #475569);
            margin-bottom: 4px;
        }
        .svg-zoom-legend-grid {
            display: grid;
            grid-template-columns: minmax(60px, 80px) 1fr;
            gap: 4px 12px;
            font-size: var(--text-xs);
        }
        .svg-zoom-legend-var {
            font-weight: 500;
            font-family: var(--font-mono);
            color: var(--color-text-primary, #0f172a);
        }
        .svg-zoom-legend-def {
            font-weight: 400;
            color: var(--color-text-secondary, #475569);
        }
        .svg-zoom-exam-tip {
            background: #fef9c3;
            border-left: 3px solid #ca8a04;
            border-radius: 0 8px 8px 0;
            padding: 10px 14px;
            max-height: 80px;
            overflow-y: auto;
        }
        .svg-zoom-exam-tip-label {
            font-size: 12px;
            font-weight: 600;
            color: #854d0e;
            margin-bottom: 2px;
        }
        .svg-zoom-exam-tip-text {
            font-size: 12px;
            font-weight: 400;
            color: #854d0e;
            line-height: 1.4;
        }
        .svg-zoom-btn-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .svg-zoom-example-link {
            background: none; border: none;
            font-size: 13px; font-weight: 500;
            color: var(--color-primary, #2563eb);
            cursor: pointer; padding: 0;
            text-decoration: none;
        }
        .svg-zoom-example-link:hover {
            text-decoration: underline;
        }
        .svg-zoom-download {
            display: inline-block;
            text-align: center;
        }
        .svg-zoom-header {
            flex: 0 0 auto;
            padding-bottom: 6px;
            text-align: center;
        }
        .svg-zoom-header-context {
            font-size: 14px;
            font-weight: 500;
            color: var(--color-text-secondary);
            margin-bottom: 8px;
        }
        .svg-zoom-header-badge {
            display: inline-block;
            background: var(--color-primary, #2563eb);
            color: #fff;
            font-size: 11px;
            font-weight: 600;
            padding: 2px 8px;
            border-radius: 6px;
            margin-right: 8px;
            vertical-align: middle;
        }
        .svg-zoom-header-title {
            vertical-align: middle;
        }
        .svg-zoom-dots {
            display: flex;
            justify-content: center;
            gap: 4px;
            padding-top: 6px;
        }
        .svg-zoom-dot {
            width: 8px; height: 8px;
            border-radius: 50%;
            border: 1.5px solid var(--color-text-faint, #94a3b8);
            background: transparent;
            cursor: pointer;
            padding: 0;
            transition: background 0.15s, border-color 0.15s;
        }
        .svg-zoom-dot.active {
            background: var(--color-primary, #2563eb);
            border-color: var(--color-primary, #2563eb);
        }
        .svg-zoom-dot:hover:not(.active) {
            border-color: var(--color-primary, #2563eb);
        }

        /* ── Zoom modal diagram hover tooltip ── */
        .svg-zoom-content g.diag-part {
            cursor: help;
        }
        .zoom-diag-tip {
            position: absolute;
            background: var(--color-bg-card, #fff);
            border: 0.5px solid var(--color-border, #e2e8f0);
            border-radius: 8px;
            padding: 8px 12px;
            font-size: 13px;
            max-width: 220px;
            pointer-events: none;
            z-index: 5;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
            line-height: 1.4;
        }
        .zoom-diag-tip-title {
            font-weight: 500;
            color: var(--color-text-primary, #0f172a);
        }
        .zoom-diag-tip-desc {
            font-weight: 400;
            color: var(--color-text-secondary, #475569);
            margin-top: 2px;
        }

        /* ── Question Footer (after answering) ── */
        .quiz-answer-footer {
            padding: var(--space-4) var(--space-8);
            background: var(--color-bg-subtle);
            border-top: 1px solid var(--color-border);
            display: flex; align-items: center; gap: var(--space-3);
        }

        /* ── BELOW-SLIDE DROPDOWNS ── */
        .lec-dropdowns-wrap { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
        .lec-dropdown {
            background: var(--color-bg-card); border: 1px solid var(--color-border);
            border-radius: 14px; overflow: hidden;
            box-shadow: var(--shadow-sm);
        }
        .lec-dropdown-header {
            display: flex; align-items: center; justify-content: space-between;
            padding: 14px 20px; cursor: pointer;
            transition: background 0.15s; user-select: none;
        }
        .lec-dropdown-header:hover { background: var(--color-bg-subtle); }
        .lec-dropdown-header-left {
            display: flex; align-items: center; gap: 10px;
        }
        .lec-dropdown-icon {
            width: 32px; height: 32px; border-radius: 8px;
            display: flex; align-items: center; justify-content: center;
            font-size: 0.9rem; flex-shrink: 0;
        }
        .lec-dropdown-icon.why   { background: #ede9fe; }
        .lec-dropdown-icon.tip   { background: #fef3c7; }
        .lec-dropdown-title {
            font-size: 0.88rem; font-weight: 700; color: var(--color-text-primary);
        }
        .lec-dropdown-subtitle {
            font-size: 0.72rem; color: var(--color-text-faint); margin-top: 1px;
        }
        .lec-dropdown-chevron {
            font-size: 0.75rem; color: var(--color-text-faint);
            transition: transform 0.25s; display: inline-block;
        }
        .lec-dropdown-chevron.open { transform: rotate(180deg); }
        .lec-dropdown-body {
            display: none; padding: 0 20px 18px;
            border-top: 1px solid var(--color-bg-sunken);
        }
        .lec-dropdown-body.open { display: block; }

        /* ── PRACTICE MODE QUESTIONS ── */
        .prac-header { margin-bottom: 20px; }
        .prac-loading {
            text-align: center; padding: 48px 24px;
            background: var(--color-bg-card); border: 1px solid var(--color-bg-sunken); border-radius: var(--radius-xl);
        }
        .prac-loading-spinner {
            width: 36px; height: 36px; border: 3px solid var(--color-border);
            border-top-color: var(--color-primary); border-radius: 50%;
            animation: spin 0.8s linear infinite; margin: 0 auto 14px;
        }
        @keyframes spin { to { transform: rotate(360deg); } }
        .prac-q-card, .concept-q-card {
            max-width: 52rem; margin: var(--space-6) auto;
            background: var(--color-bg-card); border: 1px solid var(--color-border);
            border-radius: var(--radius-xl); overflow: hidden;
            box-shadow: var(--shadow-md); padding-bottom: 20px;
        }
        .prac-q-header, .concept-q-header {
            display: flex; align-items: center; gap: var(--space-3);
            padding: var(--space-3) var(--space-6);
            background: var(--color-bg-subtle);
            border-bottom: 1px solid var(--color-border);
            font-size: var(--text-xs); flex-wrap: wrap;
        }
        .prac-q-num {
            font-size: 0.62rem; font-weight: 800;
            font-family: var(--font-mono);
            color: var(--color-text-faint); letter-spacing: 1px;
        }
        .diff-pill {
            font-size: 0.6rem; font-weight: 800;
            padding: 2px 8px; border-radius: 20px;
            text-transform: uppercase; letter-spacing: 1px;
        }
        .diff-pill.easy   { background: var(--color-success-light); color: #065f46; }
        .diff-pill.medium { background: var(--color-warning-light); color: #92400e; }
        .diff-pill.hard   { background: var(--color-danger-light); color: #991b1b; }
        .diff-pill.exam   { background: #ede9fe; color: #5b21b6; }
        .prac-q-body {
            padding: var(--space-6) var(--space-8);
        }
        .prac-q-text {
            font-family: var(--font-ui); font-size: clamp(0.9375rem, 1.3vw, 1.0625rem);
            color: var(--color-text-primary); line-height: 1.8;
            margin-bottom: var(--space-6); font-weight: 500;
        }
        .prac-options { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 0 2px; margin-bottom: 16px; }
        .prac-opt-btn {
            display: flex; align-items: flex-start; gap: 12px;
            background: var(--color-bg-card); border: 0.5px solid var(--color-border);
            border-radius: 8px; padding: 14px 18px;
            font-size: 14px; color: var(--color-text-secondary);
            cursor: pointer; text-align: left; line-height: 1.65;
            transition: all 0.15s; font-family: var(--font-ui); width: 100%;
            min-width: 0;
        }
        .prac-opt-btn > span:last-child {
            min-width: 0; flex: 1;
            overflow-wrap: break-word; word-wrap: break-word;
            font-size: 14px; line-height: 1.65;
        }
        .prac-opt-btn:hover:not(:disabled) {
            background: var(--color-bg-subtle); border-color: var(--color-border-strong, var(--color-border));
        }
        .prac-opt-btn.correct {
            background: #E1F5EE; border: 2px solid #0F6E56; color: #04342C;
        }
        .prac-opt-btn.correct .prac-opt-letter { background: #9FE1CB; color: #04342C; border-color: #9FE1CB; }
        .prac-opt-btn.wrong {
            background: #FCEBEB; border: 2px solid #A32D2D; color: #501313;
        }
        .prac-opt-btn.wrong .prac-opt-letter { background: #F7C1C1; color: #501313; border-color: #F7C1C1; }
        .prac-opt-btn:disabled { cursor: default; }
        .prac-opt-letter {
            width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
            display: flex; align-items: center; justify-content: center;
            background: var(--color-bg-subtle); border: 1px solid var(--color-border);
            font-size: 12px; font-weight: 500; color: var(--color-text-secondary);
            transition: all 0.15s;
        }
        .prac-explanation {
            display: none; margin-top: 10px;
            background: var(--color-bg-subtle); border-left: 3px solid var(--color-primary);
            border-radius: 0 8px 8px 0; padding: 12px 14px;
            font-size: 0.83rem; color: var(--color-text-secondary); line-height: 1.7;
        }
        .prac-explanation.screen-visible { display: block; }
        .prac-ref-tag {
            display: inline-flex; align-items: center; gap: 4px;
            background: #f0fdfa; border: 1px solid #99f6e4;
            color: #0f766e; border-radius: 5px;
            padding: 2px 8px; font-size: 0.68rem; font-weight: 700;
            margin-top: 6px;
        }

        /* ── Mobile responsiveness ── */
        @media(max-width:640px) {
            .mode-switcher { flex-wrap:wrap; }
            .mode-btn { flex:1; min-width:0; padding:7px 8px; font-size:0.7rem; justify-content:center; }
            .slide-body { padding:16px; }
            .slide-nav { padding:12px 16px; }
            .slide-header { padding:14px 16px; }
        }
        .debug-toast { padding:10px 16px; border-radius:8px; font-size:0.78rem; font-weight:600; color:white; opacity:1; transition:opacity 0.3s; box-shadow:0 4px 12px rgba(0,0,0,0.15); word-break:break-word; }
        .debug-toast-error { background:var(--color-danger); }
        .debug-toast-warn { background:var(--color-warning); }
        .debug-toast-info { background:var(--color-primary); }
        .note-expand-panel {
          display: none;
          margin-top: 0.75rem;
          padding-top: 0.75rem;
          border-top: 1px solid var(--color-bg-sunken);
        }
        .note-expand-panel.screen-visible {
          display: block;
        }

        /* Study Notes Modal */
        .note-modal-overlay {
            position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
            background: rgba(0, 0, 0, 0.7); z-index: 9999;
            display: flex; align-items: center; justify-content: center; padding: 24px;
        }
        [data-theme="dark"] .note-modal-overlay { background: rgba(0, 0, 0, 0.85); }
        .note-modal-card {
            background: var(--color-bg-card); border-radius: 16px;
            width: 90vw; max-width: 900px; max-height: 90vh;
            display: flex; flex-direction: column;
            overflow: hidden; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
        }
        .note-modal-header {
            display: flex; justify-content: space-between; align-items: flex-start;
            padding: 24px 24px 16px; border-bottom: 1px solid var(--color-border);
            flex-shrink: 0; background: var(--color-bg-card);
            border-radius: 16px 16px 0 0;
        }
        .note-modal-cat {
            font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em;
            text-transform: uppercase; color: var(--color-primary); margin-bottom: 4px;
        }
        .note-modal-title { font-size: 1.25rem; font-weight: 600; color: var(--color-text-primary); }
        .note-modal-close {
            background: transparent; border: none; font-size: 1.25rem;
            cursor: pointer; color: var(--color-text-faint); padding: 4px 8px; border-radius: 6px;
        }
        .note-modal-close:hover { background: var(--color-bg-subtle); color: var(--color-text-primary); }
        .note-modal-body { padding: 24px; font-size: 0.9rem; line-height: 1.7; color: var(--color-text-primary); flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }

        /* Modal section headers */
        .nm-section-hd {
            font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em;
            text-transform: uppercase; color: var(--color-text-faint);
            border-bottom: 1px solid var(--color-border);
            padding-bottom: 6px; margin: 24px 0 12px;
        }
        .nm-section-hd:first-child { margin-top: 0; }

        /* Modal formulas — larger than card */
        .nm-formulas { font-size: 1rem; display: flex; flex-direction: column; gap: 8px; }
        .nm-formulas .note-formula-label { font-size: 0.8rem; }

        /* Modal variables — 2-column grid */
        .nm-vars { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 0.85rem; }
        .nm-vars .note-vars-heading { display: none; }

        /* Modal reference */
        .nm-ref { font-size: 0.85rem; color: var(--color-text-secondary); }

        /* Study guide info/insight/trap boxes */
        .nm-box { padding: 12px 16px; border-radius: 8px; margin-bottom: 8px; font-size: 0.85rem; line-height: 1.6; }
        .nm-box strong { display: block; margin-bottom: 4px; font-size: 0.8rem; }
        .nm-box-info { background: #eff6ff; border-left: 3px solid #2563eb; color: #1e40af; }
        .nm-box-insight { background: #f0fdf4; border-left: 3px solid #16a34a; color: #166534; }
        .nm-box-trap { background: #fef2f2; border-left: 3px solid #dc2626; color: #991b1b; }
        .nm-box-ref { background: var(--color-bg-subtle); border-left: 3px solid var(--color-primary); color: var(--color-text-secondary); }
        [data-theme="dark"] .nm-box-info { background: rgba(37,99,235,0.1); color: #93c5fd; }
        [data-theme="dark"] .nm-box-insight { background: rgba(22,163,74,0.1); color: #86efac; }
        [data-theme="dark"] .nm-box-trap { background: rgba(220,38,38,0.1); color: #fca5a5; }

        /* Modal practice problems */
        .note-modal-body .note-practice-heading { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--color-text-faint); margin-bottom: 16px; }
        .note-modal-body .note-prob-title { font-size: 1rem; font-weight: 600; margin-bottom: 8px; }
        .note-modal-body .note-prob-text { font-size: 0.9rem; line-height: 1.7; margin-bottom: 12px; }
        .note-modal-body .note-prob-choice {
            display: block; width: 100%; text-align: left; padding: 10px 16px; margin-bottom: 6px;
            border: 1px solid var(--color-border); border-radius: 8px;
            background: var(--color-bg-card); color: var(--color-text-primary);
            cursor: pointer; font-size: 0.875rem; box-sizing: border-box;
        }
        .note-modal-body .note-prob-choice:hover:not(.disabled) { background: var(--color-bg-subtle); }

        /* ── PREFERENCES PAGE ───────────────────────────────────────────── */
        .pref-page {
            max-width: 60rem; margin: 0 auto;
            padding: var(--space-8) var(--space-6);
        }
        .pref-header { margin-bottom: var(--space-6); }
        .pref-title {
            font-size: var(--text-2xl); font-weight: 700;
            color: var(--color-text); margin: 0 0 var(--space-1) 0;
        }
        .pref-subtitle {
            font-size: var(--text-sm); color: var(--color-text-muted); margin: 0;
        }
        .pref-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: var(--space-6);
        }
        @media (max-width: 768px) {
            .pref-grid { grid-template-columns: 1fr; }
        }
        .pref-card {
            background: var(--color-card); border: 1px solid var(--color-border);
            border-radius: var(--radius-xl); overflow: hidden;
            box-shadow: var(--shadow-sm);
        }
        .pref-card-danger { border-color: var(--color-danger); }
        .pref-card-header {
            padding: var(--space-4) var(--space-5);
            font-size: var(--text-base); font-weight: 700;
            color: var(--color-text);
            border-bottom: 1px solid var(--color-border);
            background: var(--color-bg-sunken);
        }
        .pref-card-icon { margin-right: var(--space-2); }
        .pref-card-body { padding: var(--space-5); }
        .pref-section { margin-bottom: var(--space-5); }
        .pref-section:last-child { margin-bottom: 0; }
        .pref-label {
            display: block; font-size: var(--text-sm); font-weight: 600;
            color: var(--color-text); margin-bottom: var(--space-2);
        }

        /* Theme selector cards */
        .pref-theme-row {
            display: flex; gap: var(--space-2); flex-wrap: wrap;
        }
        .pref-theme-card {
            flex: 1; min-width: 70px;
            padding: var(--space-3) var(--space-4);
            border: 2px solid var(--color-border);
            border-radius: var(--radius-lg);
            cursor: pointer; text-align: center;
            background: var(--color-card);
            transition: all var(--transition-fast);
        }
        .pref-theme-card:hover { border-color: var(--color-primary); }
        .pref-theme-card.active {
            border-color: var(--color-primary);
            background: var(--color-primary-light);
        }
        .pref-swatch {
            display: block; width: 100%; height: 24px;
            border-radius: var(--radius-sm); margin-bottom: var(--space-2);
        }
        .pref-theme-name {
            font-size: var(--text-xs); font-weight: 500;
            color: var(--color-text-muted);
        }
        .pref-theme-card.active .pref-theme-name { color: var(--color-primary); font-weight: 600; }

        /* Segmented controls */
        .pref-segmented {
            display: inline-flex; border: 1px solid var(--color-border);
            border-radius: var(--radius-lg); overflow: hidden;
            background: var(--color-bg-sunken);
        }
        .pref-segmented-wrap { flex-wrap: wrap; }
        .pref-seg-btn {
            padding: var(--space-2) var(--space-4);
            font-size: var(--text-sm); font-weight: 500;
            color: var(--color-text-muted); background: transparent;
            border: none; cursor: pointer;
            transition: all var(--transition-fast);
        }
        .pref-seg-btn:hover { color: var(--color-text); }
        .pref-seg-btn.active {
            background: var(--color-primary); color: #fff;
            font-weight: 600;
        }

        /* Font preview */
        .pref-preview-text {
            margin-top: var(--space-3); padding: var(--space-3) var(--space-4);
            background: var(--color-bg-sunken); border-radius: var(--radius-md);
            font-size: var(--text-base); color: var(--color-text);
            line-height: 1.6;
        }

        /* Radio cards (font family) */
        .pref-radio-row { display: flex; gap: var(--space-3); }
        .pref-radio-card {
            flex: 1; padding: var(--space-4);
            border: 2px solid var(--color-border);
            border-radius: var(--radius-lg);
            cursor: pointer; text-align: center;
            background: var(--color-card);
            transition: all var(--transition-fast);
        }
        .pref-radio-card:hover { border-color: var(--color-primary); }
        .pref-radio-card.active {
            border-color: var(--color-primary);
            background: var(--color-primary-light);
        }
        .pref-radio-preview {
            display: block; font-size: 1.75rem; font-weight: 700;
            color: var(--color-text); margin-bottom: var(--space-1);
        }
        .pref-radio-name {
            font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 500;
        }
        .pref-radio-card.active .pref-radio-name { color: var(--color-primary); font-weight: 600; }

        /* Toggle switch */
        .toggle-switch {
            position: relative; display: inline-flex;
            align-items: center; cursor: pointer;
            gap: var(--space-3);
        }
        .toggle-track {
            width: 44px; height: 24px;
            background: var(--color-border-strong);
            border-radius: var(--radius-full);
            transition: background var(--transition-fast);
            position: relative;
        }
        .toggle-thumb {
            position: absolute; top: 3px; left: 3px;
            width: 18px; height: 18px;
            background: white; border-radius: 50%;
            box-shadow: var(--shadow-sm);
            transition: transform var(--transition-fast);
        }
        .toggle-switch.active .toggle-track { background: var(--color-primary); }
        .toggle-switch.active .toggle-thumb { transform: translateX(20px); }

        /* Toggle row */
        .pref-toggle-row {
            display: flex; align-items: center;
            justify-content: space-between;
            padding: var(--space-3) 0;
            border-bottom: 1px solid var(--color-border);
        }
        .pref-toggle-row:last-child { border-bottom: none; }
        .pref-toggle-info { flex: 1; margin-right: var(--space-4); }
        .pref-toggle-label {
            display: block; font-size: var(--text-sm); font-weight: 500;
            color: var(--color-text);
        }
        .pref-toggle-desc {
            display: block; font-size: var(--text-xs);
            color: var(--color-text-muted); margin-top: 2px;
        }

        /* Text input & save button */
        .pref-text-input {
            background: var(--color-bg-sunken); border: 1px solid var(--color-border);
            border-radius: var(--radius-md); padding: var(--space-2) var(--space-3);
            font-size: var(--text-sm); color: var(--color-text);
            outline: none; transition: border-color var(--transition-fast);
        }
        .pref-text-input:focus { border-color: var(--color-primary); }
        .pref-save-btn {
            background: var(--color-primary); color: #fff;
            font-size: var(--text-sm); font-weight: 600;
            padding: var(--space-2) var(--space-5);
            border: none; border-radius: var(--radius-md);
            cursor: pointer; transition: background var(--transition-fast);
        }
        .pref-save-btn:hover { filter: brightness(1.1); }
        .pref-range { flex: 1; accent-color: var(--color-primary); }

        /* Custom time input */
        .pref-custom-time {
            display: flex; align-items: center;
            gap: var(--space-2); margin-top: var(--space-3);
        }

        /* Danger button */
        .pref-danger-btn {
            margin-top: var(--space-3);
            background: var(--color-danger); color: #fff;
            font-size: var(--text-sm); font-weight: 600;
            padding: var(--space-2) var(--space-5);
            border: none; border-radius: var(--radius-md);
            cursor: pointer; transition: background var(--transition-fast);
        }
        .pref-danger-btn:hover { filter: brightness(1.1); }

        /* Color-blind mode overrides */
        [data-colorblind="deuteranopia"] {
            --color-success: #2563eb; --color-danger: #ea580c;
        }
        [data-colorblind="protanopia"] {
            --color-success: #eab308; --color-danger: #2563eb;
        }
        [data-colorblind="tritanopia"] {
            --color-success: #059669; --color-danger: #dc2626;
        }

        /* ── LECTURE BOOK SPREAD LAYOUT ─────────────────────────────────── */
        .lec-page-outer {
            padding: 0;
        }
        .lec-page-outer.detail-active {
            height: calc(100vh - 52px);
            overflow: hidden;
        }
        .main-content.lecture-detail-active {
            height: 100vh;
            overflow: hidden;
        }
        .lec-module-header {
            display: flex; align-items: center; justify-content: space-between;
            padding: 2rem 3rem 1.5rem;
        }
        .lecture-book-wrapper {
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            background: var(--color-bg-page);
        }
        /* Top bar */
        .lecture-top-bar {
            height: 3rem; flex-shrink: 0;
            background: var(--color-nav-bg);
            display: flex; align-items: center;
            padding: 0 1.5rem; gap: 1rem;
            border-bottom: 1px solid var(--color-border);
        }
        .lec-back-arrow {
            background: none; border: none; color: rgba(255,255,255,0.7);
            font-size: 1.1rem; cursor: pointer; padding: 0.25rem 0.5rem;
            border-radius: var(--radius-sm);
            transition: color var(--transition-fast);
        }
        .lec-back-arrow:hover { color: #fff; }
        .lec-top-chapter-badge {
            background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.9);
            font-size: var(--text-xs); font-weight: 700;
            padding: 0.15rem 0.5rem; border-radius: var(--radius-sm);
            letter-spacing: var(--tracking-wide);
        }
        .lec-top-chapter-name {
            color: rgba(255,255,255,0.9); font-size: var(--text-sm); font-weight: 600;
        }
        .lec-top-divider { color: rgba(255,255,255,0.3); }
        .lec-top-principle-name {
            color: rgba(255,255,255,0.6); font-size: var(--text-sm); font-weight: 400;
        }
        .lec-top-pages {
            color: rgba(255,255,255,0.4); font-size: var(--text-xs);
            font-family: var(--font-mono);
        }
        .lec-top-nav-btn {
            background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
            color: rgba(255,255,255,0.8); font-size: var(--text-xs); font-weight: 600;
            padding: 0.3rem 0.75rem; border-radius: var(--radius-sm);
            cursor: pointer; transition: all var(--transition-fast);
        }
        .lec-top-nav-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
        .lec-top-nav-btn.primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
        .lec-top-nav-btn.primary:hover { filter: brightness(1.15); }

        /* Tab strip */
        .lecture-tab-strip {
            height: 2.5rem; flex-shrink: 0;
            background: var(--color-bg-subtle);
            border-bottom: 1px solid var(--color-border);
            display: flex; align-items: stretch;
            padding: 0 1.5rem; gap: 0;
        }
        .lecture-tab {
            padding: 0 1.25rem;
            font-size: var(--text-sm); font-weight: 500;
            border: none; background: none; cursor: pointer;
            color: var(--color-text-muted);
            border-bottom: 2px solid transparent;
            transition: all var(--transition-fast);
        }
        .lecture-tab:hover { color: var(--color-text); }
        .lecture-tab.active {
            color: var(--color-primary);
            border-bottom-color: var(--color-primary);
            font-weight: 600;
        }

        /* Book spread */
        .lecture-book-spread {
            flex: 1; display: grid;
            grid-template-columns: 1fr 1fr;
            grid-template-rows: minmax(0, 1fr);
            overflow: hidden; min-height: 0;
        }
        .book-page-left, .book-page-right {
            overflow-y: auto;
            overflow-x: hidden;
            height: 100%;
            min-height: 0;
            padding: 2rem 2.5rem;
            scrollbar-width: thin;
            scrollbar-color: var(--color-border) transparent;
        }
        .book-page-left {
            background: var(--color-bg-card);
            border-right: 1px solid var(--color-border);
        }
        .book-page-right { background: var(--color-bg-subtle); }

        /* Bottom bar */
        .lecture-bottom-bar {
            height: 3rem; flex-shrink: 0;
            background: var(--color-bg-card);
            border-top: 1px solid var(--color-border);
            display: flex; align-items: center;
            justify-content: space-between;
            padding: 0 1.5rem;
        }
        .lec-bottom-dots { display: flex; gap: 6px; align-items: center; }
        .lec-bottom-dot {
            width: 8px; height: 8px; border-radius: 50%;
            background: var(--color-border-strong);
            cursor: pointer; transition: all var(--transition-fast);
        }
        .lec-bottom-dot.active { background: var(--color-primary); transform: scale(1.25); }
        .lec-bottom-label {
            font-size: 0.875rem; color: var(--color-text-muted);
        }
        .lec-bottom-nav { display: flex; gap: 0.5rem; }
        .lec-bottom-btn {
            font-size: 0.875rem; font-weight: 600;
            padding: 0.4rem 1.125rem; border-radius: var(--radius-md);
            cursor: pointer; transition: all var(--transition-fast);
            border: 1px solid var(--color-border);
        }
        .lec-bottom-btn.secondary {
            background: var(--color-bg-card); color: var(--color-text-muted);
        }
        .lec-bottom-btn.secondary:hover { color: var(--color-text-primary); border-color: var(--color-text-muted); }
        .lec-bottom-btn.primary {
            background: var(--color-primary); color: #fff; border-color: var(--color-primary);
        }
        .lec-bottom-btn.primary:hover { filter: brightness(1.1); }
        .lec-bottom-btn:disabled { opacity: 0.4; cursor: default; }

        /* ── LEFT PAGE CONTENT ──────────────────────────────────────────── */
        .book-page-num {
            font-size: 0.6875rem; color: var(--color-text-faint);
            font-style: italic; margin-bottom: 1.25rem;
        }
        .book-principle-label {
            display: flex; align-items: center; gap: 0.625rem;
            margin-bottom: 0.875rem;
        }
        .book-principle-bar {
            width: 3px; height: 22px;
            background: var(--color-primary); border-radius: 2px;
        }
        .book-principle-tag {
            font-size: 0.75rem; font-weight: 700;
            color: var(--color-primary);
            letter-spacing: 0.12em;
            text-transform: uppercase;
        }
        .book-principle-title {
            font-size: clamp(1.25rem, 2.5vw, 1.75rem); font-weight: 700;
            color: var(--color-text-primary);
            letter-spacing: -0.02em;
            line-height: 1.25;
            margin-bottom: 1.125rem;
        }
        .book-body-text {
            font-family: var(--font-ui);
            font-size: clamp(0.9375rem, 1.3vw, 1.0625rem);
            line-height: 1.85;
            color: var(--color-text-secondary);
            margin-bottom: 1.125rem;
        }
        .book-body-text strong { color: var(--color-text-primary); font-weight: 600; }
        .book-body-text .key-term { color: var(--color-primary); font-weight: 600; }

        /* Deep dive expandable */
        .deep-dive-btn {
            width: 100%; display: flex; align-items: center; gap: 0.5rem;
            padding: 0.625rem 1rem;
            background: var(--color-bg-subtle);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-md);
            font-size: var(--text-sm); color: var(--color-text-secondary);
            cursor: pointer; font-weight: 500; text-align: left;
            transition: all var(--transition-fast);
            margin-bottom: 1rem;
        }
        .deep-dive-btn:hover {
            background: var(--color-primary-light);
            border-color: var(--color-primary-muted);
            color: var(--color-primary);
        }
        .deep-dive-btn .dd-chevron { transition: transform var(--transition-fast); margin-left: auto; }
        .deep-dive-btn.open .dd-chevron { transform: rotate(180deg); }
        .deep-dive-content {
            display: none;
            background: var(--color-bg-subtle);
            border: 1px solid var(--color-border);
            border-radius: 0 0 var(--radius-md) var(--radius-md);
            padding: 1rem 1.25rem;
            font-size: var(--text-sm); line-height: 1.8;
            color: var(--color-text-secondary);
            margin-top: -1rem; margin-bottom: 1rem;
        }
        .deep-dive-content.open { display: block; }

        /* Exam tip callout */
        .book-callout-tip {
            background: var(--color-warning-light);
            border-left: 3px solid var(--color-warning);
            border-radius: 0 var(--radius-md) var(--radius-md) 0;
            padding: 0.875rem 1.125rem; margin-bottom: 1rem;
        }
        .book-callout-tip .callout-header {
            font-size: 0.6875rem; font-weight: 700;
            color: var(--color-warning);
            letter-spacing: 0.12em;
            text-transform: uppercase; margin-bottom: 0.375rem;
        }
        .book-callout-tip .callout-body {
            font-size: clamp(0.875rem, 1.1vw, 1rem);
            line-height: 1.7; color: var(--color-text-secondary);
        }

        /* Real world callout */
        .book-callout-real {
            background: var(--color-success-light);
            border-left: 3px solid var(--color-success);
            border-radius: 0 var(--radius-md) var(--radius-md) 0;
            padding: 0.875rem 1.125rem; margin-bottom: 1rem;
        }
        .book-callout-real .callout-header {
            font-size: 0.6875rem; font-weight: 700;
            color: var(--color-success);
            letter-spacing: 0.12em;
            text-transform: uppercase; margin-bottom: 0.375rem;
        }
        .book-callout-real .callout-body {
            font-size: clamp(0.875rem, 1.1vw, 1rem);
            line-height: 1.7; color: var(--color-text-secondary);
        }

        .book-reference-line {
            font-size: 0.75rem; color: var(--color-text-faint);
            font-style: italic; margin-top: auto;
            padding-top: 1rem;
            border-top: 1px solid var(--color-border);
        }

        /* ── RIGHT PAGE CONTENT ─────────────────────────────────────────── */
        /* SVG diagram container */
        .book-diagram-wrap {
            background: var(--color-bg-card);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-lg);
            padding: 1.25rem; margin-bottom: 1.25rem;
            display: flex;
            flex-direction: column; align-items: center;
        }
        .book-diagram-title {
            font-size: var(--text-xs); font-weight: 700;
            color: var(--color-text-muted);
            letter-spacing: var(--tracking-wider);
            text-transform: uppercase;
            margin-bottom: 0.75rem; text-align: center;
        }
        .book-diagram-wrap svg { width: 100%; height: auto; max-height: 360px; }

        /* Formula table */
        .book-formula-table {
            background: var(--color-bg-card);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-lg);
            margin-bottom: 1.25rem; overflow: hidden;
        }
        .book-formula-header {
            padding: 0.625rem 1rem;
            border-bottom: 1px solid var(--color-border);
            background: var(--color-bg-subtle);
            display: flex; align-items: center; justify-content: space-between;
        }
        .book-formula-header-title {
            font-size: 0.6875rem; font-weight: 700;
            color: var(--color-primary);
            letter-spacing: 0.1em;
            text-transform: uppercase;
        }
        .book-vars-toggle-btn {
            font-size: var(--text-xs); color: var(--color-text-muted);
            background: var(--color-bg-card);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-sm);
            padding: 0.2rem 0.625rem; cursor: pointer;
            transition: all var(--transition-fast);
        }
        .book-vars-toggle-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
        .book-vars-dropdown {
            display: none;
            padding: 1rem 1.25rem;
            background: var(--color-primary-light);
            border-bottom: 1px solid var(--color-border);
        }
        .book-vars-dropdown.open { display: grid; grid-template-columns: 1fr 1fr; gap: 0.25rem 1.5rem; }
        .book-var-item { font-size: var(--text-sm); line-height: 1.9; }
        .book-var-sym { font-family: var(--font-mono); color: var(--color-primary); font-weight: 600; }
        .book-var-def { color: var(--color-text-secondary); }
        .book-formula-grid {
            display: grid; grid-template-columns: 100px 1fr;
        }
        .book-formula-label-cell {
            font-size: 0.75rem; color: var(--color-text-muted);
            text-transform: uppercase;
            letter-spacing: 0.06em;
            padding: 0.5rem 0 0.5rem 1rem;
            border-bottom: 1px solid var(--color-border);
            display: flex; align-items: center;
        }
        .book-formula-eq-cell {
            font-family: var(--font-mono);
            font-size: clamp(0.875rem, 1.2vw, 1rem);
            color: var(--color-text-primary);
            padding: 0.5rem 1rem;
            border-bottom: 1px solid var(--color-border);
            display: flex; align-items: center;
        }

        /* Worked example */
        .book-example-wrap {
            background: var(--color-bg-card);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-lg);
            overflow: hidden; margin-bottom: 1.25rem;
        }
        .book-example-header {
            background: var(--color-primary-light);
            padding: 0.625rem 1.25rem;
            border-bottom: 1px solid var(--color-primary-muted);
            display: flex; align-items: center; gap: 0.5rem;
        }
        .book-example-header-label {
            font-size: 0.6875rem; font-weight: 700;
            color: var(--color-primary);
            letter-spacing: 0.12em;
            text-transform: uppercase;
        }
        .book-example-body { padding: 1rem 1.25rem; }
        .book-example-question {
            font-size: clamp(0.9375rem, 1.3vw, 1.0625rem);
            line-height: 1.75;
            color: var(--color-text-primary); margin-bottom: 1rem;
        }
        .book-example-choices {
            display: flex; flex-direction: column; gap: 0.5rem;
            margin-bottom: 0.875rem;
        }
        .book-example-choice-btn {
            width: 100%; text-align: left;
            display: flex; align-items: flex-start; gap: 0.75rem;
            font-size: clamp(0.875rem, 1.2vw, 1rem);
            padding: 0.75rem 1rem;
            border: 1.5px solid var(--color-border);
            border-radius: var(--radius-md);
            background: var(--color-bg-card);
            color: var(--color-text-primary);
            cursor: pointer;
            transition: all var(--transition-fast);
        }
        .book-example-choice-btn:hover { border-color: var(--color-primary); background: var(--color-primary-light); }
        .book-example-choice-btn.correct { border-color: var(--color-success); background: var(--color-success-light); color: var(--color-success); font-weight: 600; }
        .book-example-choice-btn.incorrect { border-color: var(--color-danger); background: var(--color-danger-light); color: var(--color-danger); }
        .book-choice-letter {
            width: 1.625rem; height: 1.625rem;
            border-radius: 50%;
            border: 1.5px solid var(--color-border-strong);
            display: flex; align-items: center; justify-content: center;
            font-size: 0.6875rem; font-weight: 700;
            flex-shrink: 0; font-family: var(--font-mono);
            color: var(--color-text-muted);
        }
        .book-see-sol-btn {
            font-size: var(--text-sm); color: var(--color-primary);
            background: none; border: 1px solid var(--color-primary-muted);
            border-radius: var(--radius-md);
            padding: 0.4rem 0.875rem; cursor: pointer;
            font-weight: 500; transition: all var(--transition-fast);
        }
        .book-see-sol-btn:hover { background: var(--color-primary-light); }

        /* Solution panel */
        .book-sol-panel {
            display: none; margin-top: 0.875rem;
            border: 1px solid var(--color-border);
            border-radius: var(--radius-md); overflow: hidden;
        }
        .book-sol-panel.open { display: block; }
        .book-sol-formula-section {
            background: var(--color-primary-light);
            border-left: 3px solid var(--color-primary);
            padding: 0.75rem 1rem;
            border-bottom: 1px solid var(--color-border);
            font-family: var(--font-mono); font-size: var(--text-sm);
        }
        .book-sol-steps-section {
            padding: 0.875rem 1rem;
            border-bottom: 1px solid var(--color-border);
            font-family: var(--font-mono); font-size: var(--text-sm);
            line-height: 2;
        }
        .book-sol-step-num {
            display: inline-flex; align-items: center; justify-content: center;
            width: 20px; height: 20px; border-radius: 50%;
            background: var(--color-primary); color: #fff;
            font-size: 0.65rem; font-weight: 700; margin-right: 0.5rem;
        }
        .book-sol-trap-section {
            background: var(--color-danger-light);
            border-left: 3px solid var(--color-danger);
            padding: 0.75rem 1rem;
            font-size: var(--text-sm); line-height: 1.7;
        }

        /* ── RESPONSIVE: single column on narrow ─────────────────────────── */
        @media (max-width: 900px) {
            .lecture-book-spread {
                grid-template-columns: 1fr;
            }
            .book-page-left {
                border-right: none;
                border-bottom: 1px solid var(--color-border);
            }
            .lecture-top-bar { flex-wrap: wrap; height: auto; padding: 0.5rem 1rem; gap: 0.5rem; }
            .lec-top-principle-name, .lec-top-pages { display: none; }
        }

        /* ═══════════════════════════════════════════════════════════════
           Dashboard activity item hover
           ═══════════════════════════════════════════════════════════════ */
        .dash-activity-item {
            color: var(--color-text-secondary);
        }
        .dash-activity-item p,
        .dash-activity-item span {
            color: inherit;
        }
        .dash-activity-item:hover {
            background: var(--color-bg-sunken);
            border-color: var(--color-border) !important;
        }
        [data-theme="dark"] .dash-activity-item {
            color: var(--color-text-secondary);
        }
        [data-theme="dark"] .dash-activity-item p[style*="color:var(--color-text-primary)"] {
            color: var(--color-text-primary) !important;
        }

        /* ═══════════════════════════════════════════════════════════════
           FIX 5: Dashboard bottom row — CSS fallback for grid layout
           ═══════════════════════════════════════════════════════════════ */
        #page-dashboard .grid.grid-cols-1.lg\:grid-cols-3 {
            display: grid;
            grid-template-columns: 1fr;
            gap: 3rem;
        }
        @media (min-width: 1024px) {
            #page-dashboard .grid.grid-cols-1.lg\:grid-cols-3 {
                grid-template-columns: 2fr 1fr;
            }
        }

        /* ═══════════════════════════════════════════════════════════════
           RESPONSIVE BREAKPOINTS
           ═══════════════════════════════════════════════════════════════ */

        /* Large screens 1400px+ — more padding */
        @media (min-width: 1400px) {
            #page-dashboard > div,
            #page-quiz > div,
            #page-analytics > div,
            .pref-page {
                padding-left: 3rem;
                padding-right: 3rem;
            }
        }

        /* Medium 768–1024px — tighter layout */
        @media (max-width: 1024px) {
            .sidebar { width: 180px; }
            .main-content {
                margin-left: 180px;
                width: calc(100vw - 180px);
            }
            #page-dashboard > div,
            #page-quiz > div,
            #page-analytics > div {
                padding-left: 1.25rem;
                padding-right: 1.25rem;
            }
            .dash-stats-row { grid-template-columns: repeat(3, 1fr); }
            .dash-subj-grid { grid-template-columns: 1fr !important; }
            .dash-header { flex-wrap: wrap; gap: var(--space-3); height: auto; padding: var(--space-3) var(--space-4); }
            .dash-header-right { width: 100%; justify-content: flex-end; }
        }

        /* Small 640–768px — collapsed sidebar icons only */
        @media (max-width: 768px) {
            .sidebar { width: 60px; }
            .sidebar-logo-text,
            .sidebar-section-label,
            .sidebar-user-name,
            .sidebar-user-role,
            .sidebar-link span:not(iconify-icon) {
                display: none;
            }
            .sidebar-logo { padding: var(--space-3); justify-content: center; border-left: none; }
            .sidebar-link { justify-content: center; padding: var(--space-3); margin: 2px var(--space-1); border-left: none; }
            .sidebar-user { justify-content: center; padding: var(--space-3); }
            .main-content {
                margin-left: 60px;
                width: calc(100vw - 60px);
            }
            .dash-stats-row { grid-template-columns: 1fr; }

            /* Touch-friendly: minimum tap targets */
            .qb-diff-btn { min-height: 44px; display: flex; align-items: center; }
            .qb-show-sol, .qb-reset-q { min-height: 44px; }
            .topic-tag { min-height: 44px; display: flex; align-items: center; }

            /* Mobile: answer buttons need adequate spacing */
            .qb-answers { grid-template-columns: 1fr; gap: 8px; }

            /* Mobile: exam navigation */
            .ex-nav-grid { gap: 4px; }
            .ex-nav-btn { min-width: 36px; min-height: 36px; font-size: var(--text-xs); }
        }

        /* Very small < 640px — no sidebar */
        @media (max-width: 640px) {
            .sidebar { display: none; }
            .main-content {
                margin-left: 0;
                width: 100%;
            }
            .prac-q-card,
            .concept-q-card {
                border-radius: 0;
                border-left: none;
                border-right: none;
            }
        }

        /* Mobile: layout refinements at 640px */
        @media (max-width: 640px) {
            /* Mobile: quiz score ring */
            .qz-score-ring { transform: scale(0.8); transform-origin: center; }

            /* Mobile: search bar full width */
            .dash-search-wrap { width: 100%; min-width: unset; }
            .dash-header { flex-direction: column; gap: 10px; }

            /* Mobile: flashcard text */
            .flashcard-container { padding: 1rem; }
            #fc-question { font-size: var(--text-sm); }

            /* Mobile: filter bar wrapping */
            .qb-filter-bar { padding: 10px 12px; gap: 8px; }
            .qb-filter-bar select, .qb-filter-bar input { font-size: var(--text-xs); padding: 6px 8px; }

            /* Mobile: solution panel margins */
            .sol-breakdown { margin: var(--space-3) var(--space-2) var(--space-4); }

            /* Mobile: lecture book pages */
            .book-page { padding: 1rem 0.75rem; }
            .book-page-content { font-size: var(--text-sm); }
        }

        /* ═══════════════════════════════════════════════════════════════
           FIX 7: Dark mode overrides for lecture book pages
           ═══════════════════════════════════════════════════════════════ */
        [data-theme="dark"] .book-page-left,
        [data-theme="dark"] .book-page-right {
            background: var(--color-bg-card);
            color: var(--color-text-secondary);
        }
        [data-theme="dark"] .book-principle-title,
        [data-theme="dark"] .book-body-text strong {
            color: var(--color-text-primary);
        }
        [data-theme="dark"] .book-body-text {
            color: var(--color-text-secondary);
        }
        [data-theme="dark"] .book-callout-tip,
        [data-theme="dark"] .book-callout-real {
            background: rgba(255,255,255,0.04);
            border-color: rgba(255,255,255,0.1);
        }
        [data-theme="dark"] .book-formula-table {
            background: rgba(255,255,255,0.03);
        }
        [data-theme="dark"] .book-formula-table th {
            background: rgba(255,255,255,0.06);
            color: var(--color-text-primary);
        }
        [data-theme="dark"] .book-formula-table td {
            color: var(--color-text-secondary);
            border-color: rgba(255,255,255,0.08);
        }
        [data-theme="dark"] .book-example-choice-btn {
            background: rgba(255,255,255,0.04);
            border-color: rgba(255,255,255,0.1);
            color: var(--color-text-secondary);
        }
        [data-theme="dark"] .book-example-choice-btn:hover {
            background: rgba(59,130,246,0.12);
            border-color: rgba(59,130,246,0.3);
        }
        [data-theme="dark"] .deep-dive-btn {
            background: rgba(255,255,255,0.05);
            border-color: rgba(255,255,255,0.1);
            color: var(--color-text-secondary);
        }
        [data-theme="dark"] .book-see-sol-btn {
            color: var(--color-primary);
        }
        [data-theme="dark"] .book-sol-panel {
            background: rgba(255,255,255,0.03);
            border-color: rgba(255,255,255,0.08);
        }

        /* ── UTILITY CLASSES ────────────────────────────────────────── */

        /* Layout */
        .flex-center { display: flex; align-items: center; }
        .flex-between { display: flex; align-items: center; justify-content: space-between; }
        .flex-col { display: flex; flex-direction: column; }
        .flex-1 { flex: 1; }
        .flex-wrap-gap { display: flex; flex-wrap: wrap; }
        .gap-xs { gap: var(--space-2); }
        .gap-sm { gap: var(--space-3); }
        .gap-md { gap: var(--space-4); }
        .gap-lg { gap: var(--space-6); }
        .stack-sm { display: flex; flex-direction: column; gap: 1rem; }
        .stack-md { display: flex; flex-direction: column; gap: 1.5rem; }
        .stack-lg { display: flex; flex-direction: column; gap: 2.5rem; }
        .is-hidden { display: none !important; }
        .text-center { text-align: center; }
        .cursor-pointer { cursor: pointer; }

        /* Typography */
        .page-heading { font-size: var(--text-2xl); font-weight: 700; color: var(--color-text-primary); }
        .section-heading { font-size: var(--text-lg); font-weight: 700; color: var(--color-text-primary); letter-spacing: -0.01em; }
        .card-title { font-size: var(--text-xl); font-weight: 700; color: var(--color-text-primary); }
        .text-muted { font-size: var(--text-sm); color: var(--color-text-secondary); }
        .text-muted-sm { font-size: 0.83rem; color: var(--color-text-secondary); }
        .text-faint { font-size: var(--text-sm); color: var(--color-text-faint); }
        .text-meta { font-size: var(--text-xs); color: var(--color-text-faint); }
        .text-meta-bold { font-size: var(--text-xs); font-weight: 700; color: var(--color-text-primary); }
        .text-meta-secondary { font-size: var(--text-xs); color: var(--color-text-secondary); }
        .label-overline {
            font-size: 0.625rem; font-weight: 700; color: var(--color-text-faint);
            text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.5rem;
        }
        .label-overline-primary {
            font-size: var(--text-xs); font-weight: 600; color: var(--color-primary);
            text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.75rem;
        }
        .mono-label { font-family: var(--font-mono); font-size: 0.62rem; color: var(--color-text-faint); }
        .mono-label-md { font-family: var(--font-mono); font-size: 0.65rem; color: var(--color-text-faint); }
        .mono-data { font-family: var(--font-mono); font-size: 0.78rem; color: var(--color-text-muted); }
        .mono-date { font-family: var(--font-mono); font-size: 0.72rem; color: var(--color-text-faint); }
        .stat-value-lg { font-size: var(--text-3xl); font-weight: 700; color: var(--color-text-primary); }
        .stat-unit { font-size: 1rem; font-weight: 500; color: var(--color-text-faint); margin-left: 0.25rem; }
        .stat-suffix { font-size: var(--text-lg); color: var(--color-text-faint); font-weight: 500; }
        .stat-suffix-sm { font-size: var(--text-sm); color: var(--color-text-faint); font-weight: 500; }

        /* Dashboard/Shared Components */
        .snapshot-row { display: flex; align-items: center; justify-content: space-between; }
        .divider { height: 1px; background: var(--color-border); }
        .breadcrumb-nav { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: var(--color-text-faint); }
        .breadcrumb-sep { font-size: 0.65rem; }
        .breadcrumb-current { color: var(--color-text-primary); font-weight: 600; }
        .btn-clear { font-size: var(--text-xs); font-weight: 500; color: var(--color-text-faint); background: none; border: none; cursor: pointer; }
        .btn-clear:hover { color: var(--color-danger); }
        .icon-accent { font-size: 1.25rem; color: var(--color-primary); }
        .qr-panel { background: var(--color-bg-sunken); border-radius: 1.5rem; padding: 2rem; display: flex; flex-direction: column; gap: 1.5rem; }
        .qr-quote { font-size: 0.6875rem; color: var(--color-text-faint); line-height: 1.6; text-align: center; font-style: italic; }
        .stat-baseline { display: flex; align-items: baseline; gap: var(--space-2); }
        .checkin-btn-style { margin-top: var(--space-3); font-size: 0.7rem; }
        .mt-md { margin-top: 2rem; }

        /* Grid Layouts */
        .grid-sidebar-layout { display: grid; grid-template-columns: 1fr; gap: 3rem; }
        .grid-main-col { }
        @media (min-width: 1024px) {
            .grid-sidebar-layout { grid-template-columns: 2fr 1fr; }
            .grid-main-col { grid-column: span 2; }
        }
        .stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
        @media (min-width: 1024px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
        .stat-card-simple { padding: 1.5rem; border-radius: 1rem; border: 1px solid var(--color-border); }
        .quiz-mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.5rem; }

        /* Chips / Tags */
        .chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
        .chip-active {
            padding: 0.375rem 0.75rem; border-radius: 0.5rem;
            background: var(--color-primary); color: var(--color-text-inverse);
            font-size: var(--text-xs); font-weight: 700;
            transition: color 0.15s, background 0.15s; cursor: pointer; border: none;
        }
        .chip-default {
            padding: 0.375rem 0.75rem; border-radius: 0.5rem;
            background: var(--color-bg-subtle); color: var(--color-text-secondary);
            font-size: var(--text-xs); font-weight: 700;
            transition: color 0.15s, background 0.15s; cursor: pointer; border: none;
        }
        .chip-default:hover { background: var(--color-border); }

        /* Flashcard */
        .flashcard-container {
            background: var(--color-bg-card); border-radius: 1.5rem;
            border: 1px solid var(--color-border); box-shadow: var(--shadow-md);
            padding: 3rem; text-align: center; min-height: 16rem;
            display: flex; flex-direction: column; align-items: center;
            justify-content: center; gap: 1.5rem;
        }
        .flashcard-answer {
            font-size: var(--text-sm); font-family: var(--font-mono); font-weight: 700;
            color: var(--color-primary); background: var(--color-primary-light);
            border-radius: 0.75rem; padding: 0.75rem 1.5rem; text-align: center; width: 100%;
            box-sizing: border-box; overflow: hidden;
        }
        .fc-source { font-size: var(--text-xs); color: var(--color-text-faint); text-align: center; }
        .fc-counter-above { text-align: center; font-size: var(--text-sm); font-weight: 500; color: var(--color-text-faint); margin-bottom: 1rem; }
        .fc-counter-row { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-top: 1.5rem; }
        .fc-btn-show {
            padding: 0.75rem 1.5rem; background: var(--color-primary); color: var(--color-text-inverse);
            border-radius: 0.75rem; font-size: var(--text-sm); font-weight: 700;
            border: none; cursor: pointer; transition: opacity 0.15s;
        }
        .fc-btn-show:hover { opacity: 0.85; }
        .fc-btn-skip {
            padding: 0.625rem 1.25rem; border-radius: 0.5rem;
            background: var(--color-bg-subtle); color: var(--color-text-secondary);
            border: 1px solid var(--color-border); cursor: pointer;
            transition: background 0.15s, border-color 0.15s;
            font-size: var(--text-sm); font-weight: 600; font-family: var(--font-ui);
        }
        .fc-btn-skip:hover { background: var(--color-border); border-color: var(--color-text-faint); }
        .fc-btn-know {
            padding: 0.625rem 1.25rem; border-radius: 0.5rem;
            background: var(--color-success); color: white;
            border: 1px solid var(--color-success); cursor: pointer;
            transition: background 0.15s, opacity 0.15s;
            font-size: var(--text-sm); font-weight: 600; font-family: var(--font-ui);
        }
        .fc-btn-know:hover { opacity: 0.85; }

        /* Flashcard answer — equation display */
        .fc-equation {
            font-size: 1.1rem;
            text-align: center;
            margin-bottom: 12px;
            line-height: 2;
            overflow-x: auto;
            overflow-y: hidden;
            max-width: 100%;
            -webkit-overflow-scrolling: touch;
        }
        /* Flashcard variable grid */
        .fc-var-grid {
            display: flex;
            flex-direction: column;
            gap: 4px;
            margin-top: 8px;
            padding-top: 8px;
            border-top: 1px solid var(--color-border);
            text-align: left;
        }
        .fc-var-row {
            display: flex;
            align-items: baseline;
            gap: 8px;
            font-size: 0.85rem;
            line-height: 1.5;
        }
        .fc-var-sym {
            font-weight: 600;
            min-width: 40px;
            text-align: right;
            flex-shrink: 0;
            color: var(--color-text-primary);
        }
        .fc-var-sym::after {
            content: ' =';
            font-weight: 400;
            color: var(--color-text-faint);
        }
        .fc-var-def {
            color: var(--color-text-secondary);
        }

        /* Quick Action Buttons (dashboard sidebar) */
        .qa-btn-primary {
            display: flex; align-items: center; justify-content: space-between;
            width: 100%; padding: 1rem; background: var(--color-primary);
            border-radius: 0.75rem; color: var(--color-text-inverse); border: none;
            cursor: pointer; transition: opacity 0.15s;
            box-shadow: 0 4px 12px rgba(37,99,235,0.2);
        }
        .qa-btn-primary:hover { opacity: 0.9; }
        .qa-btn-secondary {
            display: flex; align-items: center; justify-content: space-between;
            width: 100%; padding: 1rem; background: var(--color-bg-card);
            border-radius: 0.75rem; color: var(--color-text-primary);
            border: 1px solid var(--color-border); cursor: pointer; transition: border-color 0.15s;
        }
        .qa-btn-secondary:hover { border-color: var(--color-primary-muted); }
        .qa-btn-inner { display: flex; align-items: center; gap: 0.75rem; }
        .qa-btn-label { font-size: var(--text-sm); font-weight: 700; }
        .qa-btn-icon { font-size: var(--text-lg); }
        .qa-btn-icon-primary { font-size: var(--text-lg); color: var(--color-primary); }
        .qa-btn-arrow { color: var(--color-text-faint); }

        /* Sidebar overflow helper */
        .sidebar-nav-scroll { flex: 1; overflow-y: auto; }
        .sidebar-user-overflow { overflow: hidden; }
        .sidebar-name-truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .sidebar-label-first { margin-top: 0; }

        /* Lecture viewport helpers */
        .viewport-flex { flex: 1; display: flex; flex-direction: column; min-height: 0; }
        .viewport-scroll { flex: 1; overflow-y: auto; padding: 2rem; }

        /* Quiz filter panel */
        .qz-filter-panel {
            display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding: 14px 16px;
            background: var(--color-bg-subtle); border: 1px solid var(--color-border); border-radius: 12px;
        }
        .qz-filter-col { flex: 1; min-width: 140px; }
        .qz-filter-label {
            font-size: 0.65rem; font-weight: 700; color: var(--color-text-muted);
            text-transform: uppercase; letter-spacing: 1.5px; display: block; margin-bottom: 4px;
        }
        .qz-filter-select {
            width: 100%; padding: 8px 12px; border: 1px solid var(--color-border);
            border-radius: 8px; font-size: 0.82rem; background: var(--color-bg-card); cursor: pointer;
            color: var(--color-text-primary);
        }
        .qz-exit-btn {
            background: transparent; color: var(--color-text-muted);
            border: 1px solid var(--color-border-strong); font-size: 0.78rem;
            padding: 6px 14px; border-radius: 8px; cursor: pointer;
        }

        /* Practice Exam Builder */
        .qz-practice-builder {
            margin-top: 1rem; padding: 1.5rem; background: var(--color-bg-card);
            border: 1px solid var(--color-border); border-radius: 1rem;
            box-shadow: var(--shadow-md);
        }
        .qz-pb-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
        .qz-pb-title { font-family: 'Manrope', sans-serif; font-size: 1rem; font-weight: 800; color: var(--color-text-primary); margin: 0; }
        .qz-pb-close { background: none; border: none; font-size: 1.25rem; color: var(--color-text-muted); cursor: pointer; }
        .qz-pb-section { margin-bottom: 1rem; }
        .qz-pb-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-muted); display: block; margin-bottom: 0.5rem; }
        .qz-pb-subjects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.375rem; }
        .qz-pb-subj-item {
            display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.625rem;
            border: 1px solid var(--color-border); border-radius: 0.5rem;
            cursor: pointer; transition: all 0.15s; font-size: 0.75rem;
        }
        .qz-pb-subj-item:hover { border-color: var(--color-primary-muted); }
        .qz-pb-subj-item:has(input:checked) { border-color: #0058be; background: rgba(0,88,190,0.04); }
        .qz-pb-subj-name { flex: 1; font-weight: 600; color: var(--color-text-primary); }
        .qz-pb-subj-ch { font-size: 0.6rem; color: var(--color-text-muted); font-weight: 700; }
        .qz-pb-options { display: flex; gap: 1.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
        .qz-pb-option { flex: 1; min-width: 160px; }
        .qz-pb-count-btns, .qz-pb-mode-btns { display: flex; gap: 0.375rem; }
        .qz-pb-count, .qz-pb-mode {
            flex: 1; padding: 0.5rem 0.75rem; border: 1px solid var(--color-border);
            border-radius: 0.5rem; background: var(--color-bg-card); font-size: 0.75rem;
            font-weight: 700; cursor: pointer; transition: all 0.15s; text-align: center;
            color: var(--color-text-primary);
        }
        .qz-pb-count:hover, .qz-pb-mode:hover { border-color: #0058be; }
        .qz-pb-count--active, .qz-pb-mode--active { background: #0058be; color: #fff; border-color: #0058be; }
        .qz-pb-summary {
            font-size: 0.75rem; color: var(--color-text-muted); padding: 0.75rem;
            background: var(--color-bg-subtle); border-radius: 0.5rem; margin-bottom: 1rem;
        }
        .qz-pb-start {
            width: 100%; padding: 0.75rem; background: #091426; color: #fff; border: none;
            border-radius: 0.75rem; font-family: 'Manrope', sans-serif; font-size: 0.875rem;
            font-weight: 800; cursor: pointer; transition: all 0.15s;
            box-shadow: 0 4px 12px rgba(9,20,38,0.15);
        }
        .qz-pb-start:hover { background: #0058be; }
        .qz-pb-start:disabled { opacity: 0.4; cursor: not-allowed; }
        @media (max-width: 600px) {
            .qz-pb-subjects { grid-template-columns: 1fr; }
            .qz-pb-options { flex-direction: column; }
        }

        /* Exam pre-screen */
        .ex-pre-wrap {
            display: flex; flex-direction: column; align-items: center;
            justify-content: center; width: 100%; height: 100%; min-height: 400px;
            background: var(--color-bg-page); padding: 2rem; box-sizing: border-box;
        }
        .ex-pre-card {
            background: var(--color-bg-card); border: 1px solid var(--color-border);
            border-radius: 16px; padding: 2.5rem 3rem; max-width: 520px;
            width: 100%; text-align: center; box-shadow: 0 4px 24px rgba(0,0,0,0.08);
        }
        .ex-pre-emoji { font-size: 2.5rem; margin-bottom: 1rem; }
        .ex-pre-title { font-size: 1.5rem; font-weight: 700; color: var(--color-text-primary); margin: 0 0 0.75rem; font-family: var(--font-ui); }
        .ex-pre-desc { font-size: 1rem; color: var(--color-text-secondary); margin: 0 0 1.5rem; line-height: 1.6; font-family: var(--font-ui); }
        .ex-pre-list { text-align: left; margin: 0 0 2rem; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
        .ex-pre-list li { font-size: 0.9375rem; color: var(--color-text-primary); font-family: var(--font-ui); display: flex; align-items: center; gap: 0.5rem; }
        .ex-pre-check { color: var(--color-success); }
        .ex-pre-start-btn {
            width: 100%; padding: 0.875rem 2rem; background: var(--color-primary); color: white;
            border: none; border-radius: 8px; font-size: 1rem; font-weight: 700;
            cursor: pointer; font-family: var(--font-ui); letter-spacing: 0.02em;
        }
        .ex-pre-start-btn:hover { opacity: 0.9; }

        /* Subject final quiz (fq) */
        .fq-pre-wrap { text-align: center; padding: 24px 0; }
        .fq-pre-header-label {
            font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 3px;
            text-transform: uppercase; color: var(--color-primary); margin-bottom: 8px;
        }
        .fq-pre-title-text { font-family: 'Manrope', sans-serif; font-size: 1.6rem; font-weight: 800; color: var(--color-text-primary); margin-bottom: 12px; letter-spacing: -0.02em; }
        .fq-pre-info-text { font-size: 0.85rem; color: var(--color-text-secondary); margin-bottom: 20px; background: var(--color-bg-sunken); padding: 10px 16px; border-radius: 12px; display: inline-flex; gap: 8px; }

        /* JS-generated solution/reflection components */
        .sol-body-text { font-size: 0.83rem; color: var(--color-text-secondary); line-height: 1.75; }
        .sol-step-badge {
            flex-shrink: 0; background: var(--color-primary); color: var(--color-text-inverse);
            border-radius: 4px; padding: 1px 7px; font-size: 0.65rem;
            font-weight: 800; white-space: nowrap; margin-top: 3px;
        }
        .sol-step-row { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--color-border); }
        .sol-final-wrap {
            margin-top: 10px; background: var(--color-success-light);
            border: 1px solid var(--color-success-muted); border-radius: 8px; padding: 10px 14px;
        }
        .sol-final-label { font-size: 0.62rem; font-weight: 800; color: var(--color-success); letter-spacing: 2px; margin-bottom: 4px; }
        .sol-final-value { font-size: 0.9rem; font-weight: 700; color: var(--color-success); }

        /* Reflection modal */
        .refl-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
        .refl-title { font-size: 1.1rem; font-weight: 800; color: var(--color-text-primary); margin: 0; }
        .refl-close-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--color-text-muted); line-height: 1; }
        .refl-section-panel { background: var(--color-bg-subtle); border: 1px solid var(--color-border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
        .refl-section-label { font-size: 0.6rem; font-weight: 700; letter-spacing: 2px; color: var(--color-text-muted); text-transform: uppercase; margin-bottom: 6px; }
        .refl-q-text { font-size: 0.88rem; color: var(--color-text-primary); line-height: 1.7; }
        .refl-choices-label { font-size: 0.6rem; font-weight: 700; letter-spacing: 2px; color: var(--color-text-muted); text-transform: uppercase; margin-bottom: 8px; }
        .refl-ans-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 6px; border-radius: 8px; }
        .refl-ans-block { flex: 1; padding: 10px 14px; border-radius: 8px; }
        .refl-ans-label-correct { font-size: 0.6rem; font-weight: 700; letter-spacing: 1.5px; color: var(--color-success); margin-bottom: 2px; }
        .refl-ans-label-wrong { font-size: 0.6rem; font-weight: 700; letter-spacing: 1.5px; color: var(--color-danger); margin-bottom: 2px; }
        .refl-correct-block { flex: 1; padding: 10px 14px; border-radius: 8px; background: var(--color-success-light); border: 1px solid var(--color-success-muted); }
        .refl-insight-panel { background: var(--color-primary-light); border: 1px solid var(--color-primary-muted); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
        .refl-insight-label { font-size: 0.6rem; font-weight: 700; letter-spacing: 2px; color: var(--color-primary); margin-bottom: 6px; }
        .refl-insight-text { font-size: 0.83rem; color: var(--color-primary); line-height: 1.7; }
        .refl-go-btn {
            background: var(--color-primary); color: var(--color-text-inverse); border: none;
            padding: 10px 24px; border-radius: 10px; font-weight: 700; font-size: 0.85rem; cursor: pointer;
        }
        .refl-conf-label { font-weight: 600; margin-bottom: 8px; font-size: 0.82rem; }
        .refl-conf-row { display: flex; gap: 8px; flex-wrap: wrap; }
        .refl-flag-label { display: flex; align-items: center; gap: 6px; margin-top: 8px; cursor: pointer; font-size: 0.8rem; }

        /* Lecture-generated inline content */
        .lec-overview-text { font-size: 0.88rem; color: var(--color-text-secondary); margin-bottom: 1rem; }
        .lec-exam-weight-panel {
            display: flex; align-items: center; gap: 12px; padding: 12px 16px;
            background: var(--color-primary-light); border: 1px solid var(--color-primary-muted);
            border-radius: 10px; margin-bottom: 14px;
        }
        .lec-exam-weight-icon { font-size: 1.8rem; }
        .lec-exam-weight-title { font-size: 0.82rem; font-weight: 700; color: var(--color-primary); }
        .lec-exam-weight-desc { font-size: 0.78rem; color: var(--color-primary); }
        .lec-ref-section-label { font-size: 0.68rem; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--color-primary); margin-bottom: 8px; }
        .lec-ref-panel { background: var(--color-bg-card); border: 1px solid var(--color-border); border-radius: 8px; padding: 12px 14px; }
        .lec-ref-manual-name { font-size: 0.85rem; font-weight: 700; color: var(--color-text-primary); margin-bottom: 6px; }
        .lec-ref-chapter { font-size: 0.78rem; color: var(--color-primary); padding: 3px 0; }
        .lec-standards-label { font-size: 0.68rem; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--color-text-muted); margin-bottom: 8px; }
        .lec-standard-item { font-size: 0.8rem; color: var(--color-text-secondary); padding: 5px 0; border-bottom: 1px solid var(--color-border); }
        .lec-tip-label { font-size: 0.68rem; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--color-warning); margin-bottom: 10px; }
        .lec-tip-card { background: var(--color-warning-light); border: 1px solid var(--color-warning-muted); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; }
        .lec-tip-num { font-size: 0.7rem; font-weight: 800; color: var(--color-warning); margin-right: 6px; }
        .lec-tip-text { font-size: 0.83rem; color: var(--color-text-secondary); line-height: 1.7; }
        .lec-mistake-label { font-size: 0.68rem; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--color-danger); margin-bottom: 10px; margin-top: 16px; }
        .lec-mistake-card { background: var(--color-danger-light); border: 1px solid var(--color-danger-muted); border-radius: 8px; padding: 10px 14px; margin-bottom: 7px; font-size: 0.82rem; color: var(--color-danger); line-height: 1.6; }
        .lec-section-title { font-size: 1.1rem; font-weight: 800; color: var(--color-text-primary); margin-bottom: 4px; }
        .lec-section-meta { font-size: 0.8rem; color: var(--color-text-muted); }
        .lec-empty-state { text-align: center; padding: 3rem; }
        .lec-empty-emoji { font-size: 2rem; margin-bottom: 12px; }
        .lec-empty-text { color: var(--color-text-faint); font-size: 0.88rem; }
        .lec-error-wrap { padding: 2rem; }
        .lec-error-title { font-weight: 700; color: var(--color-text-primary); }
        .lec-error-detail { font-size: 0.82rem; color: var(--color-text-muted); font-family: var(--font-mono); }
        .lec-error-box { font-weight: 800; font-size: 0.88rem; margin-bottom: 6px; }

        /* Practice/Concept question completion */
        .prac-complete-card {
            text-align: center; padding: 3rem 1.5rem;
            background: var(--color-bg-card); border: 1px solid var(--color-border); border-radius: 1rem;
        }
        .prac-complete-emoji { font-size: 3rem; margin-bottom: 12px; }
        .prac-complete-score { font-size: 1.5rem; font-weight: 800; color: var(--color-text-primary); margin-bottom: 4px; }
        .prac-complete-detail { font-size: 0.88rem; color: var(--color-text-muted); margin-bottom: 20px; }
        .prac-badge-math {
            font-size: 0.62rem; font-weight: 700; padding: 2px 8px; border-radius: 4px;
            background: var(--color-primary-light); color: var(--color-primary); margin-left: 4px;
        }
        .prac-badge-concept {
            font-size: 0.62rem; font-weight: 700; padding: 2px 8px; border-radius: 4px;
            background: var(--color-success-light); color: var(--color-success); margin-left: 4px;
        }
        .prac-ref-tag { font-size: 0.68rem; color: var(--color-text-faint); margin-left: auto; }
        .prac-q-text-wrap { white-space: pre-wrap; }
        .prac-diagram-wrap { margin: 12px 0; }
        .prac-result-feedback { margin-top: 16px; margin-bottom: 12px; padding: 0; }

        /* Progress/reflection items */
        .prog-empty-msg { font-family: var(--font-mono); font-size: 0.7rem; color: var(--color-text-faint); padding: 10px 0; }
        .prog-topic-badge {
            font-size: 0.6rem; color: var(--color-text-muted); background: var(--color-bg-subtle);
            padding: 1px 6px; border-radius: 4px; margin-left: 4px;
        }
        .prog-flag-badge { font-size: 0.6rem; color: var(--color-danger); margin-left: 4px; }
        .no-data-msg { color: var(--color-text-faint); font-size: 0.83rem; padding: 10px 0; }

        /* Dashboard activity items */
        .dash-activity-item {
            display: flex; align-items: flex-start; gap: 1rem; padding: 1.25rem;
            border-radius: 1rem; border: 1px solid transparent; transition: all 0.15s;
        }
        .dash-activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; flex-shrink: 0; }
        .dash-activity-body { flex: 1; min-width: 0; }
        .dash-activity-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 4px; }
        .dash-activity-title { font-size: var(--text-sm); font-weight: 700; color: var(--color-text-primary); }
        .dash-activity-time { font-size: 11px; color: var(--color-text-faint); font-weight: 500; white-space: nowrap; }
        .dash-activity-detail { font-size: var(--text-xs); color: var(--color-text-secondary); margin-bottom: 8px; line-height: 1.6; }
        .dash-activity-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
        .dash-activity-tag {
            padding: 2px 8px; border-radius: 4px; font-size: 10px;
            font-weight: 700; text-transform: uppercase;
        }
        .dash-activity-go-btn {
            margin-left: auto; flex-shrink: 0; padding: 4px 12px; border-radius: 8px;
            font-size: 11px; font-weight: 600; color: var(--color-primary);
            background: var(--color-primary-light); border: 1px solid var(--color-primary-muted);
            cursor: pointer; white-space: nowrap;
        }
        .dash-empty-activity { text-align: center; padding: 2.5rem 0; font-size: var(--text-sm); color: var(--color-text-faint); }

        /* Timer bar */
        .timer-bar-wrap { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
        .timer-bar-track { flex: 1; height: 4px; background: var(--color-border); border-radius: 2px; }
        .timer-bar-fill { height: 100%; border-radius: 2px; transition: width 1s linear; }

        /* FQ no-questions error */
        .fq-no-q-wrap { text-align: center; padding: 40px 20px; }
        .fq-no-q-emoji { font-size: 2rem; margin-bottom: 12px; }
        .fq-no-q-title { font-size: 1rem; font-weight: 700; color: var(--color-danger); margin-bottom: 8px; }
        .fq-no-q-desc { font-size: 0.85rem; color: var(--color-text-muted); }

        /* FQ timing grid */
        .fq-timing-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; max-width: 420px; margin: 0 auto; }

        /* Reference manual helpers */
        .ref-icon-external { color: var(--color-text-faint); font-size: 0.85rem; flex-shrink: 0; margin-top: 2px; }
        .ref-manual-body { flex: 1; min-width: 0; }
        .ref-badge-icon { font-size: 0.6rem; vertical-align: -1px; }

        /* Pref settings helpers */
        .pref-section-divider { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--color-border); }
        .pref-name-row { display: flex; gap: var(--space-3); align-items: center; }
        .pref-goal-row { display: flex; align-items: center; gap: var(--space-4); }
        .pref-goal-label-style { width: 5rem; text-align: right; }

        /* Quiz topic list */
        .qz-topic-list { display: flex; flex-wrap: wrap; gap: 8px; }
        .qz-topic-btn {
            padding: 6px 12px; border-radius: 8px; background: var(--color-bg-subtle);
            color: var(--color-text-secondary); border: 1px solid var(--color-border);
            font-size: var(--text-xs); font-weight: 500; cursor: pointer; transition: all 0.15s;
        }
        .qz-topic-btn:hover { background: var(--color-primary-light); color: var(--color-primary); border-color: var(--color-primary-muted); }
        .qz-q-counter { font-size: var(--text-xs); color: var(--color-text-faint); margin-bottom: 12px; font-weight: 500; }
        .qz-topic-label { font-size: 10px; font-weight: 700; letter-spacing: 2px; color: var(--color-primary); text-transform: uppercase; margin-bottom: 8px; }

        /* Flashcard filter buttons */
        .fc-filter-btn {
            padding: 6px 12px; border-radius: 8px; font-size: var(--text-xs);
            font-weight: 700; cursor: pointer; transition: all 0.15s; border: none;
        }
        .fc-filter-btn-active { background: var(--color-primary); color: var(--color-text-inverse); }
        .fc-filter-btn-default { background: var(--color-bg-subtle); color: var(--color-text-secondary); }
        .fc-filter-btn-default:hover { background: var(--color-border); }

        /* Module accordion */
        .mod-subject-title { font-weight: 700; color: var(--color-text-primary); flex: 1; font-size: var(--text-sm); }
        .mod-arrow { font-size: var(--text-xs); color: var(--color-text-faint); transition: transform 0.2s; }

        /* Score badge (dynamic color set by JS) */
        .score-badge-sm { font-size: var(--text-xs); font-weight: 700; }

        /* Note/formula cards */
        .note-card-wrap {
            padding: 1.5rem; border-radius: 1rem; border: 1px solid var(--color-border);
            display: flex; flex-direction: column; gap: 12px;
            transition: box-shadow 0.15s;
        }
        .note-card-wrap:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
        .note-cat-label { font-size: 10px; font-weight: 700; color: var(--color-primary); text-transform: uppercase; letter-spacing: 2px; }
        .note-title { font-weight: 700; color: var(--color-text-primary); }
        .note-formulas { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-xs); color: var(--color-text-secondary); }
        .note-formula-label { color: var(--color-text-faint); }
        .note-vars-section {
            margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--color-border);
            font-size: 11px; color: var(--color-text-faint); display: flex; flex-direction: column; gap: 2px;
        }
        .note-vars-heading { font-weight: 600; color: var(--color-text-muted); margin-bottom: 4px; }
        .note-footer-text { color: var(--color-text-faint); padding-top: 4px; }
        .note-deep-dive-btn {
            margin-top: 12px; font-size: 11px; color: var(--color-primary); font-weight: 600;
            display: flex; align-items: center; gap: 4px; background: none; border: none; cursor: pointer;
        }
        .note-deep-dive-btn:hover { color: var(--color-primary); opacity: 0.8; }
        .note-show-sol-btn { font-size: 11px; color: var(--color-primary); font-weight: 600; background: none; border: none; cursor: pointer; }
        .note-show-sol-btn:hover { opacity: 0.8; }
        .note-sol-content {
            font-size: 11px; color: var(--color-text-secondary); background: var(--color-bg-subtle);
            border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 4px;
        }
        .note-trap-text { color: var(--color-text-faint); }
        .note-table { width:100%; border-collapse:collapse; margin-top:8px; font-size:var(--text-xs); }
        .note-table th, .note-table td { padding:5px 12px; border:1px solid var(--color-border); text-align:center; }
        .note-table th { background:var(--color-bg-subtle); font-weight:700; font-size:var(--text-2xs); text-transform:uppercase; letter-spacing:0.5px; }
        .note-alt-list { margin-top:8px; }
        .note-alt-item { padding:3px 0; font-size:var(--text-xs); color:var(--color-text-secondary); }
        .note-preview-text { font-size:var(--text-xs); color:var(--color-text-muted); font-style:italic; margin-top:6px; }

        /* Module accordion rows */
        .mod-row { border: 1px solid var(--color-border); border-radius: 12px; margin-bottom: 8px; overflow: hidden; }
        .mod-header {
            display: flex; align-items: center; gap: 12px; padding: 16px 20px;
            cursor: pointer; transition: background 0.15s;
        }
        .mod-header:hover { background: var(--color-bg-subtle); }
        .mod-ch-row {
            display: flex; align-items: center; justify-content: space-between;
            padding: 14px 20px 14px 52px; cursor: pointer; transition: background 0.15s;
            min-height: 48px;
        }
        .mod-ch-row:hover { background: var(--color-bg-subtle); }
        .mod-ch-name { font-size: var(--text-base); color: var(--color-text-secondary); font-weight: 500; }
        .mod-fq-row {
            display: flex; align-items: center; justify-content: space-between;
            padding: 12px 20px 12px 52px;
        }
        .mod-fq-inner { display: flex; align-items: center; gap: 12px; }
        .mod-fq-title { font-size: var(--text-sm); font-weight: 700; color: var(--color-text-primary); }

        /* Quiz result detail */
        .qz-score-detail { font-size: var(--text-sm); color: var(--color-text-muted); }
        .qz-result-heading { text-align: center; margin-bottom: 1.5rem; }

        /* Note expand panel */
        .note-expand-content { font-size: 11px; color: var(--color-text-secondary); display: flex; flex-direction: column; gap: 8px; }
        .note-practice-heading { font-size: 11px; font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 2px; }
        .note-practice-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border); display: flex; flex-direction: column; gap: 16px; }
        .note-prob-title { font-size: 11px; font-weight: 600; color: var(--color-text-secondary); }
        .note-prob-text { font-size: 11px; color: var(--color-text-secondary); }
        .note-prob-steps { font-size: 11px; color: var(--color-text-secondary); display: flex; flex-direction: column; gap: 4px; }
        .note-prob-choices { display: flex; flex-direction: column; gap: 4px; }
        .note-prob-choice {
            padding: 0.5rem 0.75rem; border: 1px solid var(--color-border); border-radius: 0.375rem;
            cursor: pointer; transition: background 0.15s, border-color 0.15s;
            font-size: var(--text-sm); color: var(--color-text-primary);
        }
        .note-prob-choice:hover:not(.disabled) { background: var(--color-bg-subtle); border-color: var(--color-primary); }
        .note-choice-correct { background: var(--color-success-light) !important; border-color: var(--color-success) !important; color: var(--color-success) !important; }
        .note-choice-wrong { background: var(--color-danger-light) !important; border-color: var(--color-danger) !important; color: var(--color-danger) !important; }
        .note-prob-choice.disabled { opacity: 0.7; cursor: default; }

/* ── DRILL WRONG ANSWERS ────────────────────────────────────── */
.drill-card {
    background: var(--color-bg-card); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); padding: 1.25rem 1.5rem;
    margin-top: 0.5rem; box-shadow: var(--shadow-xs);
}
.drill-card-desc {
    font-size: 0.85rem; color: var(--color-text-secondary);
    margin: 0 0 1rem 0; line-height: 1.4;
}
.drill-btn {
    display: inline-flex; align-items: center; gap: 0.625rem;
    padding: 0.625rem 1.5rem; border-radius: var(--radius-md);
    font-size: clamp(0.875rem, 1.2vw, 1rem); font-weight: 600;
    background: var(--color-primary); color: #fff;
    border: 1.5px solid var(--color-primary);
    cursor: pointer; transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
    font-family: var(--font-ui);
}
.drill-btn:hover:not(:disabled) {
    background: var(--color-primary-hover, var(--color-primary));
    box-shadow: 0 2px 10px rgba(0,0,0,0.15); transform: translateY(-1px);
}
.drill-btn:active:not(:disabled) { transform: translateY(0); }
.drill-btn:disabled {
    background: var(--color-bg-subtle); color: var(--color-text-muted);
    border-color: var(--color-border); cursor: not-allowed;
}
.drill-btn-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.5rem; height: 1.5rem; padding: 0 0.375rem;
    border-radius: 999px; font-size: 0.75rem; font-weight: 700;
    background: rgba(255,255,255,0.25); color: #fff;
}
.drill-btn:disabled .drill-btn-badge {
    background: var(--color-border); color: var(--color-text-muted);
}
.drill-btn-hint {
    display: inline-block; margin-left: 0.75rem;
    font-size: 0.8rem; color: var(--color-text-muted);
    font-style: italic;
}

/* ── Spaced Review (SM-2) ─────────────────────────────────── */
.sr-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px; border-radius: 11px;
    background: var(--color-primary); color: #fff;
    font-size: var(--text-2xs, 0.7rem); font-weight: 700;
    padding: 0 6px;
}
.sr-interval-note {
    font-size: var(--text-xs, 0.8rem); color: var(--color-text-muted);
    margin-top: 8px; font-style: italic;
}

/* ── Timed Mini-Drill ────────────────────────────────────── */
.mini-timer {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: var(--text-lg, 1.125rem);
    font-weight: 700;
    color: var(--color-text-primary);
    text-align: center;
    padding: 6px 14px;
    border-radius: var(--radius-md, 8px);
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
}
.mini-timer.warning {
    color: var(--color-danger);
    background: var(--color-danger-light);
    border-color: var(--color-danger-muted, var(--color-danger));
    animation: mini-pulse 1s ease-in-out infinite;
}
@keyframes mini-pulse { 0%,100% { opacity:1; } 50% { opacity:0.6; } }

/* ── Bookmarked Questions ──────────────────────────────────── */
.bookmark-grid { display:flex; flex-direction:column; gap:8px; }
.bookmark-card {
    background:var(--color-bg-card);
    border:1px solid var(--color-border);
    border-radius:var(--radius-md);
    padding:12px 16px;
    transition:border-color 0.15s;
}
.bookmark-card:hover { border-color:var(--color-primary-muted); }
.bookmark-card-header { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.bookmark-qid { font-family:var(--font-mono); font-size:var(--text-2xs); color:var(--color-text-muted); }
.bookmark-topic { font-size:var(--text-xs); color:var(--color-primary); font-weight:500; }
.bookmark-remove-btn {
    margin-left:auto; background:none; border:none; color:var(--color-text-faint);
    cursor:pointer; font-size:var(--text-sm); padding:2px 6px; border-radius:4px;
}
.bookmark-remove-btn:hover { background:var(--color-danger-light); color:var(--color-danger); }
.bookmark-question { font-size:var(--text-sm); color:var(--color-text-secondary); line-height:1.5; margin-bottom:6px; }
.bookmark-meta { font-size:var(--text-xs); color:var(--color-text-muted); }

/* ══════════════════════════════════════════════════════════════
   FORMULA REFERENCE — Floating Action Button + Slide Panel
   ══════════════════════════════════════════════════════════════ */

/* FAB button — bottom-right corner */
.formula-fab {
    position: fixed; bottom: 24px; right: 24px; z-index: 90;
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--color-primary); color: #fff; border: none;
    font-size: 1.2rem; cursor: pointer; box-shadow: var(--shadow-lg);
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
.formula-fab:hover { transform: scale(1.1); box-shadow: var(--shadow-xl); }
.formula-fab:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
}

/* Slide-in panel from right edge */
.formula-slide-panel {
    position: fixed; top: 0; right: -380px; width: 360px; height: 100vh;
    background: var(--color-bg-card); border-left: 1px solid var(--color-border);
    box-shadow: var(--shadow-xl); z-index: 95; transition: right 0.3s ease;
    display: flex; flex-direction: column; overflow: hidden;
}
.formula-slide-panel.panel-open { right: 0; }

.formula-slide-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.formula-slide-search {
    margin: 12px 16px; padding: 8px 12px; border: 1px solid var(--color-border);
    border-radius: 6px; font-size: var(--text-sm); background: var(--color-bg-subtle);
    color: var(--color-text-primary); outline: none; flex-shrink: 0;
}
.formula-slide-search:focus { border-color: var(--color-primary); }

/* Scrollable card container */
#formula-slide-content {
    flex: 1; overflow-y: auto; padding: 0 16px 16px;
}

/* Section headers — sticky within scroll area */
.fsp-section-hd {
    font-size: var(--text-2xs); font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; color: var(--color-primary);
    padding: 8px 12px; border-radius: var(--radius-sm);
    background: var(--color-primary-light);
    border-left: 3px solid var(--color-primary);
    margin: 12px 0 8px; position: sticky; top: 0;
    z-index: 1;
}

/* Individual formula cards */
.fsp-card {
    padding: 8px 0; border-bottom: 1px solid var(--color-border);
}
.fsp-name { font-size: var(--text-sm); font-weight: 600; color: var(--color-text-primary); }
.fsp-latex { font-size: var(--text-sm); color: var(--color-text-secondary); margin: 4px 0; }
.fsp-note  { font-size: var(--text-xs); color: var(--color-text-muted); }

/* Responsive: full-width on narrow screens */
@media (max-width: 480px) {
    .formula-slide-panel { width: 100vw; right: -105vw; }
    .formula-fab { bottom: 16px; right: 16px; width: 44px; height: 44px; }
}

/* ══════════════════════════════════════════════════════════════
   PERFORMANCE INSIGHTS (Analytics Page)
   ══════════════════════════════════════════════════════════════ */
.insights-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
@media (max-width:768px) { .insights-grid { grid-template-columns:1fr; } }
.insight-card {
    background:var(--color-bg-card);
    border:1px solid var(--color-border);
    border-radius:var(--radius-lg);
    padding:16px;
    box-shadow:var(--shadow-xs);
}
.insight-card-title {
    font-size:var(--text-sm);
    font-weight:700;
    color:var(--color-text-primary);
    margin-bottom:12px;
    text-transform:uppercase;
    letter-spacing:0.5px;
}

/* Score Trend Bars */
.trend-chart { position:relative; height:140px; }
.trend-bars { display:flex; align-items:flex-end; height:120px; gap:2px; padding-bottom:20px; }
.trend-bar-wrap { display:flex; flex-direction:column; align-items:center; justify-content:flex-end; height:100%; }
.trend-bar { width:80%; border-radius:3px 3px 0 0; min-height:4px; transition:height 0.3s; }
.trend-bar-label { font-size:0.6rem; color:var(--color-text-muted); margin-top:4px; }
.trend-pass-line { position:absolute; left:0; right:0; border-top:2px dashed var(--color-success); opacity:0.4; }

/* Weak Topics */
.weak-topic-row { display:flex; align-items:center; gap:8px; padding:4px 0; }
.weak-topic-label { font-size:var(--text-xs); font-weight:600; color:var(--color-text-secondary); min-width:50px; }
.weak-topic-bar-track { flex:1; height:8px; background:var(--color-bg-subtle); border-radius:4px; overflow:hidden; }
.weak-topic-bar-fill { height:100%; border-radius:4px; transition:width 0.3s; }
.weak-topic-pct { font-size:var(--text-xs); font-weight:700; min-width:35px; text-align:right; }

/* ══════════════════════════════════════════════════════════════
   NCEES HANDBOOK QUICK REFERENCE
   ══════════════════════════════════════════════════════════════ */
.qref-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
}
.qref-section { margin-bottom: 12px; }
.qref-section-hd {
    font-size: var(--text-2xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-primary);
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
}
.qref-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 5px 0;
    border-bottom: 1px solid var(--color-bg-sunken);
    font-size: var(--text-sm);
}
.qref-topic { color: var(--color-text-primary); flex: 1; }
.qref-handbook {
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    text-align: right;
    white-space: nowrap;
    margin-left: 16px;
}

/* ══════════════════════════════════════════════════════════════
   ACCESSIBILITY: FOCUS VISIBLE + SKIP LINK
   ══════════════════════════════════════════════════════════════ */

/* Global focus-visible outline for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Answer buttons — extra ring for visibility */
.qz-ans-btn:focus-visible, .prac-opt-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--color-primary-light);
}

/* Sidebar links — inset outline so it stays within the nav */
.sidebar-link:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
    background: var(--color-nav-active-bg);
}

/* General buttons */
.btn:focus-visible, .reveal-btn:focus-visible, .diff-badge:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Remove default outline for mouse users */
:focus:not(:focus-visible) { outline: none; }

/* Skip-to-content link — hidden until focused */
.skip-to-content {
    position: absolute; top: -100px; left: 16px; z-index: 9999;
    background: var(--color-primary); color: #fff; padding: 8px 16px;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    font-size: var(--text-sm); font-weight: 600;
    transition: top 0.2s; text-decoration: none;
}
.skip-to-content:focus { top: 0; }

/* ══════════════════════════════════════════════════════════════
   COMPARISON TABLES
   ══════════════════════════════════════════════════════════════ */
.comp-table-card { background:var(--color-bg-card); border:1px solid var(--color-border);
    border-radius:var(--radius-lg); margin-bottom:16px; overflow:hidden; box-shadow:var(--shadow-xs); }
.comp-table-cat { font-size:var(--text-2xs); font-weight:700; text-transform:uppercase;
    letter-spacing:1px; color:var(--color-primary); padding:12px 16px 0; }
.comp-table-title { font-size:var(--text-lg); font-weight:700; padding:4px 16px 12px;
    color:var(--color-text-primary); }
.comp-table-scroll { overflow-x:auto; }
.comp-table { width:100%; border-collapse:collapse; font-size:var(--text-sm); }
.comp-table th { background:var(--color-bg-subtle); font-weight:700; text-align:left;
    padding:10px 14px; border-bottom:2px solid var(--color-border); font-size:var(--text-xs);
    text-transform:uppercase; letter-spacing:0.5px; white-space:nowrap; }
.comp-table td { padding:8px 14px; border-bottom:1px solid var(--color-border);
    color:var(--color-text-secondary); }
.comp-table .comp-feature { font-weight:600; color:var(--color-text-primary); white-space:nowrap; }
.comp-table tr:last-child td { border-bottom:none; }
.comp-table tr:hover td { background:var(--color-bg-subtle); }

/* ══════════════════════════════════════════════════════════════
   PRINT MODE
   ══════════════════════════════════════════════════════════════ */
@media print {
    /* Hide non-content elements */
    .sidebar, .dash-header, .dash-search-wrap,
    .qz-progress-bar-wrap, .prac-progress-bar, .prac-paginator,
    .qz-q-counter, .reveal-btn, .conf-btn, .refl-conf-row,
    .refl-flag-label, .reflection-panel,
    .qz-next-btn, .qz-retry-btn, .qz-review-btn,
    .ex-nav-arrow, .ex-pill-scroll, .ex-timer, .ex-nav-grid, .ex-grid-toggle, .ex-timer-warning,
    .diagram-zoom-btn, .note-expand-btn,
    .btn, button:not(.qz-ans-btn),
    .svg-zoom-overlay, .note-modal-overlay,
    .shortcut-help-overlay, #shortcut-help-overlay,
    .formula-fab, .formula-slide-panel,
    .sr-section, .drill-section, .mini-drill-section,
    .bookmark-section { display: none !important; }

    /* Full width content */
    .main-content { margin-left: 0 !important; width: 100% !important; padding: 0 !important; }
    .page-section { padding: 1rem !important; }

    /* Expand cards */
    .qz-question-card, .qb-card, .prac-q-card, .concept-q-card {
        box-shadow: none !important; border: 1px solid #ccc !important;
        break-inside: avoid; margin-bottom: 1rem;
    }

    /* Show solutions */
    .qz-sol-panel, .qz-sol-box, .prac-sol-panel, .concept-insight-panel {
        display: block !important;
    }
    .sol-breakdown { margin: 0.5rem 0 !important; }

    /* Typography for print */
    body { font-size: 11pt !important; color: #000 !important; background: #fff !important; }
    .qz-q-text, .qb-question-text, .prac-q-text { font-size: 11pt !important; color: #000 !important; }

    /* Answer buttons as text list */
    .qz-ans-btn { border: 1px solid #ddd !important; background: #fff !important;
        color: #000 !important; page-break-inside: avoid; }
    .qz-ans-btn.correct { background: #e8f5e9 !important; border-color: #4caf50 !important; }
    .qz-ans-btn.wrong { background: #ffebee !important; border-color: #f44336 !important; }

    /* SVG diagrams print */
    .question-diagram svg { max-width: 100% !important; max-height: none !important; }

    /* Solution sections */
    .sol-section { border-bottom: 1px solid #ddd !important; }
    .sol-step-num { background: #333 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    /* Page breaks */
    .qb-card, .qz-question-card { page-break-inside: avoid; }
    h1, h2, h3 { page-break-after: avoid; }

    /* Study notes print enhancements */
    .note-card-wrap { break-inside: avoid; border: 1px solid #ccc !important; margin-bottom: 1rem; }
    .note-expand-panel { display: block !important; }
    .note-expand-btn { display: none !important; }
    .comp-table-card { break-inside: avoid; }
    .qref-card { break-inside: avoid; }

    /* Quiz results print */
    .qz-score-ring { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .offline-banner { display: none !important; }
}

/* ─── PWA: Offline Banner ─── */
.offline-banner {
    position: fixed; top: 0; left: 0; right: 0; z-index: 10000;
    padding: 8px 16px; text-align: center;
    font-size: var(--text-xs); font-weight: 600; font-family: var(--font-ui);
}
.offline-banner--warn { background: #fef3c7; color: #92400e; }
.offline-banner--info { background: #dbeafe; color: #1e40af; }
[data-theme="dark"] .offline-banner--warn { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .offline-banner--info { background: #1e3a5f; color: #93c5fd; }

/* ─── Study Hub ─── */

/* Layout containers */
.rm-hero    { margin-bottom: 1.5rem; }
.rm-stats   { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.rm-cols    { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.rm-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.rm-history { margin-bottom: 1.5rem; }

/* Hero card */
.rm-hero-card {
    display: flex; align-items: center; gap: 2rem;
    background: var(--color-bg-card); border-radius: 12px;
    padding: 2rem; border: 1px solid var(--color-border);
}
.rm-hero-empty .rm-title { font-size: 1.25rem; margin-bottom: 0.5rem; }
.rm-hero-left { flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.rm-hero-right { flex: 1; min-width: 0; }

/* Gauge */
.rm-gauge { display: block; }

/* Title & subtitle */
.rm-title { font-size: 1.3rem; font-weight: 700; color: var(--color-text-primary); margin: 0 0 0.25rem; line-height: 1.3; }
.rm-subtitle { font-size: 0.9rem; color: var(--color-text-secondary); margin: 0 0 0.75rem; }

/* Exam countdown */
.rm-countdown { font-size: 0.85rem; color: var(--color-text-secondary); margin: 0 0 0.5rem; }
.rm-countdown-warn { color: var(--color-warning); font-weight: 600; }
.rm-countdown-urgent { color: var(--color-danger); font-weight: 700; }

/* Recommendation box */
.rm-rec {
    background: rgba(186, 117, 23, 0.08); border-left: 4px solid #BA7517;
    padding: 0.75rem 1rem; border-radius: 0 8px 8px 0;
    font-size: 0.85rem; color: var(--color-text-primary);
    margin-bottom: 0.75rem; line-height: 1.5;
}
[data-theme="dark"] .rm-rec { background: rgba(186, 117, 23, 0.15); }

/* Gaps */
.rm-gaps { font-size: 0.8rem; color: var(--color-text-secondary); margin-bottom: 0.75rem; }
.rm-gaps-title { font-weight: 600; margin: 0 0 0.25rem; color: var(--color-danger); }
.rm-gaps ul { margin: 0; padding-left: 1.25rem; }
.rm-gaps li { margin-bottom: 0.15rem; }

/* Session length toggle */
.rm-session-length {
    display: flex; align-items: center; gap: 0.5rem;
    margin-bottom: 1rem; flex-wrap: wrap;
}
.rm-session-label { font-size: 0.8rem; color: var(--color-text-secondary); }
.rm-session-btn {
    padding: 4px 12px; border-radius: 6px; font-size: 0.8rem; font-weight: 600;
    border: 1px solid var(--color-border); background: var(--color-bg-card);
    color: var(--color-text-secondary); cursor: pointer; transition: all 0.15s;
}
.rm-session-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.rm-session-btn.active {
    background: var(--color-primary); color: #fff;
    border-color: var(--color-primary);
}
.rm-session-est { font-size: 0.75rem; color: var(--color-text-muted); }

/* Hero buttons */
.rm-hero-btns { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.rm-btn {
    padding: 10px 20px; border-radius: 8px; font-size: 0.9rem; font-weight: 600;
    cursor: pointer; border: none; transition: all 0.15s; font-family: var(--font-ui);
}
.rm-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.rm-btn-primary { background: var(--color-primary); color: #fff; }
.rm-btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.rm-btn-outline {
    background: transparent; color: var(--color-primary);
    border: 2px solid var(--color-primary);
}
.rm-btn-outline:hover:not(:disabled) { background: rgba(83, 74, 183, 0.08); }

/* Stat cards */
.rm-stat {
    background: var(--color-bg-card); border-radius: 10px;
    padding: 1.25rem 1rem; text-align: center;
    border: 1px solid var(--color-border);
}
.rm-stat-value {
    font-size: 1.75rem; font-weight: 700; color: var(--color-text-primary);
    font-family: var(--font-data, 'JetBrains Mono', monospace); line-height: 1.2;
}
.rm-stat-green { color: var(--color-success, #1D9E75); }
.rm-stat-red { color: var(--color-danger, #E24B4A); }
.rm-stat-label {
    font-size: 0.8rem; color: var(--color-text-secondary);
    text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.25rem;
}

@media (max-width: 768px) {
    .rm-hero-card { flex-direction: column; text-align: center; gap: 1.25rem; padding: 1.5rem; }
    .rm-hero-right { text-align: left; }
    .rm-hero-btns { justify-content: center; }
    .rm-stats { grid-template-columns: 1fr 1fr; }
    .rm-cols { grid-template-columns: 1fr; }
}

/* Clickable stat cards */
.rm-stat-click { cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.rm-stat-click:hover { border-color: var(--color-primary-muted); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

/* Panels — weakest topics + mistake journal */
.rm-panel {
    background: var(--color-bg-card); border-radius: 10px;
    padding: 1.25rem; border: 1px solid var(--color-border);
    align-self: start;
}
.rm-panel-title { font-size: 1rem; font-weight: 700; margin: 0 0 1rem; color: var(--color-text-primary); }
.rm-empty { font-size: 0.85rem; color: var(--color-text-muted); line-height: 1.5; }

/* Weakest topics */
.rm-weak-list { max-height: 400px; overflow-y: auto; padding-right: 0.25rem; }
.rm-weak-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.rm-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.rm-dot-red { background: var(--color-danger); }
.rm-dot-amber { background: var(--color-warning); }
.rm-dot-green { background: var(--color-success); }
.rm-weak-info { flex: 1; min-width: 0; }
.rm-weak-label { font-size: 0.8rem; color: var(--color-text-primary); display: block; margin-bottom: 0.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-weak-bar-track { height: 6px; border-radius: 3px; background: var(--color-bg-subtle); overflow: hidden; }
.rm-weak-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.rm-weak-pct { font-size: 0.8rem; font-weight: 600; color: var(--color-text-secondary); font-family: var(--font-data, monospace); width: 36px; text-align: right; }
.rm-link-btn {
    background: none; border: none; color: var(--color-primary); cursor: pointer;
    font-size: 0.8rem; font-weight: 600; padding: 0.5rem 0 0; font-family: var(--font-ui);
}
.rm-link-btn:hover { text-decoration: underline; }

/* Journal tabs */
.rm-journal-tabs {
    display: flex; border-bottom: 2px solid var(--color-border); margin-bottom: 1rem; gap: 0;
}
.rm-journal-tab {
    flex: 1; padding: 0.6rem 0.5rem; text-align: center; font-size: 0.8rem; font-weight: 600;
    background: none; border: none; border-bottom: 2px solid transparent;
    color: var(--color-text-muted); cursor: pointer; font-family: var(--font-ui);
    margin-bottom: -2px; transition: all 0.15s;
}
.rm-journal-tab:hover { color: var(--color-text-primary); }
.rm-journal-tab.active {
    color: var(--color-primary); border-bottom-color: var(--color-primary);
}

/* Mistake journal */
.rm-panel-count {
    font-size: 0.75rem; font-weight: 700; background: var(--color-danger-light); color: #991b1b;
    padding: 2px 8px; border-radius: 10px; margin-left: 0.5rem; vertical-align: middle;
}
[data-theme="dark"] .rm-panel-count { background: #7f1d1d; color: #fca5a5; }
.rm-journal-list { max-height: 400px; overflow-y: auto; padding-right: 0.25rem; }
.rm-journal-attempt {
    font-size: 0.6rem; font-weight: 700; padding: 2px 6px; border-radius: 4px;
    background: var(--color-warning-light); color: #92400e;
    text-transform: uppercase; letter-spacing: 0.3px;
}
[data-theme="dark"] .rm-journal-attempt { background: #78350f; color: #fde68a; }
.rm-panel-count-green { background: var(--color-success-light); color: #065f46; }
[data-theme="dark"] .rm-panel-count-green { background: #064e3b; color: #6ee7b7; }
.rm-journal-redeemed { border-left: 3px solid var(--color-success); }
.rm-journal-status-ok {
    font-size: 0.65rem; font-weight: 600; padding: 2px 8px; border-radius: 4px;
    background: var(--color-success-light); color: #065f46;
}
[data-theme="dark"] .rm-journal-status-ok { background: #064e3b; color: #6ee7b7; }
.rm-journal-attempts-ok {
    font-size: 0.6rem; font-weight: 600; color: var(--color-text-muted); font-style: italic;
}
.rm-journal-item {
    padding: 0.75rem; border-radius: 8px; margin-bottom: 0.5rem;
    background: var(--color-bg-subtle); cursor: pointer;
    border: 1px solid transparent; transition: border-color 0.15s;
}
.rm-journal-item:hover { border-color: var(--color-primary-muted); }
.rm-journal-top { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; }
.rm-journal-badge {
    font-size: 0.65rem; font-weight: 700; padding: 2px 8px; border-radius: 4px;
    background: var(--color-primary-light); color: var(--color-primary);
    text-transform: uppercase; letter-spacing: 0.5px;
}
[data-theme="dark"] .rm-journal-badge { background: #1e1b4b; color: #a5b4fc; }
.rm-journal-status {
    font-size: 0.65rem; font-weight: 600; padding: 2px 8px; border-radius: 4px;
    background: var(--color-danger-light); color: #991b1b;
}
[data-theme="dark"] .rm-journal-status { background: #7f1d1d; color: #fca5a5; }
.rm-journal-status-learned {
    font-size: 0.65rem; font-weight: 600; padding: 2px 8px; border-radius: 4px;
    background: #dbeafe; color: #1e40af;
}
[data-theme="dark"] .rm-journal-status-learned { background: #1e3a5f; color: #93c5fd; }
.rm-journal-status-warn {
    font-size: 0.65rem; font-weight: 600; padding: 2px 8px; border-radius: 4px;
    background: #fef3c7; color: #92400e;
}
[data-theme="dark"] .rm-journal-status-warn { background: #78350f; color: #fcd34d; }
.refl-conf-title {
    font-size: 0.9rem; font-weight: 700; color: var(--color-text-primary);
    margin: 0 0 0.25rem; padding: 0;
}
.rm-journal-q { font-size: 0.8rem; color: var(--color-text-primary); margin: 0; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rm-journal-note { font-size: 0.75rem; color: var(--color-text-muted); margin: 0.25rem 0 0; font-style: italic; }
.rm-journal-nudge { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--color-border); }
.rm-journal-nudge p { font-size: 0.8rem; color: var(--color-text-secondary); margin: 0; line-height: 1.5; }
.rm-journal-nudge a { color: var(--color-primary); font-weight: 600; text-decoration: none; }
.rm-journal-nudge a:hover { text-decoration: underline; }

/* Chapter Progress Modal */
.rm-chapter-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 9000; overflow-y: auto;
    padding: 2rem; justify-content: center; align-items: flex-start;
}
.rm-chapter-overlay.open { display: flex; }
.rm-modal {
    background: var(--color-bg-card); border-radius: 14px;
    width: 100%; max-width: 1000px; margin: 0 auto;
    border: 1px solid var(--color-border); box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    overflow: hidden;
}
.rm-modal-hd {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--color-border);
}
.rm-modal-title { font-size: 1.15rem; font-weight: 700; margin: 0; }
.rm-modal-close {
    background: none; border: none; font-size: 1.5rem; cursor: pointer;
    color: var(--color-text-muted); line-height: 1; padding: 0.25rem;
}
.rm-modal-close:hover { color: var(--color-text-primary); }
.rm-modal-body { padding: 1.25rem 1.5rem; max-height: 70vh; overflow-y: auto; }
.rm-modal-subject { margin-bottom: 1.5rem; }
.rm-modal-subj-title { font-size: 0.95rem; font-weight: 700; margin: 0 0 0.75rem; color: var(--color-text-primary); }
.rm-modal-subj-weight { font-weight: 400; color: var(--color-text-muted); font-size: 0.8rem; }
/* V2: Enhanced chapter cards — 2-column grid */
.rm-modal-chapters-v2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.rm-ch-card-v2 {
    display: flex; gap: 0.65rem; padding: 0.65rem 0.75rem; border-radius: 10px;
    background: var(--color-bg-subtle); border: 1px solid var(--color-border);
}
.rm-ch-gauge-col { flex-shrink: 0; display: flex; align-items: flex-start; padding-top: 0.1rem; }
.rm-ch-info-v2 { flex: 1; min-width: 0; }
.rm-ch-header-v2 { margin-bottom: 0.3rem; }
.rm-ch-name-v2 { font-size: 0.78rem; font-weight: 600; color: var(--color-text-primary); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-ch-total-qs { font-size: 0.65rem; color: var(--color-text-muted); }
.rm-ch-metric { display: flex; align-items: center; gap: 0.35rem; margin-bottom: 0.2rem; }
.rm-ch-metric-label { font-size: 0.6rem; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.3px; width: 48px; flex-shrink: 0; }
.rm-ch-bar-track { flex: 1; height: 5px; border-radius: 3px; background: var(--color-border); overflow: hidden; }
.rm-ch-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; min-width: 2px; }
.rm-ch-bar-coverage { background: var(--color-primary); opacity: 0.7; }
.rm-ch-bar-green { background: var(--color-success); }
.rm-ch-bar-amber { background: var(--color-warning); }
.rm-ch-bar-red { background: var(--color-danger); }
.rm-ch-metric-val { font-size: 0.6rem; color: var(--color-text-secondary); font-family: var(--font-data, monospace); width: 75px; text-align: right; flex-shrink: 0; }
.rm-ch-improvement { display: flex; align-items: center; gap: 0.3rem; margin-top: 0.2rem; font-size: 0.65rem; flex-wrap: wrap; }
.rm-ch-first { color: var(--color-text-muted); }
.rm-ch-arrow { color: var(--color-text-muted); }
.rm-ch-now { color: var(--color-text-primary); font-weight: 600; }
.rm-ch-delta { font-weight: 700; padding: 1px 5px; border-radius: 4px; font-size: 0.65rem; }
.rm-ch-up { color: #065f46; background: var(--color-success-light); }
.rm-ch-down { color: #991b1b; background: var(--color-danger-light); }
.rm-ch-flat { color: var(--color-text-muted); background: var(--color-bg-subtle); }
[data-theme="dark"] .rm-ch-up { color: #6ee7b7; background: #064e3b; }
[data-theme="dark"] .rm-ch-down { color: #fca5a5; background: #7f1d1d; }
/* Tooltips — use title attribute (native browser tooltip) */
[data-tip] { cursor: help; }

.rm-ch-remaining { font-size: 0.7rem; color: var(--color-danger); font-weight: 600; margin-top: 0.2rem; }
.rm-ch-not-attempted { font-size: 0.75rem; color: var(--color-text-muted); font-style: italic; margin-bottom: 0.4rem; }
.rm-ch-study-btn {
    font-size: 0.7rem; font-weight: 600; padding: 4px 12px; border-radius: 6px;
    background: var(--color-primary-light); color: var(--color-primary); border: 1px solid var(--color-primary-muted);
    cursor: pointer; font-family: var(--font-ui); transition: all 0.15s;
}
.rm-ch-study-btn:hover { background: var(--color-primary); color: #fff; }

/* Legacy chapter grid */
.rm-modal-chapters { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.rm-ch-num { font-size: 0.75rem; font-weight: 700; color: var(--color-text-secondary); }

/* Drill count selector */
.rm-drill-selector { text-align: center; padding: 2rem 1rem; }
.rm-drill-selector-title { font-size: 1.2rem; font-weight: 700; margin: 0 0 0.5rem; }
.rm-drill-selector-desc { font-size: 0.9rem; color: var(--color-text-secondary); margin: 0 0 1.25rem; }
.rm-drill-options { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }
.rm-drill-opt {
    padding: 0.6rem 1.25rem; border-radius: 8px; font-size: 0.95rem; font-weight: 700;
    border: 2px solid var(--color-border); background: var(--color-bg-card);
    color: var(--color-text-primary); cursor: pointer; transition: all 0.15s;
    font-family: var(--font-data, monospace); min-width: 52px;
}
.rm-drill-opt:hover:not(:disabled) { border-color: var(--color-primary); color: var(--color-primary); }
.rm-drill-opt.disabled { opacity: 0.3; cursor: not-allowed; }
.rm-drill-opt-all { border-color: var(--color-primary); color: var(--color-primary); }
.rm-drill-opt-all:hover { background: var(--color-primary); color: #fff; }

/* ── Unified session tags (all pills same shape/size) ── */
.smart-tag {
    display: inline-flex; align-items: center;
    font-size: var(--text-2xs, 0.68rem); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; padding: 3px 8px; border-radius: var(--radius-sm, 4px);
    background: var(--color-bg-subtle); color: var(--color-text-secondary);
    white-space: nowrap;
}
.smart-tag.concept { background: #dbeafe; color: #1e40af; }
.smart-tag.math { background: #fef3c7; color: #92400e; }
.smart-tag.session { background: #d1fae5; color: #065f46; }
.smart-tag.drill { background: var(--color-warning-light, #fff7ed); color: #92400e; }
.smart-tag.easy { background: var(--color-success-light); color: #065f46; }
.smart-tag.medium { background: var(--color-warning-light); color: #92400e; }
.smart-tag.hard { background: var(--color-danger-light); color: #991b1b; }
.smart-tag.exam { background: #ede9fe; color: #5b21b6; }
.smart-tag.recent-wrong { background: #fee2e2; color: #991b1b; }
.smart-tag.spaced-due { background: #ede9fe; color: #5b21b6; }
.smart-tag.weak-topic { background: #fef3c7; color: #92400e; }
.smart-tag.unseen { background: #dbeafe; color: #1e40af; }
[data-theme="dark"] .smart-tag { background: var(--color-bg-card); color: var(--color-text-muted); }
[data-theme="dark"] .smart-tag.concept { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .smart-tag.math { background: #422006; color: #fcd34d; }
[data-theme="dark"] .smart-tag.session { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .smart-tag.drill { background: #422006; color: #fcd34d; }
[data-theme="dark"] .smart-tag.easy { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .smart-tag.medium { background: #422006; color: #fcd34d; }
[data-theme="dark"] .smart-tag.hard { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .smart-tag.exam { background: #2e1065; color: #c4b5fd; }
[data-theme="dark"] .smart-tag.recent-wrong { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .smart-tag.spaced-due { background: #2e1065; color: #c4b5fd; }
[data-theme="dark"] .smart-tag.weak-topic { background: #422006; color: #fcd34d; }
[data-theme="dark"] .smart-tag.unseen { background: #1e3a5f; color: #93c5fd; }

@media (max-width: 768px) {
    .rm-modal-chapters { grid-template-columns: 1fr; }
    .rm-chapter-overlay { padding: 1rem; }
    .rm-ch-metric-label { width: 45px; }
    .rm-ch-metric-val { width: 70px; }
}

/* ── Self-Assessment collapsible chapter groups ── */
.sa-chapter-group { margin-bottom: 0.5rem; }
.sa-chapter-summary {
    font-size: 0.82rem; font-weight: 700; color: var(--color-text-secondary);
    cursor: pointer; padding: 0.4rem 0.25rem; border-bottom: 1px solid var(--color-border);
    list-style: none; display: flex; align-items: center; gap: 0.5rem;
}
.sa-chapter-summary::-webkit-details-marker { display: none; }
.sa-chapter-summary::before { content: '▸'; font-size: 0.7rem; color: var(--color-text-muted); transition: transform 0.15s; }
.sa-chapter-group[open] > .sa-chapter-summary::before { transform: rotate(90deg); }
.sa-chapter-summary:hover { color: var(--color-text-primary); }

/* ─── Session History ─── */
.rm-sh-list { display: flex; flex-direction: column; }
.rm-sh-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.6rem 0; border-bottom: 1px solid var(--color-border);
    font-size: 0.85rem;
}
.rm-sh-item:last-child { border-bottom: none; }
.rm-sh-hidden { display: none; }
.rm-sh-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.rm-sh-green { background: #059669; }
.rm-sh-amber { background: #d97706; }
.rm-sh-red   { background: #dc2626; }
.rm-sh-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.rm-sh-topic {
    font-weight: 600; color: var(--color-text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rm-sh-meta { font-size: 0.75rem; color: var(--color-text-muted); }
.rm-sh-score {
    font-weight: 700; font-size: 0.85rem; flex-shrink: 0; text-align: right;
}
.rm-sh-score.rm-sh-green { color: #059669; background: none; }
.rm-sh-score.rm-sh-amber { color: #d97706; background: none; }
.rm-sh-score.rm-sh-red   { color: #dc2626; background: none; }
.rm-sh-score small { font-weight: 400; font-size: 0.75rem; color: var(--color-text-muted); }
.rm-sh-retake {
    padding: 3px 10px; font-size: 0.7rem; font-weight: 600;
    color: var(--color-primary); background: var(--color-primary-light);
    border: 1px solid var(--color-primary-muted); border-radius: 6px;
    cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.rm-sh-retake:hover { background: var(--color-primary-muted); }
.rm-sh-toggle {
    display: block; width: 100%; text-align: center; margin-top: 0.5rem;
    font-size: 0.8rem; font-weight: 600; color: var(--color-primary);
    background: none; border: none; cursor: pointer; padding: 0.4rem;
}
.rm-sh-toggle:hover { text-decoration: underline; }

/* Dark mode session history */
[data-theme="dark"] .rm-sh-score.rm-sh-green { color: #34d399; }
[data-theme="dark"] .rm-sh-score.rm-sh-amber { color: #fbbf24; }
[data-theme="dark"] .rm-sh-score.rm-sh-red   { color: #f87171; }

/* =====================================================================
   MENTORSHIP PATH — Onboarding & Welcome Flow
   ===================================================================== */
.mp-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(15, 23, 42, 0.85);
    display: flex; align-items: center; justify-content: center;
    overflow-y: auto; padding: 20px;
}
.mp-overlay-dialog {
    max-width: 640px; width: 100%;
    background: var(--color-bg-card, #fff);
    border-radius: 20px; padding: 40px 36px 32px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    position: relative;
    animation: mp-slide-in 0.35s ease-out;
}
@keyframes mp-slide-in {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}
.mp-dots {
    display: flex; justify-content: center; gap: 8px; margin-top: 24px;
}
.mp-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--color-border, #e2e8f0);
    transition: background 0.2s, transform 0.2s;
}
.mp-dot.active { background: var(--color-primary, #6366f1); transform: scale(1.3); }
.mp-dot.done { background: var(--color-primary, #6366f1); opacity: 0.5; }
.mp-welcome-screen, .mp-onboard-screen { text-align: center; }
.mp-welcome-icon { font-size: 48px; margin-bottom: 12px; }
.mp-welcome-title, .mp-onboard-title {
    font-size: 1.5rem; font-weight: 700; margin: 0 0 8px;
    color: var(--color-text, #1e293b);
}
.mp-welcome-subtitle, .mp-onboard-subtitle {
    font-size: 0.95rem; color: var(--color-text-secondary, #64748b); margin: 0 0 24px;
}
.mp-welcome-stats {
    font-size: 1rem; color: var(--color-text-secondary, #64748b); margin: 0 0 28px;
}
.mp-welcome-note {
    font-size: 0.9rem; color: var(--color-text-secondary, #64748b);
    margin: 20px 0 0; font-style: italic;
}
.mp-welcome-actions {
    display: flex; justify-content: center; gap: 12px; margin-top: 28px; flex-wrap: wrap;
}
.mp-btn {
    padding: 10px 24px; border-radius: 10px; font-size: 0.95rem;
    font-weight: 600; cursor: pointer; border: none;
    transition: background 0.15s, transform 0.1s;
}
.mp-btn:active { transform: scale(0.97); }
.mp-btn-primary { background: var(--color-primary, #6366f1); color: #fff; }
.mp-btn-primary:hover { filter: brightness(1.1); }
.mp-btn-secondary {
    background: var(--color-background-secondary, #f1f5f9);
    color: var(--color-text, #1e293b);
}
.mp-btn-secondary:hover { filter: brightness(0.95); }
.mp-btn-link {
    background: none; color: var(--color-text-secondary, #64748b);
    text-decoration: underline; padding: 10px 12px;
}
.mp-milestone-path {
    display: flex; flex-direction: column; gap: 10px;
    max-width: 320px; margin: 0 auto 8px; text-align: left;
}
.mp-milestone-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; border-left: 3px solid;
    border-radius: 0 8px 8px 0;
    background: var(--color-background-secondary, #f8fafc);
}
.mp-milestone-badge {
    width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 0.8rem; flex-shrink: 0;
}
.mp-milestone-label { font-weight: 600; font-size: 0.9rem; }
.mp-workflow-steps {
    display: flex; align-items: center; justify-content: center;
    flex-wrap: wrap; gap: 6px; margin: 16px 0;
}
.mp-workflow-step {
    display: flex; align-items: center; gap: 6px;
    background: var(--color-background-secondary, #f1f5f9);
    padding: 6px 12px; border-radius: 8px; font-size: 0.85rem;
}
.mp-workflow-step em { font-size: 0.75rem; color: var(--color-text-secondary); }
.mp-workflow-num {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--color-primary, #6366f1); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.mp-workflow-arrow { color: var(--color-text-secondary, #94a3b8); font-size: 0.9rem; }
.mp-preview-cards {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 20px 0;
}
.mp-preview-card {
    background: var(--color-background-secondary, #f8fafc);
    border-radius: 12px; padding: 18px 14px; text-align: center;
}
.mp-preview-card strong { display: block; font-size: 0.85rem; margin: 8px 0 4px; }
.mp-preview-card p { font-size: 0.8rem; color: var(--color-text-secondary); margin: 0; }
.mp-preview-icon { font-size: 28px; }
.mp-input {
    display: block; width: 100%; max-width: 340px; margin: 0 auto;
    padding: 12px 16px; border: 2px solid var(--color-border, #e2e8f0);
    border-radius: 10px; font-size: 1rem; text-align: center;
    background: var(--color-bg-card, #fff); color: var(--color-text, #1e293b);
    outline: none; transition: border-color 0.15s;
}
.mp-input:focus { border-color: var(--color-primary, #6366f1); }
.mp-input-error { border-color: #ef4444; animation: mp-shake 0.3s; }
@keyframes mp-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
.mp-input-sm { display: inline-block; width: 80px; text-align: center; }
.mp-checkbox-label {
    display: block; margin: 12px auto 0; max-width: 340px;
    font-size: 0.9rem; color: var(--color-text-secondary); cursor: pointer; text-align: left;
}
.mp-experience-options {
    display: flex; flex-direction: column; gap: 10px;
    max-width: 360px; margin: 0 auto;
}
.mp-exp-btn {
    display: flex; flex-direction: column; padding: 14px 18px;
    border: 2px solid var(--color-border, #e2e8f0); border-radius: 12px;
    background: var(--color-bg-card, #fff); cursor: pointer; text-align: left;
    transition: border-color 0.15s, background 0.15s;
}
.mp-exp-btn:hover {
    border-color: var(--color-primary, #6366f1);
    background: var(--color-background-secondary, #f8fafc);
}
.mp-exp-btn strong { font-size: 0.95rem; color: var(--color-text); }
.mp-exp-btn span { font-size: 0.85rem; color: var(--color-text-secondary); margin-top: 2px; }
.mp-mode-cards {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 20px 0;
}
.mp-mode-card {
    padding: 20px 14px; border: 2px solid var(--color-border, #e2e8f0);
    border-radius: 14px; background: var(--color-bg-card, #fff);
    cursor: pointer; text-align: center;
    transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.mp-mode-card:hover {
    border-color: var(--color-primary, #6366f1); transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}
.mp-mode-card.recommended {
    border-color: var(--color-primary, #6366f1); background: rgba(99, 102, 241, 0.04);
}
.mp-mode-icon { font-size: 28px; margin-bottom: 8px; }
.mp-mode-card strong { display: block; font-size: 0.95rem; margin-bottom: 6px; }
.mp-mode-card p { font-size: 0.82rem; color: var(--color-text-secondary); margin: 0; }
.mp-mode-note {
    font-size: 0.85rem; color: var(--color-text-secondary); margin: 16px 0 0; font-style: italic;
}
.mp-pace-cards {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px; margin: 20px 0;
}
.mp-pace-card {
    padding: 16px 12px; border: 2px solid var(--color-border, #e2e8f0);
    border-radius: 12px; background: var(--color-bg-card, #fff);
    cursor: pointer; text-align: center; transition: border-color 0.15s, transform 0.1s;
}
.mp-pace-card:hover:not(.disabled) {
    border-color: var(--color-primary, #6366f1); transform: translateY(-2px);
}
.mp-pace-card.recommended { border-color: var(--color-primary, #6366f1); }
.mp-pace-card.disabled { opacity: 0.5; cursor: not-allowed; }
.mp-pace-card strong { display: block; font-size: 0.9rem; }
.mp-pace-card span { display: block; font-size: 0.85rem; color: var(--color-text-secondary); }
.mp-pace-card p { font-size: 0.8rem; color: var(--color-text-secondary); margin: 6px 0 0; }
.mp-pace-warning { font-size: 0.75rem; color: #ef4444; display: block; margin-top: 4px; }
.mp-custom-hours { margin: 16px 0 0; font-size: 0.9rem; color: var(--color-text-secondary); }
.mp-fasttrack-list {
    display: flex; flex-direction: column; gap: 8px;
    max-width: 400px; margin: 0 auto; text-align: left;
}
.mp-fasttrack-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 8px; cursor: pointer;
    background: var(--color-background-secondary, #f8fafc); font-size: 0.9rem;
}
.mp-fasttrack-item:hover { background: var(--color-border, #e2e8f0); }
.mp-order-list {
    display: flex; flex-direction: column; gap: 6px;
    max-width: 460px; margin: 0 auto; text-align: left;
}
.mp-order-item {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; border-radius: 10px;
    background: var(--color-background-secondary, #f8fafc);
}
.mp-order-num {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--color-primary, #6366f1); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.mp-order-arrows { display: flex; flex-direction: column; gap: 2px; }
.mp-arrow-btn {
    background: none; border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 4px; cursor: pointer; padding: 1px 6px;
    font-size: 0.65rem; line-height: 1; color: var(--color-text-secondary);
}
.mp-arrow-btn:hover:not(:disabled) {
    background: var(--color-primary, #6366f1); color: #fff; border-color: transparent;
}
.mp-arrow-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.mp-order-name { flex: 1; font-size: 0.9rem; font-weight: 500; }
.mp-ft-badge {
    font-size: 0.7rem; font-weight: 600; padding: 2px 8px;
    border-radius: 20px; background: #fef3c7; color: #92400e;
}
.mp-prereq-warning { font-size: 0.75rem; color: #d97706; margin-left: auto; }
.mp-plan-timeline {
    display: flex; flex-direction: column; gap: 6px;
    max-width: 440px; margin: 16px auto; text-align: left;
}
.mp-plan-row {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 14px; border-radius: 8px;
    background: var(--color-background-secondary, #f8fafc);
}
.mp-plan-row.mp-plan-review { background: rgba(99, 102, 241, 0.08); font-weight: 600; }
.mp-plan-week {
    font-size: 0.8rem; font-weight: 600; color: var(--color-text-secondary); min-width: 80px;
}
.mp-plan-subject { font-size: 0.9rem; }
.mp-plan-fit { font-size: 0.85rem; margin: 12px 0 0; font-weight: 500; }
.mp-fit-good { color: #059669; }
.mp-fit-tight { color: #d97706; }

/* Dark mode */
[data-theme="dark"] .mp-overlay { background: rgba(0, 0, 0, 0.9); }
[data-theme="dark"] .mp-overlay-dialog { background: var(--color-bg-card); }
[data-theme="dark"] .mp-preview-card,
[data-theme="dark"] .mp-milestone-item,
[data-theme="dark"] .mp-workflow-step,
[data-theme="dark"] .mp-fasttrack-item,
[data-theme="dark"] .mp-order-item,
[data-theme="dark"] .mp-plan-row { background: var(--color-background-secondary); }
[data-theme="dark"] .mp-exp-btn,
[data-theme="dark"] .mp-mode-card,
[data-theme="dark"] .mp-pace-card { background: var(--color-bg-card); border-color: var(--color-border); }
[data-theme="dark"] .mp-mode-card.recommended { background: rgba(99, 102, 241, 0.1); }
[data-theme="dark"] .mp-ft-badge { background: #422006; color: #fbbf24; }
[data-theme="dark"] .mp-input {
    background: var(--color-background-secondary); border-color: var(--color-border); color: var(--color-text);
}

/* Responsive */
@media (max-width: 600px) {
    .mp-overlay-dialog { padding: 28px 20px 24px; }
    .mp-preview-cards, .mp-mode-cards { grid-template-columns: 1fr; }
    .mp-pace-cards { grid-template-columns: 1fr 1fr; }
    .mp-workflow-steps { flex-direction: column; }
    .mp-workflow-arrow { transform: rotate(90deg); }
    .mp-welcome-title, .mp-onboard-title { font-size: 1.25rem; }
}


/* =====================================================================
   MENTORSHIP PATH — Today Card (Phase 4)
   ===================================================================== */
.mp-today {
    background: var(--color-bg-card, #fff);
    border-radius: 16px; padding: 24px 28px;
    border: 2px solid var(--color-primary, #6366f1);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
    margin-bottom: 20px;
}
.mp-today-header {
    display: flex; align-items: flex-start; gap: 14px;
}
.mp-today-icon { font-size: 28px; flex-shrink: 0; line-height: 1.2; }
.mp-today-text { flex: 1; }
.mp-today-message {
    font-size: 1rem; font-weight: 500; margin: 0 0 4px;
    color: var(--color-text, #1e293b); line-height: 1.4;
}
.mp-today-phase {
    font-size: 0.85rem; color: var(--color-text-secondary, #64748b);
}
.mp-today-actions {
    display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap;
}
.mp-today-phases {
    display: flex; align-items: center; gap: 6px;
    margin-top: 14px; padding-top: 14px;
    border-top: 1px solid var(--color-border, #e2e8f0);
    flex-wrap: wrap; font-size: 0.82rem;
}
.mp-phases-label {
    font-weight: 600; color: var(--color-text-secondary, #64748b);
    margin-right: 4px;
}
.mp-phase-pill {
    padding: 3px 10px; border-radius: 20px;
    background: var(--color-background-secondary, #f1f5f9);
    color: var(--color-text-secondary, #64748b);
}
.mp-phase-pill.current {
    background: var(--color-primary, #6366f1); color: #fff; font-weight: 600;
}
.mp-phase-arrow { color: var(--color-text-secondary, #94a3b8); }

/* Dark mode */
[data-theme="dark"] .mp-today {
    background: var(--color-bg-card);
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}
[data-theme="dark"] .mp-phase-pill { background: var(--color-background-secondary); }
[data-theme="dark"] .mp-phase-pill.current { background: var(--color-primary); }

/* Responsive */
@media (max-width: 600px) {
    .mp-today { padding: 18px 16px; }
    .mp-today-phases { flex-direction: column; align-items: flex-start; }
    .mp-phase-arrow { display: none; }
}


/* =====================================================================
   MENTORSHIP PATH — Progress Timeline + Exam Countdown (Phase 5)
   ===================================================================== */

/* Exam Countdown (header) */
.mp-countdown {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 14px; border-radius: 20px; font-size: 0.82rem;
    white-space: nowrap;
}
.mp-countdown.calm { background: rgba(99, 102, 241, 0.08); color: var(--color-primary, #6366f1); }
.mp-countdown.normal { background: rgba(217, 119, 6, 0.1); color: #d97706; }
.mp-countdown.warning { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.mp-countdown.urgent { background: #ef4444; color: #fff; }
.mp-countdown-days { font-weight: 700; font-size: 1rem; }
.mp-countdown-label { font-weight: 500; }
.mp-countdown-msg {
    display: none; font-size: 0.78rem; opacity: 0.85;
}
.mp-countdown:hover .mp-countdown-msg { display: inline; }
.mp-countdown-nudge {
    display: block; font-size: 0.75rem; opacity: 0.8; margin-top: 2px;
}

/* Progress Timeline */
#mp-progress-timeline { margin-bottom: 20px; }

.mp-tl-milestone { margin-bottom: 16px; }
.mp-tl-ms-header {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; border-left: 4px solid;
    margin-bottom: 4px;
}
.mp-tl-ms-badge {
    padding: 4px 14px; border-radius: 20px;
    color: #fff; font-weight: 700; font-size: 0.8rem;
}
.mp-tl-ms-check { font-size: 1rem; }

.mp-tl-chapter {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px 10px 32px;
    border-left: 2px solid var(--color-border, #e2e8f0);
    margin-left: 14px;
    transition: background 0.15s;
    border-radius: 0 8px 8px 0;
    cursor: default;
}
.mp-tl-chapter.available,
.mp-tl-chapter.active,
.mp-tl-chapter.complete { cursor: pointer; }
.mp-tl-chapter:hover:not(.locked) {
    background: var(--color-background-secondary, #f8fafc);
}

/* Timeline dot */
.mp-tl-dot {
    width: 12px; height: 12px; border-radius: 50%;
    flex-shrink: 0; border: 2px solid;
}
.mp-tl-dot.locked { border-color: var(--color-border, #cbd5e1); background: transparent; }
.mp-tl-dot.available { border-color: var(--color-primary, #6366f1); background: transparent; }
.mp-tl-dot.active { border-color: var(--color-primary, #6366f1); background: var(--color-primary, #6366f1); }
.mp-tl-dot.complete { border-color: #059669; background: #059669; }

/* Timeline content */
.mp-tl-content {
    display: flex; align-items: center; gap: 8px; flex: 1;
    flex-wrap: wrap; min-width: 0;
}
.mp-tl-chkey {
    font-size: 0.8rem; font-weight: 700; color: var(--color-text-secondary, #64748b);
    min-width: 50px;
}
.mp-tl-chname {
    font-size: 0.9rem; font-weight: 500; color: var(--color-text, #1e293b);
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mp-tl-status {
    font-size: 0.78rem; color: var(--color-text-secondary, #94a3b8);
    margin-left: auto; white-space: nowrap;
}
.mp-tl-phase {
    font-size: 0.75rem; padding: 2px 8px; border-radius: 12px;
    background: rgba(99, 102, 241, 0.1); color: var(--color-primary, #6366f1);
    font-weight: 600;
}

/* State-specific styling */
.mp-tl-chapter.locked .mp-tl-chname { color: var(--color-text-secondary, #94a3b8); }
.mp-tl-chapter.active {
    background: rgba(99, 102, 241, 0.04);
    border-left-color: var(--color-primary, #6366f1);
}
.mp-tl-chapter.complete .mp-tl-status { color: #059669; font-weight: 600; }

/* Dark mode */
[data-theme="dark"] .mp-countdown.calm { background: rgba(99, 102, 241, 0.15); }
[data-theme="dark"] .mp-countdown.normal { background: rgba(217, 119, 6, 0.15); }
[data-theme="dark"] .mp-countdown.warning { background: rgba(239, 68, 68, 0.15); }
[data-theme="dark"] .mp-tl-chapter:hover:not(.locked) { background: var(--color-background-secondary); }
[data-theme="dark"] .mp-tl-chapter.active { background: rgba(99, 102, 241, 0.08); }
[data-theme="dark"] .mp-tl-chapter.locked .mp-tl-chname { color: var(--color-text-secondary); }
[data-theme="dark"] .mp-tl-phase { background: rgba(99, 102, 241, 0.2); }

/* Responsive */
@media (max-width: 600px) {
    .mp-tl-chapter { padding-left: 20px; margin-left: 8px; }
    .mp-tl-content { flex-direction: column; align-items: flex-start; gap: 2px; }
    .mp-tl-status { margin-left: 0; }
    .mp-countdown { font-size: 0.75rem; padding: 3px 10px; }
}


/* =====================================================================
   MENTORSHIP PATH — Study Path Settings (Phase 6)
   ===================================================================== */
.mp-mode-switch {
    display: flex; gap: 6px; flex-wrap: wrap;
}
.mp-mode-sw-btn {
    padding: 8px 16px; border-radius: 8px; font-size: 0.85rem;
    font-weight: 600; cursor: pointer;
    border: 2px solid var(--color-border, #e2e8f0);
    background: var(--color-bg-card, #fff);
    color: var(--color-text, #1e293b);
    transition: border-color 0.15s, background 0.15s;
}
.mp-mode-sw-btn:hover {
    border-color: var(--color-primary, #6366f1);
}
.mp-mode-sw-btn.active {
    border-color: var(--color-primary, #6366f1);
    background: var(--color-primary, #6366f1);
    color: #fff;
}
[data-theme="dark"] .mp-mode-sw-btn {
    background: var(--color-bg-card); border-color: var(--color-border);
    color: var(--color-text);
}
[data-theme="dark"] .mp-mode-sw-btn.active {
    background: var(--color-primary); color: #fff;
}


/* =====================================================================
   MENTORSHIP PATH — Schedule Tracking (Phase 7)
   ===================================================================== */
.mp-schedule {
    background: var(--color-bg-card, #fff);
    border-radius: 12px; padding: 18px 22px;
    border-left: 4px solid; margin-bottom: 16px;
}
.mp-schedule.on-track { border-left-color: #059669; }
.mp-schedule.ahead { border-left-color: var(--color-primary, #6366f1); }
.mp-schedule.behind { border-left-color: #d97706; }
.mp-schedule-header {
    display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.mp-schedule-icon { font-size: 1.1rem; }
.mp-schedule-label { font-weight: 700; font-size: 0.95rem; }
.mp-schedule-days {
    font-size: 0.8rem; font-weight: 600; padding: 2px 8px;
    border-radius: 12px; margin-left: auto;
}
.mp-schedule.ahead .mp-schedule-days { background: rgba(99, 102, 241, 0.1); color: var(--color-primary); }
.mp-schedule.behind .mp-schedule-days { background: rgba(217, 119, 6, 0.1); color: #d97706; }
.mp-schedule.on-track .mp-schedule-days { background: rgba(5, 150, 105, 0.1); color: #059669; }
.mp-schedule-msg {
    font-size: 0.88rem; color: var(--color-text-secondary, #64748b);
    margin: 0 0 12px; line-height: 1.4;
}
.mp-schedule-bar {
    height: 6px; border-radius: 3px;
    background: var(--color-background-secondary, #e2e8f0);
    overflow: hidden; margin-bottom: 6px;
}
.mp-schedule-fill {
    height: 100%; border-radius: 3px;
    transition: width 0.4s ease;
}
.mp-schedule.on-track .mp-schedule-fill { background: #059669; }
.mp-schedule.ahead .mp-schedule-fill { background: var(--color-primary, #6366f1); }
.mp-schedule.behind .mp-schedule-fill { background: #d97706; }
.mp-schedule-detail {
    font-size: 0.78rem; color: var(--color-text-secondary, #94a3b8);
}
[data-theme="dark"] .mp-schedule { background: var(--color-bg-card); }
[data-theme="dark"] .mp-schedule-bar { background: var(--color-background-secondary); }


/* =====================================================================
   MENTORSHIP PATH — Synapse Quiz + Milestones (Phase 8)
   ===================================================================== */

/* Synapse Quiz */
.mp-synapse-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px;
}
.mp-synapse-badge {
    font-size: 0.8rem; font-weight: 700; padding: 4px 12px;
    border-radius: 20px; background: rgba(99, 102, 241, 0.1);
    color: var(--color-primary, #6366f1);
}
.mp-synapse-count {
    font-size: 0.82rem; color: var(--color-text-secondary, #64748b);
}
.mp-synapse-stem {
    font-size: 1rem; line-height: 1.5; margin: 0 0 16px;
    color: var(--color-text, #1e293b);
}
.mp-synapse-options {
    display: flex; flex-direction: column; gap: 8px;
}
.mp-synapse-opt {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border: 2px solid var(--color-border, #e2e8f0);
    border-radius: 10px; background: var(--color-bg-card, #fff);
    cursor: pointer; text-align: left; font-size: 0.92rem;
    transition: border-color 0.15s, background 0.15s;
}
.mp-synapse-opt:hover {
    border-color: var(--color-primary, #6366f1);
    background: var(--color-background-secondary, #f8fafc);
}
.mp-synapse-letter {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--color-background-secondary, #f1f5f9);
    font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}
.mp-synapse-score {
    font-size: 1.2rem; margin: 8px 0 16px;
    color: var(--color-text, #1e293b);
}
.mp-synapse-connection {
    font-size: 0.9rem; color: var(--color-text-secondary, #64748b);
    margin: 12px 0; padding: 12px 16px;
    background: var(--color-background-secondary, #f8fafc);
    border-radius: 10px; line-height: 1.4;
}

/* Milestone Celebration */
.mp-milestone-celebration { margin-bottom: 20px; }
.mp-ms-badge-large {
    width: 80px; height: 80px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    animation: mp-badge-pop 0.5s ease-out;
}
@keyframes mp-badge-pop {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}
.mp-ms-badge-icon { font-size: 36px; }
.mp-ms-next {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 14px; margin: 16px 0;
    background: var(--color-background-secondary, #f8fafc);
    border-radius: 10px;
}
.mp-ms-next-label {
    font-size: 0.78rem; color: var(--color-text-secondary, #94a3b8);
    text-transform: uppercase; letter-spacing: 0.05em;
}
.mp-ms-next-name { font-size: 1.1rem; font-weight: 700; }
.mp-ms-next-desc { font-size: 0.85rem; color: var(--color-text-secondary); }

/* Dark mode */
[data-theme="dark"] .mp-synapse-opt {
    background: var(--color-bg-card); border-color: var(--color-border);
}
[data-theme="dark"] .mp-synapse-opt:hover {
    background: var(--color-background-secondary);
}
[data-theme="dark"] .mp-synapse-letter { background: var(--color-background-secondary); }
[data-theme="dark"] .mp-synapse-connection,
[data-theme="dark"] .mp-ms-next { background: var(--color-background-secondary); }


/* =====================================================================
   REFERENCE DRILL ENGINE (Phase 9)
   ===================================================================== */
.rd-screen { text-align: left; }
.rd-header {
    display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.rd-type-badge {
    font-size: 0.8rem; font-weight: 700; padding: 4px 12px;
    border-radius: 20px; background: rgba(249, 115, 22, 0.1); color: #f97316;
}
.rd-progress { font-size: 0.82rem; color: var(--color-text-secondary, #64748b); }
.rd-timer {
    margin-left: auto; font-size: 1rem; font-weight: 700;
    color: var(--color-text, #1e293b); min-width: 40px; text-align: right;
}
.rd-timer.urgent { color: #ef4444; animation: rd-pulse 0.5s ease-in-out infinite alternate; }
@keyframes rd-pulse { from { opacity: 1; } to { opacity: 0.5; } }
.rd-prompt {
    font-size: 1rem; line-height: 1.5; margin: 0 0 16px;
    color: var(--color-text, #1e293b);
}
.rd-choices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.rd-choice-btn {
    display: flex; flex-direction: column; gap: 2px;
    padding: 12px 16px; border: 2px solid var(--color-border, #e2e8f0);
    border-radius: 10px; background: var(--color-bg-card, #fff);
    cursor: pointer; text-align: left;
    transition: border-color 0.15s, background 0.15s;
}
.rd-choice-btn:hover {
    border-color: #f97316; background: rgba(249, 115, 22, 0.04);
}
.rd-choice-btn strong { font-size: 0.92rem; }
.rd-handbook { font-size: 0.78rem; color: var(--color-text-secondary, #94a3b8); }
.rd-hints { display: flex; gap: 8px; margin-bottom: 10px; }
.rd-hint-btn {
    font-size: 0.8rem; padding: 6px 14px; border-radius: 8px;
    border: 1px solid var(--color-border, #e2e8f0);
    background: var(--color-background-secondary, #f8fafc);
    color: var(--color-text-secondary, #64748b); cursor: pointer;
    transition: background 0.15s;
}
.rd-hint-btn:hover:not(:disabled) { background: var(--color-border, #e2e8f0); }
.rd-hint-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.rd-hint-text {
    font-size: 0.85rem; padding: 10px 14px; border-radius: 8px;
    background: rgba(249, 115, 22, 0.06); color: var(--color-text, #1e293b);
    margin-bottom: 10px; font-style: italic;
}
.rd-actions { text-align: center; margin-top: 8px; }

/* Feedback */
.rd-feedback {
    text-align: center; padding: 40px 20px;
}
.rd-feedback-icon { font-size: 48px; margin-bottom: 12px; }
.rd-feedback-text { font-size: 1.2rem; font-weight: 600; margin: 0 0 8px; }
.rd-feedback.correct .rd-feedback-text { color: #059669; }
.rd-feedback.wrong .rd-feedback-text { color: #ef4444; }
.rd-feedback-answer { font-size: 0.9rem; color: var(--color-text-secondary); margin: 0; }

/* Results */
.rd-result-score { text-align: center; margin: 16px 0; }
.rd-score-num { font-size: 2rem; font-weight: 800; }
.rd-score-num.pass { color: #059669; }
.rd-score-num.fail { color: #d97706; }
.rd-score-detail {
    display: block; font-size: 0.9rem; color: var(--color-text-secondary);
    margin-top: 4px;
}
.rd-result-stats {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
    margin: 20px 0; text-align: center;
}
.rd-stat {
    padding: 10px; border-radius: 10px;
    background: var(--color-background-secondary, #f8fafc);
}
.rd-stat-val { display: block; font-size: 1.1rem; font-weight: 700; color: var(--color-text); }
.rd-stat-label { font-size: 0.75rem; color: var(--color-text-secondary); }

/* Dark mode */
[data-theme="dark"] .rd-choice-btn { background: var(--color-bg-card); border-color: var(--color-border); }
[data-theme="dark"] .rd-choice-btn:hover { background: var(--color-background-secondary); }
[data-theme="dark"] .rd-hint-btn { background: var(--color-background-secondary); }
[data-theme="dark"] .rd-hint-text { background: rgba(249, 115, 22, 0.1); }
[data-theme="dark"] .rd-stat { background: var(--color-background-secondary); }

/* Responsive */
@media (max-width: 600px) {
    .rd-result-stats { grid-template-columns: repeat(2, 1fr); }
    .rd-header { flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════════════════════════
   GUIDED LECTURE LAYOUT (Phase 2) — gl- prefix
   Three-column editorial flow for Guided/Custom mode
   ═══════════════════════════════════════════════════════════════════ */

/* ── LAYOUT CONTAINER ── */
.gl-container {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: var(--color-bg-page, #f7f9fb);
}

/* ── BACK BAR (replaces old lecture-top-bar) ── */
.gl-back-bar {
    height: 2.75rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
}
.gl-back-bar .lec-back-arrow {
    background: none;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}
.gl-back-bar .lec-back-arrow:hover { background: var(--color-bg-subtle); }
.gl-back-bar .lec-top-chapter-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}
.gl-back-spacer { flex: 1; }
.gl-back-bar .gl-page-label { font-size: 0.78rem; color: var(--color-text-muted); }
.gl-back-bar .gl-nav-btn { font-size: 0.78rem; padding: 0.3rem 0.75rem; }
[data-theme="dark"] .gl-back-bar { background: var(--color-background-secondary, #1e293b); }

/* ── LEFT SIDEBAR: Chapter Outline ── */
.gl-sidebar-left {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-card);
    border-right: 1px solid var(--color-border);
    overflow: hidden;
}

.gl-chapter-title {
    padding: 1.25rem 1rem 1rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
    line-height: 1.3;
}

.gl-step-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.gl-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    line-height: 1.3;
    cursor: default;
    transition: background var(--transition-fast);
    color: var(--color-text-secondary);
}

.gl-step-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    border-radius: 50%;
}

.gl-step-label { flex: 1; }

/* Step states */
.gl-step.complete .gl-step-icon {
    background: var(--color-success);
    color: #fff;
}
.gl-step.complete { color: var(--color-text-muted); cursor: pointer; }
.gl-step.complete:hover { background: var(--color-bg-subtle); }

.gl-step.active {
    background: var(--color-primary-bg, #eff6ff);
    color: var(--color-primary);
    font-weight: 600;
    border-left: 3px solid var(--color-primary);
    padding-left: calc(0.75rem - 3px);
}
.gl-step.active .gl-step-icon {
    background: var(--color-primary);
    color: #fff;
}

.gl-step.locked { color: var(--color-text-tertiary, #94a3b8); cursor: pointer; opacity: 0.7; }
.gl-step.locked .gl-step-icon {
    border: 1.5px solid var(--color-border-strong, #cbd5e1);
    color: transparent;
}
.gl-step.locked:hover { background: var(--color-bg-subtle); opacity: 1; }

/* Free Study: visited = clickable but not yet active (no lock) */
.gl-step.visited { color: var(--color-text-secondary); cursor: pointer; }
.gl-step.visited:hover { background: var(--color-bg-subtle); }
.gl-step.visited .gl-step-icon {
    border: 1.5px solid var(--color-text-muted);
    color: transparent;
}

.gl-step.optional .gl-step-label::after {
    content: ' (optional)';
    font-style: italic;
    font-weight: 400;
    opacity: 0.7;
}

/* Course progress at bottom of sidebar */
.gl-course-progress {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.gl-course-progress .gl-progress-label { margin-bottom: 0.4rem; }

/* ── MAIN CONTENT AREA ── */
.gl-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: var(--color-bg-page);
}

.gl-step-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: clamp(1.25rem, 3vw, 2.5rem);
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

.gl-step-content::-webkit-scrollbar { width: 6px; }
.gl-step-content::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }

/* Placeholder state (Phase 2 only) */
.gl-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-tertiary, #94a3b8);
    text-align: center;
    gap: 0.75rem;
}
.gl-placeholder-icon { font-size: 2.5rem; opacity: 0.5; }
.gl-placeholder-title { font-size: 1.1rem; font-weight: 600; }
.gl-placeholder-sub { font-size: 0.85rem; max-width: 360px; }

/* ── BOTTOM BAR ── */
.gl-bottom-bar {
    flex-shrink: 0;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-card);
    padding: 0.5rem 1.5rem;
}

.gl-chapter-bar { margin-bottom: 0.5rem; }

.gl-progress-bar {
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    overflow: hidden;
}

.gl-progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 2px;
    transition: width 0.4s ease;
    width: 0%;
}

.gl-page-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gl-page-label {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.gl-nav-btn {
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.4rem 1.125rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-bg-card);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.gl-nav-btn:hover { background: var(--color-bg-subtle); }

.gl-nav-primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.gl-nav-primary:hover { filter: brightness(1.1); }

/* ── RIGHT SIDEBAR: Contextual Reference ── */
.gl-sidebar-right {
    width: 220px;
    flex-shrink: 0;
    overflow-y: auto;
    background: var(--color-bg-subtle);
    border-left: 1px solid var(--color-border);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    scrollbar-width: thin;
}

.gl-panel {
    background: var(--color-bg-card, #ffffff);
    border: 1px solid var(--color-border, #e0e3e5);
    border-radius: 16px;
    padding: 1rem;
    font-size: 0.82rem;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(25,28,30,0.04), 0 12px 32px rgba(25,28,30,0.08);
}

.gl-panel-heading {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.gl-panel-body {
    color: var(--color-text-secondary);
}

.gl-panel-empty {
    color: var(--color-text-tertiary, #94a3b8);
    font-style: italic;
    font-size: 0.78rem;
}

/* ── STEP CONTENT RENDERING ── */
.gl-step-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.gl-step-type-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: var(--color-primary-bg, #eff6ff);
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}
.gl-badge-example { background: #fef3c7; color: #92400e; }
.gl-badge-review { background: #ecfdf5; color: #065f46; }
.gl-badge-quiz { background: #fce7f3; color: #9d174d; }
.gl-badge-challenge { background: #dc2626; color: #fff; }

/* ── Challenge Problem Step (Productive Failure) ──────────────── */
.gl-challenge-intro { margin: 1rem 0; }
.gl-challenge-stem { font-size: 0.95rem; line-height: 1.6; margin-bottom: 1.25rem; color: var(--color-text); }
.gl-challenge-choices { display: flex; flex-direction: column; gap: 0.5rem; }
.gl-challenge-option {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1rem; border: 1.5px solid var(--color-border, #e2e8f0);
    border-radius: 8px; background: var(--color-surface, #fff);
    cursor: pointer; text-align: left; font-size: 0.9rem;
    transition: border-color 0.2s, background 0.2s;
}
.gl-challenge-option:hover:not(:disabled) { border-color: var(--color-primary, #3b82f6); }
.gl-challenge-option--disabled { cursor: default; opacity: 0.85; }
.gl-challenge-option--correct { background: #f0fdf4; border-color: #22c55e; }
.gl-challenge-option--wrong { background: #fef2f2; border-color: #ef4444; }
.gl-challenge-letter { font-weight: 700; min-width: 1.5rem; text-align: center; }
.gl-challenge-fb { padding: 1rem; border-radius: 8px; margin-top: 1rem; line-height: 1.5; }
.gl-challenge-fb--right { background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; }
.gl-challenge-fb--wrong { background: #fef2f2; border: 1px solid #fecaca; color: #7f1d1d; }
.gl-challenge-fb-icon { font-weight: 700; margin-right: 0.25rem; }
.gl-challenge-skip { padding: 1rem; color: var(--color-text-muted, #94a3b8); font-style: italic; }

/* ── V2 Principle: connectsFrom + editorial ────────────────────── */
.gl-connects-from {
    padding: 0.75rem 1rem; margin-bottom: 1.25rem;
    background: var(--color-info-light, #eff6ff);
    border-left: 3px solid var(--color-info, #3b82f6);
    border-radius: 0 8px 8px 0;
    font-size: 0.9rem; color: var(--color-text); line-height: 1.5;
}
.gl-connects-icon { font-size: 1rem; }
.gl-editorial-v2 p { margin-bottom: 0.75rem; line-height: 1.7; }
.gl-math-display { margin: 1rem 0; text-align: center; }

/* ── V2 Principle: A+ callout types ────────────────────────────── */
.gl-callout-header {
    font-weight: 700; font-size: 0.85rem; text-transform: uppercase;
    letter-spacing: 0.03em; margin-bottom: 0.5rem;
    color: var(--color-text-secondary, #475569);
}
.gl-mental-model {
    margin: 1.25rem 0; padding: 1rem 1.25rem;
    background: var(--color-info-light, #f0f9ff);
    border: 1px solid var(--color-info-muted, #bae6fd); border-radius: 10px;
}
.gl-mental-model-analogy { font-style: italic; line-height: 1.65; margin: 0.5rem 0; }
.gl-mental-model-insight {
    margin-top: 0.75rem; padding-top: 0.75rem;
    border-top: 1px solid var(--color-info-muted, #bae6fd);
    font-size: 0.9rem; line-height: 1.5;
}
.gl-exam-procedure {
    margin: 1.25rem 0; padding: 1rem 1.25rem;
    background: var(--color-surface-alt, #f8fafc);
    border: 1px solid var(--color-border, #e2e8f0); border-radius: 10px;
}
.gl-exam-procedure-list { margin: 0.5rem 0 0 1.25rem; padding: 0; line-height: 1.7; }
.gl-exam-procedure-list li { margin-bottom: 0.4rem; padding-left: 0.25rem; }
.gl-preview-sentence {
    margin: 1.5rem 0 0.5rem; padding: 0.75rem 1rem;
    background: var(--color-primary-light, #eff6ff);
    border-left: 3px solid var(--color-primary, #3b82f6);
    border-radius: 0 8px 8px 0; font-size: 0.9rem; line-height: 1.5;
}
.gl-preview-icon { font-weight: 700; margin-right: 0.25rem; }
.gl-real-world-content { line-height: 1.6; margin: 0.25rem 0; }
.gl-real-world-takeaway {
    margin-top: 0.75rem; padding-top: 0.75rem;
    border-top: 1px solid var(--color-border, #e2e8f0);
    font-size: 0.88rem; color: var(--color-text-secondary, #475569);
}

.gl-badge-drill { background: #ede9fe; color: #5b21b6; }

.gl-step-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0;
    line-height: 1.3;
}

.gl-editorial-content {
    font-size: 0.92rem;
    line-height: 1.8;
    color: var(--color-text-primary, #191c1e);
    margin-bottom: 1.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.gl-editorial-content p { margin-bottom: 0.75rem; }
.gl-editorial-content strong { color: var(--color-text-primary); }
/* MathJax in lecture: no scrollbars, blend with text */
.gl-editorial-content mjx-container,
.gl-step-content mjx-container,
.gl-inline-formula mjx-container,
.vector-callout mjx-container,
.gl-panel mjx-container {
    max-width: 100% !important;
    overflow: hidden !important;
    display: inline-block;
}
/* Inline math: blend with surrounding text */
.gl-step-content mjx-container:not([display="true"]),
.vector-callout mjx-container,
.gl-panel mjx-container:not([display="true"]) {
    font-size: 0.95em !important;
    vertical-align: -0.125em !important;
    display: inline !important;
    margin: 0 1px !important;
}
/* Display math (centered equations): allow slightly larger */
.gl-step-content mjx-container[display="true"] {
    overflow: hidden !important;
    max-width: 100% !important;
    margin: 0.5rem 0;
}
/* Phase 1 (2026-04-17): V2 principle prose has many single-variable math refs
   (`\(A\)`, `\(g_1\)`) that look slightly smaller and shifted down vs surrounding
   prose because the existing inline-math rule above uses font-size: 0.95em and
   vertical-align: -0.125em. In V2 editorial context, match prose baseline so
   single variables read as natural italic letters inline. Formula Library and
   display-mode math are untouched. */
.gl-editorial-v2 mjx-container:not([display="true"]) {
    font-size: inherit !important;
    vertical-align: baseline !important;
}

.gl-editorial-sidebar-content {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--color-text-secondary);
    padding: 1rem;
    background: var(--color-bg-subtle);
    border-radius: var(--radius-lg, 12px);
    border: 1px solid var(--color-border);
    margin-bottom: 1.5rem;
}

.gl-example-content { margin-bottom: 1.5rem; }
.gl-example-problem {
    font-size: 0.92rem;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.gl-example-choices { display: flex; flex-direction: column; gap: 0.5rem; }
.gl-choice {
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--color-bg-card);
}
.gl-choice:hover { border-color: var(--color-primary); background: var(--color-primary-bg, #eff6ff); }

.gl-phase-placeholder {
    padding: 2rem;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 0.92rem;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg, 12px);
    margin-top: 1rem;
}

/* ── Deep Dive accordion ── */
.gl-deep-dive {
    margin: 1.25rem 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
}
.gl-deep-dive-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--color-bg-subtle);
    color: var(--color-primary);
    list-style: none;
    user-select: none;
}
.gl-deep-dive-toggle::-webkit-details-marker { display: none; }
.gl-deep-dive-toggle::after { content: '\25BC'; font-size: 0.7rem; margin-left: auto; transition: transform 0.2s; }
.gl-deep-dive[open] .gl-deep-dive-toggle::after { transform: rotate(180deg); }
.gl-deep-dive-content {
    padding: 1rem 1.25rem;
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--color-text-secondary);
    border-top: 1px solid var(--color-border);
}

/* ── Real World callout ── */
.gl-real-world {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    background: #f0fdf4;
    border-radius: 8px;
    border-left: 3px solid #22c55e;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #166534;
}

[data-theme="dark"] .gl-deep-dive { border-color: var(--color-border); }
[data-theme="dark"] .gl-deep-dive-toggle { background: var(--color-background-secondary, #1e293b); }
[data-theme="dark"] .gl-deep-dive-content { border-color: var(--color-border); }
[data-theme="dark"] .gl-real-world { background: rgba(34, 197, 94, 0.1); color: #86efac; border-color: #22c55e; }

/* ── References & Formula boxes ── */
.gl-ref-box {
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg, 12px);
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
}
.gl-ref-heading {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}
.gl-ref-item { font-size: 0.85rem; padding: 0.2rem 0; color: var(--color-primary); }

.gl-formulas-overview {
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg, 12px);
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
}
.gl-formula-row {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}
.gl-formula-row:last-child { border-bottom: none; }
.gl-formula-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    min-width: 100px;
    flex-shrink: 0;
}
.gl-formula-math { font-size: 0.92rem; }

/* ── Inline formula card (paired with principle) ── */
.gl-inline-formula {
    background: var(--color-bg-subtle, #f8fafc);
    border: 1px solid var(--color-border, #e2e8f0);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-md, 8px);
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
    overflow: hidden;
}
.gl-inline-formula .gl-formula-math { font-size: 1rem; margin: 0.5rem 0; }
.gl-formula-vars { font-size: 0.8rem; color: var(--color-text-secondary); line-height: 1.6; margin-top: 0.5rem; }
.gl-formula-usage { font-size: 0.82rem; color: var(--color-text-secondary); margin-top: 0.5rem; font-style: italic; }

/* ── Worked example (paired with principle) ── */
.gl-worked-example {
    background: var(--color-bg-card);
    border: 1.5px solid var(--color-border);
    border-left: 4px solid #f59e0b;
    border-radius: var(--radius-lg, 12px);
    padding: 1.25rem;
    margin: 1.5rem 0;
}
.gl-worked-example .gl-ref-heading { color: #92400e; }

.gl-example-solution {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}
.gl-solution-body { font-size: 0.88rem; line-height: 1.7; }
.gl-trap-box {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: #fef2f2;
    border-radius: 8px;
    border-left: 3px solid #ef4444;
    font-size: 0.82rem;
    color: #991b1b;
}
.gl-tip-box {
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    background: #eff6ff;
    border-radius: 8px;
    border-left: 3px solid #3b82f6;
    font-size: 0.82rem;
    color: #1e40af;
}

/* Choice answer states */
.gl-choice-correct {
    background: #ecfdf5 !important;
    border-color: #10b981 !important;
    color: #065f46;
    font-weight: 600;
}
.gl-choice-wrong {
    background: #fef2f2 !important;
    border-color: #ef4444 !important;
    color: #991b1b;
}

/* ── Step sub-heading & done row ── */
.gl-step-sub { font-size: 0.82rem; color: var(--color-text-muted); margin-top: 0.25rem; }
.gl-done-row { margin-top: 1.5rem; display: flex; gap: 0.75rem; justify-content: center; }

/* ── INLINE FLASHCARDS ── */
.gl-fc-counter { font-size: 0.82rem; color: var(--color-text-muted); margin-bottom: 0.75rem; text-align: center; }
.gl-fc-card {
    background: var(--color-bg-card);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg, 12px);
    padding: 2rem;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-fast);
    margin-bottom: 1rem;
}
.gl-fc-card:hover { border-color: var(--color-primary); }
.gl-fc-q { font-size: 1.1rem; font-weight: 600; line-height: 1.5; }
.gl-fc-a { font-size: 1rem; line-height: 1.6; color: var(--color-text-secondary); }
.gl-fc-hint { font-size: 0.75rem; color: var(--color-text-tertiary); margin-top: 0.75rem; }
.gl-fc-btns { display: flex; gap: 0.75rem; justify-content: center; }

/* ── INLINE STUDY NOTES ── */
.gl-note-section {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg, 12px);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.gl-note-title { font-size: 1.1rem; font-weight: 700; margin: 0 0 0.25rem; }
.gl-note-cat { font-size: 0.72rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.gl-note-formulas { margin: 1rem 0; font-size: 0.92rem; }
.gl-note-formula-row { padding: 0.3rem 0; }
.gl-note-formula-label { font-size: 0.78rem; color: var(--color-text-muted); margin-left: 0.5rem; }
.gl-note-vars { margin: 0.75rem 0; font-size: 0.85rem; line-height: 1.6; }
.gl-note-deep { margin: 1rem 0; display: flex; flex-direction: column; gap: 0.5rem; }
.gl-note-problems { margin-top: 1rem; }
.gl-note-prob { margin-bottom: 1.25rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--color-border); }
.gl-note-prob:last-child { border-bottom: none; }

/* ── PER-QUESTION COUNTDOWN TIMER ── */
.q-timer {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 14px;
    border-radius: 8px;
    font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    transition: background 0.3s, color 0.3s;
    min-width: 90px;
    text-align: center;
    user-select: none;
}
.q-timer-target {
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
    margin-bottom: 2px;
}
.q-timer-count {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
}
.q-timer-normal {
    background: var(--color-surface-alt, #f0f4f8);
    color: var(--color-text-muted, #64748b);
}
.q-timer-warning {
    background: #fef3c7;
    color: #92400e;
}
.q-timer-over {
    background: #fee2e2;
    color: #dc2626;
    animation: q-timer-pulse 1.5s ease-in-out infinite;
}
@keyframes q-timer-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}
[data-theme="dark"] .q-timer-normal {
    background: rgba(255,255,255,0.06);
    color: #94a3b8;
}
[data-theme="dark"] .q-timer-warning {
    background: #422006;
    color: #fbbf24;
}
[data-theme="dark"] .q-timer-over {
    background: #450a0a;
    color: #f87171;
}

/* ── FILL-IN-THE-BLANK ── */
.fill-blank-wrapper {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0;
    padding: 20px;
    background: var(--color-surface-alt, #f8f9fa);
    border-radius: 8px;
    border: 2px solid var(--color-border, #dee2e6);
}
.fill-blank-label {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text, #212529);
    white-space: nowrap;
}
.fill-blank-input {
    width: 160px;
    padding: 10px 14px;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    text-align: right;
    border: 2px solid var(--color-border, #adb5bd);
    border-radius: 6px;
    background: var(--color-surface, #fff);
    color: var(--color-text, #212529);
    outline: none;
    transition: border-color 0.2s;
    -moz-appearance: textfield;
}
.fill-blank-input::-webkit-outer-spin-button,
.fill-blank-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.fill-blank-input:focus {
    border-color: var(--color-primary, #4361ee);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}
.fill-blank-input.correct {
    border-color: var(--color-success, #28a745);
    background: rgba(40, 167, 69, 0.08);
}
.fill-blank-input.incorrect {
    border-color: var(--color-danger, #dc3545);
    background: rgba(220, 53, 69, 0.08);
}
.fill-blank-unit {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--color-text-muted, #6c757d);
}
.fill-blank-feedback {
    width: 100%;
    margin-top: 8px;
    padding: 8px 12px;
    font-size: 0.9rem;
    color: var(--color-danger, #dc3545);
    background: rgba(220, 53, 69, 0.06);
    border-radius: 4px;
}
/* Dark mode */
[data-theme="dark"] .fill-blank-wrapper {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.12);
}
[data-theme="dark"] .fill-blank-input {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.2);
    color: #e2e8f0;
}
[data-theme="dark"] .fill-blank-input:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}
[data-theme="dark"] .fill-blank-input.correct {
    border-color: #6ee7b7;
    background: rgba(110, 231, 183, 0.1);
}
[data-theme="dark"] .fill-blank-input.incorrect {
    border-color: #fca5a5;
    background: rgba(252, 165, 165, 0.1);
}
[data-theme="dark"] .fill-blank-label { color: #e2e8f0; }
[data-theme="dark"] .fill-blank-unit { color: #94a3b8; }
[data-theme="dark"] .fill-blank-feedback {
    color: #fca5a5;
    background: rgba(252, 165, 165, 0.08);
}

/* ── MULTIPLE-CORRECT ── */
.mc-instruction {
    padding: 12px 16px;
    margin-bottom: 16px;
    background: rgba(67, 97, 238, 0.08);
    border-left: 4px solid var(--color-primary, #4361ee);
    border-radius: 4px;
    font-size: 0.95rem;
    color: var(--color-text, #212529);
}
.mc-choices { display: flex; flex-direction: column; gap: 4px; }
.mc-choice-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}
.mc-choice-row:hover { background: var(--color-surface-alt, #f8f9fa); }
.mc-checkbox {
    width: 18px; height: 18px; margin-top: 3px;
    accent-color: var(--color-primary, #4361ee);
    flex-shrink: 0;
}
.mc-choice-text { font-size: 0.95rem; line-height: 1.5; color: var(--color-text, #212529); }
.mc-correct-selected { background: rgba(40,167,69,0.1); border-left-color: var(--color-success, #28a745); }
.mc-correct-missed { background: rgba(40,167,69,0.05); border-left: 3px dashed var(--color-success, #28a745); opacity: 0.85; }
.mc-incorrect-selected { background: rgba(220,53,69,0.1); border-left-color: var(--color-danger, #dc3545); text-decoration: line-through; opacity: 0.7; }
.mc-feedback-correct, .ma-feedback-correct {
    padding: 10px 16px; margin: 8px 0; border-radius: 6px;
    background: rgba(40,167,69,0.1); color: var(--color-success, #28a745); font-weight: 600;
}
.mc-feedback-incorrect, .ma-feedback-incorrect {
    padding: 10px 16px; margin: 8px 0; border-radius: 6px;
    background: rgba(220,53,69,0.06); color: var(--color-danger, #dc3545); font-weight: 600;
}
.mc-counter { font-size: 0.85rem; color: var(--color-text-muted, #6c757d); }
.mc-counter-ready { color: var(--color-success, #28a745); font-weight: 600; }
/* Dark mode MC */
[data-theme="dark"] .mc-instruction { background: rgba(99,102,241,0.12); border-left-color: #818cf8; color: #e2e8f0; }
[data-theme="dark"] .mc-choice-row:hover { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .mc-choice-text { color: #e2e8f0; }
[data-theme="dark"] .mc-correct-selected { background: rgba(110,231,183,0.12); border-left-color: #6ee7b7; }
[data-theme="dark"] .mc-correct-missed { background: rgba(110,231,183,0.06); border-left-color: #6ee7b7; }
[data-theme="dark"] .mc-incorrect-selected { background: rgba(252,165,165,0.12); border-left-color: #fca5a5; }
[data-theme="dark"] .mc-feedback-correct, [data-theme="dark"] .ma-feedback-correct { background: rgba(110,231,183,0.1); color: #6ee7b7; }
[data-theme="dark"] .mc-feedback-incorrect, [data-theme="dark"] .ma-feedback-incorrect { background: rgba(252,165,165,0.08); color: #fca5a5; }

/* ── FIGURE + MULTI-SELECT ── */
.fmc-figure { margin: 16px 0 20px; text-align: center; }
.fmc-image {
    max-width: 100%; height: auto;
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.fmc-caption { margin-top: 8px; font-size: 0.85rem; color: var(--color-text-muted, #6c757d); font-style: italic; }
.fmc-image-fallback {
    padding: 40px;
    background: var(--color-surface-alt, #f8f9fa);
    border: 2px dashed var(--color-border, #dee2e6);
    border-radius: 8px;
    color: var(--color-text-muted, #6c757d);
    font-style: italic; text-align: center;
}
[data-theme="dark"] .fmc-image { border-color: rgba(255,255,255,0.12); }
[data-theme="dark"] .fmc-image-fallback { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.15); color: #94a3b8; }

/* ── MATCHING ── */
.ma-instruction {
    padding: 12px 16px; margin-bottom: 12px;
    background: rgba(67,97,238,0.08);
    border-left: 4px solid var(--color-primary, #4361ee);
    border-radius: 4px; font-size: 0.95rem;
    color: var(--color-text, #212529);
}
.ma-value-bank {
    padding: 10px 16px; margin-bottom: 16px;
    background: var(--color-surface-alt, #f8f9fa);
    border-radius: 6px; font-size: 0.9rem;
    color: var(--color-text, #212529);
}
.ma-table { display: flex; flex-direction: column; gap: 8px; }
.ma-row {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 12px 16px;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: 6px;
}
.ma-condition { flex: 1; font-size: 0.9rem; line-height: 1.4; }
.ma-select {
    width: 130px; padding: 8px 12px;
    font-size: 1rem; font-weight: 600;
    border: 2px solid var(--color-border, #adb5bd);
    border-radius: 6px;
    background: var(--color-surface, #fff);
    color: var(--color-text, #212529);
    cursor: pointer; flex-shrink: 0;
}
.ma-select:focus { border-color: var(--color-primary, #4361ee); outline: none; box-shadow: 0 0 0 3px rgba(67,97,238,0.15); }
.ma-row-correct { border-color: var(--color-success, #28a745); background: rgba(40,167,69,0.06); }
.ma-row-incorrect { border-color: var(--color-danger, #dc3545); background: rgba(220,53,69,0.06); }
.ma-correction { font-weight: 700; color: var(--color-success, #28a745); margin-left: 8px; font-size: 0.9rem; }
.ma-counter { font-size: 0.85rem; color: var(--color-text-muted, #6c757d); }
.ma-counter-ready { color: var(--color-success, #28a745); font-weight: 600; }
/* Dark mode MA */
[data-theme="dark"] .ma-instruction { background: rgba(99,102,241,0.12); border-left-color: #818cf8; color: #e2e8f0; }
[data-theme="dark"] .ma-value-bank { background: rgba(255,255,255,0.04); color: #e2e8f0; }
[data-theme="dark"] .ma-row { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .ma-condition { color: #e2e8f0; }
[data-theme="dark"] .ma-select { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.2); color: #e2e8f0; }
[data-theme="dark"] .ma-select:focus { border-color: #818cf8; box-shadow: 0 0 0 3px rgba(129,140,248,0.2); }
[data-theme="dark"] .ma-row-correct { border-color: #6ee7b7; background: rgba(110,231,183,0.08); }
[data-theme="dark"] .ma-row-incorrect { border-color: #fca5a5; background: rgba(252,165,165,0.08); }
[data-theme="dark"] .ma-correction { color: #6ee7b7; }

/* ── INLINE QUIZ ── */
.gl-quiz-progress-bar { height: 4px; background: var(--color-border); border-radius: 2px; margin-bottom: 0.75rem; }
.gl-quiz-progress-fill { height: 100%; background: var(--color-primary); border-radius: 2px; transition: width 0.3s; }
.gl-quiz-counter { font-size: 0.82rem; color: var(--color-text-muted); margin-bottom: 1rem; }
.gl-quiz-stem { font-size: 0.95rem; line-height: 1.7; margin-bottom: 1.25rem; }

.gl-quiz-result { text-align: center; padding: 2rem 0; }
.gl-quiz-score { font-size: 2.5rem; font-weight: 800; }
.gl-score-pass { color: var(--color-success, #10b981); }
.gl-score-fail { color: var(--color-danger, #ef4444); }
.gl-quiz-score-label { font-size: 0.88rem; color: var(--color-text-muted); margin-top: 0.25rem; }
.gl-quiz-verdict { font-size: 1.1rem; font-weight: 600; margin-top: 0.5rem; }

/* ── INLINE DRILL ── */
.gl-drill-intro { font-size: 0.92rem; line-height: 1.6; margin-bottom: 1rem; color: var(--color-text-secondary); }

/* Right sidebar detail styles */
.gl-conn-item { padding: 0.25rem 0; font-size: 0.82rem; }
.gl-formula-card {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}
.gl-formula-card:last-child { border-bottom: none; }
.gl-formula-name { font-size: 0.75rem; font-weight: 600; color: var(--color-text-muted); margin-bottom: 0.25rem; }
.gl-formula-eq { font-size: 0.85rem; overflow-x: auto; }
.gl-tip-item { padding: 0.3rem 0; font-size: 0.82rem; line-height: 1.5; }

.gl-nav-btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ── DARK MODE ── */
[data-theme="dark"] .gl-step-type-badge { background: rgba(59, 130, 246, 0.15); }
[data-theme="dark"] .gl-badge-example { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
[data-theme="dark"] .gl-badge-review { background: rgba(16, 185, 129, 0.15); color: #34d399; }
[data-theme="dark"] .gl-badge-quiz { background: rgba(236, 72, 153, 0.15); color: #f472b6; }
[data-theme="dark"] .gl-badge-drill { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
[data-theme="dark"] .gl-badge-challenge { background: #b91c1c; }
[data-theme="dark"] .gl-challenge-option { background: var(--color-surface-dark, #1e293b); border-color: var(--color-border-dark, #334155); }
[data-theme="dark"] .gl-challenge-option:hover:not(:disabled) { border-color: #60a5fa; }
[data-theme="dark"] .gl-challenge-option--correct { background: rgba(34, 197, 94, 0.15); border-color: rgba(34, 197, 94, 0.4); }
[data-theme="dark"] .gl-challenge-option--wrong { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.4); }
[data-theme="dark"] .gl-challenge-fb--right { background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.25); color: #86efac; }
[data-theme="dark"] .gl-challenge-fb--wrong { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.25); color: #fca5a5; }
[data-theme="dark"] .gl-connects-from { background: rgba(59, 130, 246, 0.1); border-left-color: rgba(59, 130, 246, 0.5); }
[data-theme="dark"] .gl-mental-model { background: rgba(59, 130, 246, 0.08); border-color: rgba(59, 130, 246, 0.2); }
[data-theme="dark"] .gl-mental-model-insight { border-top-color: rgba(59, 130, 246, 0.2); }
[data-theme="dark"] .gl-exam-procedure { background: rgba(255, 255, 255, 0.03); border-color: var(--color-border-dark, #334155); }
[data-theme="dark"] .gl-preview-sentence { background: rgba(59, 130, 246, 0.08); border-left-color: rgba(59, 130, 246, 0.4); }
[data-theme="dark"] .gl-real-world-takeaway { border-top-color: var(--color-border-dark, #334155); }

/* ── Sidebar: Exam Patterns ── */
.gl-pattern-row {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border, #e2e8f0);
}
.gl-pattern-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.gl-pattern-trigger {
    font-style: italic;
    color: var(--color-text-secondary, #64748b);
    font-size: 0.85rem;
}
.gl-pattern-means {
    font-weight: 600;
    font-size: 0.88rem;
    margin-top: 0.15rem;
}
.gl-pattern-action {
    font-size: 0.82rem;
    color: var(--color-text-secondary, #64748b);
    margin-top: 0.1rem;
}

/* ── Sidebar: Speed Tip / Mentor Thinking ── */
.gl-speed-tip {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}
.gl-recognition {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}
.gl-disguises-header {
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: 0.5rem;
}
.gl-disguises-list {
    margin: 0.25rem 0 0 1.25rem;
    padding: 0;
    font-size: 0.82rem;
}
.gl-disguises-list li { margin-bottom: 0.25rem; }

/* ── Sidebar: Cross-Topic Links (V2 per-principle) ── */
.gl-cross-link {
    margin-bottom: 0.75rem;
    font-size: 0.88rem;
}
.gl-cross-reason {
    font-size: 0.82rem;
    color: var(--color-text-secondary, #64748b);
    margin-top: 0.1rem;
}

/* ── Micro-Check Comprehension Gates ── */
.gl-micro-check {
    margin: 1.25rem 0;
    padding: 1rem 1.25rem;
    background: var(--color-warning-light, #fffbeb);
    border: 1px solid var(--color-warning-muted, #fde68a);
    border-radius: 10px;
}
.gl-micro-check-header {
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.5rem;
    color: var(--color-warning-dark, #92400e);
}
.gl-micro-check-q {
    font-size: 0.92rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}
.gl-micro-check-options {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.gl-micro-check-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 6px;
    background: var(--color-surface, #fff);
    cursor: pointer;
    text-align: left;
    font-size: 0.88rem;
    font-family: inherit;
    color: inherit;
}
.gl-micro-check-option:hover:not(:disabled) {
    border-color: var(--color-primary, #3b82f6);
}
.gl-mc-option--disabled {
    cursor: default;
    opacity: 0.85;
}
.gl-mc-option--correct {
    background: var(--color-success-light, #dcfce7);
    border-color: var(--color-success, #22c55e);
}
.gl-mc-option--wrong {
    background: var(--color-danger-light, #fee2e2);
    border-color: var(--color-danger, #ef4444);
}
.gl-mc-radio {
    font-size: 1rem;
    min-width: 1rem;
}
.gl-micro-check-fb { margin-top: 0.5rem; }
.gl-mc-fb-right {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.88rem;
    background: var(--color-success-light, #dcfce7);
    color: var(--color-success-dark, #14532d);
}
.gl-mc-fb-wrong {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.88rem;
    background: var(--color-danger-light, #fee2e2);
    color: var(--color-danger-dark, #7f1d1d);
}

/* ── Dark Mode: Sidebar Panels + Micro-Checks ── */
[data-theme="dark"] .gl-pattern-row {
    border-bottom-color: var(--color-border-dark, #334155);
}
[data-theme="dark"] .gl-micro-check {
    background: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.25);
}
[data-theme="dark"] .gl-micro-check-header { color: #fbbf24; }
[data-theme="dark"] .gl-micro-check-option {
    background: var(--color-bg-card, #1e293b);
    border-color: var(--color-border-dark, #334155);
    color: var(--color-text, #e2e8f0);
}
[data-theme="dark"] .gl-micro-check-option:hover:not(:disabled) {
    border-color: rgba(59, 130, 246, 0.5);
}
[data-theme="dark"] .gl-mc-option--correct {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
}
[data-theme="dark"] .gl-mc-option--wrong {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
}
[data-theme="dark"] .gl-mc-fb-right {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}
[data-theme="dark"] .gl-mc-fb-wrong {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

/* ── Predict Prompt (test intuition before reading) ── */
.gl-predict {
    margin: 0 0 1.5rem;
    padding: 1.25rem;
    background: var(--color-primary-light, #eff6ff);
    border: 1.5px solid var(--color-primary-muted, #93c5fd);
    border-radius: 10px;
}
.gl-predict-header {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.75rem;
    color: var(--color-primary-dark, #1e40af);
}
.gl-predict-question {
    font-size: 0.93rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}
.gl-predict-options {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.gl-predict-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 6px;
    background: var(--color-surface, #fff);
    cursor: pointer;
    text-align: left;
    font-size: 0.88rem;
    font-family: inherit;
    color: inherit;
}
.gl-predict-option:hover:not(:disabled) {
    border-color: var(--color-primary, #3b82f6);
}
.gl-predict-option--disabled {
    cursor: default;
    opacity: 0.85;
}
.gl-predict-option--correct {
    background: var(--color-success-light, #dcfce7);
    border-color: var(--color-success, #22c55e);
}
.gl-predict-option--wrong {
    background: var(--color-danger-light, #fee2e2);
    border-color: var(--color-danger, #ef4444);
}
.gl-predict-radio {
    font-size: 1rem;
    min-width: 1rem;
}
.gl-predict-reveal { margin-top: 0.75rem; }
.gl-predict-fb-right {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.88rem;
    background: var(--color-success-light, #dcfce7);
    color: var(--color-success-dark, #14532d);
    margin-bottom: 0.5rem;
}
.gl-predict-fb-wrong {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.88rem;
    background: var(--color-danger-light, #fee2e2);
    color: var(--color-danger-dark, #7f1d1d);
    margin-bottom: 0.5rem;
}
.gl-predict-reveal-text {
    padding: 0.75rem;
    background: var(--color-surface-alt, #f8fafc);
    border-radius: 6px;
    font-size: 0.88rem;
    line-height: 1.55;
    border-left: 3px solid var(--color-primary, #3b82f6);
}

/* Dark mode: Predict Prompt */
[data-theme="dark"] .gl-predict {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.25);
}
[data-theme="dark"] .gl-predict-header { color: #93c5fd; }
[data-theme="dark"] .gl-predict-option {
    background: var(--color-bg-card, #1e293b);
    border-color: var(--color-border-dark, #334155);
    color: var(--color-text, #e2e8f0);
}
[data-theme="dark"] .gl-predict-option:hover:not(:disabled) {
    border-color: rgba(59, 130, 246, 0.5);
}
[data-theme="dark"] .gl-predict-option--correct {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
}
[data-theme="dark"] .gl-predict-option--wrong {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
}
[data-theme="dark"] .gl-predict-fb-right {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}
[data-theme="dark"] .gl-predict-fb-wrong {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}
[data-theme="dark"] .gl-predict-reveal-text {
    background: rgba(255, 255, 255, 0.03);
    border-left-color: rgba(59, 130, 246, 0.4);
}

[data-theme="dark"] .gl-editorial-sidebar-content { background: var(--color-background-secondary, #1e293b); }
[data-theme="dark"] .gl-choice { background: var(--color-bg-card); }
[data-theme="dark"] .gl-choice:hover { background: rgba(59, 130, 246, 0.1); }
[data-theme="dark"] .gl-phase-placeholder { border-color: var(--color-border); }
[data-theme="dark"] .gl-ref-box { background: var(--color-background-secondary, #1e293b); }
[data-theme="dark"] .gl-formulas-overview { background: var(--color-background-secondary, #1e293b); }
[data-theme="dark"] .gl-inline-formula { background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.3); }
[data-theme="dark"] .gl-worked-example { background: var(--color-bg-card); border-color: var(--color-border); }
[data-theme="dark"] .gl-trap-box { background: rgba(239, 68, 68, 0.1); color: #fca5a5; border-color: #ef4444; }
[data-theme="dark"] .gl-tip-box { background: rgba(59, 130, 246, 0.1); color: #93c5fd; border-color: #3b82f6; }
[data-theme="dark"] .gl-choice-correct { background: rgba(16, 185, 129, 0.15) !important; border-color: #10b981 !important; color: #6ee7b7; }
[data-theme="dark"] .gl-choice-wrong { background: rgba(239, 68, 68, 0.15) !important; border-color: #ef4444 !important; color: #fca5a5; }
[data-theme="dark"] .gl-fc-card { background: var(--color-bg-card); border-color: var(--color-border); }
[data-theme="dark"] .gl-note-section { background: var(--color-bg-card); border-color: var(--color-border); }
[data-theme="dark"] .gl-score-pass { color: #34d399; }
[data-theme="dark"] .gl-score-fail { color: #f87171; }
[data-theme="dark"] .gl-sidebar-left { background: var(--color-background-secondary, #1e293b); }
[data-theme="dark"] .gl-sidebar-right { background: var(--color-background-secondary, #1e293b); }
[data-theme="dark"] .gl-panel { background: var(--color-bg-card); border-color: var(--color-border); }
[data-theme="dark"] .gl-step.active { background: rgba(59, 130, 246, 0.12); }
[data-theme="dark"] .gl-nav-btn { background: var(--color-bg-card); color: var(--color-text-secondary); border-color: var(--color-border); }
[data-theme="dark"] .gl-nav-btn:hover { background: var(--color-bg-subtle); }
[data-theme="dark"] .gl-bottom-bar { background: var(--color-background-secondary, #1e293b); }
[data-theme="dark"] .gl-placeholder { color: var(--color-text-tertiary); }

/* ── MOBILE BAR (step dots + toggle buttons) ── */
.gl-mobile-bar {
    display: none;  /* hidden on desktop */
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-card);
    flex-shrink: 0;
}
.gl-mobile-toggle {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.35rem 0.6rem;
    font-size: 1rem;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: background var(--transition-fast);
}
.gl-mobile-toggle:hover { background: var(--color-bg-subtle); }

.gl-mobile-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    overflow-x: auto;
    flex: 1;
    justify-content: center;
    padding: 0 0.5rem;
}
.gl-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-border-strong, #cbd5e1);
    flex-shrink: 0;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.gl-dot-active {
    background: var(--color-primary);
    transform: scale(1.4);
}
.gl-dot-complete {
    background: var(--color-success, #10b981);
}

/* ── TRANSITION ANIMATION ── */
.gl-step-content {
    animation: glFadeIn 0.25s ease-out;
}
@keyframes glFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── SIDEBAR TOGGLE (for tablet/mobile overlay) ── */
.gl-sidebar-open {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    width: 260px !important;
}
.gl-sidebar-right.gl-sidebar-open {
    left: auto;
    right: 0;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
}

/* ── RESPONSIVE ── */

/* Smaller desktop: 1024-1279px — narrower sidebars */
@media (max-width: 1279px) {
    .gl-sidebar-left { width: 180px; }
    .gl-sidebar-right { width: 200px; }
}

/* Tablet: 768-1024px */
@media (max-width: 1024px) {
    .gl-sidebar-right { display: none; }
    .gl-sidebar-left { width: 180px; }
    .gl-mobile-bar { display: flex; }
    .gl-step-content { padding: 1.5rem; }
}

/* Mobile: <768px */
@media (max-width: 768px) {
    .gl-sidebar-left { display: none; }
    .gl-sidebar-right { display: none; }
    .gl-mobile-bar { display: flex; }
    .gl-step-content { padding: 1.25rem 1rem; }
    .gl-bottom-bar { padding: 0.5rem 0.75rem; }
    .gl-page-nav { gap: 0.25rem; }
    .gl-nav-btn { padding: 0.35rem 0.75rem; font-size: 0.78rem; }
    .gl-page-label { font-size: 0.75rem; }
    .gl-step-title { font-size: 1.05rem; }
    .gl-editorial-content { font-size: 0.88rem; }
    .gl-worked-example { padding: 1rem; }
    .gl-inline-formula { padding: 0.75rem 1rem; }
    .gl-fc-card { padding: 1.25rem; min-height: 140px; }
    .gl-quiz-score { font-size: 2rem; }
    .gl-done-row { flex-wrap: wrap; }
}

/* Small mobile: <480px */
@media (max-width: 480px) {
    .gl-step-content { padding: 1rem 0.75rem; }
    .gl-example-choices { gap: 0.35rem; }
    .gl-choice { padding: 0.6rem 0.75rem; font-size: 0.82rem; }
    .gl-formula-row { flex-direction: column; gap: 0.25rem; }
    .gl-formula-label { min-width: auto; }
}

/* Dark mode for mobile bar */
[data-theme="dark"] .gl-mobile-bar { background: var(--color-background-secondary, #1e293b); }
[data-theme="dark"] .gl-mobile-toggle { color: var(--color-text-secondary); border-color: var(--color-border); }
[data-theme="dark"] .gl-mobile-toggle:hover { background: var(--color-bg-subtle); }
[data-theme="dark"] .gl-sidebar-open { box-shadow: 4px 0 20px rgba(0,0,0,0.4); }
[data-theme="dark"] .gl-sidebar-right.gl-sidebar-open { box-shadow: -4px 0 20px rgba(0,0,0,0.4); }

/* ══════════════════════════════════════════════════════════════
   REDESIGN V3 — Flat Flexbox Lecture Layout
   Activates ONLY when #gl-container has .v2-content-bg class.
   2-level flat flexbox: body (flex row) → left card + right col.
   Each column scrolls independently. Bottom bar always visible.
   ══════════════════════════════════════════════════════════════ */

/* ── Container: flex column, fills parent (.lecture-book-wrapper) ── */
.gl-container.v2-content-bg {
    display: flex !important;
    flex-direction: column !important;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Hidden elements ── */
.gl-container.v2-content-bg .gl-sidebar-left,
.gl-container.v2-content-bg .gl-mobile-bar {
    display: none;
}
.gl-container.v2-content-bg .gl-sidebar-left.gl-sidebar-open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 2.75rem;
    left: 260px;
    width: 240px;
    height: calc(100dvh - 2.75rem);
    z-index: 50;
    background: var(--color-bg-card);
    border-right: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
}

/* ── Lecture body: ONE scroll area (matches reference design) ── */
/* Outer wrapper clips the fixed background to the content area */
.v2-lecture-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
}
/* Inner scroll container */
.v2-lecture-body-inner {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    gap: 1.5rem;
    padding: 1.25rem;
    position: relative;
    z-index: 1;
    align-items: flex-start;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}
/* Blurred background: absolute on non-scrolling outer, contained within bounds */
.v2-lecture-body::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image: var(--v2-bg-image, linear-gradient(135deg, rgba(219,234,254,0.3), rgba(241,245,249,0.8)));
    background-size: cover;
    background-position: center;
    filter: blur(12px) brightness(1.15) saturate(0.7);
    pointer-events: none;
}

/* ── Left editorial card (60%) ── */
.v2-editorial-card {
    flex: 3;
    min-width: 0;
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 4px 12px rgba(25,28,30,0.04), 0 12px 32px rgba(25,28,30,0.08);
}
/* Paper texture overlay */
.v2-editorial-card::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.02;
    pointer-events: none;
    background-image: url('https://www.transparenttextures.com/patterns/paper-fibers.png');
    z-index: 0;
    border-radius: 16px;
}

/* ── Right column (40%, sticky — stays in view while left scrolls) ── */
.v2-right-col {
    flex: 2;
    min-width: 0;
    position: sticky;
    top: 1.25rem;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-self: flex-start;
}

/* Override gl-main inside editorial card */
.gl-container.v2-content-bg .gl-main {
    display: block;
    overflow: visible;
    min-height: auto;
    min-width: auto;
    background: transparent;
}

/* Override gl-step-content inside editorial card */
.gl-container.v2-content-bg .gl-step-content {
    overflow: visible;
    padding: 0;
    position: relative;
    z-index: 10;
}

/* Field Observation in left card */
.v2-insight-left {
    margin-top: 1.5rem;
    background: rgba(220, 252, 231, 0.85);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(134, 239, 172, 0.3);
    border-radius: 12px;
    padding: 14px;
    font-size: 0.85rem;
}
.v2-insight-left .gl-panel-heading {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #059669;
    margin-bottom: 8px;
}
.v2-insight-left .gl-panel-body {
    color: var(--color-text-primary);
    line-height: 1.6;
}
.v2-insight-left .gl-panel-empty { display: none; }

/* ── SVG diagram placeholder ── */
.v2-svg-placeholder {
    width: 100%;
    min-height: 250px;
    border: 2px dashed var(--color-border, #e0e3e5);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}
.v2-svg-placeholder-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted, #94a3b8);
}

/* ── Right sidebar: 2-column card grid ── */
.gl-container.v2-content-bg .gl-sidebar-right {
    width: auto;
    border-left: none;
    background: transparent;
    padding: 0;
    overflow: visible;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* Panels as glass cards */
.gl-container.v2-content-bg .gl-panel {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 14px;
    box-shadow: none;
    font-size: 0.8rem;
    min-width: 0;
}
/* Key Formulas: full-width dark card below SVG (outside the 2-col grid) */
.v2-right-col > #gl-formulas {
    background: linear-gradient(135deg, #091426, #1e293b);
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    font-size: 0.85rem;
    line-height: 1.6;
}
.v2-right-col > #gl-formulas .gl-panel-heading {
    color: #e2e8f0;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin-bottom: 10px;
}
.v2-right-col > #gl-formulas .gl-panel-mentor-header {
    background: rgba(245, 239, 225, 0.06);
    border-left: 2px solid var(--fm-blueprint, #1E4E6B);
    color: rgba(245, 239, 225, 0.82);
    padding: 8px 12px;
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 0.82rem;
    line-height: 1.5;
    border-radius: 0 3px 3px 0;
    margin: 0 0 14px;
}
/* Phase 10.7: Field-Manual formula card INSIDE the dark companion rail.
   Paper card on dark panel, blueprint left rule, dashed separators around
   the equation, monospace § reference stamp. Overrides the old minimalist
   "thin separator" treatment that looked unfinished against the dark panel. */
.v2-right-col > #gl-formulas .gl-formula-card {
    background: var(--fm-paper, #F5EFE1);
    color: var(--fm-ink, #1A1D1F);
    border: 1px solid rgba(0,0,0,0.1);
    border-left: 3px solid var(--fm-blueprint, #1E4E6B);
    border-radius: 3px;
    padding: 14px 16px 12px 18px;
    margin: 10px 0;
    font-family: 'Fraunces', Georgia, serif;
    overflow: hidden;
}
.v2-right-col > #gl-formulas .gl-formula-card:last-child { margin-bottom: 2px; }
.v2-right-col > #gl-formulas .gl-formula-name {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    font-size: 0.96rem;
    color: var(--fm-ink, #1A1D1F);
    letter-spacing: -0.005em;
    margin: 0 0 8px;
}
.v2-right-col > #gl-formulas .gl-formula-eq {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 1rem;
    color: var(--fm-ink, #1A1D1F);
    padding: 10px 4px 8px;
    margin: 6px 0;
    border-top: 1px dashed rgba(0,0,0,0.18);
    border-bottom: 1px dashed rgba(0,0,0,0.18);
    /* Horizontal scroll only when equation actually overflows; no vertical
       scrollbar buttons leaking through. */
    overflow-x: auto;
    overflow-y: hidden;
    text-align: center;
    line-height: 1.4;
}
/* Kill the native up/down scrollbar button arrows (WebKit) that showed up
   on cramped equation containers. */
.v2-right-col > #gl-formulas .gl-formula-eq::-webkit-scrollbar { height: 4px; }
.v2-right-col > #gl-formulas .gl-formula-eq::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.v2-right-col > #gl-formulas .gl-formula-eq::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 2px; }
.v2-right-col > #gl-formulas .gl-formula-eq mjx-container { color: var(--fm-ink, #1A1D1F) !important; margin: 0 auto !important; }
.v2-right-col > #gl-formulas .gl-formula-ref {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.7rem;
    color: var(--fm-blueprint, #1E4E6B);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 700;
    margin-top: 4px;
}
[data-theme="dark"] .v2-right-col > #gl-formulas .gl-formula-card {
    background: #1E242B;
    color: #E5E3DB;
    border-color: #2B3036;
    border-left-color: #85B9D9;
}
[data-theme="dark"] .v2-right-col > #gl-formulas .gl-formula-name { color: #F1EEE6; }
[data-theme="dark"] .v2-right-col > #gl-formulas .gl-formula-eq {
    color: #F1EEE6;
    border-top-color: rgba(255,255,255,0.12);
    border-bottom-color: rgba(255,255,255,0.12);
}
[data-theme="dark"] .v2-right-col > #gl-formulas .gl-formula-eq mjx-container { color: #F1EEE6 !important; }
[data-theme="dark"] .v2-right-col > #gl-formulas .gl-formula-ref { color: #85B9D9; }
.gl-container.v2-content-bg #gl-exam-patterns {
    grid-column: 1 / -1;
    background: rgba(254, 243, 199, 0.85);
    border-color: rgba(252, 211, 77, 0.3);
}
.gl-container.v2-content-bg #gl-mentor-thinking { grid-column: 1 / -1; }

/* ══ V2 LECTURE HEADER (matches reference design) ══ */
.v2-lecture-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.25rem;
    border-bottom: 1px solid var(--color-border, #e2e8f0);
    background: #fff;
    z-index: 20;
    position: relative;
    gap: 0.75rem;
}
.v2-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.v2-header-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border: none; background: none;
    border-radius: 8px;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all 0.15s;
    flex-shrink: 0;
}
.v2-header-back:hover { background: var(--color-bg-subtle); color: var(--color-text-primary); }
.v2-header-back .material-symbols-outlined { font-size: 18px; }
.v2-subject-badge {
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #a38c6a;
    background: #fadfb8;
    padding: 3px 10px;
    border-radius: 4px;
    flex-shrink: 0;
    font-family: var(--font-ui);
}
.v2-header-ch {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    flex-shrink: 0;
}
.v2-header-dot { color: var(--color-text-muted); font-size: 12px; flex-shrink: 0; }
.v2-header-title {
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 800;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.v2-header-dots {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-left: 0.5rem;
    flex-shrink: 0;
}
.v2-header-dots .v2-dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--color-border);
    transition: background 0.2s;
}
.v2-header-dots .v2-dot--done { background: #16a34a; }
.v2-header-dots .v2-dot--active { background: #0058be; }
.v2-header-step {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.v2-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
/* Step rail */
.v2-step-rail {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.v2-rail-group {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    background: var(--color-bg-subtle, #f2f4f6);
    border-radius: 8px;
}
.v2-rail-label {
    font-size: 7px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: var(--color-text-muted);
    margin-right: 4px;
}
.v2-rail-arrow {
    font-size: 9px;
    color: var(--color-text-muted);
    margin: 0 2px;
}
.v2-sp {
    width: 22px; height: 22px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
    border: none; background: none;
}
.v2-sp--done { background: #16a34a; color: #fff; }
.v2-sp--done .material-symbols-outlined { font-size: 10px; }
.v2-sp--active { background: #0058be; color: #fff; box-shadow: 0 0 0 2px rgba(0,88,190,0.25); }
.v2-sp--locked { background: #eceef0; color: #75777d; }
.v2-header-icon {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border: none; background: none;
    border-radius: 8px; cursor: pointer; color: var(--color-text-muted);
}
.v2-header-icon:hover { background: var(--color-bg-subtle); }
.v2-header-icon .material-symbols-outlined { font-size: 16px; }

/* ══ V2 LECTURE FOOTER (matches reference design) ══ */
.v2-lecture-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--color-border, #e2e8f0);
    background: #fff;
    z-index: 20;
    position: relative;
}
/* Phase 10.9: grid layout — left / true-center / right. Puts the Vector
   Pill geometrically in the middle of the bar regardless of Prev / Next
   / progress widths, and lets the right cluster hold both the progress
   gate pill and the Next button as one aligned group. */
.v2-footer-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0.4rem 1.25rem;
    gap: 0.75rem;
}
.v2-footer-nav .v2-footer-prev { justify-self: start; grid-column: 1; }
.v2-footer-nav .v2-vector-pill { justify-self: center; grid-column: 2; }
.v2-footer-nav .v2-footer-right { justify-self: end; grid-column: 3; }
.v2-footer-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.v2-footer-prev,
.v2-footer-next {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: color 0.15s;
    padding: 0;
}
.v2-footer-prev:hover,
.v2-footer-next:hover { color: var(--color-text-primary); }
.v2-footer-circle {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s;
}
.v2-footer-circle .material-symbols-outlined { font-size: 14px; }
.v2-footer-circle--gray {
    background: var(--color-bg-subtle, #e6e8ea);
    color: var(--color-text-muted);
}
.v2-footer-circle--primary {
    background: var(--color-primary, #091426);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,88,190,0.2);
}
.v2-footer-prev:hover .v2-footer-circle { transform: translateX(-2px); }
.v2-footer-next:hover .v2-footer-circle { transform: translateX(2px); }
.v2-footer-label {
    display: flex;
    flex-direction: column;
}
.v2-footer-label--right { text-align: right; }
.v2-footer-label-top {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}
.v2-footer-label-name {
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-primary);
}
/* Smart Gate pill — Phase 10.9: sits inside .v2-footer-right cluster now,
   no margin-left/right auto needed (grid + flex-gap handles spacing). */
.v2-smart-gate {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 1rem;
    background: var(--color-bg-subtle, #f2f4f6);
    border-radius: 9999px;
}
.v2-gate-icon {
    font-size: 14px;
    color: var(--color-primary, #0058be);
}
.v2-gate-text {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-primary);
    white-space: nowrap;
}
.v2-gate-bar {
    width: 96px;
    height: 6px;
    background: var(--color-border, #e6e8ea);
    border-radius: 9999px;
    overflow: hidden;
}
.v2-gate-bar-fill {
    height: 100%;
    background: var(--color-primary, #0058be);
    border-radius: 9999px;
    transition: width 0.3s;
}

/* Dark mode header + footer */
[data-theme="dark"] .v2-lecture-header { background: var(--color-bg-card); }
[data-theme="dark"] .v2-lecture-footer { background: var(--color-bg-card); }
[data-theme="dark"] .v2-subject-badge { background: #422006; color: #fbbf24; }
[data-theme="dark"] .v2-footer-circle--gray { background: var(--color-bg-subtle); }
[data-theme="dark"] .v2-footer-circle--primary { background: #3b82f6; }
[data-theme="dark"] .v2-smart-gate { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .v2-rail-group { background: rgba(255,255,255,0.06); }

/* Responsive header + footer */
@media (max-width: 1024px) {
    .v2-step-rail { display: none; }
    .v2-header-title { max-width: 200px; }
    .v2-smart-gate { display: none; }
    .v2-footer-label { display: none; }
}
@media (max-width: 768px) {
    .v2-header-dots { display: none; }
    .v2-header-step { display: none; }
    .v2-subject-badge { display: none; }
    .v2-lecture-header { padding: 0.4rem 0.75rem; }
    .v2-footer-nav { padding: 0.4rem 0.75rem; }
}

/* ── Neutralize old companion fixed positioning (only when vc-active is used by old code) ── */
.gl-container.v2-content-bg #vector-companion.vc-active {
    position: absolute; /* let .v2-vector-dropdown handle actual positioning */
}

/* ── Bottom bar: flex-shrink-0, always visible (matches reference footer pattern) ── */
.gl-container.v2-content-bg > .gl-bottom-bar {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 44px;
    padding: 0;
    border-top: 1px solid var(--color-border);
    background: #fff;
    z-index: 20;
    position: relative;
}
.gl-container.v2-content-bg .gl-page-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 1.25rem;
    width: 100%;
}
.gl-container.v2-content-bg .gl-page-nav #gl-next-btn {
    margin-left: auto;
}

/* ── Vector Pill (Phase 9: live status + Field Manual style) ── */
.v2-vector-pill { position: relative; }
.v2-vector-pill-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 8px;
    border-radius: 9999px;
    background: var(--fm-paper-2, #FAF6EC);
    border: 1px solid var(--fm-rule, #C9BFA8);
    cursor: pointer;
    transition: all 140ms ease;
    font-family: 'Inter Tight', system-ui, sans-serif;
    color: var(--fm-ink, #1A1D1F);
    box-shadow: 0 2px 6px rgba(26, 29, 31, 0.08);
}
.v2-vector-pill-btn:hover {
    background: var(--fm-paper, #F5EFE1);
    border-color: var(--fm-blueprint, #1E4E6B);
    transform: translateY(-1px);
}
.v2-vector-pill-glyph {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--fm-blueprint, #1E4E6B);
    background: var(--fm-paper, #F5EFE1);
    border: 1.5px solid var(--fm-blueprint, #1E4E6B);
    flex-shrink: 0;
    animation: v2-vector-breathe 3.2s ease-in-out infinite;
}
@keyframes v2-vector-breathe {
    0%, 100% { box-shadow: 0 0 0 0 rgba(30, 78, 107, 0.18); }
    50% { box-shadow: 0 0 0 4px rgba(30, 78, 107, 0.06); }
}
.v2-vector-pill-textcol {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    line-height: 1.2;
    min-width: 0;
}
.v2-vector-pill-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--fm-ink-2, #4A5158);
}
.v2-vector-pill-status {
    /* Phase 10: allow the status line to wrap across 2 lines (ellipsis on 3rd)
       so Vector's mentor-voice messages aren't clipped mid-sentence. */
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 0.84rem;
    line-height: 1.35;
    color: var(--fm-ink, #1A1D1F);
    max-width: 420px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
}
.v2-vector-pill-signal {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
    flex-shrink: 0;
    transition: background 200ms ease;
}
.v2-vector-pill-signal--active { animation: v2-dot-pulse 1.8s ease-in-out infinite; }
.v2-vector-pill-signal[data-tone="teaching"] { background: var(--fm-blueprint, #1E4E6B); }
.v2-vector-pill-signal[data-tone="warning"]  { background: var(--fm-redline,   #B42D1F); }
.v2-vector-pill-signal[data-tone="success"]  { background: var(--fm-survey,    #4F6B3A); }
.v2-vector-pill-arrow {
    font-size: 16px;
    color: var(--fm-ink-3, #7A7468);
    transition: transform 0.2s;
}
.v2-vector-pill.vc-open .v2-vector-pill-arrow { transform: rotate(180deg); }
.v2-vector-pill-icon { display: none; } /* legacy Material icon hidden */
.v2-vector-pill-dot {
    display: none; width: 6px; height: 6px; border-radius: 50%;
    background: var(--fm-ochre, #B8822A); animation: v2-dot-pulse 1.5s ease-in-out infinite;
}
.v2-vector-pill.has-update .v2-vector-pill-dot { display: block; }
@keyframes v2-dot-pulse {
    0%,100% { opacity:1; transform:scale(1); }
    50% { opacity:0.5; transform:scale(1.3); }
}
.v2-vector-pill.vc-mode-warning .v2-vector-pill-btn { border-color: var(--fm-redline, #B42D1F); }
.v2-vector-pill.vc-mode-trap    .v2-vector-pill-btn { border-color: var(--fm-redline, #B42D1F); }
.v2-vector-pill.vc-mode-tip     .v2-vector-pill-btn { border-color: var(--fm-survey,  #4F6B3A); }
@media (max-width: 900px) {
    .v2-vector-pill-status { display: none; }
    .v2-vector-pill-btn { padding: 4px 10px 4px 6px; }
}

/* ── Upward dropdown ── */
#vector-companion.v2-vector-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
    z-index: 100;
    max-height: 50vh;
    overflow-y: auto;
    scrollbar-width: thin;
}
.v2-vector-pill.vc-open #vector-companion.v2-vector-dropdown { display: block; }
.v2-vector-pill.vc-open .v2-vector-pill-arrow { transform: rotate(180deg); }
.v2-vector-pill.vc-open .v2-vector-pill-dot { display: none; }
.v2-vector-dropdown .vector-companion-section {
    padding: 8px 0; border-bottom: 1px solid rgba(0,0,0,0.06);
}
.v2-vector-dropdown .vector-companion-section:last-child { border-bottom: none; }
.v2-vector-dropdown .vector-companion-msg { font-size: 0.85rem; line-height: 1.6; color: #334155; margin: 0; }
.v2-vector-dropdown .vector-companion-stats { display: flex; gap: 12px; }
.v2-vector-dropdown .vector-companion-stat { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.v2-vector-dropdown .vector-companion-stat-label { font-size: 0.7rem; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; }
.v2-vector-dropdown .vector-companion-stat-value { font-size: 0.85rem; font-weight: 700; color: #091426; }

/* ── Dark mode ── */
[data-theme="dark"] .v2-editorial-card { background: rgba(30,41,59,0.92); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
[data-theme="dark"] .v2-editorial-card::before { opacity: 0.01; }
[data-theme="dark"] .v2-lecture-body::before { filter: blur(12px) brightness(0.4) saturate(0.5); }
[data-theme="dark"] .gl-container.v2-content-bg .gl-panel { background: rgba(30,41,59,0.85); border-color: rgba(255,255,255,0.08); color: #e2e8f0; }
[data-theme="dark"] .gl-container.v2-content-bg .gl-panel .gl-panel-heading { color: #e2e8f0; }
[data-theme="dark"] .gl-container.v2-content-bg > .gl-bottom-bar { background: var(--color-bg-card); }
[data-theme="dark"] .v2-vector-pill-btn { background: rgba(30,58,138,0.6); border-color: rgba(96,165,250,0.2); color: #e2e8f0; }
[data-theme="dark"] .v2-vector-pill-btn:hover { background: rgba(30,58,138,0.8); border-color: #60a5fa; }
[data-theme="dark"] .v2-vector-pill-icon { color: #60a5fa; }
[data-theme="dark"] #vector-companion.v2-vector-dropdown { background: rgba(30,41,59,0.96); border-color: rgba(255,255,255,0.08); box-shadow: 0 -4px 20px rgba(0,0,0,0.3); }
[data-theme="dark"] #vector-companion.v2-vector-dropdown .vector-companion-msg { color: #e2e8f0; }
[data-theme="dark"] #vector-companion.v2-vector-dropdown .vector-companion-stat-value { color: #f1f5f9; }
[data-theme="dark"] #vector-companion.v2-vector-dropdown .vector-companion-section { border-bottom-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .gl-container.v2-content-bg .gl-sidebar-left { background: var(--color-bg-card); }
[data-theme="dark"] .gl-container.v2-content-bg #gl-formulas { background: linear-gradient(135deg, #0f172a, #1e293b); }
[data-theme="dark"] .gl-container.v2-content-bg #gl-exam-patterns { background: rgba(120,53,15,0.6); border-color: rgba(251,191,36,0.2); }
[data-theme="dark"] .v2-svg-placeholder { border-color: rgba(255,255,255,0.1); background: rgba(30,41,59,0.4); }
[data-theme="dark"] .v2-svg-placeholder-label { color: #64748b; }

/* ── Responsive: tablet ── */
@media (max-width: 1024px) {
    .v2-lecture-body { flex-direction: column; overflow-y: auto; }
    .v2-editorial-card, .v2-right-col { overflow-y: visible; flex: none; }
    .gl-container.v2-content-bg .gl-sidebar-left { left: 0; }
    .gl-container.v2-content-bg .gl-mobile-bar { display: flex; }
    .v2-vector-dropdown { width: min(320px, 90vw); left: auto; right: 0; transform: none; }
    .v2-vector-pill.vc-open .v2-vector-dropdown { transform: none; }
}

/* ── Responsive: mobile ── */
@media (max-width: 768px) {
    .v2-lecture-body { padding: 1rem 0.75rem; gap: 1rem; }
    .v2-editorial-card { padding: 1.25rem; }
    .gl-container.v2-content-bg .gl-page-nav { padding: 0.4rem 0.75rem; }
    .gl-container.v2-content-bg .gl-sidebar-right { grid-template-columns: 1fr; }
    .v2-vector-pill-name { display: none; }
    .v2-vector-dropdown { width: calc(100vw - 2rem); left: auto; right: -1rem; transform: none; }
    .v2-vector-pill.vc-open .v2-vector-dropdown { transform: none; }
}

/* ══════════════════════════════════════════════════════════════
   REDESIGN V2 — Glass Card System + Design Foundation
   Phase 1: New classes for incremental migration.
   These classes have NO effect until applied to elements.
   ══════════════════════════════════════════════════════════════ */

/* ── Material Symbols defaults ── */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.icon-filled {
    font-variation-settings: 'FILL' 1;
}

/* ── Editorial gradient (hero cards, dark headers) ── */
.editorial-gradient {
    background: linear-gradient(135deg, #091426, #1e293b);
}

/* ── Glass card system — 4 semantic variants ── */
.glass {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 20px;
}
.glass-blue {
    background: rgba(219, 234, 254, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(147, 197, 253, 0.3);
    border-radius: 16px;
    padding: 20px;
}
.glass-green {
    background: rgba(220, 252, 231, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(134, 239, 172, 0.3);
    border-radius: 16px;
    padding: 20px;
}
.glass-amber {
    background: rgba(254, 243, 199, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(252, 211, 77, 0.3);
    border-radius: 16px;
    padding: 20px;
}

/* ── Answer card (.ac) — quiz answer choice ── */
.v2-ac {
    transition: all 0.15s;
    cursor: pointer;
    border: 2px solid rgba(197, 198, 205, 0.2);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.v2-ac:hover {
    border-color: #0058be;
    background: rgba(0, 88, 190, 0.02);
}
.v2-ac-ok {
    border-color: #16a34a !important;
    background: #f0fdf4 !important;
}
.v2-ac-no {
    border-color: #ba1a1a !important;
    background: #fef2f2 !important;
}

/* ── Solution step cards ── */
.v2-sol-step {
    background: #fff;
    border: 1px solid #e0e3e5;
    border-radius: 12px;
    padding: 14px 18px;
    text-align: center;
    margin-bottom: 6px;
}
.v2-sol-step.final {
    border-color: #0058be;
    border-width: 2px;
}

/* ── Step pills (step rail navigation) ── */
.sp {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.sp-done   { background: #16a34a; color: #fff; }
.sp-active { background: #0058be; color: #fff; box-shadow: 0 0 0 2px rgba(0, 88, 190, 0.25); }
.sp-locked { background: #eceef0; color: #75777d; }

/* ── Sidebar active state (new design) ── */
.v2-nav-active {
    background: linear-gradient(90deg, rgba(0, 88, 190, 0.08), transparent);
    border-right: 3px solid #0058be;
}

/* ── Blurred subject background ── */
.v2-content-bg {
    position: relative;
    isolation: isolate;
}
.v2-content-bg::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background-size: cover;
    background-position: center;
    filter: blur(12px) brightness(1.15) saturate(0.7);
    pointer-events: none;
}

/* ── Formula tab (right panel) ── */
.ftab {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    border: 1.5px solid transparent;
}
.ftab:hover  { background: rgba(0, 88, 190, 0.04); }
.ftab.active { background: rgba(0, 88, 190, 0.08); border-color: rgba(0, 88, 190, 0.2); color: #0058be; }

/* ── Celebration animations ── */
@keyframes celebBounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-12px); }
}
.celeb-icon { animation: celebBounce 1s ease-in-out 2; }

@keyframes celebFade {
    0%   { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}
.celeb-in { animation: celebFade 0.6s ease-out forwards; opacity: 0; }

/* ── Dropdown accordion (deep dive, etc.) ── */
.dd-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}
.dd-open .dd-content { max-height: 800px; }
.dd-open .dd-arrow   { transform: rotate(180deg); }
.dd-arrow             { transition: transform 0.2s; }

/* ══════════════════════════════════════════════════════════════
   REDESIGN V2 — Dark Mode Variants
   ══════════════════════════════════════════════════════════════ */

[data-theme="dark"] .glass {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}
[data-theme="dark"] .glass-blue {
    background: rgba(30, 58, 138, 0.6);
    border-color: rgba(96, 165, 250, 0.2);
    color: #bfdbfe;
}
[data-theme="dark"] .glass-green {
    background: rgba(20, 83, 45, 0.6);
    border-color: rgba(74, 222, 128, 0.2);
    color: #bbf7d0;
}
[data-theme="dark"] .glass-amber {
    background: rgba(120, 53, 15, 0.6);
    border-color: rgba(251, 191, 36, 0.2);
    color: #fef3c7;
}
[data-theme="dark"] .editorial-gradient {
    background: linear-gradient(135deg, #0f172a, #1e293b);
}
[data-theme="dark"] .v2-ac {
    border-color: rgba(148, 163, 184, 0.2);
}
[data-theme="dark"] .v2-ac:hover {
    border-color: #60a5fa;
    background: rgba(96, 165, 250, 0.08);
}
[data-theme="dark"] .v2-ac-ok {
    border-color: #4ade80 !important;
    background: rgba(34, 197, 94, 0.15) !important;
}
[data-theme="dark"] .v2-ac-no {
    border-color: #f87171 !important;
    background: rgba(239, 68, 68, 0.15) !important;
}
[data-theme="dark"] .v2-sol-step {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}
[data-theme="dark"] .v2-sol-step.final {
    border-color: #60a5fa;
}
[data-theme="dark"] .sp-locked {
    background: #334155;
    color: #94a3b8;
}
[data-theme="dark"] .v2-nav-active {
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.12), transparent);
    border-right-color: #60a5fa;
}
[data-theme="dark"] .ftab:hover  { background: rgba(96, 165, 250, 0.06); }
[data-theme="dark"] .ftab.active { background: rgba(96, 165, 250, 0.12); border-color: rgba(96, 165, 250, 0.25); color: #60a5fa; }

/* ══════════════════════════════════════════════════════════════
   REDESIGN V2 — Phase 2: Sidebar Restyle
   White sidebar with Manrope font, Material Symbols,
   right-border active state, hover slide animation.
   Overrides existing sidebar styles (lines 573-641).
   ══════════════════════════════════════════════════════════════ */

/* ── Sidebar container: white bg, light right border ── */
.sidebar {
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    width: 260px;
}
.main-content {
    margin-left: 260px;
    width: calc(100vw - 260px);
}

/* ── Logo: text-only brand ── */
.sidebar-logo {
    padding: 2rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-left: none;
}
.sidebar-logo-icon { display: none; }
.sidebar-logo-text {
    font-family: 'Manrope', sans-serif;
    font-size: 22px;
    font-weight: 900;
    color: #091426;
    letter-spacing: -0.02em;
}
.sidebar-logo-sub {
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #0058be;
    margin-top: 2px;
}

/* ── Divider between logo and nav ── */
.sidebar-divider {
    margin: 0 1.5rem;
    height: 1px;
    background: #e2e8f0;
}

/* ── Section labels ── */
.sidebar-section-label {
    font-family: 'Manrope', sans-serif;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #94a3b8;
    padding: 1.5rem 1rem 0.75rem;
    margin-top: 0;
}
.sidebar-label-first {
    margin-top: 0;
    padding-top: 1.5rem;
}

/* ── Nav links: Manrope, hover slide, right border active ── */
.sidebar-link {
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1rem;
    margin: 1px 0.75rem;
    border-radius: 8px;
    border-left: none;
    border-right: 3px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
    cursor: pointer;
}
.sidebar-link:hover {
    color: #091426;
    background: #f8fafc;
    transform: translateX(4px);
}
.sidebar-link.active {
    color: #0058be;
    font-weight: 700;
    background: linear-gradient(90deg, rgba(0, 88, 190, 0.08), transparent);
    border-left: none;
    border-right-color: #0058be;
}

/* ── Material Symbols icon sizing in sidebar ── */
.sidebar-icon {
    font-size: 20px;
    flex-shrink: 0;
    line-height: 1;
}
.sidebar-link.active .sidebar-icon {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Hide old iconify icons if any remain */
.sidebar-link iconify-icon { display: none; }

/* ── User card at bottom ── */
.sidebar-user {
    padding: 1rem 0.75rem 1.5rem;
    margin-top: auto;
    border-top: none;
}
.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 88, 190, 0.1);
    color: #0058be;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-user-name {
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #091426;
}
.sidebar-user-role {
    font-size: 10px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.sidebar-user-overflow {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0.25rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 16px;
}

/* ── Sidebar Dark Mode ── */
[data-theme="dark"] .sidebar {
    background: #0f172a;
    border-right-color: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .sidebar-logo-text { color: #f1f5f9; }
[data-theme="dark"] .sidebar-logo-sub { color: #60a5fa; }
[data-theme="dark"] .sidebar-divider { background: rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .sidebar-section-label { color: #475569; }
[data-theme="dark"] .sidebar-link {
    color: #94a3b8;
}
[data-theme="dark"] .sidebar-link:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .sidebar-link.active {
    color: #60a5fa;
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.12), transparent);
    border-right-color: #60a5fa;
}
[data-theme="dark"] .sidebar-user {
    background: rgba(255, 255, 255, 0.04);
}
[data-theme="dark"] .sidebar-user-avatar {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
}
[data-theme="dark"] .sidebar-user-name { color: #f1f5f9; }
[data-theme="dark"] .sidebar-user-role { color: #64748b; }

/* ── Sidebar Sepia Mode ── */
[data-theme="sepia"] .sidebar {
    background: #faf6f0;
    border-right-color: #e8ddd0;
}
[data-theme="sepia"] .sidebar-logo-text { color: #3d2418; }
[data-theme="sepia"] .sidebar-logo-sub { color: #8b4513; }
[data-theme="sepia"] .sidebar-divider { background: #e8ddd0; }
[data-theme="sepia"] .sidebar-section-label { color: #a08070; }
[data-theme="sepia"] .sidebar-link { color: #8b7355; }
[data-theme="sepia"] .sidebar-link:hover { color: #3d2418; background: rgba(139, 69, 19, 0.05); }
[data-theme="sepia"] .sidebar-link.active {
    color: #8b4513;
    background: linear-gradient(90deg, rgba(139, 69, 19, 0.08), transparent);
    border-right-color: #8b4513;
}
[data-theme="sepia"] .sidebar-user { background: rgba(139, 69, 19, 0.04); }
[data-theme="sepia"] .sidebar-user-avatar { background: rgba(139, 69, 19, 0.1); color: #8b4513; }
[data-theme="sepia"] .sidebar-user-name { color: #3d2418; }

/* ── Sidebar High-Contrast Mode ── */
[data-theme="high-contrast"] .sidebar {
    background: #000000;
    border-right-color: #333333;
}
[data-theme="high-contrast"] .sidebar-logo-text { color: #ffffff; }
[data-theme="high-contrast"] .sidebar-logo-sub { color: #60a5fa; }
[data-theme="high-contrast"] .sidebar-divider { background: #333333; }
[data-theme="high-contrast"] .sidebar-section-label { color: #888888; }
[data-theme="high-contrast"] .sidebar-link { color: #aaaaaa; }
[data-theme="high-contrast"] .sidebar-link:hover { color: #ffffff; background: #222222; }
[data-theme="high-contrast"] .sidebar-link.active {
    color: #60a5fa;
    background: #1a1a1a;
    border-right-color: #60a5fa;
}
[data-theme="high-contrast"] .sidebar-user { background: #111111; }
[data-theme="high-contrast"] .sidebar-user-avatar { background: #1a1a3d; color: #60a5fa; }
[data-theme="high-contrast"] .sidebar-user-name { color: #ffffff; }

/* ── Sidebar Focus Mode (minimal, keeps blue brand) ── */
[data-theme="focus"] .sidebar {
    background: #fafafa;
    border-right-color: #e0e0e0;
}
[data-theme="focus"] .sidebar-logo-text { color: #111111; }
[data-theme="focus"] .sidebar-logo-sub { color: #0058be; }
[data-theme="focus"] .sidebar-divider { background: #e0e0e0; }
[data-theme="focus"] .sidebar-section-label { color: #999999; }
[data-theme="focus"] .sidebar-link { color: #666666; }
[data-theme="focus"] .sidebar-link:hover { color: #111111; background: #f5f5f5; }
[data-theme="focus"] .sidebar-link.active {
    color: #0058be;
    background: linear-gradient(90deg, rgba(0, 88, 190, 0.08), transparent);
    border-right-color: #0058be;
}
[data-theme="focus"] .sidebar-user { background: #f5f5f5; }
[data-theme="focus"] .sidebar-user-avatar { background: rgba(0, 88, 190, 0.1); color: #0058be; }
[data-theme="focus"] .sidebar-user-name { color: #111111; }

/* ══════════════════════════════════════════════════════════════
   REDESIGN V2 — Phase 3: Dashboard Hero + Stats
   ══════════════════════════════════════════════════════════════ */

/* ── Hero + Countdown Row ── */
.v2-hero-row {
    display: grid;
    grid-template-columns: 8fr 4fr;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}
.v2-hero-card {
    padding: 2.5rem 3rem;
    border-radius: 1.5rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}
@media (min-width: 1280px) { .v2-hero-card { padding: 3rem 3.5rem; } }
.v2-hero-content { position: relative; z-index: 1; }
.v2-hero-badge {
    display: inline-block;
    padding: 0.375rem 1rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 1.25rem;
}
.v2-hero-title {
    font-family: 'Manrope', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0 0 0.75rem;
    color: #fff;
}
@media (min-width: 1280px) { .v2-hero-title { font-size: 3rem; } }
.v2-hero-subtitle {
    color: #bcc7de;
    font-size: 0.95rem;
    max-width: 480px;
    line-height: 1.6;
    margin: 0 0 2rem;
}
.v2-hero-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.v2-hero-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff;
    color: #091426;
    padding: 0.875rem 1.5rem;
    border-radius: 0.75rem;
    border: none;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}
.v2-hero-btn:hover { transform: translateY(-2px); box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2); }
.v2-hero-btn-icon { font-size: 20px; }
.v2-hero-checkin {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.v2-hero-checkin:hover { background: rgba(255, 255, 255, 0.18); }
.v2-hero-checkin:disabled { opacity: 0.5; cursor: default; }
.v2-hero-glow {
    position: absolute;
    right: -10%;
    top: -20%;
    width: 55%;
    height: 140%;
    background: rgba(0, 88, 190, 0.08);
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
}

/* ── Countdown Card ── */
.v2-countdown-card {
    background: #fff;
    padding: 2rem 2.5rem;
    border-radius: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    border: 1px solid rgba(197, 198, 205, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.v2-countdown-label {
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #0058be;
}
.v2-countdown-days {
    font-family: 'Manrope', sans-serif;
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #091426;
    margin: 0;
}
/* Beat the global h1,h2 { color: var(--color-text-primary) } rule */
.v2-hero-row .v2-countdown-days,
.v2-section-header .v2-section-title { color: inherit; }
.v2-countdown-hint {
    font-size: 12px;
    color: #75777d;
    margin: 0;
    line-height: 1.5;
}
/* Countdown sub-boxes (Days / Hours / Min) */
.v2-countdown-boxes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    width: 100%;
    margin: 0.25rem 0;
}
.v2-cd-box {
    background: #f2f4f6;
    padding: 1rem;
    border-radius: 1rem;
    text-align: center;
}
.v2-cd-num {
    display: block;
    font-family: 'Manrope', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #091426;
}
.v2-cd-unit {
    font-family: 'Manrope', sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #75777d;
}

/* ── Section Header (Performance Overview / Mission Control) ── */
.v2-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
}
.v2-section-overline {
    display: block;
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #0058be;
    margin-bottom: 0.375rem;
}
.v2-section-title {
    font-family: 'Manrope', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #091426;
    margin: 0;
}
.v2-section-link {
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #0058be;
    text-decoration: none;
    transition: text-decoration 0.15s;
}
.v2-section-link:hover { text-decoration: underline; }

/* ── Hero Milestone (Next Milestone label) ── */
.v2-hero-milestone {
    display: flex;
    flex-direction: column;
    margin-left: 0.5rem;
}
.v2-hero-milestone-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #8590a6;
}
.v2-hero-milestone-name {
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

/* ── Performance Stats Row ── */
.v2-stats-row {
    display: grid;
    grid-template-columns: 3fr 3fr 3fr;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: stretch;
}
.v2-readiness-card {
    color: #fff;
    padding: 1.25rem 1.75rem;
    border-radius: 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(9, 20, 38, 0.2);
}
.v2-readiness-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.v2-readiness-badge {
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
.v2-readiness-updated {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 500;
}
.v2-readiness-heading {
    font-family: 'Manrope', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.125rem;
}
.v2-readiness-subtitle {
    font-size: 11px;
    color: #8590a6;
    margin: 0 0 0.5rem;
    line-height: 1.3;
}
.v2-readiness-score {
    display: flex;
    align-items: flex-end;
    gap: 0.375rem;
    margin-bottom: 0.125rem;
}
.v2-readiness-score > span:first-child {
    font-family: 'Manrope', sans-serif;
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1;
    transition: color 0.5s ease;
}
.v2-readiness-unit {
    font-family: 'Manrope', sans-serif;
    font-size: 1.25rem;
    font-weight: 500;
    color: #0058be;
    margin-bottom: 0.375rem;
}
.v2-readiness-trend {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    margin-left: 0.5rem;
}
.v2-trend-arrow {
    font-size: 18px;
    color: #4ade80;
}
.v2-trend-value {
    font-family: 'Manrope', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #4ade80;
}
.v2-readiness-zone {
    font-size: 11px;
    color: #bcc7de;
    margin: 0.125rem 0 0.5rem;
    line-height: 1.3;
}
.v2-readiness-bar {
    height: 4px;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}
.v2-readiness-fill {
    height: 100%;
    background: #0058be;
    border-radius: 4px;
    transition: width 0.6s ease;
}
.v2-readiness-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.v2-rs-stat-label {
    font-family: 'Manrope', sans-serif;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    margin: 0 0 0.25rem;
    letter-spacing: 0.05em;
}
.v2-rs-stat-value {
    font-family: 'Manrope', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}
.v2-readiness-glow {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 66%;
    height: 66%;
    background: linear-gradient(to top, rgba(0, 88, 190, 0.25), transparent);
    filter: blur(60px);
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.3s;
}
.v2-readiness-card:hover .v2-readiness-glow { opacity: 1; }
.v2-readiness-deco {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 56px;
    color: rgba(255, 255, 255, 0.06);
    pointer-events: none;
    transition: opacity 0.3s;
}
.v2-readiness-card:hover .v2-readiness-deco { opacity: 0.12; }

/* ── 3 Metric Cards ── */
.v2-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}
.v2-metric-card {
    background: #fff;
    padding: 1.75rem;
    border-radius: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid rgba(197, 198, 205, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    min-height: 180px;
}
.v2-metric-icon {
    font-size: 30px;
    color: #0058be;
    margin-bottom: 1.5rem;
}
.v2-metric-value {
    font-family: 'Manrope', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: #091426;
    margin: 0;
}
.v2-metric-label {
    font-family: 'Manrope', sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #94a3b8;
    margin: 0.25rem 0 0;
}

/* ── Dark Mode: Hero + Stats ── */
[data-theme="dark"] .v2-countdown-card {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .v2-countdown-card .v2-countdown-label { color: #60a5fa; }
[data-theme="dark"] .v2-countdown-card .v2-countdown-days { color: #f1f5f9; }
[data-theme="dark"] .v2-countdown-hint { color: #94a3b8; }
[data-theme="dark"] .v2-cd-box { background: #0f172a; }
[data-theme="dark"] .v2-cd-num { color: #f1f5f9; }
[data-theme="dark"] .v2-cd-unit { color: #64748b; }
[data-theme="dark"] .v2-section-header .v2-section-title { color: #f1f5f9; }
[data-theme="dark"] .v2-section-overline { color: #60a5fa; }
[data-theme="dark"] .v2-section-link { color: #60a5fa; }
[data-theme="dark"] .v2-metric-card {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .v2-metric-value { color: #f1f5f9; }
[data-theme="dark"] .v2-metric-label { color: #64748b; }
[data-theme="dark"] .v2-metric-icon { color: #60a5fa; }
[data-theme="dark"] .v2-readiness-card {
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .v2-readiness-heading { color: #f1f5f9; }
[data-theme="dark"] .v2-readiness-subtitle { color: #64748b; }

/* ── Topic Analysis Panel (matches reference: gray container + white cards) ── */
.v2-topic-analysis {
    background: #eceef0;
    border-radius: 1.5rem;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}
.v2-ta-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.v2-ta-title {
    font-family: 'Manrope', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    color: #091426;
    margin: 0;
}
.v2-ta-tune {
    color: #0058be;
    font-size: 20px;
    cursor: pointer;
}
.v2-ta-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    max-height: 210px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.v2-ta-card {
    background: #fff;
    padding: 0.625rem 0.875rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(197, 198, 205, 0.1);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: border-color 0.2s;
    cursor: pointer;
}
.v2-ta-card:hover {
    border-color: #0058be;
}
.v2-ta-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.v2-ta-card-name {
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #091426;
}
.v2-ta-badge {
    font-family: 'Manrope', sans-serif;
    font-size: 9px;
    font-weight: 800;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    flex-shrink: 0;
}
.v2-ta-badge--critical { background: rgba(186, 26, 26, 0.1); color: #ba1a1a; }
.v2-ta-badge--review { background: rgba(250, 223, 184, 0.6); color: #564427; }
.v2-ta-badge--good { background: rgba(0, 88, 190, 0.1); color: #0058be; }
.v2-ta-bar {
    height: 5px;
    width: 100%;
    background: #eceef0;
    border-radius: 5px;
    overflow: hidden;
}
.v2-ta-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
    min-width: 4%;
}
.v2-ta-bar-fill--critical { background: #ba1a1a; }
.v2-ta-bar-fill--review { background: #564427; }
.v2-ta-bar-fill--good { background: #0058be; }
.v2-ta-hint {
    font-size: 10px;
    color: #64748b;
    font-style: italic;
    margin: 0;
}
.v2-ta-btn {
    margin-top: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    background: #091426;
    color: #fff;
    border: none;
    border-radius: 1rem;
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(9, 20, 38, 0.15);
}
.v2-ta-btn:hover { background: #0058be; }
[data-theme="dark"] .v2-topic-analysis {
    background: #0f172a;
}
[data-theme="dark"] .v2-ta-title { color: #f1f5f9; }
[data-theme="dark"] .v2-ta-card {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .v2-ta-card:hover { border-color: #60a5fa; }
[data-theme="dark"] .v2-ta-card-name { color: #f1f5f9; }
[data-theme="dark"] .v2-ta-bar { background: #334155; }
[data-theme="dark"] .v2-ta-hint { color: #94a3b8; }
[data-theme="dark"] .v2-ta-btn { background: #1e293b; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
[data-theme="dark"] .v2-ta-btn:hover { background: #2563eb; }

/* ── Topic Mastery Heatmap ── */
.v2-heatmap-card {
    background: #fff;
    border-radius: 1.5rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid rgba(197, 198, 205, 0.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
}
.v2-hm-grid {
    flex: 1;
}
.v2-hm-title {
    font-family: 'Manrope', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    color: #091426;
    margin: 0;
}
.v2-hm-subtitle {
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    color: #64748b;
    margin: 0.125rem 0 0.75rem;
}
.v2-hm-legend {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}
.v2-hm-dot {
    width: 8px; height: 8px; border-radius: 2px;
}
.v2-hm-dot--crit { background: #fca5a5; }
.v2-hm-dot--low { background: #fde68a; }
.v2-hm-dot--mid { background: #86efac; }
.v2-hm-dot--good { background: #22c55e; }
.v2-hm-dot--master { background: #15803d; }
.v2-hm-dot-label {
    font-size: 9px; font-weight: 600; color: #94a3b8; margin-right: 0.5rem;
}
.v2-hm-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}
.v2-hm-tile {
    border-radius: 0.625rem;
    padding: 0.5rem;
    text-align: center;
    color: #fff;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.v2-hm-tile:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.v2-hm-tile-name {
    font-family: 'Manrope', sans-serif;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: block;
    margin-bottom: 0.125rem;
    opacity: 0.9;
    line-height: 1.2;
    min-height: 22px;
}
.v2-hm-tile-pct {
    font-family: 'Manrope', sans-serif;
    font-size: 1.25rem;
    font-weight: 900;
    display: block;
}
.v2-hm-tile--crit { background: #fca5a5; color: #7f1d1d; }
.v2-hm-tile--low { background: #fde68a; color: #713f12; }
.v2-hm-tile--mid { background: #86efac; color: #14532d; }
.v2-hm-tile--good { background: #22c55e; color: #fff; }
.v2-hm-tile--master { background: #15803d; color: #fff; }
.v2-hm-tile--empty { background: #e2e8f0; color: #94a3b8; }
[data-theme="dark"] .v2-heatmap-card { background: #1e293b; border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .v2-hm-title { color: #f1f5f9; }
[data-theme="dark"] .v2-hm-subtitle { color: #64748b; }
[data-theme="dark"] .v2-hm-tile--empty { background: #334155; color: #64748b; }

/* ── Heatmap in Study Hub ── */
.rm-heatmap { margin-bottom: 1.5rem; }
.rm-heatmap .v2-heatmap-card { max-width: 100%; }

/* ── Dashboard Mastery Summary (compact replacement for heatmap) ── */
.v2-mastery-summary {
    background: #fff;
    border-radius: 1.5rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid rgba(197, 198, 205, 0.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.v2-mastery-summary-pct {
    font-family: 'Manrope', sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    margin: 0.5rem 0 0.125rem;
    color: #091426;
}
.v2-mastery-summary-label {
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    margin: 0 0 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.v2-mastery-summary-link {
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #0058be;
    text-decoration: none;
}
.v2-mastery-summary-link:hover { text-decoration: underline; }
[data-theme="dark"] .v2-mastery-summary { background: #1e293b; border-color: rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .v2-mastery-summary-pct { color: #f1f5f9; }
.v2-mastery-summary-mission {
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: #0058be;
    margin: 0 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
[data-theme="dark"] .v2-mastery-summary-mission { color: #60a5fa; }
[data-theme="dark"] .v2-mastery-summary-link { color: #60a5fa; }

/* ── Dashboard Completion Card ── */
.v2-completion-card { display: flex; }
.v2-cc-inner {
    background: #fff; border-radius: 1.5rem; padding: 1.5rem;
    border: 1px solid rgba(197,198,205,0.05); box-shadow: 0 10px 25px rgba(0,0,0,0.06);
    display: flex; flex-direction: column; width: 100%;
}
.v2-cc-title {
    font-family: 'Manrope', sans-serif; font-size: 0.875rem; font-weight: 800;
    color: #091426; margin: 0 0 1rem; text-transform: uppercase; letter-spacing: 0.03em;
}
.v2-cc-progress { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.5rem; }
.v2-cc-pct { font-family: 'Manrope', sans-serif; font-size: 2.25rem; font-weight: 900; color: #091426; line-height: 1; }
.v2-cc-pct-label { font-size: 0.75rem; font-weight: 600; color: #64748b; }
.v2-cc-bar { height: 4px; background: #e2e8f0; border-radius: 2px; margin-bottom: 1rem; overflow: hidden; }
.v2-cc-bar-fill { height: 100%; background: #0058be; border-radius: 2px; transition: width 0.3s; }
.v2-cc-rows { flex: 1; }
.v2-cc-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.375rem 0; border-bottom: 1px solid rgba(197,198,205,0.08);
}
.v2-cc-row:last-child { border-bottom: none; }
.v2-cc-label { font-size: 0.75rem; color: #64748b; }
.v2-cc-value { font-size: 0.8rem; font-weight: 800; color: #091426; }
.v2-cc-value--green { color: #16a34a; }
.v2-cc-value--blue { color: #0058be; }
.v2-cc-value--red { color: #dc2626; }
.v2-cc-footer {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid #e2e8f0;
    font-size: 0.7rem; color: #94a3b8;
}
.v2-cc-footer a { font-weight: 700; color: #0058be; text-decoration: none; font-size: 0.7rem; }
.v2-cc-footer a:hover { text-decoration: underline; }
[data-theme="dark"] .v2-cc-inner { background: #1e293b; border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .v2-cc-title { color: #f1f5f9; }
[data-theme="dark"] .v2-cc-pct { color: #f1f5f9; }
[data-theme="dark"] .v2-cc-bar { background: #334155; }
[data-theme="dark"] .v2-cc-value { color: #f1f5f9; }
[data-theme="dark"] .v2-cc-value--green { color: #34d399; }
[data-theme="dark"] .v2-cc-value--blue { color: #60a5fa; }
[data-theme="dark"] .v2-cc-row { border-color: rgba(255,255,255,0.05); }
[data-theme="dark"] .v2-cc-footer { border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .v2-cc-footer a { color: #60a5fa; }

/* ══ Quiz Shell — Learning Mode (matches lecture-morph-v9 reference) ══ */
.qs-learning { max-width: 720px; }

/* Header: title + difficulty + progress */
.qs-header {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin-bottom: 1.25rem;
}
.qs-header-left { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.qs-title {
    font-family: 'Manrope', sans-serif; font-size: 0.625rem; font-weight: 700;
    color: #0058be; text-transform: uppercase; letter-spacing: 0.12em; display: block;
}
.qs-diff {
    font-size: 0.6rem; font-weight: 700; padding: 0.2rem 0.6rem;
    border-radius: 9999px; text-transform: uppercase; letter-spacing: 0.04em;
}
.qs-diff--easy { background: #dcfce7; color: #15803d; }
.qs-diff--medium { background: #fef3c7; color: #92400e; }
.qs-diff--hard { background: #fee2e2; color: #dc2626; }
.qs-diff--exam-level { background: #ede9fe; color: #5b21b6; }
.qs-progress { display: flex; align-items: center; gap: 0.5rem; }
.qs-progress-text {
    font-family: 'Manrope', sans-serif; font-size: 0.75rem; font-weight: 700;
    color: #64748b; white-space: nowrap;
}
.qs-progress-bar { width: 80px; height: 5px; background: #e2e8f0; border-radius: 9999px; overflow: hidden; }
.qs-progress-fill { height: 100%; background: #0058be; border-radius: 9999px; transition: width 0.3s; }

/* Question card — white card with shadow (matches reference) */
.qs-stem {
    font-size: 0.875rem; font-weight: 500; line-height: 1.7; color: #191c1e;
    margin-bottom: 1.25rem; padding: 1.5rem;
    background: #fff; border-radius: 0.75rem;
    border: 1px solid rgba(197,198,205,0.1);
    box-shadow: 0 8px 24px -4px rgba(15,23,42,0.06);
}
.qs-image { margin-bottom: 1rem; text-align: center; }
.qs-image img { max-width: 100%; max-height: 300px; border-radius: 0.5rem; }

/* Answer choices — 2x2 grid with circular letter badges (matches .ac reference) */
.qs-choices {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0.625rem;
    margin-bottom: 1.25rem;
}
.qs-choice {
    display: flex; align-items: center; gap: 0.625rem; padding: 0.75rem 0.875rem;
    background: #fff; border: 2px solid rgba(197,198,205,0.2); border-radius: 0.75rem;
    cursor: pointer; transition: all 0.15s;
}
.qs-choice:hover { border-color: #0058be; background: rgba(0,88,190,0.02); }
.qs-choice--correct { border-color: #16a34a !important; background: #f0fdf4 !important; cursor: default; }
.qs-choice--wrong { border-color: #ba1a1a !important; background: #fef2f2 !important; cursor: default; }
.qs-choice--dimmed { opacity: 0.45; cursor: default; }
.qs-choice--dimmed:hover { border-color: rgba(197,198,205,0.2); background: #fff; }
.qs-choice-letter {
    width: 1.75rem; height: 1.75rem; border-radius: 50%;
    border: 2px solid #c5c6cd; background: transparent;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Manrope', sans-serif; font-size: 0.625rem; font-weight: 700;
    color: #45474c; flex-shrink: 0; transition: all 0.15s;
}
.qs-choice--correct .qs-choice-letter { background: #16a34a; border-color: #16a34a; color: #fff; }
.qs-choice--wrong .qs-choice-letter { background: #ba1a1a; border-color: #ba1a1a; color: #fff; }
.qs-choice-text { font-size: 0.8125rem; font-weight: 500; line-height: 1.45; color: #191c1e; }

/* Feedback banner */
.qs-feedback {
    display: flex; align-items: center; gap: 0.5rem; padding: 0.875rem 1.125rem;
    border-radius: 0.75rem; margin-bottom: 1rem; font-weight: 700; font-size: 0.9375rem;
}
.qs-feedback--correct { background: rgba(22,163,74,0.08); color: #15803d; }
.qs-feedback--wrong { background: rgba(220,38,38,0.08); color: #ba1a1a; }

/* Solution panel — left green border (matches reference) */
.qs-solution {
    margin-bottom: 1rem; background: #fff; padding: 1.5rem;
    border-radius: 0.75rem; border-left: 4px solid #16a34a;
    box-shadow: 0 8px 24px -4px rgba(15,23,42,0.06);
}

/* Action buttons */
.qs-actions { display: flex; justify-content: flex-end; gap: 0.75rem; }
.qs-btn {
    display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.625rem 1.5rem;
    border: none; border-radius: 0.75rem; font-family: 'Manrope', sans-serif;
    font-size: 0.75rem; font-weight: 700; cursor: pointer; transition: all 0.15s;
}
.qs-btn--primary {
    background: #091426; color: #fff;
    box-shadow: 0 4px 12px rgba(9,20,38,0.15);
}
.qs-btn--primary:hover { background: #0058be; box-shadow: 0 4px 16px rgba(0,88,190,0.2); }
.qs-btn--secondary { background: #e6e8ea; color: #091426; }
.qs-btn--secondary:hover { background: #d8dadc; }

/* Score Card */
.qs-score-card {
    text-align: center; padding: 2.5rem 2rem;
    background: #fff; border-radius: 1rem;
    box-shadow: 0 8px 24px -4px rgba(15,23,42,0.06);
}
.qs-score-hero { margin-bottom: 1.5rem; }
.qs-score-icon { font-size: 3rem; margin-bottom: 0.5rem; display: block; }
.qs-score-pct { font-family: 'Manrope', sans-serif; font-size: 3.5rem; font-weight: 900; line-height: 1; }
.qs-score-label { font-family: 'Manrope', sans-serif; font-size: 1.125rem; font-weight: 800; color: #091426; margin-top: 0.25rem; }
.qs-score-detail { font-size: 0.875rem; color: #64748b; margin-top: 0.25rem; }
.qs-score-stats {
    display: flex; justify-content: center; gap: 2rem; margin-bottom: 1.5rem;
    padding: 1rem 1.25rem; background: #f7f9fb; border-radius: 0.75rem;
}
.qs-score-stat { text-align: center; }
.qs-score-stat-label { display: block; font-size: 0.6rem; font-weight: 700; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.05em; }
.qs-score-stat-value { font-family: 'Manrope', sans-serif; font-size: 1.25rem; font-weight: 900; color: #091426; }
.qs-breakdown { text-align: left; margin-bottom: 1.5rem; }
.qs-breakdown-title { font-family: 'Manrope', sans-serif; font-size: 0.8rem; font-weight: 800; color: #091426; margin: 0 0 0.75rem; }
.qs-breakdown-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.375rem; }
.qs-breakdown-label { font-size: 0.75rem; font-weight: 700; color: #0058be; min-width: 2.5rem; }
.qs-breakdown-bar { flex: 1; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.qs-breakdown-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.qs-breakdown-pct { font-size: 0.75rem; font-weight: 800; color: #091426; min-width: 2.5rem; text-align: right; }
.qs-score-actions { display: flex; justify-content: center; gap: 0.75rem; }

/* Responsive: stack choices on mobile */
@media (max-width: 600px) {
    .qs-choices { grid-template-columns: 1fr; }
}

/* Dark mode — Learning */
[data-theme="dark"] .qs-stem { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.06); color: #f1f5f9; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
[data-theme="dark"] .qs-choice { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .qs-choice:hover { border-color: #60a5fa; background: rgba(0,88,190,0.08); }
[data-theme="dark"] .qs-choice--correct { border-color: #22c55e !important; background: rgba(34,197,94,0.1) !important; }
[data-theme="dark"] .qs-choice--wrong { border-color: #ef4444 !important; background: rgba(239,68,68,0.1) !important; }
[data-theme="dark"] .qs-choice-letter { border-color: rgba(255,255,255,0.15); color: #cbd5e1; }
[data-theme="dark"] .qs-choice-text { color: #f1f5f9; }
[data-theme="dark"] .qs-feedback--correct { background: rgba(34,197,94,0.12); color: #34d399; }
[data-theme="dark"] .qs-feedback--wrong { background: rgba(239,68,68,0.12); color: #f87171; }
[data-theme="dark"] .qs-solution { background: rgba(255,255,255,0.04); border-left-color: #22c55e; box-shadow: none; }
[data-theme="dark"] .qs-btn--primary { background: #0058be; box-shadow: 0 4px 12px rgba(0,88,190,0.3); }
[data-theme="dark"] .qs-btn--secondary { background: rgba(255,255,255,0.08); color: #f1f5f9; }
[data-theme="dark"] .qs-score-card { background: rgba(255,255,255,0.04); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
[data-theme="dark"] .qs-score-label { color: #f1f5f9; }
[data-theme="dark"] .qs-score-stat-value { color: #f1f5f9; }
[data-theme="dark"] .qs-score-stats { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .qs-breakdown-bar { background: #334155; }
[data-theme="dark"] .qs-breakdown-pct { color: #f1f5f9; }

/* ══ Quiz Shell — Assessment Mode (Full-page CBT) ══ */
.qs-assess-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: #f7f9fb; z-index: 10000; overflow-y: auto;
}
.qs-assess { display: flex; flex-direction: column; min-height: 100vh; }
.qs-assess-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.75rem 1.5rem; background: #091426; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.1); position: sticky; top: 0; z-index: 10;
}
.qs-assess-header-left { display: flex; align-items: center; gap: 1rem; }
.qs-assess-header-center { flex: 1; text-align: center; }
.qs-assess-header-right { display: flex; align-items: center; gap: 0.75rem; }
.qs-assess-title { font-family: 'Manrope', sans-serif; font-size: 0.875rem; font-weight: 800; }
.qs-assess-timer {
    font-family: 'JetBrains Mono', monospace; font-size: 1rem; font-weight: 700;
    padding: 0.25rem 0.75rem; background: rgba(255,255,255,0.1); border-radius: 0.375rem;
}
.qs-assess-timer--urgent { background: #dc2626; animation: trendsPulse 1s ease-in-out infinite; }
.qs-assess-progress-text { font-size: 0.75rem; font-weight: 600; color: rgba(255,255,255,0.6); }
.qs-assess-flagged-count { font-size: 0.7rem; font-weight: 700; color: #fbbf24; }
.qs-assess-submit-btn {
    padding: 0.5rem 1.25rem; background: #0058be; color: #fff; border: none;
    border-radius: 0.5rem; font-weight: 800; font-size: 0.8rem; cursor: pointer;
}
.qs-assess-submit-btn:hover { background: #004a9e; }

/* 2-column body */
.qs-assess-body {
    display: grid; grid-template-columns: 1fr 280px; flex: 1; max-width: 1200px;
    margin: 0 auto; width: 100%; gap: 0;
}
.qs-assess-question {
    padding: 2rem 2.5rem; overflow-y: auto;
}
.qs-assess-q-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.qs-assess-q-num { font-family: 'Manrope', sans-serif; font-size: 0.8rem; font-weight: 800; color: #64748b; }
.qs-assess-flag {
    display: flex; align-items: center; gap: 0.25rem; cursor: pointer;
    font-size: 0.75rem; font-weight: 600; color: #64748b;
}
.qs-assess-flag input { display: none; }
.qs-assess-flag:has(input:checked) { color: #f59e0b; }
.qs-assess-stem {
    font-size: 1rem; line-height: 1.7; color: #091426; margin-bottom: 1.5rem;
    padding: 1.25rem; background: #fff; border-radius: 0.75rem;
    border: 1px solid rgba(197,198,205,0.1); box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.qs-assess-image { margin-bottom: 1rem; text-align: center; }
.qs-assess-image img { max-width: 100%; max-height: 300px; border-radius: 0.5rem; }
.qs-assess-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 0.625rem; margin-bottom: 1.25rem; }
.qs-assess-choice {
    display: flex; align-items: center; gap: 0.625rem; padding: 0.75rem 0.875rem;
    background: #fff; border: 2px solid rgba(197,198,205,0.2); border-radius: 0.75rem;
    cursor: pointer; transition: all 0.15s;
}
.qs-assess-choice:hover { border-color: #0058be; background: rgba(0,88,190,0.02); }
.qs-assess-choice--selected { border-color: #0058be !important; background: rgba(0,88,190,0.06) !important; }
.qs-assess-choice--correct { border-color: #16a34a !important; background: #f0fdf4 !important; }
.qs-assess-choice--wrong { border-color: #ba1a1a !important; background: #fef2f2 !important; }
.qs-assess-choice-letter {
    width: 1.75rem; height: 1.75rem; border-radius: 50%;
    border: 2px solid #c5c6cd; background: transparent;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Manrope', sans-serif; font-size: 0.625rem; font-weight: 700;
    color: #45474c; flex-shrink: 0; transition: all 0.15s;
}
.qs-assess-choice--selected .qs-assess-choice-letter { background: #0058be; border-color: #0058be; color: #fff; }
.qs-assess-choice--correct .qs-assess-choice-letter { background: #16a34a; border-color: #16a34a; color: #fff; }
.qs-assess-choice--wrong .qs-assess-choice-letter { background: #ba1a1a; border-color: #ba1a1a; color: #fff; }
.qs-assess-choice-text { font-size: 0.8125rem; font-weight: 500; line-height: 1.45; color: #191c1e; }

/* Confidence tagging */
.qs-assess-confidence { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.qs-assess-conf-label { font-size: 0.75rem; font-weight: 700; color: #64748b; }
.qs-assess-conf-btn {
    padding: 0.35rem 0.75rem; border: 1px solid #c5c6cd; border-radius: 9999px;
    background: #fff; font-size: 0.7rem; font-weight: 700; cursor: pointer; transition: all 0.1s;
}
.qs-assess-conf-btn:hover { border-color: #0058be; }
.qs-assess-conf-btn--active { background: #0058be; color: #fff; border-color: #0058be; }

/* Bottom nav */
.qs-assess-nav { display: flex; justify-content: space-between; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #e2e8f0; }

/* Right sidebar — question grid */
.qs-assess-sidebar {
    background: #fff; border-left: 1px solid #e2e8f0; padding: 1.5rem;
    position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
}
.qs-assess-grid-title { font-family: 'Manrope', sans-serif; font-size: 0.65rem; font-weight: 800; color: #64748b; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.5rem; }
.qs-assess-grid-wrap { max-height: 220px; overflow-y: auto; margin-bottom: 0.75rem; }
.qs-assess-grid-wrap::-webkit-scrollbar { width: 3px; }
.qs-assess-grid-wrap::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.qs-assess-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 0.2rem; }
.qs-assess-grid-btn {
    width: 100%; aspect-ratio: 1; border: 1px solid #e2e8f0; border-radius: 0.25rem;
    background: #f7f9fb; font-size: 0.6rem; font-weight: 700; cursor: pointer;
    transition: all 0.1s; color: #64748b; padding: 0;
}
.qs-assess-grid-btn:hover { border-color: #0058be; }
.qs-assess-grid-btn--current { border-color: #0058be; background: rgba(0,88,190,0.08); color: #0058be; font-weight: 800; border-width: 2px; }
.qs-assess-grid-btn--answered { background: #091426; color: #fff; border-color: #091426; }
.qs-assess-grid-btn--correct { background: #16a34a; color: #fff; border-color: #16a34a; }
.qs-assess-grid-btn--wrong { background: #dc2626; color: #fff; border-color: #dc2626; }
.qs-assess-grid-btn--flagged { box-shadow: inset 0 -2px 0 #fbbf24; }
.qs-assess-legend { display: flex; flex-wrap: wrap; gap: 0.5rem; font-size: 0.55rem; color: #94a3b8; margin-bottom: 0.75rem; }
.qs-assess-legend span { display: flex; align-items: center; gap: 0.2rem; }
.qs-assess-legend-dot { width: 8px; height: 8px; border-radius: 2px; }
.qs-assess-legend-dot--answered { background: #091426; }
.qs-assess-legend-dot--flagged { background: #fbbf24; }
.qs-assess-legend-dot--current { background: #0058be; }

/* Flagged questions dropdown */
.qs-assess-flagged-section { border-top: 1px solid #e2e8f0; padding-top: 0.75rem; }
.qs-assess-flagged-toggle {
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; padding: 0.5rem 0.625rem; border-radius: 0.5rem;
    font-family: 'Manrope', sans-serif; font-size: 0.7rem; font-weight: 700;
    color: #64748b; transition: background 0.15s;
}
.qs-assess-flagged-toggle:hover { background: #f7f9fb; }
.qs-assess-flagged-badge {
    background: #fbbf24; color: #78350f; font-size: 0.6rem; font-weight: 800;
    padding: 0.1rem 0.4rem; border-radius: 9999px; min-width: 1.2rem; text-align: center;
}
.qs-assess-flagged-chevron { font-size: 0.6rem; transition: transform 0.2s; }
.qs-assess-flagged-section.open .qs-assess-flagged-chevron { transform: rotate(180deg); }
.qs-assess-flagged-list {
    max-height: 180px; overflow-y: auto; margin-top: 0.375rem;
}
.qs-assess-flagged-item {
    display: flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.625rem;
    border-radius: 0.375rem; cursor: pointer; font-size: 0.65rem; color: #45474c;
    transition: background 0.1s;
}
.qs-assess-flagged-item:hover { background: #f7f9fb; }
.qs-assess-flagged-item-num { font-weight: 800; color: #0058be; min-width: 1.5rem; }
.qs-assess-flagged-item-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-assess-flagged-empty { font-size: 0.65rem; color: #94a3b8; font-style: italic; padding: 0.5rem 0.625rem; }

/* Answer elimination (cross-out via right-click) */
.qs-assess-choice--eliminated { opacity: 0.3; }
.qs-assess-choice--eliminated .qs-assess-choice-text { text-decoration: line-through; }
.qs-assess-choice--eliminated .qs-assess-choice-letter { opacity: 0.4; }

/* Show All / Collapse grid toggle */
.qs-assess-grid--full { max-height: 280px; overflow-y: auto; }
.qs-assess-grid--full::-webkit-scrollbar { width: 3px; }
.qs-assess-grid--full::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.qs-assess-grid-expand {
    display: flex; align-items: center; justify-content: center; gap: 0.25rem;
    width: 100%; padding: 0.35rem; margin-top: 0.25rem; border: 1px dashed #c5c6cd;
    border-radius: 0.375rem; background: transparent; color: #64748b;
    font-size: 0.6rem; font-weight: 700; cursor: pointer; transition: all 0.15s;
}
.qs-assess-grid-expand:hover { border-color: #0058be; color: #0058be; }

/* Progress Summary card */
.qs-assess-progress-card {
    background: #f7f9fb; border: 1px solid #eceef0; border-radius: 0.625rem;
    padding: 0.625rem 0.75rem; margin-bottom: 0.75rem;
}
.qs-assess-pc-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.65rem; padding: 0.2rem 0;
}
.qs-assess-pc-row span:first-child { color: #64748b; font-weight: 600; }
.qs-assess-pc-row span:last-child { font-family: 'Manrope', sans-serif; font-weight: 800; color: #091426; }

/* Formula Hint panel (practice CBT) */
.qs-assess-formula-panel {
    background: rgba(219,234,254,0.5); border: 1px solid rgba(147,197,253,0.3);
    border-radius: 0.625rem; padding: 0.75rem; margin-top: 0.75rem;
}
.qs-assess-panel-title {
    font-family: 'Manrope', sans-serif; font-size: 0.6rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.08em; color: #0058be; margin-bottom: 0.5rem;
}
.qs-assess-formula-latex {
    font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; color: #091426;
    padding: 0.5rem; background: #fff; border-radius: 0.375rem; text-align: center;
    margin-bottom: 0.375rem;
}
.qs-assess-formula-vars {
    display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; font-size: 0.6rem; color: #45474c;
}

/* Handbook Page Navigator (practice CBT) */
.qs-assess-handbook-panel {
    background: rgba(254,243,199,0.5); border: 1px solid rgba(252,211,77,0.3);
    border-radius: 0.625rem; padding: 0.75rem; margin-top: 0.5rem;
}
.qs-assess-handbook-content {
    display: flex; flex-direction: column; gap: 0.2rem;
}
.qs-assess-handbook-label { font-size: 0.6rem; color: #92400e; font-weight: 600; }
.qs-assess-handbook-content strong { font-family: 'Manrope', sans-serif; font-size: 0.75rem; color: #78350f; }
.qs-assess-handbook-pages { font-size: 0.65rem; color: #a16207; }

/* Submit confirmation modal */
.qs-assess-confirm-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6); z-index: 10001;
    display: flex; align-items: center; justify-content: center;
}
.qs-assess-confirm-card {
    background: #fff; border-radius: 1rem; padding: 2rem;
    max-width: 380px; width: 90%; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.qs-assess-confirm-title { font-family: 'Manrope', sans-serif; font-size: 1.125rem; font-weight: 800; color: #091426; margin-bottom: 1rem; }
.qs-assess-confirm-stats { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 1rem; }
.qs-assess-confirm-stat { text-align: center; }
.qs-assess-confirm-stat span:first-child { display: block; font-family: 'Manrope', sans-serif; font-size: 1.5rem; font-weight: 900; color: #091426; }
.qs-assess-confirm-stat span:last-child { display: block; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.04em; }
.qs-assess-confirm-stat--warn span:first-child { color: #dc2626; }
.qs-assess-confirm-stat--flag span:first-child { color: #f59e0b; }
.qs-assess-confirm-warn { font-size: 0.75rem; color: #dc2626; margin-bottom: 1rem; }
.qs-assess-confirm-actions { display: flex; justify-content: center; gap: 0.75rem; }

/* Dark mode */
[data-theme="dark"] .qs-assess-overlay { background: #0f172a; }
[data-theme="dark"] .qs-assess-stem { background: #1e293b; border-color: rgba(255,255,255,0.06); color: #f1f5f9; }
[data-theme="dark"] .qs-assess-choice { background: #1e293b; border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .qs-assess-choice:hover { border-color: #60a5fa; }
[data-theme="dark"] .qs-assess-choice--selected { border-color: #60a5fa; background: rgba(0,88,190,0.15); }
[data-theme="dark"] .qs-assess-choice-text { color: #f1f5f9; }
[data-theme="dark"] .qs-assess-choice-letter { background: rgba(255,255,255,0.08); color: #f1f5f9; }
[data-theme="dark"] .qs-assess-sidebar { background: #1e293b; border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .qs-assess-grid-btn { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.08); color: #94a3b8; }
[data-theme="dark"] .qs-assess-nav { border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .qs-assess-conf-btn { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); color: #f1f5f9; }
[data-theme="dark"] .qs-assess-grid-wrap::-webkit-scrollbar-thumb { background: #475569; }
[data-theme="dark"] .qs-assess-flagged-section { border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .qs-assess-flagged-toggle { color: #94a3b8; }
[data-theme="dark"] .qs-assess-flagged-toggle:hover { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .qs-assess-flagged-item { color: #cbd5e1; }
[data-theme="dark"] .qs-assess-flagged-item:hover { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .qs-assess-grid-expand { border-color: rgba(255,255,255,0.1); color: #94a3b8; }
[data-theme="dark"] .qs-assess-grid-expand:hover { border-color: #60a5fa; color: #60a5fa; }
[data-theme="dark"] .qs-assess-grid--full::-webkit-scrollbar-thumb { background: #475569; }
[data-theme="dark"] .qs-assess-progress-card { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .qs-assess-pc-row span:last-child { color: #f1f5f9; }
[data-theme="dark"] .qs-assess-formula-panel { background: rgba(30,58,138,0.2); border-color: rgba(59,130,246,0.2); }
[data-theme="dark"] .qs-assess-formula-latex { background: rgba(255,255,255,0.05); color: #e0e7ff; }
[data-theme="dark"] .qs-assess-formula-vars { color: #94a3b8; }
[data-theme="dark"] .qs-assess-handbook-panel { background: rgba(120,53,15,0.15); border-color: rgba(245,158,11,0.2); }
[data-theme="dark"] .qs-assess-handbook-label { color: #fbbf24; }
[data-theme="dark"] .qs-assess-handbook-content strong { color: #fcd34d; }
[data-theme="dark"] .qs-assess-handbook-pages { color: #f59e0b; }
[data-theme="dark"] .qs-assess-confirm-card { background: #1e293b; }
[data-theme="dark"] .qs-assess-confirm-title { color: #f1f5f9; }
[data-theme="dark"] .qs-assess-confirm-stat span:first-child { color: #f1f5f9; }

/* Responsive */
@media (max-width: 768px) {
    .qs-assess-body { grid-template-columns: 1fr; }
    .qs-assess-sidebar { position: static; height: auto; border-left: none; border-top: 1px solid #e2e8f0; }
    .qs-assess-question { padding: 1rem; }
    .qs-assess-choices { grid-template-columns: 1fr; }
}

/* ══ Roadmap Page ══ */
.rm-hero {
    background: linear-gradient(135deg, #091426, #1e293b); border-radius: 1.5rem;
    padding: 2.5rem; color: #fff; display: flex; justify-content: space-between;
    align-items: center; gap: 2rem; margin-bottom: 2rem; position: relative; overflow: hidden;
}
.rm-hero::after { content: ''; position: absolute; right: -4rem; top: -4rem; width: 16rem; height: 16rem; background: rgba(0,88,190,0.08); border-radius: 50%; filter: blur(60px); }
.rm-hero-left { position: relative; z-index: 1; }
.rm-hero-label { font-size: 0.625rem; font-weight: 800; letter-spacing: 0.15em; text-transform: uppercase; color: rgba(255,255,255,0.4); display: block; margin-bottom: 0.5rem; }
.rm-hero-title { font-family: 'Manrope', sans-serif; font-size: 2.5rem; font-weight: 900; line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 0.75rem; }
.rm-hero-accent { color: #60a5fa; }
.rm-hero-desc { font-size: 0.875rem; color: rgba(255,255,255,0.5); line-height: 1.5; }
.rm-hero-stats { display: flex; gap: 1.5rem; position: relative; z-index: 1; }
.rm-hero-stat { text-align: center; padding: 1rem 1.25rem; background: rgba(255,255,255,0.06); border-radius: 0.75rem; border: 1px solid rgba(255,255,255,0.08); }
.rm-hero-stat-val { display: block; font-family: 'Manrope', sans-serif; font-size: 1.75rem; font-weight: 900; }
.rm-hero-stat-lbl { display: block; font-size: 0.6rem; font-weight: 700; text-transform: uppercase; color: rgba(255,255,255,0.4); letter-spacing: 0.05em; margin-top: 0.2rem; }

.rm-section { margin-bottom: 2.5rem; }
.rm-section-title { font-family: 'Manrope', sans-serif; font-size: 1.25rem; font-weight: 800; color: #091426; margin: 0 0 0.25rem; }
.rm-section-desc { font-size: 0.8rem; color: #64748b; margin: 0 0 1rem; }

/* Workflow flow */
.rm-workflow-flow { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding: 1.25rem; background: #f7f9fb; border-radius: 0.75rem; border: 1px solid #eceef0; }
.rm-workflow-step { display: flex; align-items: center; gap: 0.5rem; }
.rm-workflow-icon { width: 2rem; height: 2rem; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rm-workflow-label { font-size: 0.7rem; font-weight: 700; color: #091426; white-space: nowrap; }
.rm-workflow-arrow { display: flex; align-items: center; }

/* Timeline */
.rm-timeline { position: relative; padding-left: 2rem; }
.rm-timeline-line { position: absolute; left: 1.45rem; top: 0; bottom: 0; width: 2px; background: #e2e8f0; z-index: 0; }

.rm-milestone { position: relative; z-index: 1; display: flex; gap: 1.25rem; margin-bottom: 2rem; }
.rm-milestone-marker { width: 2.75rem; height: 2.75rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.rm-milestone-content { flex: 1; background: #fff; border: 1px solid rgba(197,198,205,0.2); border-radius: 0.75rem; padding: 1.25rem; box-shadow: 0 4px 12px rgba(9,20,38,0.04); }
.rm-milestone--locked .rm-milestone-content { opacity: 0.5; }
.rm-milestone-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; flex-wrap: wrap; gap: 0.5rem; }
.rm-milestone-name { font-family: 'Manrope', sans-serif; font-size: 1.1rem; font-weight: 800; color: #091426; margin: 0; }
.rm-milestone-badge { font-size: 0.6rem; font-weight: 800; padding: 0.2rem 0.6rem; border-radius: 9999px; }
.rm-milestone-desc { font-size: 0.75rem; color: #64748b; margin: 0 0 1rem; }

/* Subject cards inside milestone */
.rm-subjects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem; }
.rm-subject-card { background: #f7f9fb; border: 1px solid #eceef0; border-radius: 0.625rem; padding: 0.875rem; }
.rm-subject-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.rm-subject-name { font-family: 'Manrope', sans-serif; font-size: 0.8rem; font-weight: 800; color: #091426; }
.rm-subject-weight { font-size: 0.6rem; font-weight: 800; color: #0058be; background: rgba(0,88,190,0.08); padding: 0.15rem 0.4rem; border-radius: 9999px; }
.rm-subject-progress { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.625rem; }
.rm-subject-bar { flex: 1; height: 4px; background: #e2e8f0; border-radius: 2px; overflow: hidden; }
.rm-subject-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }
.rm-subject-pct { font-size: 0.6rem; font-weight: 800; color: #64748b; min-width: 2rem; text-align: right; }

/* Chapter list */
.rm-chapter-list { display: flex; flex-direction: column; gap: 0.25rem; }
.rm-chapter-item { display: flex; align-items: center; gap: 0.375rem; font-size: 0.65rem; color: #45474c; }
.rm-chapter-key { font-weight: 700; color: #0058be; min-width: 2rem; }
.rm-chapter-name { flex: 1; }

/* Mock CBT gate cards between milestones */
.rm-gate {
    display: flex; align-items: center; gap: 0.625rem; padding: 0.75rem 1rem;
    margin: 1rem 0 0; border-radius: 0.625rem; border: 1.5px dashed #c5c6cd;
    background: #f7f9fb;
}
.rm-gate--passed { border-color: #16a34a; background: rgba(22,163,74,0.04); }
.rm-gate--passed .material-symbols-outlined { color: #16a34a; font-variation-settings: 'FILL' 1; }
.rm-gate--available { border-color: #0058be; background: rgba(0,88,190,0.04); }
.rm-gate--available .material-symbols-outlined { color: #0058be; }
.rm-gate--locked .material-symbols-outlined { color: #94a3b8; }
.rm-gate-label { flex: 1; font-size: 0.75rem; font-weight: 700; color: #091426; }
.rm-gate-status { font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: #64748b; }
.rm-gate--passed .rm-gate-status { color: #16a34a; }
.rm-gate--available .rm-gate-status { color: #0058be; }

/* Dark mode */
[data-theme="dark"] .rm-hero { background: linear-gradient(135deg, #091426, #0f172a); }
[data-theme="dark"] .rm-section-title { color: #f1f5f9; }
[data-theme="dark"] .rm-section-desc { color: #94a3b8; }
[data-theme="dark"] .rm-workflow-flow { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .rm-workflow-label { color: #f1f5f9; }
[data-theme="dark"] .rm-timeline-line { background: #334155; }
[data-theme="dark"] .rm-milestone-content { background: #1e293b; border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .rm-milestone-name { color: #f1f5f9; }
[data-theme="dark"] .rm-milestone-desc { color: #94a3b8; }
[data-theme="dark"] .rm-subject-card { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .rm-subject-name { color: #f1f5f9; }
[data-theme="dark"] .rm-subject-bar { background: #334155; }
[data-theme="dark"] .rm-chapter-item { color: #cbd5e1; }
[data-theme="dark"] .rm-gate { background: rgba(255,255,255,0.02); border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .rm-gate-label { color: #f1f5f9; }

@media (max-width: 768px) {
    .rm-hero { flex-direction: column; text-align: center; padding: 2rem 1.5rem; }
    .rm-hero-title { font-size: 2rem; }
    .rm-hero-stats { justify-content: center; }
    .rm-subjects-grid { grid-template-columns: 1fr; }
    .rm-workflow-flow { justify-content: center; }
}

/* ── Subject Detail Modal ── */
.v2-subj-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9000;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}
.v2-subj-modal-overlay.open { display: flex; }
.v2-subj-modal {
    background: #fff;
    border-radius: 1.5rem;
    width: 100%;
    max-width: 560px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
.v2-subj-modal-hd {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}
.v2-subj-modal-title {
    font-family: 'Manrope', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    color: #091426;
    margin: 0;
}
.v2-subj-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 0.25rem;
    border-radius: 0.5rem;
}
.v2-subj-modal-close:hover { color: #091426; background: #f1f5f9; }
.v2-subj-modal-body {
    padding: 1rem 1.5rem 1.5rem;
    overflow-y: auto;
    max-height: calc(80vh - 60px);
}
.v2-subj-ch-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.15s;
}
.v2-subj-ch-row:hover { background: #f8fafc; margin: 0 -1.5rem; padding-left: 1.5rem; padding-right: 1.5rem; }
.v2-subj-ch-row:last-child { border-bottom: none; }
.v2-subj-ch-key {
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 900;
    color: #0058be;
    min-width: 2.5rem;
}
.v2-subj-ch-name {
    flex: 1;
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #091426;
}
.v2-subj-ch-bar {
    width: 60px;
    height: 5px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
}
.v2-subj-ch-bar-fill {
    height: 100%;
    border-radius: 5px;
    min-width: 3%;
}
.v2-subj-ch-pct {
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    font-weight: 800;
    min-width: 2.5rem;
    text-align: right;
}
.v2-subj-ch-badge {
    font-family: 'Manrope', sans-serif;
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    min-width: 4.5rem;
    text-align: center;
}
.v2-subj-ch-badge--done { background: #dcfce7; color: #15803d; }
.v2-subj-ch-badge--progress { background: #dbeafe; color: #1d4ed8; }
.v2-subj-ch-badge--critical { background: #fee2e2; color: #dc2626; }
.v2-subj-ch-badge--none { background: #f1f5f9; color: #94a3b8; }
[data-theme="dark"] .v2-subj-modal { background: #1e293b; }
[data-theme="dark"] .v2-subj-modal-hd { border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .v2-subj-modal-title { color: #f1f5f9; }
[data-theme="dark"] .v2-subj-ch-name { color: #f1f5f9; }
[data-theme="dark"] .v2-subj-ch-row:hover { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .v2-subj-ch-row { border-color: rgba(255,255,255,0.04); }
[data-theme="dark"] .v2-subj-ch-bar { background: #334155; }
.v2-subj-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}
.v2-subj-summary-stat {
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    background: #f1f5f9;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}
.v2-subj-continue-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 1rem;
    padding: 0.875rem;
    background: linear-gradient(135deg, #091426, #1e293b);
    color: #fff;
    border: none;
    border-radius: 0.75rem;
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(9, 20, 38, 0.35);
}
.v2-subj-continue-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(9, 20, 38, 0.5); }
[data-theme="dark"] .v2-subj-summary { border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .v2-subj-summary-stat { background: rgba(255,255,255,0.06); color: #94a3b8; }
[data-theme="dark"] .v2-subj-continue-btn { background: linear-gradient(135deg, #0f172a, #334155); box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
[data-theme="dark"] .v2-subj-continue-btn:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.6); }
.v2-subj-fq-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 0.5rem 0;
}
.v2-subj-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}
.v2-subj-next-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    flex: 1;
    padding: 0.75rem;
    background: #fff;
    color: #091426;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.v2-subj-next-btn:hover { background: #f1f5f9; border-color: #0058be; color: #0058be; }
[data-theme="dark"] .v2-subj-fq-divider { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .v2-subj-next-btn { background: #1e293b; color: #f1f5f9; border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .v2-subj-next-btn:hover { border-color: #60a5fa; color: #60a5fa; }

/* ── Heatmap Analytics Modal ── */
.v2-hma-chapter {
    padding: 0.875rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.v2-hma-chapter:last-of-type { border-bottom: none; }
.v2-hma-ch-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}
.v2-hma-ch-key {
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    font-weight: 900;
    color: #0058be;
    min-width: 2rem;
}
.v2-hma-ch-name {
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #091426;
    flex: 1;
}
.v2-hma-status {
    font-family: 'Manrope', sans-serif;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    flex-shrink: 0;
}
.v2-hma-status--pass { background: #dcfce7; color: #15803d; }
.v2-hma-status--review { background: #fef3c7; color: #92400e; }
.v2-hma-status--critical { background: #fee2e2; color: #dc2626; }
.v2-hma-status--none { background: #f1f5f9; color: #94a3b8; }
.v2-hma-ch-bar {
    height: 4px;
    width: 100%;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.v2-hma-ch-bar-fill {
    height: 100%;
    border-radius: 4px;
    min-width: 2%;
}
.v2-hma-ch-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.v2-hma-stat {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}
.v2-hma-stat-label {
    font-family: 'Manrope', sans-serif;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 0.04em;
}
.v2-hma-stat-value {
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 800;
    color: #091426;
}

/* Accumulation section */
.v2-hma-accum {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
}
.v2-hma-accum-title {
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 800;
    color: #091426;
    margin: 0 0 0.75rem;
}
.v2-hma-accum-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.v2-hma-accum-stat { text-align: center; }
.v2-hma-accum-label {
    font-family: 'Manrope', sans-serif;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    display: block;
    margin-bottom: 0.125rem;
}
.v2-hma-accum-val {
    font-family: 'Manrope', sans-serif;
    font-size: 1.25rem;
    font-weight: 900;
    color: #091426;
    display: block;
}
.v2-hma-accum-detail {
    font-size: 10px;
    color: #64748b;
    display: block;
}
.v2-hma-accum-mastery {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
}
.v2-hma-accum-mastery > span:first-child {
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    font-weight: 800;
    color: #091426;
}
.v2-hma-accum-mastery-pct {
    font-family: 'Manrope', sans-serif;
    font-size: 1.5rem;
    font-weight: 900;
}
.v2-hma-accum-formula {
    font-size: 10px;
    color: #94a3b8;
    font-family: 'JetBrains Mono', monospace;
    width: 100%;
}

/* Vector recommendation */
.v2-hma-vector {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    background: #eff6ff;
    border-radius: 0.75rem;
    border-left: 3px solid #0058be;
    font-size: 12px;
    color: #1e3a5f;
    line-height: 1.5;
}

[data-theme="dark"] .v2-hma-chapter { border-color: rgba(255,255,255,0.04); }
[data-theme="dark"] .v2-hma-ch-name { color: #f1f5f9; }
[data-theme="dark"] .v2-hma-stat-value { color: #f1f5f9; }
[data-theme="dark"] .v2-hma-ch-bar { background: #334155; }
[data-theme="dark"] .v2-hma-accum { background: #0f172a; border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .v2-hma-accum-title { color: #f1f5f9; }
[data-theme="dark"] .v2-hma-accum-val { color: #f1f5f9; }
[data-theme="dark"] .v2-hma-accum-mastery { border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .v2-hma-accum-mastery > span:first-child { color: #f1f5f9; }
[data-theme="dark"] .v2-hma-vector { background: rgba(0,88,190,0.1); border-left-color: #2563eb; color: #bcc7de; }

/* ── Format Performance (Study Hub) ── */
.rm-format-grid { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.rm-format-row { display: flex; align-items: center; gap: 10px; }
.rm-format-label { width: 110px; font-size: 0.82rem; color: var(--text-secondary, #64748b); flex-shrink: 0; }
.rm-format-bar-wrap { flex: 1; height: 8px; background: var(--surface-secondary, #e2e8f0); border-radius: 4px; overflow: hidden; }
.rm-format-bar { height: 100%; border-radius: 4px; transition: width 0.3s; }
.rm-format-pct { width: 80px; font-size: 0.82rem; font-weight: 600; text-align: right; flex-shrink: 0; }

/* ── Time Performance (Study Hub) ── */
.rm-time-grid { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.rm-time-row { display: flex; align-items: center; gap: 10px; }
.rm-time-label { width: 70px; font-size: 0.82rem; font-weight: 600; text-transform: capitalize; }
.rm-time-val { font-size: 0.95rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.rm-time-target { font-size: 0.78rem; color: var(--text-secondary, #64748b); }
.rm-time-count { font-size: 0.75rem; color: var(--text-muted, #94a3b8); }

/* ── Heatmap Quadrant Badge ── */
.v2-hm-quadrant { font-size: 0.65rem; font-weight: 600; margin-left: auto; padding: 2px 6px; border-radius: 4px; background: rgba(0,0,0,0.04); }

/* ── Dark mode overrides ── */
[data-theme="dark"] .rm-format-bar-wrap { background: #334155; }
[data-theme="dark"] .rm-format-label { color: #94a3b8; }
[data-theme="dark"] .rm-time-target { color: #94a3b8; }
[data-theme="dark"] .rm-time-count { color: #64748b; }
[data-theme="dark"] .v2-hm-quadrant { background: rgba(255,255,255,0.06); }

/* ── Vector Callout — Phase 9 titled mentor card ────────────────── */
.vector-callout {
    position: relative;
    display: grid;
    grid-template-columns: 36px 1fr;
    column-gap: 14px;
    row-gap: 6px;
    padding: 14px 18px 14px 16px;
    border-radius: 6px;
    margin: 16px 0;
    border: 1px solid var(--fm-rule, #C9BFA8);
    border-left: 3px solid;
    background: var(--fm-paper-2, #FAF6EC);
    color: var(--fm-ink, #1A1D1F);
    font-family: 'Inter Tight', 'Inter', system-ui, sans-serif;
    align-items: start;
}
.vector-callout-glyph {
    grid-row: 1 / span 2;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: currentColor;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    line-height: 1;
    margin-top: 2px;
    background: var(--fm-paper, #F5EFE1);
}
.vector-callout-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 0;
    flex-wrap: wrap;
}
.vector-callout-label {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: currentColor;
    opacity: 0.85;
}
.vector-callout-dot {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.55;
}
.vector-callout-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1rem;
    font-weight: 600;
    font-variation-settings: "opsz" 36, "SOFT" 70;
    font-style: italic;
    letter-spacing: -0.005em;
    color: var(--fm-ink, #1A1D1F);
    margin: 0;
    line-height: 1.3;
}
.vector-callout-message {
    grid-column: 2;
    font-size: 0.93rem;
    line-height: 1.7;
    color: var(--fm-ink, #1A1D1F);
    margin: 0;
}
.vector-callout-message p:first-child { margin-top: 0; }
.vector-callout-message p:last-child { margin-bottom: 0; }

/* Style-specific accent colors — currentColor flows to glyph + label + dot */
.vector-callout--teaching      { color: var(--fm-blueprint, #1E4E6B); border-left-color: var(--fm-blueprint, #1E4E6B); background: var(--fm-blueprint-tint, #E6F0F6); }
.vector-callout--warning       { color: var(--fm-ochre, #B8822A);     border-left-color: var(--fm-ochre, #B8822A);     background: var(--fm-ochre-tint, #F9F0DB); }
.vector-callout--trap          { color: var(--fm-redline, #B42D1F);   border-left-color: var(--fm-redline, #B42D1F);   background: var(--fm-redline-tint, #FBECE9); }
.vector-callout--tip           { color: var(--fm-survey, #4F6B3A);    border-left-color: var(--fm-survey, #4F6B3A);    background: var(--fm-survey-tint, #EEF3E5); }
.vector-callout--encouragement { color: var(--fm-survey, #4F6B3A);    border-left-color: var(--fm-survey, #4F6B3A);    background: var(--fm-survey-tint, #EEF3E5); }
.vector-callout--bridge        { color: var(--fm-blueprint, #1E4E6B); border-left-color: var(--fm-blueprint, #1E4E6B); background: var(--fm-blueprint-tint, #E6F0F6); }
.vector-callout--challenge     { color: var(--fm-ochre, #B8822A);     border-left-color: var(--fm-ochre, #B8822A);     background: var(--fm-ochre-tint, #F9F0DB); }

[data-theme="dark"] .vector-callout { background: var(--fm-paper-2); border-color: var(--fm-rule); color: var(--fm-ink); }
[data-theme="dark"] .vector-callout-glyph { background: var(--fm-paper); }
[data-theme="dark"] .vector-callout-title,
[data-theme="dark"] .vector-callout-message { color: var(--fm-ink); }

/* ══════════════════════════════════════════════════════ */
/* VECTOR COMPANION PANEL                                */
/* ══════════════════════════════════════════════════════ */
.vector-companion {
    background: var(--surface-primary, #ffffff);
    border-radius: 0;
    box-shadow: -2px 0 12px rgba(0,0,0,0.06);
    transition: border-color 0.3s ease;
    overflow: hidden;
    border-left: 1px solid var(--color-border, #e2e8f0);
}
/* Desktop: fixed right panel (doesn't eat into gl-container width) */
#vector-companion.vc-active {
    position: fixed;
    top: 52px;
    right: 0;
    width: 280px;
    max-height: calc(100vh - 52px);
    overflow-y: auto;
    scrollbar-width: thin;
    z-index: 40;
    margin: 0;
    border-radius: 0;
}
.vector-companion--teaching       { border-left-color: #3b82f6; }
.vector-companion--warning        { border-left-color: #f59e0b; }
.vector-companion--trap           { border-left-color: #ef4444; }
.vector-companion--tip            { border-left-color: #22c55e; }
.vector-companion--encouragement  { border-left-color: #10b981; }
.vector-companion--concerned      { border-left-color: #f97316; }
.vector-companion--celebrating    { border-left-color: #8b5cf6; }
.vector-companion-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light, #e2e8f0);
    background: var(--surface-primary, #ffffff);
}
.vector-companion-header-left { display: flex; align-items: center; gap: 8px; }
.vector-companion-icon { font-size: 22px; color: #3b82f6; }
.vector-companion-name {
    font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; color: var(--text-secondary, #64748b);
}
.vector-companion-toggle {
    background: none; border: none; cursor: pointer; padding: 4px;
    color: var(--text-secondary, #64748b); border-radius: 6px;
}
.vector-companion-toggle:hover { background: var(--surface-secondary, #f1f5f9); }
.vector-companion-body { padding: 0; }
.vector-companion-section {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light, #f1f5f9);
}
.vector-companion-section:last-child { border-bottom: none; }
.vector-companion-msg {
    font-size: 0.88rem; line-height: 1.6;
    color: var(--text-primary, #1e293b); margin: 0;
}
.vector-companion-stats { display: flex; gap: 16px; }
.vector-companion-stat { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.vector-companion-stat-label {
    font-size: 0.68rem; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--text-secondary, #94a3b8);
}
.vector-companion-stat-value { font-size: 0.92rem; font-weight: 700; color: var(--text-primary, #1e293b); }
.vector-companion-tip-box {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 8px 10px; background: #fffbeb; border-radius: 8px;
}
.vector-companion-tip-text { font-size: 0.8rem; line-height: 1.5; color: #92400e; }
.vector-companion-listen-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 12px; background: var(--surface-secondary, #f1f5f9);
    border: 1px solid var(--border-light, #e2e8f0); border-radius: 8px;
    cursor: pointer; font-size: 0.8rem; color: var(--text-primary, #475569);
    width: 100%; justify-content: center; transition: background 0.2s;
}
.vector-companion-listen-btn:hover { background: var(--surface-hover, #e2e8f0); }
.vector-companion-listen-btn.playing { background: #eff6ff; border-color: #3b82f6; color: #3b82f6; }
.vector-companion-alert-box {
    display: flex; gap: 10px; padding: 10px;
    background: #fef2f2; border-radius: 8px; border: 1px solid #fecaca;
}
.vector-companion-alert-msg { font-size: 0.82rem; line-height: 1.5; color: #991b1b; margin: 0 0 8px; }
.vector-companion-alert-actions { display: flex; gap: 8px; }
.vector-companion-alert-btn {
    padding: 5px 10px; background: #dc2626; color: white; border: none;
    border-radius: 6px; font-size: 0.76rem; font-weight: 600; cursor: pointer;
}
.vector-companion-alert-btn:hover { background: #b91c1c; }
.vector-companion-alert-dismiss {
    padding: 5px 10px; background: none; border: 1px solid #fca5a5;
    border-radius: 6px; font-size: 0.76rem; color: #991b1b; cursor: pointer;
}
/* Collapsed state */
.vector-companion.collapsed .vector-companion-body { display: none; }
.vector-companion.collapsed .vector-companion-toggle .material-symbols-outlined { transform: rotate(180deg); }

/* Mobile bottom sheet */
@media (max-width: 1023px) {
    #vector-companion.vc-active {
        top: auto; bottom: 0; left: 0; right: 0;
        width: 100%; max-height: 45vh; border-left: none;
        border-top: 4px solid #3b82f6; border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1); z-index: 100;
    }
    .vector-companion--teaching       { border-top-color: #3b82f6; }
    .vector-companion--warning        { border-top-color: #f59e0b; }
    .vector-companion--trap           { border-top-color: #ef4444; }
    .vector-companion--tip            { border-top-color: #22c55e; }
    .vector-companion--encouragement  { border-top-color: #10b981; }
    .vector-companion--concerned      { border-top-color: #f97316; }
    .vector-companion--celebrating    { border-top-color: #8b5cf6; }
    .vector-companion.collapsed { max-height: 48px; }
}

/* Dark mode */
[data-theme="dark"] .vector-companion { background: var(--surface-primary, #1e293b); box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
[data-theme="dark"] .vector-companion-header { background: var(--surface-primary, #1e293b); }
[data-theme="dark"] .vector-companion-tip-box { background: #422006; }
[data-theme="dark"] .vector-companion-tip-text { color: #fbbf24; }
[data-theme="dark"] .vector-companion-alert-box { background: #450a0a; border-color: #7f1d1d; }
[data-theme="dark"] .vector-companion-alert-msg { color: #fca5a5; }

/* ── Speed Analysis in Heatmap Modal ── */
.v2-hma-ch-speed { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.375rem; flex-wrap: wrap; }
.v2-hma-speed-label { font-family: 'Manrope', sans-serif; font-size: 9px; font-weight: 700; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.04em; }
.v2-hma-speed-value { font-family: 'Manrope', sans-serif; font-size: 13px; font-weight: 800; }
.v2-hma-speed-detail { font-size: 9px; color: #94a3b8; font-weight: 600; }
.v2-hma-speed-types { display: flex; gap: 0.625rem; flex-wrap: wrap; margin-left: auto; }
.v2-hma-speed-type { font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600; }
[data-theme="dark"] .v2-hma-speed-label { color: #64748b; }

/* ── Study Trends ── */
.v2-trends-card {
    border-radius: 1.5rem;
    padding: 1rem 1.25rem 1rem 0.75rem;
    color: #fff;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}
.v2-trends-title {
    font-family: 'Manrope', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    margin: 0;
}
.v2-trends-subtitle {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    margin: 0.125rem 0 0.5rem;
}
.v2-trends-chart {
    margin-bottom: 0.5rem;
    flex: 1;
}
/* Chart area: Y-axis + grid */
.v2-trends-chart-area { display: flex; gap: 0; height: 180px; }
.v2-trends-yaxis {
    width: 1.75rem; position: relative; flex-shrink: 0;
}
.v2-trends-yaxis span {
    font-size: 9px; font-weight: 700; color: rgba(255,255,255,0.35);
    font-family: Manrope, sans-serif; position: absolute; right: 0.25rem;
    transform: translateY(50%); white-space: nowrap;
}
.v2-trends-grid {
    flex: 1; display: flex; align-items: flex-end; position: relative; gap: 2px;
}
/* Gridlines */
.v2-trends-gridline {
    position: absolute; left: 0; right: 0; pointer-events: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
/* Target line */
.v2-trends-target {
    position: absolute; left: 0; right: 0; z-index: 2; pointer-events: none;
    border-bottom: 1.5px dashed rgba(255,255,255,0.3);
}
.v2-trends-target::after {
    content: 'Target'; position: absolute; left: 0; top: 2px;
    font-size: 7px; font-weight: 700; color: rgba(255,255,255,0.35);
    text-transform: uppercase; letter-spacing: 0.05em;
}
/* Bar columns */
.v2-trends-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; z-index: 1; }
.v2-trends-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; position: relative; }
.v2-trends-bar {
    background: #3b82f6; border-radius: 2px 2px 0 0; min-height: 3px;
    transition: height 0.3s ease;
}
.v2-trends-bar--today {
    background: #60a5fa;
    box-shadow: 0 0 8px rgba(96, 165, 250, 0.5);
}
.v2-trends-bar--sched {
    position: absolute; bottom: 0; left: 0; width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 2px 2px 0 0; box-sizing: border-box;
}
.v2-trends-bar--actual { position: relative; z-index: 1; width: 100%; }
/* Bar labels above bars */
.v2-trends-bar-label {
    font-size: 7px; font-weight: 700; color: rgba(255,255,255,0.5);
    font-family: 'JetBrains Mono', monospace; text-align: center;
    min-height: 10px; line-height: 10px;
}
/* Live session pulse */
.v2-trends-bar--live { animation: trendsPulse 2s ease-in-out infinite; }
@keyframes trendsPulse {
    0%, 100% { box-shadow: 0 0 4px rgba(96,165,250,0.3); }
    50% { box-shadow: 0 0 12px rgba(96,165,250,0.6); }
}
.v2-trends-day-label { font-size: 9px; font-weight: 700; color: rgba(255, 255, 255, 0.35); font-family: Manrope, sans-serif; padding-top: 10px; flex-shrink: 0; }
.v2-trends-day-label--today { color: rgba(255, 255, 255, 0.9); }
.v2-trends-stats {
    display: flex;
    justify-content: space-between;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.v2-trends-stat-label {
    font-family: 'Manrope', sans-serif;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    display: block;
    margin-bottom: 0.1rem;
}
.v2-trends-stat-value {
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
}
.v2-trends-explore {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}
.v2-trends-explore:hover { background: rgba(255,255,255,0.2); }
[data-theme="dark"] .v2-readiness-fill { background: #60a5fa; }
[data-theme="dark"] .v2-readiness-zone { color: #94a3b8; }
[data-theme="dark"] .v2-hero-card { border: 1px solid rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .v2-hero-btn { color: #091426; }

/* ── Responsive: Hero + Stats ── */
@media (max-width: 1024px) {
    .v2-hero-row { grid-template-columns: 1fr; }
    .v2-hero-title { font-size: 1.5rem; }
    .v2-hero-card { padding: 2rem; }
    .v2-stats-row { grid-template-columns: 1fr; }
    .v2-metrics-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .v2-hero-title { font-size: 1.25rem; }
    .v2-hero-card { padding: 1.5rem; }
    .v2-hero-actions { flex-direction: column; align-items: flex-start; }
    .v2-metrics-grid { grid-template-columns: 1fr; }
    .v2-stats-row { grid-template-columns: 1fr; }
    .v2-hm-grid { grid-template-columns: repeat(3, 1fr); }
    .v2-hma-accum-grid { grid-template-columns: repeat(2, 1fr); }
    .v2-readiness-score > span:first-child { font-size: 2.5rem; }
    .v2-readiness-heading { font-size: 1.1rem; }
    .v2-readiness-card { padding: 1.25rem; border-radius: 1rem; }
    .v2-readiness-deco { display: none; }
    .v2-topic-analysis { padding: 1.25rem; }
}

/* ══════════════════════════════════════════════════════════════
   REDESIGN V2 — Phase 4: Subject Carousel + Bento Grid
   ══════════════════════════════════════════════════════════════ */

/* ── Carousel Navigation Buttons ── */
.v2-carousel-nav {
    display: flex;
    gap: 0.5rem;
}
.v2-carousel-btn {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    border: 1px solid rgba(197, 198, 205, 0.3);
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.v2-carousel-btn:hover {
    background: #0058be;
    color: #fff;
    border-color: #0058be;
}
.v2-carousel-btn .material-symbols-outlined { font-size: 18px; }

/* ── 3D Perspective Carousel ── */
.v2-3d-perspective {
    perspective: 2000px;
    perspective-origin: center;
}
.v2-3d-stage {
    position: relative;
    width: 100%;
    height: 500px;
}
.v2-3d-item {
    position: absolute;
    width: 360px;
    height: 470px;
    left: 50%;
    margin-left: -180px;
    top: 0;
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}
.v2-3d-item[data-pos="0"]  { transform: translateX(0) scale(1) translateZ(80px); z-index: 10; opacity: 1; }
.v2-3d-item[data-pos="1"]  { transform: translateX(340px) scale(0.88) translateZ(-20px) rotateY(-18deg); z-index: 5; opacity: 0.65; }
.v2-3d-item[data-pos="-1"] { transform: translateX(-340px) scale(0.88) translateZ(-20px) rotateY(18deg); z-index: 5; opacity: 0.65; }
.v2-3d-item[data-pos="2"]  { transform: translateX(580px) scale(0.72) translateZ(-80px) rotateY(-30deg); z-index: 2; opacity: 0.3; }
.v2-3d-item[data-pos="-2"] { transform: translateX(-580px) scale(0.72) translateZ(-80px) rotateY(30deg); z-index: 2; opacity: 0.3; }
.v2-3d-item[data-pos="3"], .v2-3d-item[data-pos="-3"],
.v2-3d-item[data-pos="4"], .v2-3d-item[data-pos="-4"],
.v2-3d-item[data-pos="5"], .v2-3d-item[data-pos="-5"] {
    transform: translateX(0) scale(0.5) translateZ(-200px);
    z-index: 0; opacity: 0; pointer-events: none;
}
/* Card inner */
.v2-3d-card {
    width: 100%;
    height: 100%;
    background: #fff;
    border-radius: 1.5rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(197, 198, 205, 0.1);
    box-shadow: 0 25px 50px -12px rgba(9, 20, 38, 0.25);
    cursor: pointer;
}
.v2-3d-item[data-pos="0"] .v2-3d-card {
    border-color: rgba(0, 88, 190, 0.1);
}
/* Card image area */
.v2-cs-img {
    height: 45%;
    position: relative;
    overflow: hidden;
}
.v2-cs-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
}
.v2-3d-item[data-pos="0"] .v2-cs-img img:hover { transform: scale(1.1); }
.v2-cs-img-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(9, 20, 38, 0.6), rgba(9, 20, 38, 0.1), transparent);
}
.v2-cs-badge {
    position: absolute;
    bottom: 1rem;
    left: 1.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-family: 'Manrope', sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
.v2-cs-status--active { background: #0058be; color: #fff; }
.v2-cs-status--complete { background: #16a34a; color: #fff; }
.v2-cs-status--not-started { background: rgba(255, 255, 255, 0.85); color: #64748b; }
/* Card body */
.v2-cs-body {
    padding: 1.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.v2-cs-name {
    font-family: 'Manrope', sans-serif;
    font-size: 1.25rem;
    font-weight: 900;
    color: #091426;
    margin: 0 0 0.5rem;
}
.v2-cs-desc {
    font-size: 12px;
    color: #45474c;
    line-height: 1.5;
    margin: 0 0 auto;
}
.v2-cs-progress-wrap { margin-top: 1rem; }
.v2-cs-progress-bar {
    height: 8px;
    width: 100%;
    background: #eceef0;
    border-radius: 8px;
    overflow: hidden;
}
.v2-cs-progress-fill {
    height: 100%;
    border-radius: 8px;
    background: #0058be;
    transition: width 0.6s ease;
}
.v2-cs-progress-fill.glow-pulse {
    box-shadow: 0 0 12px rgba(0, 88, 190, 0.25);
    animation: gp 3s infinite ease-in-out;
}
@keyframes gp { 0%, 100% { box-shadow: 0 0 12px rgba(0, 88, 190, 0.25); } 50% { box-shadow: 0 0 24px rgba(0, 88, 190, 0.5); } }
.v2-cs-progress-row {
    display: flex;
    justify-content: space-between;
    margin-top: 0.75rem;
}
.v2-cs-progress-pct, .v2-cs-progress-ch {
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 800;
}
.v2-cs-progress-pct { color: #45474c; }
.v2-cs-progress-ch { color: #0058be; }
/* Locked overlay */
.v2-cs-locked-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 1.5rem;
}
.v2-cs-lock-circle {
    width: 3.5rem;
    height: 3.5rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 0.75rem;
}
.v2-cs-lock-circle .material-symbols-outlined { font-size: 24px; color: #091426; }
.v2-cs-lock-label {
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 900;
    color: #091426;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}
.v2-cs-lock-req {
    font-size: 10px;
    color: #45474c;
    font-weight: 600;
    margin-top: 0.25rem;
}
/* Locked card styling (Guided/Custom mode) */
.v2-3d-card--locked { opacity: 0.5; }
.v2-3d-card--locked .v2-cs-img img { filter: grayscale(0.8); opacity: 0.4; }
.v2-3d-card--locked .v2-cs-img { position: relative; }
.v2-3d-card--locked .v2-cs-name { color: #94a3b8; }
.v2-3d-card--locked .v2-cs-desc { color: #94a3b8; }
.v2-3d-card--locked .v2-cs-progress-fill { background: #cbd5e1 !important; }
.v2-cs-lock-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 2.5rem; color: #fff; z-index: 2; text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    font-variation-settings: 'FILL' 1; }
.v2-cs-status--locked { background: #64748b; color: #fff; }
[data-theme="dark"] .v2-3d-card--locked { opacity: 0.35; }
[data-theme="dark"] .v2-3d-card--locked .v2-cs-name { color: #475569; }
[data-theme="dark"] .v2-3d-card--locked .v2-cs-desc { color: #475569; }
[data-theme="dark"] .v2-subj-locked-banner { background: #1e1215 !important; border-color: #7f1d1d !important; }
[data-theme="dark"] .v2-subj-locked-banner p { color: #fca5a5 !important; }
/* Pagination dots */
.v2-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}
.v2-dot {
    width: 8px;
    height: 8px;
    border-radius: 9999px;
    background: #c5c6cd;
    cursor: pointer;
    transition: all 0.3s;
}
.v2-dot.active {
    width: 28px;
    background: #0058be;
}

/* ── Dark Mode: 3D Carousel ── */
[data-theme="dark"] .v2-3d-card { background: #1e293b; border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .v2-cs-name { color: #f1f5f9; }
[data-theme="dark"] .v2-cs-desc { color: #94a3b8; }
[data-theme="dark"] .v2-cs-progress-bar { background: #334155; }
[data-theme="dark"] .v2-cs-progress-pct { color: #94a3b8; }
[data-theme="dark"] .v2-cs-progress-ch { color: #60a5fa; }
[data-theme="dark"] .v2-cs-locked-overlay { background: rgba(15,23,42,0.5); }
[data-theme="dark"] .v2-cs-lock-circle { background: rgba(30,41,59,0.9); }
[data-theme="dark"] .v2-cs-lock-circle .material-symbols-outlined { color: #94a3b8; }
[data-theme="dark"] .v2-cs-lock-label { color: #e2e8f0; }
[data-theme="dark"] .v2-cs-lock-req { color: #94a3b8; }
[data-theme="dark"] .v2-3d-card--locked .v2-cs-name { color: #475569; }
[data-theme="dark"] .v2-dot { background: #475569; }
[data-theme="dark"] .v2-dot.active { background: #60a5fa; }

/* ── Bento Grid ── */
.v2-bento-grid {
    display: grid;
    grid-template-columns: 4fr 5fr 3fr;
    grid-auto-rows: 520px;
    gap: 1.5rem;
    margin-top: 2.5rem;
    margin-bottom: 2rem;
}
.v2-bento-card {
    background: #fff;
    border-radius: 1.5rem;
    border: 1px solid rgba(197, 198, 205, 0.05);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04), 0 40px 60px -15px rgba(0, 0, 0, 0.08);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
}
.v2-bento-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.15);
}
.v2-bento-hd {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
}
.v2-bento-icon {
    font-size: 20px;
    color: #0058be;
}
.v2-bento-title {
    font-family: 'Manrope', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    color: #091426;
    margin: 0;
    flex: 1;
}
.v2-bento-action {
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #0058be;
    background: none;
    border: none;
    cursor: pointer;
}
.v2-bento-action:hover { text-decoration: underline; }
.v2-bento-body { flex: 1; }
/* Schedule card: keep button inside card boundary */
.v2-bento-schedule { overflow: hidden; }
.v2-bento-schedule .v2-bento-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.v2-bento-schedule .v2-sched-sessions {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
.v2-bento-schedule .v2-sched-add-btn {
    flex-shrink: 0;
}
.v2-bento-activity .v2-bento-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
}
.v2-bento-reference .v2-bento-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
}
.v2-bento-insights .v2-bento-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.v2-bento-empty {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.6;
}

/* ── V2 Activity Items (icon-block layout) ── */
.v2-activity-row {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}
.v2-activity-row + .v2-activity-row {
    margin-top: 2rem;
}
.v2-activity-icon {
    width: 56px;
    height: 56px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.v2-activity-row:hover .v2-activity-icon {
    transform: scale(1.1);
}
.v2-activity-content {
    flex: 1;
    min-width: 0;
}
.v2-activity-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.375rem;
}
.v2-activity-title {
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: #091426;
    margin: 0;
    line-height: 1.3;
}
.v2-activity-badge {
    font-family: 'Manrope', sans-serif;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    white-space: nowrap;
    flex-shrink: 0;
}
.v2-activity-desc {
    font-size: 12px;
    color: #45474c;
    line-height: 1.6;
    margin: 0 0 0.5rem;
}
.v2-activity-time {
    font-family: 'Manrope', sans-serif;
    font-size: 9px;
    font-weight: 800;
    color: rgba(69, 71, 76, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin: 0;
}
.v2-activity-empty {
    text-align: center;
    padding: 2.5rem 0;
    font-size: 13px;
    color: #94a3b8;
}
[data-theme="dark"] .v2-activity-title { color: #f1f5f9; }
[data-theme="dark"] .v2-activity-desc { color: #94a3b8; }
[data-theme="dark"] .v2-activity-time { color: rgba(148, 163, 184, 0.5); }
[data-theme="dark"] .v2-activity-icon { opacity: 0.9; }
[data-theme="dark"] .v2-activity-badge { opacity: 0.85; }

/* ── V2 Schedule Week Strip + Session Cards ── */
.v2-sched-week-strip {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}
.v2-sched-day-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}
.v2-sched-day-label {
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 900;
    color: #45474c;
    letter-spacing: 0.15em;
}
.v2-sched-day {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #091426;
    border: 1px solid #e2e8f0;
}
.v2-sched-day--today {
    background: #0058be;
    color: #fff;
    border-color: #0058be;
    box-shadow: 0 4px 12px rgba(0, 88, 190, 0.3);
}
.v2-sched-day--studied {
    background: #f0fdf4;
    border-color: #86efac;
    color: #16a34a;
}
.v2-sched-sessions {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
}
.v2-sched-session {
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 0.75rem;
    border-left: 4px solid #0058be;
}
.v2-sched-session--dim {
    opacity: 0.5;
    border-left-color: #e2e8f0;
}
.v2-sched-session-label {
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #64748b;
    margin: 0 0 0.375rem;
}
.v2-sched-session-label--today {
    color: #0058be;
}
.v2-sched-session-title {
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #091426;
    margin: 0;
    line-height: 1.4;
}
.v2-sched-session-meta {
    font-size: 12px;
    color: #64748b;
    margin: 0.25rem 0 0;
}
[data-theme="dark"] .v2-sched-day-label { color: #94a3b8; }
[data-theme="dark"] .v2-sched-day { color: #f1f5f9; border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .v2-sched-day--today { background: #2563eb; border-color: #2563eb; color: #fff; }
[data-theme="dark"] .v2-sched-day--studied { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.3); color: #34d399; }
[data-theme="dark"] .v2-sched-session { background: rgba(255,255,255,0.04); border-left-color: #2563eb; }
[data-theme="dark"] .v2-sched-session-title { color: #f1f5f9; }
[data-theme="dark"] .v2-sched-session-label { color: #64748b; }
[data-theme="dark"] .v2-sched-session-label--today { color: #60a5fa; }
.v2-sched-add-btn {
    width: 100%;
    margin-top: 1.5rem;
    padding: 1rem;
    border: 2px dashed rgba(197, 198, 205, 0.4);
    border-radius: 1rem;
    background: none;
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}
.v2-sched-add-btn:hover {
    background: #f8fafc;
    border-color: #0058be;
    color: #0058be;
}
[data-theme="dark"] .v2-sched-add-btn {
    border-color: rgba(255, 255, 255, 0.1);
    color: #64748b;
}
[data-theme="dark"] .v2-sched-add-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: #60a5fa;
    color: #60a5fa;
}

/* ── V2 Mentor Reasoning (schedule card + hero) ── */
.v2-sched-mentor-reason {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 88, 190, 0.06);
    border-radius: 0.75rem;
    border: 1px solid rgba(0, 88, 190, 0.1);
}
.v2-sched-mentor-icon {
    font-size: 20px;
    color: #0058be;
    flex-shrink: 0;
    margin-top: 2px;
}
.v2-sched-mentor-text {
    flex: 1;
    min-width: 0;
}
.v2-sched-mentor-msg {
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    color: #1e293b;
    line-height: 1.5;
    margin: 0;
}
.v2-sched-mentor-why {
    font-size: 11px;
    color: #64748b;
    margin: 0.25rem 0 0;
    font-style: italic;
}
.v2-mentor-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: #0058be;
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}
.v2-mentor-action-btn:hover {
    background: #004494;
    transform: translateY(-1px);
}
/* Hero mentor line */
.v2-hero-mentor-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(188, 199, 222, 0.9);
    font-size: 0.85rem;
    line-height: 1.5;
    margin: -0.5rem 0 1.5rem;
    max-width: 520px;
}
.v2-hero-mentor-icon {
    font-size: 18px;
    color: rgba(188, 199, 222, 0.7);
    flex-shrink: 0;
}
/* Dark mode — mentor reasoning */
[data-theme="dark"] .v2-sched-mentor-reason {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(96, 165, 250, 0.15);
}
[data-theme="dark"] .v2-sched-mentor-icon { color: #60a5fa; }
[data-theme="dark"] .v2-sched-mentor-msg { color: #e2e8f0; }
[data-theme="dark"] .v2-sched-mentor-why { color: #94a3b8; }
[data-theme="dark"] .v2-mentor-action-btn {
    background: #2563eb;
}
[data-theme="dark"] .v2-mentor-action-btn:hover {
    background: #3b82f6;
}

/* ══════════════════════════════════════════════════════════════
   STUDY PLAN PAGE — SP-1: Hero + Today's Session
   ══════════════════════════════════════════════════════════════ */

/* ── SP Hero (dark editorial card) ── */
.sp-hero {
    border-radius: 1.5rem;
    padding: 1.5rem 2rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.sp-hero-glow {
    position: absolute;
    right: -4rem;
    top: -4rem;
    width: 16rem;
    height: 16rem;
    background: rgba(0, 88, 190, 0.08);
    border-radius: 50%;
    filter: blur(48px);
    pointer-events: none;
}
.sp-hero-inner { position: relative; z-index: 1; }
.sp-hero-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}
.sp-overline {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 700;
    color: rgba(133, 144, 166, 0.7);
    display: block;
    margin-bottom: 0.25rem;
}
.sp-hero .sp-overline { color: rgba(188, 199, 222, 0.6); }
.sp-overline--blue { color: #0058be; }
.sp-overline--green { color: #16a34a; }
.sp-hero-title {
    font-family: 'Manrope', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
/* Metrics grid */
.sp-hero-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.sp-hero-metric {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.sp-metric-value {
    display: flex;
    align-items: baseline;
    gap: 0.375rem;
    margin: 0.5rem 0 0.25rem;
}
.sp-metric-big {
    font-family: 'Manrope', sans-serif;
    font-size: 1.75rem;
    font-weight: 900;
    line-height: 1;
}
.sp-metric-med {
    font-family: 'Manrope', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
}
.sp-metric-unit {
    font-size: 1rem;
    font-weight: 700;
    color: rgba(133, 144, 166, 0.4);
}
.sp-metric-sub {
    font-size: 0.6875rem;
    color: rgba(133, 144, 166, 0.6);
}
.sp-metric-delta {
    font-size: 0.6875rem;
    font-weight: 700;
    display: block;
}
.sp-metric-delta--up { color: #16a34a; }
.sp-metric-delta--down { color: #ef4444; }

/* Phase progress bar */
.sp-hero-phases { margin-top: 0.5rem; }
.sp-phase-bar {
    display: flex;
    gap: 3px;
    height: 0.5rem;
    border-radius: 9999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
}
.sp-phase-seg {
    height: 100%;
    border-radius: 9999px;
    overflow: hidden;
}
.sp-phase-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 9999px;
    transition: width 0.6s ease;
}
.sp-phase-fill--current { background: #0058be; }
.sp-phase-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.625rem;
    font-weight: 700;
    color: rgba(133, 144, 166, 0.4);
}
.sp-phase-label--current { color: rgba(216, 226, 255, 0.8); }
.sp-phase-label--done { color: rgba(133, 144, 166, 0.5); }

/* ── SP Today's Session ── */
.sp-today {
    background: #fff;
    border-radius: 1rem;
    padding: 1.75rem;
    border: 1px solid rgba(197, 198, 205, 0.1);
    box-shadow: 0 4px 12px rgba(25, 28, 30, 0.04), 0 12px 32px rgba(25, 28, 30, 0.06);
    margin-bottom: 2rem;
}
.sp-today-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}
.sp-today-title {
    font-family: 'Manrope', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: #091426;
    letter-spacing: -0.02em;
    margin: 0.125rem 0 0;
}
.sp-today-sub {
    font-size: 0.8125rem;
    color: #45474c;
    margin: 0.25rem 0 0;
}
.sp-today-right { text-align: right; }
.sp-today-est-label {
    display: block;
    font-size: 0.6875rem;
    color: #45474c;
}
.sp-today-est {
    font-family: 'Manrope', sans-serif;
    font-size: 1.5rem;
    font-weight: 900;
    color: #091426;
}

/* Task checklist */
.sp-today-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.sp-task {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
}
.sp-task-icon { font-size: 20px; flex-shrink: 0; }
.sp-task-label { flex: 1; }
.sp-task-spacer { flex: 1; }
.sp-task-time { font-size: 0.6875rem; white-space: nowrap; }
.sp-task-badge {
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.125rem 0.5rem;
    border-radius: 0.375rem;
    white-space: nowrap;
}
/* Done state */
.sp-task--done {
    background: rgba(22, 163, 74, 0.06);
    border: 1px solid rgba(22, 163, 74, 0.15);
}
.sp-task--done .sp-task-icon { color: #16a34a; }
.sp-task--done .sp-task-label { color: #45474c; text-decoration: line-through; }
.sp-task--done .sp-task-time { color: #45474c; }
/* Current state */
.sp-task--current {
    background: rgba(0, 88, 190, 0.05);
    border: 2px solid rgba(0, 88, 190, 0.2);
}
.sp-task--current .sp-task-icon { color: #0058be; }
.sp-task--current .sp-task-label { color: #091426; font-weight: 700; }
.sp-task--current .sp-task-badge { color: #0058be; background: rgba(0, 88, 190, 0.1); }
.sp-task--current .sp-task-time { color: #0058be; font-weight: 700; }
/* Upcoming state */
.sp-task--upcoming {
    background: #f7f9fb;
    border: 1px solid transparent;
}
.sp-task--upcoming .sp-task-icon { color: #75777d; }
.sp-task--upcoming .sp-task-label { color: #45474c; }
.sp-task--upcoming .sp-task-time { color: #75777d; }

/* Actions row */
.sp-today-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.sp-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    border-radius: 0.75rem;
    font-family: 'Manrope', sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.sp-btn--primary {
    background: linear-gradient(135deg, #091426, #1e293b);
    color: #fff;
    box-shadow: 0 4px 12px rgba(9, 20, 38, 0.35);
}
.sp-btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(9, 20, 38, 0.5);
}
[data-theme="dark"] .sp-btn--primary {
    background: linear-gradient(135deg, #0f172a, #334155);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
/* Streak badge */
.sp-streak {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-left: auto;
    padding: 0.5rem 1rem;
    background: #f7f9fb;
    border-radius: 0.75rem;
}
.sp-streak-icon { font-size: 16px; color: #0058be; }
.sp-streak-text {
    font-family: 'Manrope', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: #091426;
}

/* ── SP Dark Mode ── */
[data-theme="dark"] .sp-today {
    background: var(--color-card, #1e293b);
    border-color: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .sp-today-title { color: #f1f5f9; }
[data-theme="dark"] .sp-today-sub { color: #94a3b8; }
[data-theme="dark"] .sp-today-est { color: #f1f5f9; }
[data-theme="dark"] .sp-today-est-label { color: #94a3b8; }
[data-theme="dark"] .sp-task--done { background: rgba(22, 163, 74, 0.08); border-color: rgba(22, 163, 74, 0.2); }
[data-theme="dark"] .sp-task--done .sp-task-label { color: #94a3b8; }
[data-theme="dark"] .sp-task--current { background: rgba(37, 99, 235, 0.1); border-color: rgba(96, 165, 250, 0.25); }
[data-theme="dark"] .sp-task--current .sp-task-label { color: #e2e8f0; }
[data-theme="dark"] .sp-task--current .sp-task-badge { background: rgba(37, 99, 235, 0.2); color: #60a5fa; }
[data-theme="dark"] .sp-task--current .sp-task-time { color: #60a5fa; }
[data-theme="dark"] .sp-task--upcoming { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .sp-task--upcoming .sp-task-label { color: #94a3b8; }
[data-theme="dark"] .sp-streak { background: rgba(255, 255, 255, 0.05); }
[data-theme="dark"] .sp-streak-text { color: #e2e8f0; }
[data-theme="dark"] .sp-streak-icon { color: #60a5fa; }

/* ── SP Responsive ── */
@media (max-width: 768px) {
    .sp-hero { padding: 1.5rem; }
    .sp-hero-metrics { grid-template-columns: repeat(2, 1fr); }
    .sp-hero-title { font-size: 1.25rem; }
    .sp-metric-big { font-size: 1.75rem; }
    .sp-today { padding: 1.25rem; }
    .sp-today-header { flex-direction: column; gap: 0.75rem; }
    .sp-today-right { text-align: left; }
    .sp-today-actions { flex-wrap: wrap; }
    .sp-phase-labels { font-size: 0.5rem; }
}

/* ── Mission Strip: Yesterday / Today / Tomorrow ── */
.sp-mission-strip {
    display: grid;
    grid-template-columns: 3fr 6fr 3fr;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: stretch;
}
.sp-mission-card {
    background: #fff;
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    transition: box-shadow 0.2s;
    max-height: 420px;
    display: flex;
    flex-direction: column;
}
.sp-mission--today {
    padding: 1.75rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.sp-mission-scroll {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    margin: 0 -0.5rem;
    padding: 0 0.5rem;
}
.sp-mission-scroll::-webkit-scrollbar { width: 4px; }
.sp-mission-scroll::-webkit-scrollbar-track { background: transparent; }
.sp-mission-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }
[data-theme="dark"] .sp-mission-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }
.sp-mission--past, .sp-mission--future, .sp-mission--yesterday, .sp-mission--tomorrow {
    font-size: 0.875rem;
}
.sp-mission-label {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #0058be;
    margin-bottom: 0.5rem;
}
.sp-mission-chapter {
    font-family: 'Manrope', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.375rem;
}
.sp-mission-meta {
    font-size: 0.8rem;
    color: #64748b;
}
.sp-mission--completed { border-left: 4px solid #22c55e; }
.sp-mission--rest { opacity: 0.6; border-color: #e2e8f0; }
.sp-mission--missed { border-left: 4px solid #f59e0b; }
.sp-mission-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}
.sp-mission-header h3 {
    font-family: 'Manrope', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}
.sp-mission-estimate {
    text-align: right;
    font-size: 0.75rem;
    color: #64748b;
}
.sp-mission-estimate strong {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
}
.sp-mission-subtitle {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 1rem;
}
.sp-step {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.375rem;
    gap: 0.75rem;
}
.sp-step--done { background: #f0fdf4; }
.sp-step--current { background: #f0fdf4; border: 1px solid #bbf7d0; }
.sp-step--upcoming { background: #f8fafc; }
.sp-step-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.sp-step-icon--done { background: #22c55e; color: #fff; }
.sp-step-icon--current { border: 2px solid #cbd5e1; background: #fff; }
.sp-step-icon--upcoming { border: 2px solid #e2e8f0; background: #fff; }
.sp-step-title { flex: 1; font-weight: 600; color: #0f172a; font-size: 0.9rem; }
.sp-step-progress { font-size: 0.8rem; color: #64748b; }
.sp-step-time { font-size: 0.8rem; color: #94a3b8; min-width: 50px; text-align: right; }
.sp-step-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    background: #dbeafe;
    color: #1d4ed8;
}
.sp-bonus-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.sp-bonus-divider::before, .sp-bonus-divider::after {
    content: '';
    flex: 1;
    border-top: 1px dashed #e2e8f0;
}
.sp-priority-strip {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
}
.sp-priority-strip--remediation { background: #fef3c7; color: #92400e; }
.sp-priority-strip--spaced { background: #ede9fe; color: #5b21b6; }
.sp-mission-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
}

/* ── Estimated Completion Panel (Study Plan sidebar) ── */
.sp-cc-panel {
    background: #fff; border-radius: 1rem; padding: 1.25rem;
    border: 1px solid rgba(197,198,205,0.1); margin-bottom: 1rem;
}
.sp-cc-panel-title {
    font-family: 'Manrope', sans-serif; font-size: 0.875rem; font-weight: 800;
    color: #091426; margin: 0 0 0.75rem;
}
.sp-cc-progress-row { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.375rem; }
.sp-cc-pct { font-family: 'Manrope', sans-serif; font-size: 1.75rem; font-weight: 900; color: #091426; line-height: 1; }
.sp-cc-pct-detail { font-size: 0.7rem; color: #94a3b8; font-weight: 600; }
.sp-cc-bar { height: 4px; background: #e2e8f0; border-radius: 2px; margin-bottom: 0.75rem; overflow: hidden; }
.sp-cc-bar-fill { height: 100%; background: #0058be; border-radius: 2px; transition: width 0.3s; }
.sp-cc-row { display: flex; justify-content: space-between; padding: 0.3rem 0; font-size: 0.75rem; color: #64748b; }
.sp-cc-row--sep { border-top: 1px solid #e2e8f0; margin-top: 0.375rem; padding-top: 0.5rem; }
.sp-cc-val { font-weight: 700; color: #091426; }
.sp-cc-value--green { color: #16a34a; }
.sp-cc-value--blue { color: #0058be; }
[data-theme="dark"] .sp-cc-panel { background: #1e293b; border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .sp-cc-panel-title { color: #f1f5f9; }
[data-theme="dark"] .sp-cc-pct { color: #f1f5f9; }
[data-theme="dark"] .sp-cc-bar { background: #334155; }
[data-theme="dark"] .sp-cc-val { color: #f1f5f9; }
[data-theme="dark"] .sp-cc-row { color: #94a3b8; }
[data-theme="dark"] .sp-cc-row--sep { border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .sp-cc-value--green { color: #34d399; }
[data-theme="dark"] .sp-cc-value--blue { color: #60a5fa; }

/* ── Exam Readiness Panel ── */
.sp-readiness-panel {
    background: #fff;
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    margin-top: 1rem;
}
.sp-readiness-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.sp-readiness-title h4 {
    font-family: 'Manrope', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    margin: 0;
    color: #0f172a;
}
.sp-readiness-link {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: none;
}
.sp-readiness-metric { margin-bottom: 1rem; }
.sp-readiness-metric-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
}
.sp-readiness-metric-label { font-size: 0.85rem; font-weight: 600; color: #374151; }
.sp-readiness-metric-value { font-size: 0.95rem; font-weight: 800; color: #0f172a; }
.sp-readiness-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}
.sp-readiness-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}
.sp-readiness-sublabel { font-size: 0.75rem; color: #64748b; }

/* ── Milestones Panel ── */
.sp-milestones-panel {
    background: #fff;
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    margin-top: 1rem;
}
.sp-milestones-panel h4 {
    font-family: 'Manrope', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    margin: 0 0 1rem 0;
    color: #0f172a;
}
.sp-milestone-entry {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0;
    position: relative;
}
.sp-milestone-entry:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 15px;
    top: 36px;
    bottom: -4px;
    width: 2px;
    background: #e2e8f0;
}
.sp-milestone-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    flex-shrink: 0;
    z-index: 1;
}
.sp-milestone-icon--achieved { background: #22c55e; color: #fff; }
.sp-milestone-icon--progress { background: #3b82f6; color: #fff; }
.sp-milestone-icon--locked { background: #e2e8f0; color: #64748b; }
.sp-milestone-icon--exam { background: #0f172a; color: #fff; }
.sp-milestone-info { flex: 1; min-width: 0; }
.sp-milestone-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}
.sp-milestone-name--locked { color: #94a3b8; }
.sp-milestone-detail {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 2px;
}

/* ── Dark Mode: Mission Strip + Sidebar Panels ── */
[data-theme="dark"] .sp-mission-card { background: #1e293b; border-color: rgba(255,255,255,0.06); color: #e2e8f0; }
[data-theme="dark"] .sp-mission-chapter { color: #f1f5f9; }
[data-theme="dark"] .sp-mission-header h3 { color: #f1f5f9; }
[data-theme="dark"] .sp-mission-estimate strong { color: #f1f5f9; }
[data-theme="dark"] .sp-step--done { background: rgba(34,197,94,0.1); }
[data-theme="dark"] .sp-step--current { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.3); }
[data-theme="dark"] .sp-step--upcoming { background: rgba(255,255,255,0.03); }
[data-theme="dark"] .sp-step-title { color: #e2e8f0; }
[data-theme="dark"] .sp-readiness-panel { background: #1e293b; border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .sp-readiness-title h4 { color: #f1f5f9; }
[data-theme="dark"] .sp-readiness-metric-label { color: #94a3b8; }
[data-theme="dark"] .sp-readiness-metric-value { color: #f1f5f9; }
[data-theme="dark"] .sp-readiness-bar { background: rgba(255,255,255,0.1); }
[data-theme="dark"] .sp-milestones-panel { background: #1e293b; border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .sp-milestones-panel h4 { color: #f1f5f9; }
[data-theme="dark"] .sp-milestone-name { color: #f1f5f9; }
[data-theme="dark"] .sp-milestone-entry:not(:last-child)::after { background: rgba(255,255,255,0.1); }
[data-theme="dark"] .sp-milestone-icon--locked { background: rgba(255,255,255,0.1); color: #64748b; }
[data-theme="dark"] .sp-bonus-divider { color: #64748b; }
[data-theme="dark"] .sp-bonus-divider::before, [data-theme="dark"] .sp-bonus-divider::after { border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .sp-priority-strip--remediation { background: rgba(245,158,11,0.15); color: #fbbf24; }
[data-theme="dark"] .sp-priority-strip--spaced { background: rgba(139,92,246,0.15); color: #a78bfa; }
[data-theme="dark"] .sp-mission-actions { border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .sp-readiness-link { border-color: rgba(255,255,255,0.1); color: #94a3b8; }

/* ── Responsive: Mission Strip ── */
@media (max-width: 768px) {
    .sp-mission-strip { grid-template-columns: 1fr; }
    .sp-mission--today { order: -1; }
    .sp-mission--future, .sp-mission--tomorrow { order: 0; }
    .sp-mission--past, .sp-mission--yesterday { order: 1; }
}

/* ══════════════════════════════════════════════════════════════
   SP-2: Week Strip + Subject Progress Grid
   ══════════════════════════════════════════════════════════════ */

/* ── Week Strip ── */
.sp-week-strip { margin-bottom: 2rem; }
.sp-week-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1rem;
}
.sp-week-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.75rem;
}
.sp-day {
    background: #fff;
    border-radius: 1rem;
    padding: 1rem 0.5rem;
    border: 1px solid rgba(197, 198, 205, 0.1);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s;
}
.sp-day-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #45474c;
}
.sp-day-date {
    font-size: 0.6875rem;
    color: #45474c;
    margin-bottom: 0.25rem;
}
.sp-day-icon { font-size: 18px; }
.sp-day-detail {
    font-size: 0.625rem;
    color: #45474c;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sp-day-hours {
    font-size: 0.6875rem;
    font-weight: 700;
    color: #45474c;
}
/* Scheduled vs Actual hours in week strip */
.sp-day-hours--actual { color: #16a34a; font-weight: 700; }
.sp-day-hours--sched { color: #94a3b8; font-size: 0.5625rem; font-weight: 600; }
.sp-day-off {
    font-size: 0.6875rem;
    font-weight: 700;
    color: #75777d;
}
/* Today elevated */
.sp-day--today {
    background: rgba(0, 88, 190, 0.05);
    border: 2px solid rgba(0, 88, 190, 0.25);
    box-shadow: 0 0 0 4px rgba(0, 88, 190, 0.05);
}
.sp-day--today .sp-day-label { color: #0058be; }
.sp-day--today .sp-day-date { color: #0058be; font-weight: 700; }
.sp-day--elevated { transform: translateY(-2px); }
/* Studied */
.sp-day--studied .sp-day-hours { color: #16a34a; }
/* Rest dimmed */
.sp-day--rest {
    opacity: 0.5;
    background: #f2f4f6;
    border-color: transparent;
}
/* Missed */
.sp-day--missed {
    background: #f7f9fb;
    border-color: transparent;
}
/* Summary */
.sp-week-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #45474c;
}
.sp-week-summary-sep { color: #c5c6cd; }

/* ── Subject Progress Grid ── */
.sp-subj-grid { margin-bottom: 2rem; }
.sp-subj-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1rem;
}
.sp-subj-count {
    font-size: 0.75rem;
    color: #45474c;
}
.sp-subj-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.sp-subj-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid rgba(197, 198, 205, 0.1);
    transition: all 0.2s;
}
.sp-subj-row--in-progress { border: 2px solid rgba(0, 88, 190, 0.15); }
.sp-subj-row--dimmed { opacity: 0.6; background: #f7f9fb; }
.sp-subj-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}
.sp-subj-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}
.sp-subj-icon { font-size: 20px; flex-shrink: 0; }
.sp-subj-pct {
    font-family: 'Manrope', sans-serif;
    font-size: 0.875rem;
    font-weight: 900;
    flex-shrink: 0;
    min-width: 2rem;
    text-align: center;
}
.sp-subj-info { flex: 1; min-width: 0; }
.sp-subj-name-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.sp-subj-name {
    font-family: 'Manrope', sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    color: #091426;
}
.sp-subj-detail {
    font-size: 0.6875rem;
    color: #45474c;
    margin-top: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sp-subj-badge {
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.2rem 0.625rem;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.sp-subj-badge--green { background: rgba(22, 163, 74, 0.1); color: #16a34a; }
.sp-subj-badge--blue { background: rgba(0, 88, 190, 0.1); color: #0058be; }
.sp-subj-badge--amber { background: rgba(217, 119, 6, 0.1); color: #d97706; }
.sp-subj-badge--gray { background: #f2f4f6; color: #75777d; }
.sp-subj-row--fast-tracked { border: 2px solid rgba(217, 119, 6, 0.2); }
.sp-subj-weight {
    font-family: 'Manrope', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: #45474c;
    min-width: 2rem;
    text-align: right;
}
.sp-subj-bar {
    width: 4rem;
    height: 0.375rem;
    background: rgba(197, 198, 205, 0.2);
    border-radius: 9999px;
    overflow: hidden;
}
.sp-subj-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.4s ease;
}
.sp-subj-bar-fill--green { background: #16a34a; }
.sp-subj-bar-fill--blue { background: #0058be; }
.sp-subj-toggle {
    width: 100%;
    padding: 0.75rem;
    margin-top: 0.5rem;
    background: none;
    border: none;
    font-family: 'Manrope', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: #0058be;
    cursor: pointer;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    transition: background 0.2s;
}
.sp-subj-toggle:hover { background: rgba(0, 88, 190, 0.05); }

/* ── SP-2 Dark Mode ── */
[data-theme="dark"] .sp-day {
    background: var(--color-card, #1e293b);
    border-color: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .sp-day-label { color: #94a3b8; }
[data-theme="dark"] .sp-day-date { color: #94a3b8; }
[data-theme="dark"] .sp-day-detail { color: #94a3b8; }
[data-theme="dark"] .sp-day-hours { color: #94a3b8; }
[data-theme="dark"] .sp-day--today {
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(96, 165, 250, 0.25);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.05);
}
[data-theme="dark"] .sp-day--today .sp-day-label { color: #60a5fa; }
[data-theme="dark"] .sp-day--today .sp-day-date { color: #60a5fa; }
[data-theme="dark"] .sp-day--rest { background: rgba(255, 255, 255, 0.02); }
[data-theme="dark"] .sp-day--missed { background: rgba(255, 255, 255, 0.02); }
[data-theme="dark"] .sp-day--studied .sp-day-hours { color: #34d399; }
[data-theme="dark"] .sp-day-hours--actual { color: #34d399; }
[data-theme="dark"] .sp-day-hours--sched { color: #64748b; }
[data-theme="dark"] .sp-week-summary { color: #94a3b8; }
[data-theme="dark"] .sp-subj-row {
    background: var(--color-card, #1e293b);
    border-color: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .sp-subj-row--in-progress { border-color: rgba(96, 165, 250, 0.2); }
[data-theme="dark"] .sp-subj-row--dimmed { background: rgba(255, 255, 255, 0.02); }
[data-theme="dark"] .sp-subj-name { color: #f1f5f9; }
[data-theme="dark"] .sp-subj-detail { color: #94a3b8; }
[data-theme="dark"] .sp-subj-weight { color: #94a3b8; }
[data-theme="dark"] .sp-subj-count { color: #94a3b8; }
[data-theme="dark"] .sp-subj-badge--amber { background: rgba(217, 119, 6, 0.15); color: #fbbf24; }
[data-theme="dark"] .sp-subj-row--fast-tracked { border-color: rgba(217, 119, 6, 0.25); }
[data-theme="dark"] .sp-subj-badge--gray { background: rgba(255, 255, 255, 0.05); color: #94a3b8; }
[data-theme="dark"] .sp-subj-bar { background: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .sp-subj-toggle { color: #60a5fa; }
[data-theme="dark"] .sp-subj-toggle:hover { background: rgba(37, 99, 235, 0.1); }

/* ── SP-2 Responsive ── */
@media (max-width: 768px) {
    .sp-week-days { grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
    .sp-day { padding: 0.75rem 0.375rem; }
    .sp-week-header { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
    .sp-subj-row { flex-wrap: wrap; padding: 0.75rem; }
    .sp-subj-left { min-width: 100%; }
    .sp-subj-right { width: 100%; justify-content: flex-end; }
    .sp-subj-badge { font-size: 0.5625rem; }
}

/* ══════════════════════════════════════════════════════════════
   SP-3: Content Grid + Vector Insights + Plan Settings
   ══════════════════════════════════════════════════════════════ */

/* 2-column grid: subjects (8) + insights (4) */
.sp-content-grid {
    display: grid;
    grid-template-columns: 8fr 4fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.sp-content-main { min-width: 0; }
.sp-content-side { min-width: 0; }

/* ── Vector Insights Panel ── */
.sp-insights-panel {
    background: #fff;
    border-radius: 1rem;
    padding: 1.25rem;
    border: 1px solid rgba(197, 198, 205, 0.1);
    position: sticky;
    top: 2rem;
}
.sp-insights-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.sp-insights-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sp-insights-avatar .material-symbols-outlined { font-size: 16px; color: #bcc7de; }
.sp-insights-title-wrap { display: flex; flex-direction: column; }
.sp-insights-title {
    font-family: 'Manrope', sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    color: #091426;
    margin: 0;
}
.sp-insights-updated { font-size: 0.625rem; color: #75777d; }
.sp-insights-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.sp-insight {
    padding: 0.75rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
}
.sp-insight--red { background: rgba(186, 26, 26, 0.06); border-color: rgba(186, 26, 26, 0.1); }
.sp-insight--red .sp-insight-icon,
.sp-insight--red .sp-insight-label { color: #ba1a1a; }
.sp-insight--green { background: rgba(22, 163, 74, 0.06); border-color: rgba(22, 163, 74, 0.1); }
.sp-insight--green .sp-insight-icon,
.sp-insight--green .sp-insight-label { color: #16a34a; }
.sp-insight--blue { background: rgba(0, 88, 190, 0.06); border-color: rgba(0, 88, 190, 0.1); }
.sp-insight--blue .sp-insight-icon,
.sp-insight--blue .sp-insight-label { color: #0058be; }
.sp-insight--gray { background: #f7f9fb; }
.sp-insight--gray .sp-insight-icon,
.sp-insight--gray .sp-insight-label { color: #45474c; }
.sp-insight-label-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.375rem;
}
.sp-insight-icon { font-size: 14px; }
.sp-insight-label {
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.sp-insight-msg {
    font-size: 0.6875rem;
    color: #191c1e;
    line-height: 1.5;
    margin: 0;
}

/* ── Plan Settings (collapsed) ── */
.sp-settings {
    background: #fff;
    border-radius: 1rem;
    border: 1px solid rgba(197, 198, 205, 0.1);
    overflow: hidden;
    margin-bottom: 2rem;
}
.sp-settings-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}
.sp-settings-toggle:hover { background: #f7f9fb; }
.sp-settings-toggle-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sp-settings-icon { font-size: 20px; color: #45474c; }
.sp-settings-title {
    font-family: 'Manrope', sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    color: #091426;
}
.sp-settings-summary { font-size: 0.75rem; color: #45474c; }
.sp-settings-chevron { font-size: 20px; color: #75777d; transition: transform 0.2s; }
.sp-settings-body {
    padding: 1.25rem 1.5rem 1.5rem;
    border-top: 1px solid rgba(197, 198, 205, 0.1);
}

/* ── SP-3 Dark Mode ── */
[data-theme="dark"] .sp-insights-panel { background: var(--color-card, #1e293b); border-color: rgba(255,255,255,0.05); }
[data-theme="dark"] .sp-insights-title { color: #f1f5f9; }
[data-theme="dark"] .sp-insights-updated { color: #64748b; }
[data-theme="dark"] .sp-insight--red { background: rgba(186,26,26,0.1); border-color: rgba(186,26,26,0.15); }
[data-theme="dark"] .sp-insight--green { background: rgba(22,163,74,0.1); border-color: rgba(22,163,74,0.15); }
[data-theme="dark"] .sp-insight--blue { background: rgba(37,99,235,0.1); border-color: rgba(96,165,250,0.15); }
[data-theme="dark"] .sp-insight--blue .sp-insight-icon,
[data-theme="dark"] .sp-insight--blue .sp-insight-label { color: #60a5fa; }
[data-theme="dark"] .sp-insight--gray { background: rgba(255,255,255,0.03); }
[data-theme="dark"] .sp-insight--gray .sp-insight-icon,
[data-theme="dark"] .sp-insight--gray .sp-insight-label { color: #94a3b8; }
[data-theme="dark"] .sp-insight-msg { color: #e2e8f0; }
[data-theme="dark"] .sp-settings { background: var(--color-card, #1e293b); border-color: rgba(255,255,255,0.05); }
[data-theme="dark"] .sp-settings-toggle:hover { background: rgba(255,255,255,0.03); }
[data-theme="dark"] .sp-settings-icon { color: #94a3b8; }
[data-theme="dark"] .sp-settings-title { color: #f1f5f9; }
[data-theme="dark"] .sp-settings-summary { color: #94a3b8; }
[data-theme="dark"] .sp-settings-chevron { color: #64748b; }
[data-theme="dark"] .sp-settings-body { border-color: rgba(255,255,255,0.05); }

/* ── SP-3 Responsive ── */
@media (max-width: 768px) {
    .sp-content-grid { grid-template-columns: 1fr; }
    .sp-insights-panel { position: static; }
    .sp-settings-toggle-left { flex-wrap: wrap; }
}

/* ══════════════════════════════════════════════════════════════
   SP Settings Redesign — 4 Summary Cards + Detail Sections + Drag & Drop
   ══════════════════════════════════════════════════════════════ */

/* ── 4 Summary Cards ── */
.sp-settings-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}
.sp-settings-card {
    padding: 1rem 1.25rem;
    background: #f7f9fb;
    border-radius: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.sp-settings-card-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #45474c;
}
.sp-settings-card-value {
    font-family: 'Manrope', sans-serif;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #091426;
}
.sp-settings-card-link {
    font-size: 0.6875rem;
    font-weight: 700;
    color: #0058be;
    text-decoration: none;
    margin-top: 0.25rem;
}
.sp-settings-card-link:hover { text-decoration: underline; }

/* ── Detail Sections (expandable) ── */
.sp-settings-detail {
    display: none;
    border-top: 1px solid rgba(197, 198, 205, 0.15);
    padding-top: 1.25rem;
    margin-top: 0.5rem;
}
.sp-settings-detail-inner { max-width: 480px; }
.sp-settings-detail-title {
    font-family: 'Manrope', sans-serif;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #091426;
    display: block;
    margin-bottom: 0.75rem;
}
.sp-settings-hint {
    font-size: 0.6875rem;
    color: #45474c;
    margin: -0.25rem 0 0.75rem;
}
.sp-settings-subsection {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(197, 198, 205, 0.1);
}
.sp-settings-input-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sp-settings-input {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    width: 80px;
    transition: border-color 0.15s;
}
.sp-settings-input:focus { border-color: #0058be; }
.sp-settings-input--wide { width: 100%; flex: 1; }
.sp-settings-input-unit {
    font-size: 0.75rem;
    color: #45474c;
    font-weight: 600;
}
.sp-settings-save-btn {
    padding: 0.5rem 1rem;
    background: #0058be;
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-family: 'Manrope', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.sp-settings-save-btn:hover { background: #004494; }
.sp-settings-reset-btn {
    margin-top: 0.75rem;
    padding: 0.375rem 0.75rem;
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #45474c;
    cursor: pointer;
    transition: all 0.15s;
}
.sp-settings-reset-btn:hover { border-color: #0058be; color: #0058be; }

/* ── Mode Switch (redesigned) ── */
.sp-mode-switch {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.sp-mode-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-family: 'Manrope', sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid #e2e8f0;
    background: #fff;
    color: #091426;
    transition: all 0.15s;
}
.sp-mode-btn:hover { border-color: #0058be; }
.sp-mode-btn--active {
    border-color: #0058be;
    background: #0058be;
    color: #fff;
}

/* ── Study Days Toggle Grid ── */
.sp-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}
.sp-day-toggle {
    padding: 0.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #fff;
    font-family: 'Manrope', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: #45474c;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}
.sp-day-toggle:hover { border-color: #0058be; }
.sp-day-toggle--active {
    border-color: #0058be;
    background: #0058be;
    color: #fff;
}

/* ── Drag & Drop Subject Order (2-col grid) ── */
.sp-order-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
.sp-order-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.625rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    cursor: grab;
    transition: all 0.15s;
    user-select: none;
    font-size: 0.8125rem;
}
.sp-order-item:hover { border-color: #0058be; box-shadow: 0 2px 8px rgba(0,88,190,0.08); }
.sp-order-item--complete {
    opacity: 0.5;
    cursor: default;
    background: #f7f9fb;
}
.sp-order-item--fast {
    border-color: rgba(217, 119, 6, 0.3);
    background: rgba(217, 119, 6, 0.04);
}
.sp-order-item--dragging { opacity: 0.4; }
.sp-order-item--dragover {
    border-color: #0058be;
    box-shadow: 0 0 0 2px rgba(0,88,190,0.15);
}
.sp-order-num {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: #0058be;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Manrope', sans-serif;
    font-size: 0.6875rem;
    font-weight: 800;
    flex-shrink: 0;
}
.sp-order-grip {
    font-size: 18px;
    color: #c5c6cd;
    flex-shrink: 0;
    cursor: grab;
}
.sp-order-name {
    flex: 1;
    font-family: 'Inter', sans-serif;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #091426;
}
.sp-order-status { flex-shrink: 0; }
.sp-order-bolt {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    border: 1px solid #e2e8f0;
    background: none;
    color: #c5c6cd;
    cursor: pointer;
    transition: all 0.15s;
}
.sp-order-bolt:hover { border-color: #d97706; color: #d97706; }
.sp-order-bolt--active {
    background: rgba(217, 119, 6, 0.1);
    border-color: #d97706;
    color: #d97706;
}
.sp-settings-subsection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ── Subject Card Thumbnails ── */
.sp-order-thumb {
    width: 28px;
    height: 28px;
    border-radius: 0.375rem;
    object-fit: cover;
    flex-shrink: 0;
}

/* ── Mode Detail 2-Column Layout ── */
.sp-mode-layout {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 1.5rem;
    align-items: start;
}
.sp-mode-left { min-width: 0; }
.sp-mode-right {
    min-width: 0;
    margin-top: 0;
    position: relative;
}

/* ── Vector Path Guide ── */
.sp-path-guide {
    background: #f7f9fb;
    border-radius: 0.75rem;
    padding: 1.25rem;
    border: 1px solid rgba(197, 198, 205, 0.1);
    max-height: 520px;
    overflow-y: auto;
}
.sp-path-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.sp-path-avatar {
    font-size: 18px;
    color: #0058be;
}
.sp-path-title {
    font-family: 'Manrope', sans-serif;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #091426;
}
.sp-path-intro {
    font-size: 0.75rem;
    color: #45474c;
    line-height: 1.5;
    margin: 0 0 1rem;
}
.sp-path-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}
.sp-path-timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 12px;
    bottom: 12px;
    width: 2px;
    background: #e2e8f0;
}
.sp-path-step {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.375rem 0;
    position: relative;
}
.sp-path-step-dot {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 1;
}
.sp-path-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #75777d;
    font-family: 'Manrope', sans-serif;
    font-size: 0.625rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sp-path-icon { font-size: 20px; }
.sp-path-icon--done { color: #16a34a; }
.sp-path-icon--current { color: #0058be; }
.sp-path-step--done .sp-path-step-name { color: #45474c; }
.sp-path-step--current .sp-path-step-name { color: #0058be; font-weight: 700; }
.sp-path-step--upcoming .sp-path-step-name { color: #75777d; }
.sp-path-step-content {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding-top: 2px;
    min-width: 0;
}
.sp-path-step-name {
    font-family: 'Manrope', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: #091426;
}
.sp-path-step-reason {
    font-size: 0.625rem;
    color: #64748b;
    line-height: 1.4;
}
.sp-path-step-reason--warn {
    color: #d97706;
}
.sp-path-footer {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(197, 198, 205, 0.15);
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}
.sp-path-footer-label {
    font-size: 0.625rem;
    font-weight: 700;
    color: #45474c;
    margin-bottom: 0.25rem;
}
.sp-path-footer-item {
    font-size: 0.625rem;
    color: #64748b;
}

/* ── Path Guide Dark Mode ── */
[data-theme="dark"] .sp-path-guide { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.05); }
[data-theme="dark"] .sp-path-title { color: #f1f5f9; }
[data-theme="dark"] .sp-path-intro { color: #94a3b8; }
[data-theme="dark"] .sp-path-timeline::before { background: rgba(255,255,255,0.08); }
[data-theme="dark"] .sp-path-num { background: rgba(255,255,255,0.08); color: #94a3b8; }
[data-theme="dark"] .sp-path-step--done .sp-path-step-name { color: #94a3b8; }
[data-theme="dark"] .sp-path-step--current .sp-path-step-name { color: #60a5fa; }
[data-theme="dark"] .sp-path-step--upcoming .sp-path-step-name { color: #64748b; }
[data-theme="dark"] .sp-path-step-name { color: #e2e8f0; }
[data-theme="dark"] .sp-path-step-reason { color: #64748b; }
[data-theme="dark"] .sp-path-step-reason--warn { color: #fbbf24; }
[data-theme="dark"] .sp-path-footer { border-color: rgba(255,255,255,0.05); }
[data-theme="dark"] .sp-path-footer-label { color: #94a3b8; }
[data-theme="dark"] .sp-path-footer-item { color: #64748b; }
[data-theme="dark"] .sp-path-avatar { color: #60a5fa; }

/* ── Path Guide + Thumbnails Responsive ── */
@media (max-width: 768px) {
    .sp-mode-layout { grid-template-columns: 1fr; }
    .sp-path-guide { position: static; }
    .sp-order-thumb { width: 24px; height: 24px; }
}

/* ── Re-run Onboarding ── */
.sp-settings-onboarding {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(197, 198, 205, 0.1);
}
.sp-settings-onboarding-link {
    font-size: 0.75rem;
    font-weight: 600;
    color: #ba1a1a;
    text-decoration: none;
}
.sp-settings-onboarding-link:hover { text-decoration: underline; }

/* ── SP Settings Dark Mode ── */
[data-theme="dark"] .sp-settings-card { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .sp-settings-card-label { color: #94a3b8; }
[data-theme="dark"] .sp-settings-card-value { color: #f1f5f9; }
[data-theme="dark"] .sp-settings-card-link { color: #60a5fa; }
[data-theme="dark"] .sp-settings-detail { border-color: rgba(255,255,255,0.05); }
[data-theme="dark"] .sp-settings-detail-title { color: #f1f5f9; }
[data-theme="dark"] .sp-settings-hint { color: #94a3b8; }
[data-theme="dark"] .sp-settings-input { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); color: #f1f5f9; }
[data-theme="dark"] .sp-settings-input:focus { border-color: #60a5fa; }
[data-theme="dark"] .sp-settings-input-unit { color: #94a3b8; }
[data-theme="dark"] .sp-settings-reset-btn { border-color: rgba(255,255,255,0.1); color: #94a3b8; }
[data-theme="dark"] .sp-settings-reset-btn:hover { border-color: #60a5fa; color: #60a5fa; }
[data-theme="dark"] .sp-mode-btn { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.1); color: #e2e8f0; }
[data-theme="dark"] .sp-mode-btn:hover { border-color: #60a5fa; }
[data-theme="dark"] .sp-mode-btn--active { background: #2563eb; border-color: #2563eb; color: #fff; }
[data-theme="dark"] .sp-day-toggle { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.1); color: #94a3b8; }
[data-theme="dark"] .sp-day-toggle:hover { border-color: #60a5fa; }
[data-theme="dark"] .sp-day-toggle--active { background: #2563eb; border-color: #2563eb; color: #fff; }
[data-theme="dark"] .sp-order-item { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .sp-order-item:hover { border-color: #60a5fa; }
[data-theme="dark"] .sp-order-item--complete { background: rgba(255,255,255,0.02); }
[data-theme="dark"] .sp-order-item--fast { background: rgba(217,119,6,0.06); border-color: rgba(217,119,6,0.2); }
[data-theme="dark"] .sp-order-item--dragover { border-color: #60a5fa; box-shadow: 0 0 0 2px rgba(96,165,250,0.15); }
[data-theme="dark"] .sp-order-name { color: #e2e8f0; }
[data-theme="dark"] .sp-order-grip { color: #64748b; }
[data-theme="dark"] .sp-order-bolt { border-color: rgba(255,255,255,0.1); color: #64748b; }
[data-theme="dark"] .sp-order-bolt:hover { border-color: #fbbf24; color: #fbbf24; }
[data-theme="dark"] .sp-order-bolt--active { background: rgba(217,119,6,0.15); border-color: #fbbf24; color: #fbbf24; }
[data-theme="dark"] .sp-settings-onboarding { border-color: rgba(255,255,255,0.05); }
[data-theme="dark"] .sp-settings-subsection { border-color: rgba(255,255,255,0.05); }

/* ══ Unified Plan Settings (sp-cfg-*) ══ */
.sp-cfg-section { margin-bottom: 2.5rem; }
.sp-cfg-section-title {
    font-family: 'Manrope', sans-serif; font-size: 1.25rem; font-weight: 800;
    color: #091426; margin: 0 0 0.25rem;
}
.sp-cfg-section-subtitle { font-size: 0.8rem; color: #64748b; margin: 0 0 1.25rem; }

/* Study Mode: 3-column cards */
.sp-cfg-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.sp-cfg-mode {
    background: #fff; border-radius: 0.75rem; padding: 1.5rem;
    border: 2px solid transparent; cursor: pointer;
    transition: all 0.2s; display: flex; flex-direction: column; justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.sp-cfg-mode:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.sp-cfg-mode--active { border-color: #0058be; box-shadow: 0 0 0 4px rgba(0,88,190,0.06); }
.sp-cfg-mode--recommended { background: #091426; color: #fff; }
.sp-cfg-mode--recommended .sp-cfg-mode-desc { color: #94a3b8; }
.sp-cfg-mode--recommended.sp-cfg-mode--active { border-color: #60a5fa; }
.sp-cfg-mode-icon {
    width: 2.5rem; height: 2.5rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; margin-bottom: 1rem;
}
.sp-cfg-mode-icon--light { background: #e6e8ea; }
.sp-cfg-mode-icon--dark { background: #0058be; }
.sp-cfg-mode-badge {
    font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
    padding: 0.2rem 0.5rem; border-radius: 9999px; background: #0058be; color: #fff;
    display: inline-block; margin-bottom: 0.75rem;
}
.sp-cfg-mode-name { font-family: 'Manrope', sans-serif; font-size: 1.1rem; font-weight: 800; margin-bottom: 0.375rem; }
.sp-cfg-mode-desc { font-size: 0.8rem; line-height: 1.5; color: #64748b; margin-bottom: 1.5rem; }
.sp-cfg-mode-btn {
    width: 100%; padding: 0.75rem; border-radius: 0.75rem; font-weight: 700; font-size: 0.8rem;
    border: none; cursor: pointer; transition: all 0.15s;
}
.sp-cfg-mode-btn--light { background: #e6e8ea; color: #091426; }
.sp-cfg-mode-btn--light:hover { background: #d8dadc; }
.sp-cfg-mode-btn--primary { background: #fff; color: #091426; }
.sp-cfg-mode-btn--selected { background: #0058be; color: #fff; }

/* Chapter workflow pills */
.sp-cfg-workflow {
    display: flex; align-items: center; flex-wrap: wrap; gap: 0.375rem;
    margin-top: 1.25rem; padding: 1.25rem; background: #f7f9fb;
    border-radius: 0.75rem; border: 1px solid rgba(197,198,205,0.1);
}
.sp-cfg-pill {
    display: inline-flex; align-items: center; gap: 0.375rem;
    padding: 0.4rem 0.75rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 700;
    background: #e6e8ea; color: #091426; white-space: nowrap;
}
.sp-cfg-pill--dark { background: #091426; color: #fff; }
.sp-cfg-pill--blue { background: #0058be; color: #fff; }
.sp-cfg-pill-num { font-size: 0.625rem; font-weight: 800; opacity: 0.6; }
.sp-cfg-arrow { color: #94a3b8; font-size: 0.875rem; font-weight: 700; }
[data-theme="dark"] .sp-cfg-workflow { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .sp-cfg-pill { background: rgba(255,255,255,0.08); color: #f1f5f9; }
/* Save & Apply button */
.sp-cfg-save-row { margin: 2rem 0; text-align: center; }
.sp-cfg-save-btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.875rem 2.5rem; border: none; border-radius: 0.75rem;
    background: #0058be; color: #fff; font-family: 'Manrope', sans-serif;
    font-size: 0.875rem; font-weight: 800; cursor: pointer;
    transition: all 0.2s; box-shadow: 0 4px 12px rgba(0,88,190,0.2);
}
.sp-cfg-save-btn:hover { background: #004a9e; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,88,190,0.3); }
.sp-cfg-save-btn:active { transform: translateY(0); }
.sp-cfg-save-btn--done { background: #16a34a; box-shadow: 0 4px 12px rgba(22,163,74,0.3); }
[data-theme="dark"] .sp-cfg-save-btn { box-shadow: 0 4px 12px rgba(0,88,190,0.4); }
[data-theme="dark"] .sp-cfg-save-btn--done { background: #16a34a; }

[data-theme="dark"] .sp-cfg-arrow { color: #64748b; }

/* Subject order: pill flow (draggable) */
.sp-order-flow {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
    padding: 1.25rem; background: #f7f9fb; border-radius: 0.75rem;
    border: 1px solid rgba(197,198,205,0.1);
}
.sp-order-pill {
    display: inline-flex; align-items: center; gap: 0.375rem;
    padding: 0.5rem 0.875rem; border-radius: 9999px;
    background: #e6e8ea; color: #091426; font-size: 0.8rem; font-weight: 700;
    cursor: grab; transition: all 0.15s; white-space: nowrap;
    border: 2px solid transparent;
}
.sp-order-pill:hover { background: #d8dadc; transform: translateY(-1px); }
.sp-order-pill--done { background: #091426; color: #fff; cursor: default; }
.sp-order-pill--fast { background: #fef3c7; color: #92400e; border-color: #fbbf24; }
.sp-order-pill--dragging { opacity: 0.4; transform: scale(0.95); }
.sp-order-pill--dragover { border-color: #0058be; box-shadow: 0 0 0 3px rgba(0,88,190,0.15); }
.sp-order-pill-num {
    font-size: 0.65rem; font-weight: 800; opacity: 0.6;
    min-width: 1rem; text-align: center;
}
.sp-order-pill-thumb {
    width: 1.25rem; height: 1.25rem; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.sp-order-pill-name { font-weight: 700; }
.sp-order-pill-bolt {
    background: none; border: none; cursor: pointer; padding: 0; margin-left: 0.125rem;
    color: #94a3b8; transition: color 0.1s; display: flex; align-items: center;
}
.sp-order-pill-bolt:hover { color: #d97706; }
.sp-order-pill-bolt--active { color: #d97706; }
.sp-order-arrow { color: #94a3b8; font-size: 0.875rem; font-weight: 700; flex-shrink: 0; }
[data-theme="dark"] .sp-order-flow { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .sp-order-pill { background: rgba(255,255,255,0.08); color: #f1f5f9; }
[data-theme="dark"] .sp-order-pill:hover { background: rgba(255,255,255,0.12); }
[data-theme="dark"] .sp-order-pill--fast { background: rgba(217,119,6,0.15); color: #fbbf24; border-color: rgba(251,191,36,0.3); }
[data-theme="dark"] .sp-order-arrow { color: #64748b; }

/* Study Pace: 3-column cards */
.sp-cfg-paces { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.sp-cfg-pace {
    background: #fff; border-radius: 0.75rem; padding: 1.25rem;
    border: 2px solid transparent; cursor: pointer; display: flex; flex-direction: column;
    justify-content: space-between; transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.sp-cfg-pace:hover { transform: translateY(-1px); }
.sp-cfg-pace--active {
    border-color: #0058be; box-shadow: 0 0 0 4px rgba(0,88,190,0.08), 0 8px 24px rgba(0,88,190,0.12);
    transform: translateY(-2px);
}
.sp-cfg-pace--warn { border-color: rgba(186,26,26,0.2); }
.sp-cfg-pace--dim { opacity: 0.7; }
.sp-cfg-pace--dim:hover { opacity: 1; }
.sp-cfg-pace-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; }
.sp-cfg-pace-name { font-family: 'Manrope', sans-serif; font-size: 1rem; font-weight: 800; color: #091426; }
.sp-cfg-pace-hrs { font-size: 2.75rem; font-weight: 900; color: #091426; margin-bottom: 0.25rem; line-height: 1; }
.sp-cfg-pace-unit { font-size: 0.75rem; font-weight: 500; color: #64748b; }
.sp-cfg-pace-desc { font-size: 0.75rem; line-height: 1.5; color: #64748b; margin-bottom: 1rem; }
.sp-cfg-pace-warn {
    font-size: 0.7rem; font-weight: 500; color: #ba1a1a;
    background: rgba(186,26,26,0.06); padding: 0.5rem 0.75rem; border-radius: 0.5rem;
    border: 1px solid rgba(186,26,26,0.1); margin-bottom: 1rem;
}
.sp-cfg-pace-btn {
    width: 100%; padding: 0.75rem; border-radius: 0.75rem; font-weight: 700; font-size: 0.8rem;
    cursor: pointer; transition: all 0.15s; border: 1px solid rgba(197,198,205,0.3);
    background: transparent; color: #091426;
}
.sp-cfg-pace-btn--selected { background: #0058be; color: #fff; border-color: #0058be; }

/* Exam Date Selection card */
.sp-cfg-exam-card {
    margin-bottom: 1.5rem; padding: 1.25rem; background: #f7f9fb;
    border-radius: 0.75rem; border: 1px solid rgba(197,198,205,0.1);
    max-width: 480px;
}
.sp-cfg-exam-row-inline { display: flex; gap: 0.5rem; }
.sp-cfg-exam-overline {
    font-size: 0.625rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.1em; color: #64748b; display: block; margin-bottom: 0.75rem;
}
.sp-cfg-exam-display {
    display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 0.875rem;
    background: #fff; border-radius: 0.75rem; border: 1px solid #e2e8f0;
    cursor: pointer; transition: all 0.15s; flex: 1;
}
.sp-cfg-exam-display:hover { border-color: #0058be; box-shadow: 0 0 0 3px rgba(0,88,190,0.08); }
.sp-cfg-exam-date-text {
    flex: 1; font-family: 'Manrope', sans-serif; font-size: 1.125rem; font-weight: 800;
    color: #091426;
}
.sp-cfg-exam-input-hidden {
    position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
.sp-cfg-exam-nodate {
    display: flex; align-items: center; gap: 0.5rem; margin-top: 0.75rem;
    font-size: 0.8rem; color: #64748b; cursor: pointer;
}
.sp-cfg-exam-nodate input[type="checkbox"] {
    width: 1rem; height: 1rem; border-radius: 0.25rem; accent-color: #0058be;
}
[data-theme="dark"] .sp-cfg-exam-card { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .sp-cfg-exam-display { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .sp-cfg-exam-date-text { color: #f1f5f9; }
[data-theme="dark"] .sp-cfg-exam-nodate { color: #94a3b8; }

/* Weekly Calendar: bars + sidebar */
.sp-cfg-calendar { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; align-items: start; }
.sp-cfg-bars-wrap {
    background: #fff; border-radius: 1rem; padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.sp-cfg-bars-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem;
}
.sp-cfg-bars-header-label { font-size: 0.75rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }
.sp-cfg-bars-header-btns { display: flex; gap: 0.375rem; }
.sp-cfg-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.75rem; }
.sp-cfg-bar-col { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.sp-cfg-bar-label {
    font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 800;
    text-transform: uppercase; color: #94a3b8; letter-spacing: 0.05em;
}
.sp-cfg-bar-label--active { color: #0058be; }
.sp-cfg-bar-track {
    width: 100%; aspect-ratio: 2/5; background: #eceef0;
    border-radius: 9999px; position: relative; overflow: hidden; cursor: pointer;
    transition: all 0.15s;
}
.sp-cfg-bar-track:hover { box-shadow: 0 0 0 3px rgba(0,88,190,0.15); }
.sp-cfg-bar-fill {
    position: absolute; bottom: 0; width: 100%; background: #0058be;
    border-radius: 0 0 9999px 9999px; transition: height 0.2s;
}
.sp-cfg-bar-hours {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 800; color: #091426; opacity: 0;
    transition: opacity 0.15s; background: rgba(0,88,190,0.05);
}
.sp-cfg-bar-track:hover .sp-cfg-bar-hours { opacity: 1; }
.sp-cfg-bar-btns { display: flex; gap: 1px; justify-content: center; }
.sp-cfg-bar-btn {
    width: 1.25rem; height: 1.25rem; border: 1px solid #c5c6cd; border-radius: 50%;
    background: #fff; color: #091426; font-size: 12px; font-weight: 800; cursor: pointer;
    transition: all 0.1s; line-height: 1; display: flex; align-items: center; justify-content: center;
    padding: 0;
}
.sp-cfg-bar-btn:hover { background: #0058be; color: #fff; border-color: #0058be; }
.sp-cfg-bar-btn--active { background: #0058be; color: #fff; border-color: #0058be; box-shadow: 0 0 0 3px rgba(0,88,190,0.15); }
[data-theme="dark"] .sp-cfg-bar-btn { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.15); color: #f1f5f9; }
[data-theme="dark"] .sp-cfg-bar-btn:hover { background: #0058be; border-color: #0058be; }
.sp-cfg-bar-summary {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 1rem; padding: 0.75rem 1rem; background: #f7f9fb;
    border-radius: 0.75rem; border: 1px solid rgba(197,198,205,0.1);
}
.sp-cfg-bar-summary-info { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; font-weight: 500; color: #64748b; }
.sp-cfg-bar-summary-total { font-size: 0.8rem; font-weight: 800; color: #091426; }

/* Estimated Completion sidebar */
.sp-cfg-completion {
    background: #091426; color: #fff; border-radius: 1rem; padding: 2rem;
    box-shadow: 0 4px 12px rgba(9,20,38,0.15);
}
.sp-cfg-completion-title { font-family: 'Manrope', sans-serif; font-size: 1.25rem; font-weight: 800; margin: 0 0 2rem; color: #fff; }
.sp-cfg-completion-row {
    display: flex; justify-content: space-between; align-items: flex-end;
    padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sp-cfg-completion-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.sp-cfg-completion-label { font-size: 0.875rem; color: #94a3b8; }
.sp-cfg-completion-value { font-size: 1.125rem; font-weight: 800; }
.sp-cfg-completion-value--green { color: #34d399; }
.sp-cfg-completion-value--blue { color: #60a5fa; }

/* Dark mode */
[data-theme="dark"] .sp-cfg-section-title { color: #f1f5f9; }
[data-theme="dark"] .sp-cfg-mode { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .sp-cfg-mode:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
[data-theme="dark"] .sp-cfg-mode-desc { color: #94a3b8; }
[data-theme="dark"] .sp-cfg-mode-name { color: #f1f5f9; }
[data-theme="dark"] .sp-cfg-mode-btn--light { background: rgba(255,255,255,0.08); color: #f1f5f9; }
[data-theme="dark"] .sp-cfg-pace { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .sp-cfg-pace-name { color: #f1f5f9; }
[data-theme="dark"] .sp-cfg-pace-hrs { color: #f1f5f9; }
[data-theme="dark"] .sp-cfg-pace-btn { border-color: rgba(255,255,255,0.1); color: #f1f5f9; }
[data-theme="dark"] .sp-cfg-bars-wrap { background: rgba(255,255,255,0.03); }
[data-theme="dark"] .sp-cfg-bar-track { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .sp-cfg-bar-hours { color: #f1f5f9; background: rgba(0,88,190,0.15); }
[data-theme="dark"] .sp-cfg-bar-summary { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .sp-cfg-bar-summary-total { color: #f1f5f9; }
[data-theme="dark"] .sp-cfg-exam-row { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .sp-cfg-exam-label { color: #f1f5f9; }
[data-theme="dark"] .sp-cfg-exam-input { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); color: #f1f5f9; }

@media (max-width: 768px) {
    .sp-cfg-modes, .sp-cfg-paces { grid-template-columns: 1fr; }
    .sp-cfg-calendar { grid-template-columns: 1fr; }
}

/* ── Weekly Schedule Editor ── */
.sp-sched-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}
.sp-sched-day {
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 0.625rem;
    position: relative;
}
.sp-sched-day--rest { opacity: 0.5; border-style: dashed; }
.sp-sched-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}
.sp-sched-day-name { font-weight: 700; font-size: 0.75rem; color: #0f172a; text-transform: uppercase; letter-spacing: 0.03em; }
.sp-sched-day-hrs { font-size: 0.65rem; font-weight: 600; color: #0058be; }
.sp-sched-day-rest { font-size: 0.65rem; color: #94a3b8; font-style: italic; }
.sp-sched-slot {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0.25rem 0;
    padding: 0.25rem;
    background: #f8fafc;
    border-radius: 0.375rem;
    position: relative;
}
.sp-sched-time {
    border: 1px solid #e2e8f0;
    border-radius: 0.25rem;
    padding: 0.2rem 0.25rem;
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
    background: #fff;
    color: #0f172a;
    width: 100%;
    box-sizing: border-box;
}
.sp-sched-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 0.125rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
}
.sp-sched-remove:hover { color: #ef4444; background: #fef2f2; }
.sp-sched-actions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.25rem;
}
.sp-sched-add, .sp-sched-dup {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    font-size: 0.6rem;
    font-weight: 600;
    color: #0058be;
    background: none;
    border: 1px dashed #cbd5e1;
    border-radius: 0.25rem;
    padding: 0.2rem 0.25rem;
    cursor: pointer;
}
.sp-sched-add:hover, .sp-sched-dup:hover { background: #eff6ff; border-color: #0058be; }
@media (max-width: 1024px) {
    .sp-sched-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 768px) {
    .sp-sched-grid { grid-template-columns: repeat(2, 1fr); }
}
.sp-sched-summary {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: #f0f9ff;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    color: #0f172a;
}
/* Duplicate day picker dropdown */
.sp-dup-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 0.5rem;
    z-index: 50;
    margin-bottom: 0.25rem;
}
.sp-dup-picker-label { font-size: 0.6rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.375rem; }
.sp-dup-picker-days { display: flex; gap: 0.25rem; }
.sp-dup-picker-btn {
    flex: 1;
    padding: 0.375rem 0;
    border: 1px solid #e2e8f0;
    border-radius: 0.25rem;
    background: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    position: relative;
    color: #0f172a;
}
.sp-dup-picker-btn:hover { background: #eff6ff; border-color: #0058be; }
.sp-dup-picker-btn--disabled { opacity: 0.3; cursor: not-allowed; }
.sp-dup-picker-btn--has { border-color: #0058be; }
.sp-dup-dot { display: block; width: 4px; height: 4px; border-radius: 50%; background: #0058be; margin: 2px auto 0; }
[data-theme="dark"] .sp-dup-picker { background: #1e293b; border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .sp-dup-picker-btn { background: #1e293b; border-color: rgba(255,255,255,0.1); color: #e2e8f0; }
[data-theme="dark"] .sp-dup-picker-btn:hover { background: rgba(96,165,250,0.1); }
.sp-sched-vector-tip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #0058be;
    font-weight: 500;
}
[data-theme="dark"] .sp-sched-day { border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .sp-sched-day-name { color: #f1f5f9; }
[data-theme="dark"] .sp-sched-slot { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .sp-sched-time { background: #1e293b; border-color: rgba(255,255,255,0.1); color: #e2e8f0; }
[data-theme="dark"] .sp-sched-summary { background: rgba(0,88,190,0.1); color: #e2e8f0; }
[data-theme="dark"] .sp-sched-add, [data-theme="dark"] .sp-sched-dup { border-color: rgba(255,255,255,0.1); color: #60a5fa; }
[data-theme="dark"] .sp-sched-add:hover, [data-theme="dark"] .sp-sched-dup:hover { background: rgba(96,165,250,0.1); }

/* ── Session Cards (reference design) ── */
.sp-sched-day-label {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.375rem 0;
    margin-bottom: 0.5rem;
    color: #0f172a;
}
.sp-sched-session {
    background: #fff;
    padding: 0.625rem;
    border-radius: 0.5rem;
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    margin-bottom: 0.375rem;
    position: relative;
}
.sp-sched-session-num {
    font-size: 0.55rem;
    font-weight: 800;
    color: #0058be;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}
.sp-sched-session-time {
    font-size: 0.8rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
}
.sp-sched-session-edit { margin-top: 0.25rem; }
.sp-sched-time-input {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 0.25rem;
    padding: 0.15rem 0.25rem;
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 0.15rem;
    box-sizing: border-box;
}
.sp-sched-edit-btn {
    position: absolute;
    bottom: 0.25rem;
    right: 0.25rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    opacity: 0.4;
}
.sp-sched-edit-btn:hover { opacity: 1; }
.sp-sched-hover {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    gap: 0.25rem;
    z-index: 5;
}
.sp-sched-hover button {
    width: 22px;
    height: 22px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    color: #94a3b8;
}
.sp-sched-hover button:hover { color: #0058be; }
.sp-sched-hover button:last-child:hover { color: #ef4444; }
.sp-sched-add-btn {
    width: 100%;
    padding: 0.75rem 0;
    border: 2px dashed #e2e8f0;
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    gap: 0.125rem;
    transition: all 0.2s;
}
.sp-sched-add-btn:hover { border-color: rgba(0,88,190,0.5); color: #0058be; }
.sp-sched-add-btn--empty { padding: 1.5rem 0; }
.sp-sched-bottom-bar {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: rgba(0,88,190,0.04);
    border-left: 4px solid #0058be;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    margin-top: 1.25rem;
}
[data-theme="dark"] .sp-sched-session { background: #1e293b; border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .sp-sched-session-time { color: #e2e8f0; }
[data-theme="dark"] .sp-sched-session-num { color: #60a5fa; }
[data-theme="dark"] .sp-sched-day-label { color: #e2e8f0; }
[data-theme="dark"] .sp-sched-hover button { background: #1e293b; border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .sp-sched-add-btn { border-color: rgba(255,255,255,0.1); color: #64748b; }
[data-theme="dark"] .sp-sched-add-btn:hover { border-color: rgba(96,165,250,0.4); color: #60a5fa; }
[data-theme="dark"] .sp-sched-bottom-bar { background: rgba(0,88,190,0.08); }
[data-theme="dark"] .sp-sched-time-input { background: #0f172a; border-color: rgba(255,255,255,0.1); color: #e2e8f0; }

/* ── SP Settings Responsive ── */
@media (max-width: 768px) {
    .sp-settings-cards { grid-template-columns: repeat(2, 1fr); }
    .sp-days-grid { grid-template-columns: repeat(4, 1fr); }
    .sp-mode-switch { flex-direction: column; }
    .sp-order-grid { grid-template-columns: 1fr; }
}

/* ── V2 Reference Library (featured card + compact rows) ── */
.v2-bento-reference .ref-manual-grid {
    display: flex !important;
    flex-direction: column;
    gap: 0;
}
.v2-ref-featured {
    margin-bottom: 1rem;
}
.v2-ref-featured-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.v2-ref-featured-title {
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 900;
    color: #091426;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.125rem;
}
.v2-ref-featured-ver {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 600;
    margin: 0 0 0.75rem;
}
.v2-ref-featured-actions {
    display: flex;
    gap: 0.5rem;
}
.v2-ref-view-btn {
    flex: 1;
    padding: 0.5rem;
    background: #091426;
    color: #fff;
    border-radius: 0.625rem;
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-align: center;
    text-decoration: none;
    display: block;
    box-shadow: 0 4px 12px rgba(9, 20, 38, 0.15);
    transition: background 0.2s;
}
.v2-ref-view-btn:hover { background: #0058be; }
.v2-ref-dl-btn {
    padding: 0.5rem 0.625rem;
    border: 1px solid rgba(197, 198, 205, 0.2);
    border-radius: 0.625rem;
    color: #64748b;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}
.v2-ref-dl-btn:hover { background: #f1f5f9; color: #091426; }
.v2-ref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
    border: 1px solid rgba(197, 198, 205, 0.1);
    border-radius: 0.625rem;
    margin-top: 0.375rem;
    text-decoration: none;
    transition: background 0.15s;
    cursor: pointer;
}
.v2-ref-row:hover { background: #f8fafc; }
.v2-ref-row-icon {
    font-size: 18px;
    flex-shrink: 0;
}
.v2-ref-row-title {
    flex: 1;
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 900;
    color: #091426;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-left: 0.625rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.v2-ref-row-ext {
    font-size: 14px;
    color: #94a3b8;
    flex-shrink: 0;
}
[data-theme="dark"] .v2-ref-featured-title { color: #f1f5f9; }
[data-theme="dark"] .v2-ref-view-btn { background: #334155; }
[data-theme="dark"] .v2-ref-view-btn:hover { background: #2563eb; }
[data-theme="dark"] .v2-ref-dl-btn { border-color: rgba(255,255,255,0.1); color: #94a3b8; }
[data-theme="dark"] .v2-ref-row { border-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .v2-ref-row:hover { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .v2-ref-row-title { color: #f1f5f9; }

/* ── Dark Mode: Carousel + Bento ── */
[data-theme="dark"] .v2-carousel-btn {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}
[data-theme="dark"] .v2-carousel-btn:hover {
    background: #60a5fa;
    color: #fff;
    border-color: #60a5fa;
}
[data-theme="dark"] .v2-carousel-card {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .v2-cs-name { color: #f1f5f9; }
[data-theme="dark"] .v2-cs-meta { color: #94a3b8; }
[data-theme="dark"] .v2-cs-progress-bar { background: #334155; }
[data-theme="dark"] .v2-cs-progress-pct { color: #94a3b8; }
[data-theme="dark"] .v2-cs-progress-ch { color: #64748b; }
[data-theme="dark"] .v2-bento-card {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}
[data-theme="dark"] .v2-bento-title { color: #f1f5f9; }
[data-theme="dark"] .v2-bento-icon { color: #60a5fa; }
[data-theme="dark"] .v2-bento-action { color: #60a5fa; }
[data-theme="dark"] .v2-bento-empty { color: #64748b; }
[data-theme="dark"] .v2-bento-insights .v2-insight-item p { color: #e2e8f0 !important; }
[data-theme="dark"] .v2-bento-insights .v2-insight-item button { color: #60a5fa !important; }
[data-theme="dark"] .v2-bento-insights .v2-insight-item { border-bottom-color: rgba(255,255,255,0.06) !important; }

/* ── Responsive: Carousel + Bento ── */
@media (max-width: 1024px) {
    .v2-3d-stage { height: 440px; }
    .v2-3d-item { width: 300px; margin-left: -150px; height: 410px; }
    .v2-3d-item[data-pos="1"]  { transform: translateX(280px) scale(0.85) translateZ(-20px) rotateY(-15deg); }
    .v2-3d-item[data-pos="-1"] { transform: translateX(-280px) scale(0.85) translateZ(-20px) rotateY(15deg); }
    .v2-3d-item[data-pos="2"], .v2-3d-item[data-pos="-2"] { opacity: 0; pointer-events: none; }
    .v2-bento-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
    .v2-3d-perspective { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
    .v2-3d-stage { display: flex; gap: 1rem; height: auto; position: static; padding: 0.5rem 0; }
    .v2-3d-item { position: static !important; flex: 0 0 280px; width: 280px; height: 400px;
        margin-left: 0 !important; transform: none !important; opacity: 1 !important;
        visibility: visible !important; pointer-events: auto !important; }
    .v2-carousel-dots { display: none; }
    .v2-bento-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .v2-bento-card { padding: 1.5rem; }
    .v2-bento-hd { margin-bottom: 1.5rem; }
    .v2-activity-row { gap: 1rem; }
    .v2-activity-icon { width: 44px; height: 44px; }
}

/* ── Responsive: adjust main-content for new 260px sidebar ── */
@media (min-width: 1025px) {
    .sidebar { width: 260px; }
    .main-content { margin-left: 260px; width: calc(100vw - 260px); }
}
@media (max-width: 1024px) and (min-width: 769px) {
    .sidebar { width: 200px; }
    .main-content { margin-left: 200px; width: calc(100vw - 200px); }
    .sidebar-logo-text { font-size: 18px; }
    .sidebar-logo-sub { font-size: 8px; }
}
@media (max-width: 768px) and (min-width: 641px) {
    .sidebar { width: 60px; }
    .main-content { margin-left: 60px; width: calc(100vw - 60px); }
    .sidebar-logo-text,
    .sidebar-logo-sub,
    .sidebar-section-label,
    .sidebar-user-name,
    .sidebar-user-role,
    .sidebar-user-overflow,
    .sidebar-divider { display: none !important; }
    .sidebar-logo { padding: 1rem; justify-content: center; }
    /* Hide text node in links via font-size:0, keep icon visible */
    .sidebar-link { font-size: 0; justify-content: center; padding: 0.75rem; margin: 2px 0.25rem; border-right: none; }
    .sidebar-link .sidebar-icon { font-size: 22px; display: inline-flex !important; }
    /* Override old rule that hides non-iconify spans */
    .sidebar-link span { display: inline-flex !important; }
    .sidebar-user { justify-content: center; padding: 0.75rem; background: transparent; }
    .sidebar-user-avatar { width: 32px; height: 32px; font-size: 12px; }
}
@media (max-width: 640px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; width: 100vw; }
}

/* ═══════════════════════════════════════════════════════════════════
   FORMULA LIBRARY (fl- prefix) — Slide-over panel
   ═══════════════════════════════════════════════════════════════════ */

.fl-panel {
    position: fixed; top: 0; right: 0; width: 520px; max-width: 90vw; height: 100vh;
    background: var(--surface-container-lowest, #fff);
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    z-index: 90; transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column; overflow: hidden;
}
.fl-panel.fl-open { transform: translateX(0); }

.fl-header { padding: 16px 20px 0; flex-shrink: 0; }
.fl-header-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.fl-title { font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 1rem; color: var(--on-surface, #191c1e); display: flex; align-items: center; gap: 6px; }
.fl-subtitle { font-size: 0.78rem; line-height: 1.5; color: var(--on-surface-variant, #45474c); margin: 4px 0 10px; padding: 0; }
.fl-close { background: none; border: none; cursor: pointer; padding: 4px; border-radius: 8px; color: var(--on-surface-variant, #45474c); }
.fl-close:hover { background: var(--surface-container-high, #e6e8ea); }

.fl-search-wrap { position: relative; margin-bottom: 10px; }
.fl-search { width: 100%; padding: 10px 36px 10px 36px; border: 1.5px solid var(--outline-variant, #c5c6cd); border-radius: 12px; font-size: 0.85rem; background: var(--surface-container-low, #f2f4f6); color: var(--on-surface, #191c1e); outline: none; }
.fl-search:focus { border-color: var(--secondary, #0058be); box-shadow: 0 0 0 3px rgba(0,88,190,0.1); }
.fl-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 18px; color: var(--on-surface-variant, #45474c); pointer-events: none; }
.fl-search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--on-surface-variant, #45474c); padding: 2px; }

.fl-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.fl-tab { flex: 1; padding: 8px; border: none; background: var(--surface-container, #eceef0); border-radius: 8px; font-size: 0.75rem; font-weight: 700; cursor: pointer; color: var(--on-surface-variant, #45474c); font-family: inherit; }
.fl-tab--active { background: var(--secondary, #0058be); color: #fff; }

.fl-body { flex: 1; overflow-y: auto; padding: 0 20px 20px; }

/* Drag instruction banner (shown during worked example) */
.fl-drag-instruction {
    display: flex; align-items: flex-start; gap: 10px;
    margin: 0 20px 12px; padding: 12px 16px; border-radius: 10px;
    background: #eff6ff; color: #1e40af; border: 1.5px solid #bfdbfe;
    font-size: 0.82rem; line-height: 1.5;
}
.fl-drag-instruction .material-symbols-outlined { color: #2563eb; flex-shrink: 0; margin-top: 1px; }
.fl-drag-instruction-text { flex: 1; }

.fl-section { margin-bottom: 8px; border: 1px solid var(--outline-variant, #c5c6cd); border-radius: 12px; overflow: hidden; }
.fl-section-header { width: 100%; display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--surface-container-low, #f2f4f6); border: none; cursor: pointer; font-family: inherit; text-align: left; }
.fl-section-header:hover { background: var(--surface-container, #eceef0); }
.fl-section-name { flex: 1; font-weight: 700; font-size: 0.78rem; color: var(--on-surface, #191c1e); line-height: 1.3; }
.fl-section-count { font-size: 0.7rem; color: var(--on-surface-variant, #45474c); background: var(--surface-container-high, #e6e8ea); padding: 2px 8px; border-radius: 10px; }
.fl-section-arrow { font-size: 18px; color: var(--on-surface-variant, #45474c); transition: transform 0.2s; }
.fl-section-body { padding: 8px; }

/* Formula card — rich layout: header, equation area, description, variables */
.fl-card { padding: 14px 16px; border: 1.5px solid var(--outline-variant, #c5c6cd); border-radius: 14px; margin-bottom: 10px; background: var(--surface-container-lowest, #fff); transition: border-color 0.15s, box-shadow 0.15s; position: relative; overflow: hidden; }
.fl-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--secondary, #0058be); opacity: 0; transition: opacity 0.15s; }
.fl-card:hover { border-color: var(--secondary, #0058be); box-shadow: 0 4px 12px rgba(0,88,190,0.06); }
.fl-card:hover::before { opacity: 1; }

/* Header: refCode + name + star */
.fl-card-header { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 8px; }
.fl-card-refcode { font-size: 0.6rem; font-weight: 800; color: var(--secondary, #0058be); text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap; font-family: 'JetBrains Mono', monospace; padding-top: 3px; }
.fl-card-name { font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 0.88rem; color: var(--on-surface, #191c1e); line-height: 1.3; flex: 1; }
.fl-star { background: none; border: none; cursor: pointer; padding: 2px; color: var(--outline, #75777d); flex-shrink: 0; }
.fl-star.fl-starred { color: #d97706; }

/* Equation area with subtle background */
.fl-card-eq-wrap { background: var(--surface-container-low, #f2f4f6); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; text-align: center; overflow-x: auto; }
.fl-card-equation { font-size: 0.95rem; color: var(--on-surface, #191c1e); }

/* Description (usage) */
.fl-card-usage { font-size: 0.75rem; color: var(--on-surface-variant, #45474c); line-height: 1.55; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Variables */
.fl-card-vars { font-size: 0.7rem; color: var(--on-surface-variant, #64748b); line-height: 1.45; padding-top: 8px; border-top: 1px solid var(--outline-variant, #e0e3e5); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

.fl-card-dragging { opacity: 0.4; border-style: dashed; }
.fl-card-ghost { border-radius: 10px; background: #fff; }

.fl-no-results { text-align: center; padding: 40px 20px; color: var(--on-surface-variant, #45474c); font-size: 0.85rem; }

/* Dark mode */
[data-theme="dark"] .fl-panel { background: var(--primary, #091426); box-shadow: -4px 0 24px rgba(0,0,0,0.4); }
[data-theme="dark"] .fl-subtitle { color: #94a3b8; }
[data-theme="dark"] .fl-search { background: var(--primary-container, #1e293b); border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .fl-section { border-color: #334155; }
[data-theme="dark"] .fl-section-header { background: var(--primary-container, #1e293b); }
[data-theme="dark"] .fl-card { background: var(--primary-container, #1e293b); border-color: #334155; }
[data-theme="dark"] .fl-card:hover { border-color: var(--secondary, #0058be); }
[data-theme="dark"] .fl-card::before { background: #60a5fa; }
[data-theme="dark"] .fl-card-refcode { color: #60a5fa; }
[data-theme="dark"] .fl-card-name { color: #e2e8f0; }
[data-theme="dark"] .fl-card-eq-wrap { background: #0f172a; }
[data-theme="dark"] .fl-card-equation { color: #cbd5e1; }
[data-theme="dark"] .fl-card-usage { color: #94a3b8; }
[data-theme="dark"] .fl-card-vars { color: #64748b; border-top-color: #334155; }
[data-theme="dark"] .fl-tab { background: #1e293b; color: #94a3b8; }
[data-theme="dark"] .fl-drag-instruction { background: rgba(37, 99, 235, 0.12); color: #93c5fd; border-color: #1e3a5f; }
[data-theme="dark"] .fl-drag-instruction .material-symbols-outlined { color: #60a5fa; }

/* Responsive: full width on mobile */
@media (max-width: 768px) {
    .fl-panel { width: 100vw; max-width: 100vw; }
}

/* ─────────────────────────────────────────────────────────────
   PHASE 6 — V2 Right-Rail Drills (companion panels inside .v2-right-col)
   Works WITH the existing two-column layout (.v2-lecture-body-inner)
   rather than nesting a new grid inside the left column.
   ───────────────────────────────────────────────────────────── */

/* Dynamic drills container appended into .v2-right-col by _glEnsureRailContainer */
.gl-v2-rail-drills {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

/* Base rail panel */
.gl-rail-panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    font-size: 0.88rem;
    line-height: 1.55;
    color: #1e293b;
}
.gl-rail-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}
.gl-rail-panel-header .material-symbols-outlined { font-size: 20px; color: #6366f1; }
.gl-rail-panel-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #475569;
}
.gl-rail-badge { margin-left: auto; font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #f1f5f9; color: #475569; }
.gl-rail-badge--done { background: #dcfce7; color: #166534; }

/* Tracker */
.gl-rail-tracker .gl-rail-panel-header .material-symbols-outlined { color: #0ea5e9; }
.gl-rail-tracker-count { margin-left: auto; font-weight: 700; font-size: 0.85rem; color: #0369a1; }
.gl-rail-tracker-bar { height: 6px; background: #e0f2fe; border-radius: 3px; overflow: hidden; margin-bottom: 10px; }
.gl-rail-tracker-fill { height: 100%; background: linear-gradient(90deg, #0ea5e9, #22c55e); transition: width 320ms ease; }
.gl-rail-tracker-items { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.gl-rail-tracker-item { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: #64748b; }
.gl-rail-tracker-item .material-symbols-outlined { font-size: 18px; color: #cbd5e1; }
.gl-rail-tracker-item--done { color: #166534; }
.gl-rail-tracker-item--done .material-symbols-outlined { color: #22c55e; }
.gl-rail-tracker-hint { margin-top: 8px; font-size: 0.78rem; color: #64748b; font-style: italic; }
.gl-rail-tracker-hint--done { color: #166534; font-style: normal; }
.gl-rail-tracker--pulse { animation: gl-pulse 900ms ease; }
@keyframes gl-pulse {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.6); }
    100% { box-shadow: 0 0 0 14px rgba(59, 130, 246, 0); }
}

/* Handbook drill — Phase 7 multi-stage interactive form */
.gl-rail-handbook .gl-rail-panel-header .material-symbols-outlined { color: #2563eb; }
.gl-rail-drill-intro { font-size: 0.85rem; color: #475569; margin-bottom: 10px; font-style: italic; line-height: 1.6; }

.gl-rail-hb-stage { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #e2e8f0; }
.gl-rail-hb-stage:first-of-type { border-top: none; padding-top: 0; }
.gl-rail-hb-stage--locked { opacity: 0.4; pointer-events: none; }
.gl-rail-hb-stage--done { opacity: 1; }
.gl-rail-hb-stage-label { font-size: 0.82rem; font-weight: 700; color: #334155; margin-bottom: 8px; }

.gl-rail-hb-refs { display: flex; flex-direction: column; gap: 6px; }
.gl-rail-hb-ref { padding: 8px 12px; text-align: left; font-size: 0.86rem; cursor: pointer; }

.gl-rail-hb-fields { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.gl-rail-hb-field { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; color: #334155; }
.gl-rail-hb-label-txt { min-width: 82px; font-weight: 600; color: #475569; }
.gl-rail-hb-input-wrap { display: flex; align-items: center; gap: 4px; flex: 1; }
.gl-rail-hb-sigil { font-weight: 700; color: #475569; font-size: 0.95rem; }
.gl-rail-hb-input {
    flex: 1;
    padding: 6px 10px;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.88rem;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    background: #ffffff;
    color: #1e293b;
    min-width: 0;
}
.gl-rail-hb-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
.gl-rail-hb-input:disabled { background: #f8fafc; color: #64748b; cursor: not-allowed; }
.gl-rail-hb-term-row { display: flex; gap: 6px; flex: 1; align-items: center; }
.gl-rail-hb-idk {
    padding: 6px 10px;
    font-size: 0.76rem;
    color: #64748b;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.gl-rail-hb-idk:hover { background: #f1f5f9; color: #334155; }

/* IDK reveal panel */
.gl-rail-hb-idk-panel {
    margin-top: 10px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.84rem;
    line-height: 1.55;
    color: #334155;
}
.gl-rail-hb-idk-title { font-weight: 700; color: #0f172a; margin-bottom: 6px; }
.gl-rail-hb-idk-row { padding: 4px 0; }
.gl-rail-hb-idk-row--yes { color: #065f46; }
.gl-rail-hb-idk-row--no { color: #991b1b; }
.gl-rail-hb-idk-sep { margin-top: 8px; padding-top: 6px; border-top: 1px dashed #e2e8f0; font-weight: 700; color: #991b1b; }
.gl-rail-hb-verdict { font-size: 0.82rem; font-weight: 600; margin-right: auto; }
.gl-rail-drill-what { margin-top: 6px; font-size: 0.84rem; padding: 8px 10px; border-radius: 6px; line-height: 1.55; }
.gl-rail-drill-what--yes { background: #f0fdf4; color: #14532d; border-left: 3px solid #10b981; }
.gl-rail-drill-what--no { background: #fef2f2; color: #7f1d1d; border-left: 3px solid #ef4444; }
.gl-rail-drill-notinhandbook { padding: 10px 12px; background: #fef3c7; border: 1px solid #fde68a; border-radius: 8px; color: #713f12; font-size: 0.88rem; line-height: 1.55; }
.gl-rail-drill-actions { margin-top: 12px; display: flex; gap: 8px; }
.gl-rail-btn { padding: 7px 14px; border: 1px solid #cbd5e1; background: #ffffff; color: #475569; font-size: 0.82rem; font-weight: 600; border-radius: 8px; cursor: pointer; transition: background 120ms ease; }
.gl-rail-btn:hover { background: #f8fafc; }
.gl-rail-btn--primary { background: #2563eb; border-color: #2563eb; color: #ffffff; }
.gl-rail-btn--primary:hover { background: #1d4ed8; }

/* Intuition check */
.gl-rail-intuition .gl-rail-panel-header .material-symbols-outlined { color: #8b5cf6; }
.gl-rail-question { font-size: 0.92rem; font-weight: 600; color: #1e293b; margin: 8px 0 12px; line-height: 1.6; }
.gl-rail-choices { display: flex; flex-direction: column; gap: 6px; }
.gl-rail-choice { text-align: left; padding: 8px 10px; background: #faf5ff; border: 1px solid #e9d5ff; border-radius: 8px; cursor: pointer; display: flex; gap: 8px; align-items: flex-start; font-size: 0.85rem; color: #1e293b; transition: all 120ms ease; }
.gl-rail-choice:hover { background: #f3e8ff; border-color: #8b5cf6; }
.gl-rail-choice-letter { font-weight: 700; color: #7c3aed; flex-shrink: 0; }
.gl-rail-choice--correct { background: #ecfdf5 !important; border-color: #10b981 !important; color: #065f46; }
.gl-rail-choice--wrong { background: #fef2f2 !important; border-color: #dc2626 !important; color: #991b1b; }
.gl-rail-choice--dim { opacity: 0.55; }
.gl-rail-reveal { margin-top: 10px; padding: 10px 12px; background: #f8fafc; border-radius: 8px; font-size: 0.84rem; color: #1e293b; line-height: 1.6; }
.gl-rail-answer { font-weight: 600; color: #1e293b; margin-bottom: 6px; }
.gl-rail-vector { color: #7c3aed; font-style: italic; margin: 6px 0; }
.gl-rail-insight { color: #64748b; font-size: 0.8rem; font-style: italic; margin-top: 6px; }

/* Micro-check panel (wraps existing _v2RenderMicroCheck output) */
.gl-rail-microcheck .gl-rail-panel-header .material-symbols-outlined { color: #8b5cf6; }
.gl-rail-microcheck [id^="v2-mc-"] { margin-top: 0 !important; }

/* Exam procedure cheat-sheet */
.gl-rail-procedure .gl-rail-panel-header .material-symbols-outlined { color: #6366f1; }
.gl-rail-procedure-list { margin: 0; padding-left: 20px; font-size: 0.85rem; line-height: 1.65; color: #334155; }
.gl-rail-procedure-list li { margin: 4px 0; }

/* Diagram slot polish */
.v2-svg-placeholder .gl-diagram-svg { width: 100%; height: auto; display: block; border-radius: 10px; }
.v2-svg-placeholder { padding: 0 !important; background: #ffffff !important; overflow: hidden; }

/* Formula card in right rail — show reference line */
.gl-formula-ref { font-size: 0.72rem; color: #64748b; margin-top: 4px; font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* Blocked Next button (soft-gate) */
.v2-footer-next--blocked,
#gl-next-btn[data-gl-blocked="1"] {
    opacity: 0.45;
    cursor: not-allowed !important;
    filter: grayscale(0.6);
    pointer-events: auto;
}
.v2-footer-next--blocked:hover,
#gl-next-btn[data-gl-blocked="1"]:hover {
    transform: none !important;
    animation: gl-shake 420ms ease;
}
@keyframes gl-shake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* Dark-theme overrides for rail panels */
[data-theme="dark"] .gl-rail-panel { background: #1e293b; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .gl-rail-panel-header { border-bottom-color: #334155; }
[data-theme="dark"] .gl-rail-panel-title { color: #94a3b8; }
[data-theme="dark"] .gl-rail-badge { background: #334155; color: #cbd5e1; }
[data-theme="dark"] .gl-rail-badge--done { background: rgba(34,197,94,0.16); color: #86efac; }
[data-theme="dark"] .gl-rail-drill-searchprompt { background: rgba(59,130,246,0.1); border-color: #1e3a5f; }
[data-theme="dark"] .gl-rail-drill-term { background: #0f172a; color: #93c5fd; border-color: #1e3a5f; }
[data-theme="dark"] .gl-rail-drill-intro { color: #94a3b8; }
[data-theme="dark"] .gl-rail-hb-stage { border-top-color: #334155; }
[data-theme="dark"] .gl-rail-hb-stage-label { color: #cbd5e1; }
[data-theme="dark"] .gl-rail-hb-label-txt, [data-theme="dark"] .gl-rail-hb-sigil { color: #94a3b8; }
[data-theme="dark"] .gl-rail-hb-input { background: #0f172a; color: #e2e8f0; border-color: #334155; }
[data-theme="dark"] .gl-rail-hb-input:disabled { background: #1e293b; color: #64748b; }
[data-theme="dark"] .gl-rail-hb-idk { background: #1e293b; color: #cbd5e1; border-color: #475569; }
[data-theme="dark"] .gl-rail-hb-idk:hover { background: #334155; color: #e2e8f0; }
[data-theme="dark"] .gl-rail-hb-idk-panel { background: #0f172a; border-color: #334155; color: #cbd5e1; }
[data-theme="dark"] .gl-rail-hb-idk-title { color: #e2e8f0; }
[data-theme="dark"] .gl-rail-hb-idk-row--yes { color: #86efac; }
[data-theme="dark"] .gl-rail-hb-idk-row--no { color: #fca5a5; }
[data-theme="dark"] .gl-rail-hb-idk-sep { border-top-color: #334155; color: #fca5a5; }
[data-theme="dark"] .gl-rail-drill-what--yes { background: rgba(16,185,129,0.08); color: #86efac; }
[data-theme="dark"] .gl-rail-drill-what--no { background: rgba(239,68,68,0.08); color: #fca5a5; }
[data-theme="dark"] .gl-rail-choice { background: rgba(139,92,246,0.08); border-color: #4c1d95; color: #e2e8f0; }
[data-theme="dark"] .gl-rail-choice:hover { background: rgba(139,92,246,0.18); }
[data-theme="dark"] .gl-rail-reveal { background: #0f172a; color: #e2e8f0; }
[data-theme="dark"] .gl-rail-tracker-bar { background: #0f172a; }
[data-theme="dark"] .gl-rail-tracker-item { color: #94a3b8; }
[data-theme="dark"] .gl-rail-tracker-item--done { color: #86efac; }
[data-theme="dark"] .v2-svg-placeholder { background: #0f172a !important; }
[data-theme="dark"] .gl-rail-procedure-list { color: #cbd5e1; }

/* ═════════════════════════════════════════════════════════════════════
   PHASE 8 — "Field Manual" aesthetic + horizontal grids + independent scroll
   Inspired by the AASHTO Green Book × a senior PE's site-trailer notebook.
   Drafting-vellum paper, graphite ink, blueprint-blue references, redline
   warnings, survey-green confirmations. Serif display (Fraunces), Inter
   Tight body, JetBrains Mono for formulas. Draftsman "detail bubble"
   badges. Drawing-grid underlay at 3% on the editorial canvas.
   ═════════════════════════════════════════════════════════════════════ */

:root {
    /* Field Manual palette */
    --fm-paper:       #F5EFE1;
    --fm-paper-grain: #EDE3CB;
    --fm-paper-2:     #FAF6EC;
    --fm-ink:         #1A1D1F;
    --fm-ink-2:       #4A5158;
    --fm-ink-3:       #7C848C;
    --fm-rule:        #C9BFA8;
    --fm-rule-soft:   #E4DBC4;
    --fm-redline:     #B42D1F;
    --fm-redline-tint:#FBECE9;
    --fm-blueprint:   #1E4E6B;
    --fm-blueprint-tint:#E6F0F6;
    --fm-survey:      #4F6B3A;
    --fm-survey-tint: #EEF3E5;
    --fm-ochre:       #B8822A;
    --fm-ochre-tint:  #F9F0DB;
    --fm-graphite:    #2C3338;

    /* Layout heights used by independent scroll */
    --v2-header-h: 120px;
    --v2-footer-h: 88px;
}

/* Phase-card accents (desaturated 20% from prior saturated palette) */
:root {
    --fm-phase-orient:   #4A5973;
    --fm-phase-setup:    #1E4E6B;
    --fm-phase-execute:  #4F6B3A;
    --fm-phase-confirm:  #3F7280;
    --fm-phase-learn:    #B8822A;
    --fm-phase-triage:   #B42D1F;
}

/* ── 1. Editorial canvas — graph-paper background ───────────────── */
.v2-editorial-card.v2-editorial-card,
.v2-editorial-card .gl-editorial-v2 {
    background:
        linear-gradient(var(--fm-paper), var(--fm-paper)),
        radial-gradient(circle, rgba(44, 51, 56, 0.28) 0.5px, transparent 0.6px) 0 0 / 12px 12px,
        radial-gradient(circle, rgba(44, 51, 56, 0.55) 0.8px, transparent 1px) 0 0 / 60px 60px;
    background-blend-mode: normal, multiply, multiply;
    color: var(--fm-ink);
}

.gl-editorial-v2 {
    font-family: 'Inter Tight', 'Inter', 'DM Sans', system-ui, sans-serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--fm-ink);
    letter-spacing: -0.005em;
}

.gl-editorial-v2 h1,
.gl-editorial-v2 h2,
.gl-editorial-v2 h3,
.gl-step-title {
    font-family: 'Fraunces', 'Source Serif 4', Georgia, serif;
    font-weight: 600;
    font-variation-settings: "opsz" 144, "SOFT" 50;
    letter-spacing: -0.015em;
    color: var(--fm-ink);
}
.gl-step-title { font-size: 1.85rem; line-height: 1.2; }

.gl-editorial-v2 p { color: var(--fm-ink); line-height: 1.75; }
.gl-editorial-v2 strong { color: var(--fm-ink); font-weight: 600; }

/* Step header badge \u2014 serif-spaced signage */
.gl-step-header .gl-step-type-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fm-blueprint);
    background: var(--fm-blueprint-tint);
    border: 1px solid var(--fm-blueprint);
    border-radius: 2px;
    padding: 3px 10px;
    font-weight: 600;
}

/* ── 2. Formula cards \u2014 blueprint left rule + \u00a7 reference stamp ─── */
.gl-editorial-v2 .gl-formula-card,
.gl-rail-panel .gl-formula-card {
    background: var(--fm-paper-2);
    border: 1px solid var(--fm-rule);
    border-left: 3px solid var(--fm-blueprint);
    border-radius: 3px;
    padding: 18px 20px 14px 22px;
    position: relative;
    font-family: 'Fraunces', Georgia, serif;
    margin: 12px 0;
}
.gl-editorial-v2 .gl-formula-card .gl-formula-name,
.gl-rail-panel .gl-formula-card .gl-formula-name {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    font-size: 0.98rem;
    color: var(--fm-ink);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}
.gl-editorial-v2 .gl-formula-card .gl-formula-eq,
.gl-rail-panel .gl-formula-card .gl-formula-eq {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    padding: 10px 0 8px;
    border-top: 1px dashed var(--fm-rule);
    border-bottom: 1px dashed var(--fm-rule);
    margin: 8px 0 6px;
    color: var(--fm-ink);
}
.gl-formula-ref {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--fm-blueprint);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 4px;
}

/* ── 3. Six-phase solution cards \u2014 drafting detail bubbles ──────── */
.gl-solution-phase {
    background: var(--fm-paper-2) !important;
    border: 1px solid var(--fm-rule) !important;
    border-radius: 4px !important;
    padding: 14px 18px !important;
    margin: 12px 0 !important;
    position: relative;
    font-family: 'Inter Tight', system-ui, sans-serif;
}
.gl-solution-phase > div:first-child {
    border-bottom: 1px solid var(--fm-rule) !important;
    padding-bottom: 8px !important;
    margin-bottom: 10px !important;
}
.gl-solution-phase > div:first-child > span:first-child {
    /* Phase number badge \u2014 detail bubble (circle with tick) */
    width: 30px !important;
    height: 30px !important;
    border-radius: 50% !important;
    background: var(--fm-paper) !important;
    color: var(--fm-ink) !important;
    border: 1.5px solid currentColor !important;
    font-family: 'Fraunces', serif !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    position: relative;
    box-shadow: inset 0 0 0 3px var(--fm-paper);
}
.gl-solution-phase > div:first-child > span:first-child::after {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    width: 6px;
    height: 1.5px;
    background: currentColor;
}
.gl-solution-phase > div:first-child > span:nth-child(3) {
    font-family: 'JetBrains Mono', monospace !important;
    letter-spacing: 0.14em !important;
    font-size: 0.74rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
}
/* Phase-specific accent recolor (overrides inline colors on badge border + header text) */
.gl-solution-phase:nth-of-type(1) > div:first-child > span:first-child,
.gl-solution-phase:nth-of-type(1) > div:first-child > span:nth-child(3),
.gl-solution-phase:nth-of-type(1) > div:first-child > span:nth-child(2) { color: var(--fm-phase-orient) !important; }
.gl-solution-phase:nth-of-type(2) > div:first-child > span { color: var(--fm-phase-setup) !important; }
.gl-solution-phase:nth-of-type(3) > div:first-child > span { color: var(--fm-phase-execute) !important; }
.gl-solution-phase:nth-of-type(4) > div:first-child > span { color: var(--fm-phase-confirm) !important; }
.gl-solution-phase:nth-of-type(5) > div:first-child > span { color: var(--fm-phase-learn) !important; }
.gl-solution-phase:nth-of-type(6) > div:first-child > span { color: var(--fm-phase-triage) !important; }

/* ── 4. PHASE 8 horizontal grids ─────────────────────────────────── */
.gl-pair-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 12px 0;
    align-items: start;
}
.gl-pair-grid > * { margin-top: 0 !important; margin-bottom: 0 !important; }

.gl-traps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 12px;
    margin: 14px 0;
    align-items: start;
}
.gl-traps-grid > * { margin-top: 0 !important; }

.gl-trap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px;
    margin-top: 10px;
    align-items: start;
}
/* Phase 10.9: grid items default to min-content sizing, so a long inline
   equation (e.g. "L = AS²/(400+3.5S) = 7·645²/(400+3.5·645) = 2,912,175/2,657.5")
   refuses to shrink and bleeds into the next column. `min-width: 0` lets
   the grid cell shrink below content, and `overflow: hidden` confines the
   card to its allocated column. The inner MathJax container gets a
   horizontal-scroll fallback so long typeset math is still readable. */
.gl-trap-grid > * {
    margin: 0 !important;
    min-width: 0;
    overflow: hidden;
}
.gl-trap-grid .gl-trap-card,
.gl-trap-grid > div {
    overflow-wrap: break-word;
    word-break: break-word;
}
.gl-trap-grid mjx-container {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}
.gl-trap-grid mjx-container::-webkit-scrollbar { height: 4px; }
.gl-trap-grid mjx-container::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.gl-trap-grid mjx-container::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 2px; }

.gl-triage-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 4px 0;
    align-items: start;
}
.gl-triage-grid > .gl-triage-cell {
    background: var(--fm-paper-2);
    border: 1px solid var(--fm-rule);
    border-top: 3px solid var(--fm-phase-triage);
    border-radius: 3px;
    padding: 10px 12px;
    font-size: 0.88rem;
    line-height: 1.6;
}
.gl-triage-cell-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fm-phase-triage);
    font-weight: 700;
    margin-bottom: 6px;
}

.gl-concept-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 14px;
    margin: 10px 0;
    align-items: start;
}

/* Pair-grid collapse + mobile rail collapse */
@media (max-width: 900px) {
    .gl-pair-grid,
    .gl-traps-grid,
    .gl-trap-grid,
    .gl-triage-grid,
    .gl-concept-grid { grid-template-columns: 1fr; }
}

/* ── 5. Independent column scroll ────────────────────────────────── */
@media (min-width: 1025px) {
    .v2-lecture-body-inner {
        height: calc(100vh - var(--v2-header-h) - var(--v2-footer-h));
        min-height: 560px;
        align-items: stretch;
    }
    .v2-editorial-card,
    .v2-right-col {
        overflow-y: auto;
        max-height: 100%;
        overscroll-behavior: contain;
        scrollbar-gutter: stable;
    }
    /* Phase 10.9: breathing room at the bottom of each scrollable column so
       the final panel has clearance from the footer border — previous layout
       had the last rail panel flush against the footer, which visually
       truncated its final line even though the scroll itself was at the end. */
    .v2-editorial-card { padding-bottom: 2rem; }
    .v2-right-col { padding-bottom: 2rem; }
    .v2-right-col {
        position: static !important; /* un-pin any prior sticky */
    }
    /* Soft scrollbar */
    .v2-editorial-card::-webkit-scrollbar,
    .v2-right-col::-webkit-scrollbar { width: 8px; }
    .v2-editorial-card::-webkit-scrollbar-thumb,
    .v2-right-col::-webkit-scrollbar-thumb {
        background: var(--fm-rule);
        border-radius: 4px;
    }
    .v2-editorial-card::-webkit-scrollbar-thumb:hover,
    .v2-right-col::-webkit-scrollbar-thumb:hover { background: var(--fm-ink-3); }
}

/* ── 6. Right-rail panels \u2014 Field Manual reskin ──────────────────── */
.gl-rail-panel {
    background: var(--fm-paper-2);
    border: 1px solid var(--fm-rule);
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(26, 29, 31, 0.04);
    font-family: 'Inter Tight', system-ui, sans-serif;
    color: var(--fm-ink);
}
.gl-rail-panel-header {
    border-bottom: 1px solid var(--fm-rule);
}
.gl-rail-panel-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    color: var(--fm-ink-2);
}
.gl-rail-tracker .gl-rail-panel-header .material-symbols-outlined { color: var(--fm-phase-setup); }
.gl-rail-tracker-count { color: var(--fm-phase-setup); font-family: 'JetBrains Mono', monospace; }
.gl-rail-tracker-bar { background: var(--fm-rule-soft); }
.gl-rail-tracker-fill { background: linear-gradient(90deg, var(--fm-phase-setup), var(--fm-survey)); }
.gl-rail-tracker-item--done { color: var(--fm-survey); }
.gl-rail-tracker-item--done .material-symbols-outlined { color: var(--fm-survey); }

.gl-rail-handbook .gl-rail-panel-header .material-symbols-outlined { color: var(--fm-blueprint); }
.gl-rail-drill-searchprompt {
    background: var(--fm-blueprint-tint);
    border: 1px solid var(--fm-blueprint);
    border-radius: 3px;
}
.gl-rail-drill-label { color: var(--fm-blueprint); font-family: 'JetBrains Mono', monospace; letter-spacing: 0.14em; }
.gl-rail-drill-term {
    font-family: 'JetBrains Mono', monospace !important;
    background: var(--fm-paper) !important;
    border: 1px dashed var(--fm-blueprint) !important;
    color: var(--fm-blueprint) !important;
}
.gl-rail-drill-what--yes { background: var(--fm-survey-tint); border-left-color: var(--fm-survey); color: var(--fm-ink); }
.gl-rail-drill-what--no  { background: var(--fm-redline-tint); border-left-color: var(--fm-redline); color: var(--fm-ink); }
.gl-rail-drill-notinhandbook { background: var(--fm-ochre-tint); border-color: var(--fm-ochre); color: var(--fm-ink); }

.gl-rail-hb-input {
    font-family: 'JetBrains Mono', monospace;
    background: var(--fm-paper);
    border-color: var(--fm-rule);
    color: var(--fm-ink);
}
.gl-rail-hb-input:focus { border-color: var(--fm-blueprint); box-shadow: 0 0 0 3px rgba(30, 78, 107, 0.12); }
.gl-rail-hb-idk { background: var(--fm-paper); border-color: var(--fm-rule); color: var(--fm-ink-2); }
.gl-rail-hb-idk-panel { background: var(--fm-paper); border-color: var(--fm-rule); }
.gl-rail-hb-idk-row--yes { color: var(--fm-survey); }
.gl-rail-hb-idk-row--no  { color: var(--fm-redline); }

.gl-rail-intuition .gl-rail-panel-header .material-symbols-outlined { color: var(--fm-phase-learn); }
.gl-rail-choice {
    background: var(--fm-paper-2);
    border-color: var(--fm-rule);
    color: var(--fm-ink);
    font-family: 'Inter Tight', sans-serif;
}
.gl-rail-choice:hover { background: var(--fm-ochre-tint); border-color: var(--fm-ochre); }
.gl-rail-choice-letter { color: var(--fm-phase-learn); font-family: 'Fraunces', serif; font-weight: 700; }
.gl-rail-choice--correct { background: var(--fm-survey-tint) !important; border-color: var(--fm-survey) !important; color: var(--fm-ink) !important; }
.gl-rail-choice--wrong   { background: var(--fm-redline-tint) !important; border-color: var(--fm-redline) !important; color: var(--fm-ink) !important; }

.gl-rail-microcheck .gl-rail-panel-header .material-symbols-outlined { color: var(--fm-phase-confirm); }
.gl-rail-procedure .gl-rail-panel-header .material-symbols-outlined { color: var(--fm-phase-setup); }
.gl-rail-procedure-list { font-family: 'Inter Tight', sans-serif; color: var(--fm-ink-2); }

/* Dark Key Formulas card in companion \u2014 keep dark, retint to graphite */
.gl-comp-keyformulas { background: var(--fm-graphite); border-color: var(--fm-graphite); }
.gl-comp-keyformulas .gl-comp-card-header h4 { color: #CBD5CF; font-family: 'JetBrains Mono', monospace; }
.gl-comp-formula-ref { font-family: 'JetBrains Mono', monospace; color: #A3BFC8; background: rgba(163, 191, 200, 0.08); }
.gl-comp-formula-ref:hover { background: rgba(163, 191, 200, 0.18); }

/* Legacy companion card restyles */
.gl-comp-card { background: var(--fm-paper-2); border-color: var(--fm-rule); color: var(--fm-ink); }
.gl-comp-examtips { background: var(--fm-ochre-tint); border-color: var(--fm-ochre); }
.gl-comp-examtips .gl-comp-card-header h4 { color: var(--fm-ochre); }
.gl-comp-examtips li { color: var(--fm-ink); }
.gl-comp-handbook { background: var(--fm-blueprint-tint); border-color: var(--fm-blueprint); }
.gl-comp-handbook .gl-comp-card-header h4 { color: var(--fm-blueprint); }
.gl-comp-hb-pill { background: var(--fm-paper); border: 1px dashed var(--fm-blueprint); }
.gl-comp-hb-section { color: var(--fm-blueprint); }

/* ── Inline formula blocks in left editorial column ─────────────── */
.gl-v2-formula-block {
    margin: 14px 0;
    padding: 16px 20px 14px 24px;
    background: var(--fm-paper-2);
    border: 1px solid var(--fm-rule);
    border-left: 3px solid var(--fm-blueprint);
    border-radius: 3px;
    font-family: 'Inter Tight', system-ui, sans-serif;
    color: var(--fm-ink);
    position: relative;
}
.gl-v2-formula-block::before {
    /* Drafting tick on top-left */
    content: '';
    position: absolute;
    left: -7px; top: 14px;
    width: 8px; height: 1.5px;
    background: var(--fm-blueprint);
}
.gl-v2-formula-label {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    font-variation-settings: "opsz" 36, "SOFT" 50;
    font-size: 0.95rem;
    color: var(--fm-blueprint);
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}
.gl-v2-formula-eq {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.18rem;
    font-weight: 500;
    text-align: center;
    padding: 14px 0 12px;
    color: var(--fm-ink);
    border-top: 1px dashed var(--fm-rule);
    border-bottom: 1px dashed var(--fm-rule);
    margin: 8px 0;
    letter-spacing: 0;
}
.gl-v2-formula-vars { margin-top: 10px; font-size: 0.85rem; }
.gl-v2-formula-vars-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fm-ink-3);
    margin-bottom: 6px;
    font-weight: 600;
}
.gl-v2-formula-var {
    display: flex;
    gap: 10px;
    padding: 4px 0;
    align-items: baseline;
    border-bottom: 1px dotted var(--fm-rule-soft);
}
.gl-v2-formula-var:last-child { border-bottom: none; }
.gl-v2-formula-var-sym {
    font-family: 'Fraunces', serif;
    font-weight: 700;
    font-style: italic;
    min-width: 30px;
    color: var(--fm-ink);
    font-size: 1rem;
}
.gl-v2-formula-var-def { color: var(--fm-ink-2); flex: 1; }
.gl-v2-formula-var-unit {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--fm-ink-3);
    white-space: nowrap;
}
.gl-v2-formula-vars-string { margin-top: 10px; font-size: 0.88rem; color: var(--fm-ink-2); }
.gl-v2-formula-derivation { margin-top: 12px; font-size: 0.84rem; color: var(--fm-ink-2); }
.gl-v2-formula-derivation summary {
    cursor: pointer;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fm-blueprint);
}
.gl-v2-formula-derivation p { margin: 8px 0 0; line-height: 1.65; }

/* ── Unified Exam-Trap card (Phase 8) ───────────────────────────── */
/* One card per trap. Title + mentor-voice narrative. No more 3-block split. */
.gl-v2-trap-card {
    margin: 14px 0;
    background: var(--fm-paper-2);
    border: 1px solid var(--fm-rule);
    border-left: 4px solid var(--fm-redline);
    border-radius: 4px;
    padding: 0;
    color: var(--fm-ink);
    overflow: hidden;
    contain: layout style;
}
.gl-v2-trap-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 12px 18px 10px;
    border-bottom: 1px dashed var(--fm-rule);
    background: var(--fm-redline-tint);
    flex-wrap: wrap;
}
.gl-v2-trap-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--fm-redline);
    font-weight: 700;
    padding: 3px 8px;
    border: 1px solid var(--fm-redline);
    border-radius: 2px;
    flex-shrink: 0;
}
.gl-v2-trap-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.02rem;
    font-weight: 600;
    font-variation-settings: "opsz" 36, "SOFT" 50;
    letter-spacing: -0.01em;
    color: var(--fm-ink);
    margin: 0;
    flex: 1;
    min-width: 0;
    line-height: 1.35;
}
.gl-v2-trap-errortag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    color: var(--fm-ink-3);
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.gl-v2-trap-body {
    padding: 14px 18px 16px;
}
.gl-v2-trap-vector {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 12px;
    align-items: start;
}
.gl-v2-trap-voice-icon {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 2px;
}
.gl-v2-trap-voice-icon .material-symbols-outlined {
    font-size: 22px;
    color: var(--fm-phase-learn);
    opacity: 0.85;
}
.gl-v2-trap-speech {
    font-family: 'Inter Tight', system-ui, sans-serif;
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--fm-ink);
}
.gl-v2-trap-lead {
    font-style: italic;
    font-family: 'Fraunces', Georgia, serif;
    font-variation-settings: "opsz" 48, "SOFT" 80;
    font-size: 1.02rem;
    color: var(--fm-ink-2);
    margin: 0 0 10px;
    padding-left: 10px;
    border-left: 2px solid var(--fm-ochre);
}
.gl-v2-trap-mechanism {
    margin: 0 0 10px;
    color: var(--fm-ink);
}
.gl-v2-trap-result {
    display: inline;
    padding: 2px 0;
    background: linear-gradient(transparent 65%, var(--fm-redline-tint) 65%);
    color: var(--fm-ink);
    font-weight: 500;
}
.gl-v2-trap-result strong {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--fm-redline);
    font-weight: 700;
    margin-right: 4px;
}
.gl-v2-trap-fix {
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--fm-survey-tint);
    border-left: 3px solid var(--fm-survey);
    border-radius: 2px;
}
.gl-v2-trap-fix-label {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fm-survey);
    font-weight: 700;
    margin-bottom: 4px;
}
.gl-v2-trap-fix-text {
    display: block;
    color: var(--fm-ink);
    font-size: 0.9rem;
    line-height: 1.65;
}

/* Pair-grid: non-formula children span both columns (handled in JS but also CSS-safe) */
.gl-pair-grid > * { contain: layout style; }

/* Dark mode for trap card */
[data-theme="dark"] .gl-v2-trap-card { border-color: var(--fm-rule); }
[data-theme="dark"] .gl-v2-trap-header { background: var(--fm-redline-tint); }
[data-theme="dark"] .gl-v2-trap-lead { color: var(--fm-ink-2); }
[data-theme="dark"] .gl-v2-trap-result { background: linear-gradient(transparent 65%, var(--fm-redline-tint) 65%); }
[data-theme="dark"] .gl-v2-trap-fix { background: var(--fm-survey-tint); }

/* ── Vector's Playbook (Phase 9) ─────────────────────────────────── */
.gl-v2-playbook {
    margin: 18px 0;
    padding: 0;
    background: var(--fm-paper-2);
    border: 1px solid var(--fm-rule);
    border-left: 4px solid var(--fm-redline);
    border-radius: 4px;
    overflow: hidden;
    color: var(--fm-ink);
}
.gl-v2-playbook-header {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 12px 20px 10px;
    background: var(--fm-redline-tint);
    border-bottom: 1px dashed var(--fm-rule);
    flex-wrap: wrap;
}
.gl-v2-playbook-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--fm-redline);
    font-weight: 700;
}
.gl-v2-playbook-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.08rem;
    font-weight: 600;
    font-variation-settings: "opsz" 144, "SOFT" 50;
    color: var(--fm-ink);
    margin: 0;
    font-style: italic;
    letter-spacing: -0.015em;
}
.gl-v2-playbook-body { padding: 14px 20px 14px; font-family: 'Inter Tight', system-ui, sans-serif; }
.gl-v2-playbook-lead {
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 1.02rem;
    line-height: 1.65;
    color: var(--fm-ink-2);
    margin: 0 0 12px;
    padding-left: 12px;
    border-left: 2px solid var(--fm-redline);
}
.gl-v2-playbook-trigger {
    margin: 10px 0;
    padding: 8px 12px;
    background: var(--fm-paper);
    border: 1px dashed var(--fm-rule);
    border-radius: 3px;
    display: flex;
    gap: 10px;
    align-items: baseline;
    flex-wrap: wrap;
}
.gl-v2-playbook-triglabel {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fm-redline);
    font-weight: 700;
    flex-shrink: 0;
}
.gl-v2-playbook-trigtext { color: var(--fm-ink); font-size: 0.92rem; line-height: 1.6; }
.gl-v2-playbook-steps {
    margin: 10px 0;
    padding-left: 26px;
    font-size: 0.93rem;
    line-height: 1.75;
    color: var(--fm-ink);
}
.gl-v2-playbook-steps li {
    margin: 6px 0;
    padding-left: 4px;
}
.gl-v2-playbook-steps li::marker {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 700;
    color: var(--fm-redline);
}
.gl-v2-playbook-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}
@media (max-width: 900px) { .gl-v2-playbook-pair { grid-template-columns: 1fr; } }
.gl-v2-playbook-mini {
    padding: 10px 12px;
    border-radius: 3px;
    background: var(--fm-paper);
    border: 1px solid var(--fm-rule);
    border-top: 3px solid;
    font-size: 0.88rem;
    line-height: 1.6;
}
.gl-v2-playbook-mini--rule { border-top-color: var(--fm-survey); }
.gl-v2-playbook-mini--shortcut { border-top-color: var(--fm-ochre); }
.gl-v2-playbook-mini-label {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.66rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 4px;
}
.gl-v2-playbook-mini--rule .gl-v2-playbook-mini-label { color: var(--fm-survey); }
.gl-v2-playbook-mini--shortcut .gl-v2-playbook-mini-label { color: var(--fm-ochre); }
.gl-v2-playbook-mini-text { color: var(--fm-ink); display: block; }
.gl-v2-playbook-signoff {
    margin-top: 14px;
    text-align: right;
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 0.88rem;
    color: var(--fm-ink-3);
    font-weight: 500;
}

/* ══════════════════════════════════════════════════════════════════════
   Phase 10 — Vector's Playbook as Teaching Centerpiece (7-section layout)
   ══════════════════════════════════════════════════════════════════════ */

.gl-v2-playbook-opening {
    margin: 4px 0 18px;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--fm-rule);
}
.gl-v2-playbook-opening .gl-v2-playbook-lead {
    margin: 0;
    padding-left: 14px;
    border-left: 3px solid var(--fm-redline);
    font-size: 1.04rem;
}

.gl-v2-playbook-section {
    margin: 22px 0 0;
    padding: 16px 16px 18px;
    background: var(--fm-paper);
    border: 1px solid var(--fm-rule);
    border-left: 3px solid var(--fm-rule);
    border-radius: 3px;
    position: relative;
}
.gl-v2-playbook-section + .gl-v2-playbook-section { margin-top: 18px; }

.gl-v2-playbook-section--recognize { border-left-color: var(--fm-blueprint); }
.gl-v2-playbook-section--insight    { border-left-color: var(--fm-ochre);     background: var(--fm-ochre-tint); }
.gl-v2-playbook-section--approach   { border-left-color: var(--fm-redline);   }
.gl-v2-playbook-section--procedure  { border-left-color: var(--fm-survey);    }
.gl-v2-playbook-section--traps      { border-left-color: var(--fm-redline);   background: var(--fm-redline-tint); }
.gl-v2-playbook-section--shortcut   { border-left-color: var(--fm-ochre);     }
.gl-v2-playbook-section--handbook   { border-left-color: var(--fm-blueprint); background: var(--fm-blueprint-tint, #eef4f8); }

.gl-v2-playbook-section-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px dotted var(--fm-rule);
}
.gl-v2-playbook-section-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    font-weight: 700;
    color: var(--fm-ink-3);
    background: var(--fm-paper-2);
    padding: 2px 8px;
    border: 1px solid var(--fm-rule);
    border-radius: 2px;
    flex-shrink: 0;
}
.gl-v2-playbook-section-title {
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 1.04rem;
    font-weight: 600;
    color: var(--fm-ink);
    letter-spacing: -0.01em;
}

.gl-v2-playbook-section-lead {
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 0.98rem;
    line-height: 1.7;
    color: var(--fm-ink-2);
    margin: 0 0 12px;
}

/* §1 Recognize lists */
.gl-v2-playbook-list-group {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px 16px;
    align-items: baseline;
    margin: 8px 0;
    padding: 6px 0;
}
@media (max-width: 720px) {
    .gl-v2-playbook-list-group { grid-template-columns: 1fr; gap: 4px; }
}
.gl-v2-playbook-list-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--fm-blueprint);
}
.gl-v2-playbook-list {
    margin: 0;
    padding-left: 18px;
    list-style: square;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--fm-ink);
}
.gl-v2-playbook-list li { margin: 2px 0; }
.gl-v2-playbook-list li::marker { color: var(--fm-blueprint); }

/* Inline handbook tip (survey-green) */
.gl-v2-playbook-handbook-tip {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 14px;
    padding: 10px 14px;
    background: var(--fm-survey-tint);
    border-left: 3px solid var(--fm-survey);
    border-radius: 3px;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--fm-ink);
}
.gl-v2-playbook-handbook-tip-icon { font-size: 1.1em; flex-shrink: 0; }
.gl-v2-playbook-handbook-tip-text em { color: var(--fm-survey); font-style: italic; font-weight: 500; }

/* §2 Key insight — pullquote + why */
.gl-v2-playbook-pullquote {
    margin: 8px 0 14px;
    padding: 14px 16px 14px 20px;
    border: 1px solid var(--fm-ochre);
    border-left: 4px solid var(--fm-ochre);
    background: var(--fm-paper);
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--fm-ink);
    letter-spacing: -0.005em;
    border-radius: 3px;
}
.gl-v2-playbook-insight-why {
    margin: 0;
    font-size: 0.96rem;
    line-height: 1.7;
    color: var(--fm-ink-2);
}

/* §3 + §4 steps with Vector voice annotation */
.gl-v2-playbook-steps {
    list-style: decimal;
    margin: 8px 0 0;
    padding-left: 24px;
}
.gl-v2-playbook-step {
    margin: 10px 0;
    padding-left: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.gl-v2-playbook-steps li::marker {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 700;
    color: var(--fm-ink-3);
}
.gl-v2-playbook-step-body {
    font-size: 0.96rem;
    line-height: 1.65;
    color: var(--fm-ink);
}
.gl-v2-playbook-step-voice {
    display: block;
    margin: 2px 0 0 6px;
    padding: 4px 10px 4px 14px;
    border-left: 2px solid var(--fm-redline);
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--fm-ink-2);
}

/* §3 Quick rule card */
.gl-v2-playbook-quick-rule {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px 16px;
    align-items: baseline;
    margin: 14px 0 4px;
    padding: 10px 14px;
    background: var(--fm-survey-tint);
    border: 1px solid var(--fm-survey);
    border-radius: 3px;
}
@media (max-width: 720px) {
    .gl-v2-playbook-quick-rule { grid-template-columns: 1fr; gap: 4px; }
}
.gl-v2-playbook-quick-rule-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.66rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--fm-survey);
}
.gl-v2-playbook-quick-rule-text {
    font-size: 0.94rem;
    line-height: 1.55;
    color: var(--fm-ink);
}

/* §3 Risk callout */
.gl-v2-playbook-risk {
    margin: 16px 0 0;
    padding: 0;
    background: var(--fm-redline-tint);
    border: 1px solid var(--fm-redline);
    border-left: 4px solid var(--fm-redline);
    border-radius: 3px;
    overflow: hidden;
}
.gl-v2-playbook-risk-header {
    display: flex;
    gap: 10px;
    align-items: baseline;
    padding: 8px 14px;
    border-bottom: 1px dashed var(--fm-redline);
    background: var(--fm-paper);
}
.gl-v2-playbook-risk-icon { color: var(--fm-redline); font-weight: 700; }
.gl-v2-playbook-risk-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--fm-redline);
}
.gl-v2-playbook-risk-body {
    padding: 12px 14px;
    font-size: 0.94rem;
    line-height: 1.7;
    color: var(--fm-ink);
}
.gl-v2-playbook-risk-body p { margin: 0 0 10px; }
.gl-v2-playbook-risk-body p:last-child { margin-bottom: 0; }

/* §5 Traps — reuse .gl-v2-trap-card; bridges between */
.gl-v2-playbook-trap-bridge {
    margin: 14px 0 8px;
    padding-left: 14px;
    border-left: 2px dotted var(--fm-ink-3);
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 0.94rem;
    line-height: 1.6;
    color: var(--fm-ink-2);
}
.gl-v2-playbook-section--traps .gl-v2-trap-card { margin: 10px 0; }

/* §6 Shortcut */
.gl-v2-playbook-shortcut {
    padding: 12px 14px;
    background: var(--fm-paper);
    border: 1px solid var(--fm-ochre);
    border-left: 4px solid var(--fm-ochre);
    border-radius: 3px;
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--fm-ink);
}
.gl-v2-playbook-shortcut p { margin: 0 0 8px; }
.gl-v2-playbook-shortcut p:last-child { margin-bottom: 0; }

/* §7 Handbook reference card */
.gl-v2-playbook-handbook-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 14px;
    background: var(--fm-paper);
    border: 1px solid var(--fm-blueprint);
    border-radius: 3px;
}
.gl-v2-playbook-handbook-row {
    display: grid;
    grid-template-columns: 24px minmax(120px, auto) 1fr;
    gap: 8px 12px;
    align-items: baseline;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--fm-ink);
    padding: 4px 0;
    border-bottom: 1px dotted var(--fm-rule);
}
.gl-v2-playbook-handbook-row:last-child { border-bottom: 0; }
.gl-v2-playbook-handbook-row--book { grid-template-columns: 24px 1fr; }
.gl-v2-playbook-handbook-row--book .gl-v2-playbook-handbook-text {
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 1rem;
    color: var(--fm-blueprint);
    font-weight: 500;
}
.gl-v2-playbook-handbook-icon { font-size: 1.05em; flex-shrink: 0; }
.gl-v2-playbook-handbook-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.64rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--fm-ink-3);
}
.gl-v2-playbook-handbook-row--use .gl-v2-playbook-handbook-label { color: var(--fm-survey); }
.gl-v2-playbook-handbook-row--avoid .gl-v2-playbook-handbook-label { color: var(--fm-ochre); }
.gl-v2-playbook-handbook-row--dont .gl-v2-playbook-handbook-label { color: var(--fm-redline); }
.gl-v2-playbook-handbook-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.86rem;
    color: var(--fm-ink);
}

/* Dark-theme overrides for every new Phase 10 class above. */
[data-theme="dark"] .gl-v2-playbook-section { background: #1A1E22; border-color: #2B3036; }
[data-theme="dark"] .gl-v2-playbook-section--insight { background: #2A241A; }
[data-theme="dark"] .gl-v2-playbook-section--traps { background: #2A1E1C; }
[data-theme="dark"] .gl-v2-playbook-section--handbook { background: #1B2327; }
[data-theme="dark"] .gl-v2-playbook-section-num { background: #242932; color: #CFCFCF; }
[data-theme="dark"] .gl-v2-playbook-section-title { color: #F1EEE6; }
[data-theme="dark"] .gl-v2-playbook-section-lead { color: #C5C1B6; }
[data-theme="dark"] .gl-v2-playbook-list-label { color: #85B9D9; }
[data-theme="dark"] .gl-v2-playbook-list { color: #E5E3DB; }
[data-theme="dark"] .gl-v2-playbook-handbook-tip { background: #1F2B1C; border-left-color: #7AA360; color: #DDE3D5; }
[data-theme="dark"] .gl-v2-playbook-pullquote { background: #2A241A; border-color: #D9A451; color: #F1EEE6; }
[data-theme="dark"] .gl-v2-playbook-insight-why { color: #C5C1B6; }
[data-theme="dark"] .gl-v2-playbook-step-body { color: #E5E3DB; }
[data-theme="dark"] .gl-v2-playbook-step-voice { color: #C5C1B6; border-left-color: #D97765; }
[data-theme="dark"] .gl-v2-playbook-quick-rule { background: #1F2B1C; border-color: #7AA360; }
[data-theme="dark"] .gl-v2-playbook-quick-rule-label { color: #9CC884; }
[data-theme="dark"] .gl-v2-playbook-quick-rule-text { color: #E5E3DB; }
[data-theme="dark"] .gl-v2-playbook-risk { background: #2A1E1C; border-color: #D97765; }
[data-theme="dark"] .gl-v2-playbook-risk-header { background: #1F1817; }
[data-theme="dark"] .gl-v2-playbook-risk-label { color: #E89583; }
[data-theme="dark"] .gl-v2-playbook-risk-body { color: #E5E3DB; }
[data-theme="dark"] .gl-v2-playbook-trap-bridge { color: #C5C1B6; border-left-color: #8A837A; }
[data-theme="dark"] .gl-v2-playbook-shortcut { background: #1E1B15; border-color: #D9A451; color: #E5E3DB; }
[data-theme="dark"] .gl-v2-playbook-handbook-card { background: #141921; border-color: #85B9D9; }
[data-theme="dark"] .gl-v2-playbook-handbook-row { border-bottom-color: #2B3036; }
[data-theme="dark"] .gl-v2-playbook-handbook-row--book .gl-v2-playbook-handbook-text { color: #85B9D9; }
[data-theme="dark"] .gl-v2-playbook-handbook-text { color: #DDE3D5; }
[data-theme="dark"] .gl-v2-playbook-handbook-label { color: #A09D93; }

/* ══════════════════════════════════════════════════════════════════════
   Phase 10 — Final Note additions (mentor connective + handbook reminder)
   ══════════════════════════════════════════════════════════════════════ */
.gl-v2-final-note-bridge {
    margin: 14px 0 8px;
    padding-left: 14px;
    border-left: 2px dotted var(--fm-ochre);
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--fm-ink-2);
}
.gl-v2-final-note-memorize-list { list-style: none; padding: 0; margin: 8px 0 0; }
.gl-v2-final-note-memorize-item {
    margin: 10px 0;
    padding: 8px 10px 8px 14px;
    border-left: 2px solid var(--fm-ochre);
    background: var(--fm-paper);
    border-radius: 3px;
}
.gl-v2-final-note-memorize-fact {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--fm-ink);
    font-weight: 600;
}
.gl-v2-final-note-memorize-why {
    display: block;
    margin-top: 4px;
    padding-left: 14px;
    font-family: 'Fraunces', Georgia, serif;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--fm-ink-2);
}
.gl-v2-final-note-memorize-why em { color: var(--fm-ink-2); }
.gl-v2-final-note-handbook {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 16px;
    padding: 10px 14px;
    background: var(--fm-paper);
    border: 1px solid var(--fm-blueprint);
    border-left: 3px solid var(--fm-blueprint);
    border-radius: 3px;
    font-family: 'Fraunces', Georgia, serif;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--fm-ink);
}
.gl-v2-final-note-handbook-icon { font-size: 1.05em; flex-shrink: 0; }
.gl-v2-final-note-handbook-body { display: block; }

[data-theme="dark"] .gl-v2-final-note-bridge { color: #C5C1B6; border-left-color: #D9A451; }
[data-theme="dark"] .gl-v2-final-note-memorize-item { background: #1A1E22; border-left-color: #D9A451; }
[data-theme="dark"] .gl-v2-final-note-memorize-fact { color: #F1EEE6; }
[data-theme="dark"] .gl-v2-final-note-memorize-why { color: #C5C1B6; }
[data-theme="dark"] .gl-v2-final-note-handbook { background: #141921; border-color: #85B9D9; color: #E5E3DB; }

/* ══════════════════════════════════════════════════════════════════════
   Phase 10 — Vector Pill chat-bubble stream + unread dot
   ══════════════════════════════════════════════════════════════════════ */
.vector-companion-messages-section {
    border-bottom: 1px solid var(--fm-rule);
    padding-bottom: 10px;
}
.v2-vector-pill-messages-header {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--fm-ink-3, #7A7468);
    margin: 0 0 6px;
    padding: 0 2px;
}
.v2-vector-pill-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    padding: 4px 2px 2px;
}
.v2-vector-pill-messages::-webkit-scrollbar { width: 6px; }
.v2-vector-pill-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 3px; }
.v2-vector-pill-message-empty {
    margin: 0;
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 0.86rem;
    color: var(--fm-ink-3, #7A7468);
    padding: 6px 2px;
}
.v2-vector-pill-message {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 8px;
    padding: 8px 10px;
    background: var(--fm-paper, #F5EFE1);
    border: 1px solid var(--fm-rule);
    border-left: 3px solid var(--fm-blueprint);
    border-radius: 3px;
}
.v2-vector-pill-message--warning { border-left-color: var(--fm-redline); }
.v2-vector-pill-message--success { border-left-color: var(--fm-survey); }
.v2-vector-pill-message--tip     { border-left-color: var(--fm-ochre); }
.v2-vector-pill-message--idle    { border-left-color: var(--fm-ink-3); }
.v2-vector-pill-message-glyph {
    font-size: 1.05rem;
    color: var(--fm-blueprint);
    line-height: 1;
    padding-top: 2px;
}
.v2-vector-pill-message--warning .v2-vector-pill-message-glyph { color: var(--fm-redline); }
.v2-vector-pill-message--success .v2-vector-pill-message-glyph { color: var(--fm-survey); }
.v2-vector-pill-message--tip     .v2-vector-pill-message-glyph { color: var(--fm-ochre); }
.v2-vector-pill-message-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.v2-vector-pill-message-text {
    margin: 0;
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--fm-ink);
    word-break: break-word;
}
.v2-vector-pill-message-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    color: var(--fm-ink-3, #7A7468);
}
/* Unread indicator on the Vector glyph */
.v2-vector-pill.has-update .v2-vector-pill-glyph {
    position: relative;
}
.v2-vector-pill.has-update .v2-vector-pill-glyph::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--fm-redline);
    box-shadow: 0 0 0 2px var(--fm-paper);
}

[data-theme="dark"] .vector-companion-messages-section { border-bottom-color: #2B3036; }
[data-theme="dark"] .v2-vector-pill-messages-header { color: #A09D93; }
[data-theme="dark"] .v2-vector-pill-message { background: #1A1E22; border-color: #2B3036; }
[data-theme="dark"] .v2-vector-pill-message-text { color: #E5E3DB; }
[data-theme="dark"] .v2-vector-pill-message-time { color: #8A837A; }
[data-theme="dark"] .v2-vector-pill.has-update .v2-vector-pill-glyph::after { box-shadow: 0 0 0 2px #14181C; }

/* ══════════════════════════════════════════════════════════════════════
   Phase 10 — Mentor-voice openers / captions / closes (shared primitives)
   ══════════════════════════════════════════════════════════════════════ */
.gl-fm-vector-opener {
    margin: 0 0 12px;
    padding: 10px 14px 10px 16px;
    border-left: 3px solid var(--fm-blueprint);
    background: var(--fm-paper);
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--fm-ink);
    border-radius: 3px;
}
.gl-fm-visual-caption {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: -8px auto 12px;
    padding: 6px 12px;
    max-width: 640px;
    font-family: 'Fraunces', Georgia, serif;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--fm-ink-2);
    border-left: 2px solid var(--fm-blueprint);
    background: var(--fm-paper);
    border-radius: 0 3px 3px 0;
    text-align: left;
}
.gl-fm-visual-caption-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--fm-blueprint);
    font-style: normal;
}
.gl-fm-visual-caption-text { font-style: italic; }

.gl-fm-vector-close {
    margin: 14px 0 0;
    padding: 8px 12px;
    border-top: 1px dotted var(--fm-rule);
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--fm-ink-2);
}
.gl-fm-vector-close-sig {
    margin-left: 8px;
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 0.86rem;
    color: var(--fm-ink-3);
}

[data-theme="dark"] .gl-fm-vector-opener { background: #1A1E22; color: #E5E3DB; border-left-color: #85B9D9; }
[data-theme="dark"] .gl-fm-visual-caption { background: #1A1E22; color: #C5C1B6; border-left-color: #85B9D9; }
[data-theme="dark"] .gl-fm-visual-caption-label { color: #85B9D9; }
[data-theme="dark"] .gl-fm-vector-close { border-top-color: #2B3036; color: #C5C1B6; }
[data-theme="dark"] .gl-fm-vector-close-sig { color: #8A837A; }

/* ══════════════════════════════════════════════════════════════════════
   Phase 10 — Inline example phase voice + closing reflection
   ══════════════════════════════════════════════════════════════════════ */
.gl-solution-phase-voice {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin: 0 0 10px;
    padding: 6px 10px;
    border-left: 2px solid var(--fm-redline);
    background: var(--fm-paper);
    font-family: 'Fraunces', Georgia, serif;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--fm-ink-2);
    border-radius: 0 3px 3px 0;
}
.gl-solution-phase-voice-glyph {
    color: var(--fm-redline);
    font-size: 1rem;
    line-height: 1;
    padding-top: 1px;
    flex-shrink: 0;
}
.gl-solution-closing-reflection {
    margin: 14px 0 0;
    padding: 12px 14px;
    border-top: 2px solid var(--fm-ochre);
    background: var(--fm-ochre-tint);
    border-radius: 0 0 3px 3px;
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 0.96rem;
    line-height: 1.65;
    color: var(--fm-ink);
    text-align: left;
}
.gl-solution-closing-sig {
    margin-left: 6px;
    font-size: 0.86rem;
    color: var(--fm-ink-3);
}

[data-theme="dark"] .gl-solution-phase-voice { background: #1A1E22; color: #C5C1B6; border-left-color: #D97765; }
[data-theme="dark"] .gl-solution-phase-voice-glyph { color: #D97765; }
[data-theme="dark"] .gl-solution-closing-reflection { background: #2A241A; color: #F1EEE6; border-top-color: #D9A451; }
[data-theme="dark"] .gl-solution-closing-sig { color: #8A837A; }

/* ══════════════════════════════════════════════════════════════════════
   Phase 10 — Right-rail mentor voice hooks
   (intuition reveal voice, handbook coaching, panel mentor header)
   ══════════════════════════════════════════════════════════════════════ */
.gl-rail-reveal-voice {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin: 0 0 10px;
    padding: 8px 10px;
    background: var(--fm-paper);
    border-left: 2px solid var(--fm-blueprint);
    border-radius: 0 3px 3px 0;
    font-family: 'Fraunces', Georgia, serif;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--fm-ink);
}
.gl-rail-reveal-voice-glyph { color: var(--fm-blueprint); font-size: 1rem; line-height: 1; padding-top: 1px; }

.gl-rail-hb-coaching {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin: 10px 0;
    padding: 10px 12px;
    background: var(--fm-redline-tint);
    border-left: 3px solid var(--fm-redline);
    border-radius: 3px;
    font-family: 'Fraunces', Georgia, serif;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--fm-ink);
}
.gl-rail-hb-coaching-glyph { color: var(--fm-redline); font-size: 1rem; line-height: 1; padding-top: 1px; }
.gl-rail-hb-coaching-body em { color: var(--fm-ink); font-style: italic; }

.gl-panel-mentor-header {
    margin: 2px 0 10px;
    padding: 6px 10px;
    background: var(--fm-paper);
    border-left: 2px solid var(--fm-blueprint);
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--fm-ink-2);
    border-radius: 0 3px 3px 0;
}

[data-theme="dark"] .gl-rail-reveal-voice { background: #1A1E22; color: #E5E3DB; border-left-color: #85B9D9; }
[data-theme="dark"] .gl-rail-reveal-voice-glyph { color: #85B9D9; }
[data-theme="dark"] .gl-rail-hb-coaching { background: #2A1E1C; color: #E5E3DB; border-left-color: #D97765; }
[data-theme="dark"] .gl-rail-hb-coaching-glyph { color: #D97765; }
[data-theme="dark"] .gl-panel-mentor-header { background: #1A1E22; color: #C5C1B6; border-left-color: #85B9D9; }

/* ── Vector's Final Note (Phase 9) ─────────────────────────────── */
.gl-v2-final-note {
    margin: 24px 0 18px;
    padding: 0;
    background: var(--fm-paper-2);
    border: 1px solid var(--fm-rule);
    border-top: 4px solid var(--fm-ochre);
    border-radius: 4px;
    overflow: hidden;
    color: var(--fm-ink);
    box-shadow: 0 2px 6px rgba(26, 29, 31, 0.06);
}
.gl-v2-final-note-header {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 14px 22px 12px;
    background: var(--fm-ochre-tint);
    border-bottom: 1px dashed var(--fm-rule);
    flex-wrap: wrap;
}
.gl-v2-final-note-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--fm-ochre);
    font-weight: 700;
}
.gl-v2-final-note-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.12rem;
    font-weight: 600;
    font-style: italic;
    color: var(--fm-ink);
    margin: 0;
    letter-spacing: -0.015em;
}
.gl-v2-final-note-target {
    margin-left: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--fm-ochre);
    font-weight: 600;
    letter-spacing: 0.08em;
}
.gl-v2-final-note-body { padding: 16px 22px 18px; font-family: 'Inter Tight', system-ui, sans-serif; }
.gl-v2-final-note-lead {
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-variation-settings: "opsz" 48, "SOFT" 80;
    font-size: 1.08rem;
    line-height: 1.65;
    color: var(--fm-ink-2);
    margin: 0 0 14px;
    padding-left: 14px;
    border-left: 2px solid var(--fm-ochre);
}
.gl-v2-final-note-rule-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 10px 0 14px;
}
@media (max-width: 900px) { .gl-v2-final-note-rule-pair { grid-template-columns: 1fr; } }
.gl-v2-final-note-block {
    padding: 10px 14px;
    background: var(--fm-paper);
    border: 1px solid var(--fm-rule);
    border-left: 3px solid;
    border-radius: 3px;
}
.gl-v2-final-note-block--rule    { border-left-color: var(--fm-survey); }
.gl-v2-final-note-block--formula { border-left-color: var(--fm-blueprint); }
.gl-v2-final-note-block-label {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.66rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 4px;
}
.gl-v2-final-note-block--rule    .gl-v2-final-note-block-label { color: var(--fm-survey); }
.gl-v2-final-note-block--formula .gl-v2-final-note-block-label { color: var(--fm-blueprint); }
.gl-v2-final-note-block-text { color: var(--fm-ink); font-size: 0.92rem; line-height: 1.6; }
.gl-v2-final-note-block-formula {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    color: var(--fm-ink);
    padding: 4px 0;
    border-top: 1px dashed var(--fm-rule);
    margin-top: 6px;
}
.gl-v2-final-note-path {
    margin: 12px 0;
    padding: 12px 14px;
    background: var(--fm-blueprint-tint);
    border-radius: 3px;
    border-left: 3px solid var(--fm-blueprint);
}
.gl-v2-final-note-path-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fm-blueprint);
    font-weight: 700;
    margin-bottom: 6px;
}
.gl-v2-final-note-path ol {
    margin: 0;
    padding-left: 24px;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--fm-ink);
    font-weight: 500;
}
.gl-v2-final-note-path li::marker { color: var(--fm-blueprint); font-weight: 700; }
.gl-v2-final-note-memorize {
    margin: 12px 0;
    padding: 12px 14px;
    background: var(--fm-ochre-tint);
    border-radius: 3px;
    border-left: 3px solid var(--fm-ochre);
}
.gl-v2-final-note-memorize--notinhandbook { background: var(--fm-redline-tint); border-left-color: var(--fm-redline); }
.gl-v2-final-note-memorize-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fm-ochre);
    font-weight: 700;
    margin-bottom: 6px;
}
.gl-v2-final-note-memorize--notinhandbook .gl-v2-final-note-memorize-label { color: var(--fm-redline); }
.gl-v2-final-note-memorize-flag {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 6px;
    background: var(--fm-redline);
    color: #fff;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    border-radius: 2px;
}
.gl-v2-final-note-memorize ul {
    margin: 4px 0 0;
    padding-left: 22px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--fm-ink);
}
.gl-v2-final-note-memorize li { margin: 3px 0; }
/* Phase 10 revision: Recognition Cue is a proper card — label row on top,
   italic Fraunces prose in a comfortable multi-line body, chip-row of
   quick-glance memorization cues inside the same card. Visual weight lifted
   so the cue reads as a closing "lock it in" surface, not a cramped one-line
   strip. */
.gl-v2-final-note-cue {
    margin: 16px 0 10px;
    padding: 14px 16px 12px;
    background: var(--fm-paper);
    border: 1px solid var(--fm-rule);
    border-left: 3px solid var(--fm-blueprint);
    border-radius: 3px;
}
.gl-v2-final-note-cue-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dotted var(--fm-rule);
}
.gl-v2-final-note-cue-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--fm-blueprint);
    font-weight: 700;
}
.gl-v2-final-note-cue-text {
    margin: 0 0 10px;
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 0.98rem;
    line-height: 1.65;
    color: var(--fm-ink);
}
.gl-v2-final-note-cue-text:last-child { margin-bottom: 0; }
.gl-v2-final-note-cue-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}
.gl-v2-final-note-chip {
    padding: 4px 10px;
    background: var(--fm-paper-2);
    border: 1px solid var(--fm-rule);
    border-radius: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--fm-ink-2);
}
[data-theme="dark"] .gl-v2-final-note-cue { background: #1A1E22; border-color: #2B3036; border-left-color: #85B9D9; }
[data-theme="dark"] .gl-v2-final-note-cue-head { border-bottom-color: #2B3036; }
[data-theme="dark"] .gl-v2-final-note-cue-label { color: #85B9D9; }
[data-theme="dark"] .gl-v2-final-note-cue-text { color: #F1EEE6; }
[data-theme="dark"] .gl-v2-final-note-chip { background: #242932; border-color: #2B3036; color: #DDE3D5; }
.gl-v2-final-note-signoff {
    margin-top: 14px;
    text-align: right;
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 0.9rem;
    color: var(--fm-ink-3);
}

/* ── Deep Dive group (Deep Dive + Real World + Field Observation) ── */
/* Phase 9b: three stacked collapsibles with consistent Field Manual framing. */
.gl-fm-deepdive-group {
    margin: 18px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.gl-fm-collapsible {
    background: var(--fm-paper-2);
    border: 1px solid var(--fm-rule);
    border-left: 3px solid;
    border-radius: 4px;
    overflow: hidden;
    padding: 0;
    color: var(--fm-ink);
    transition: border-color 140ms ease;
}
.gl-fm-collapsible[open] { box-shadow: 0 2px 6px rgba(26, 29, 31, 0.06); }
.gl-fm-collapsible--deepdive  { border-left-color: var(--fm-blueprint); }
.gl-fm-collapsible--realworld { border-left-color: var(--fm-survey);   }
.gl-fm-collapsible--field     { border-left-color: var(--fm-ochre);    }

.gl-fm-collapsible-summary {
    cursor: pointer;
    list-style: none;
    padding: 12px 16px 12px 16px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: baseline;
    font-family: 'Inter Tight', system-ui, sans-serif;
    user-select: none;
    transition: background 140ms ease;
}
.gl-fm-collapsible-summary::-webkit-details-marker { display: none; }
.gl-fm-collapsible-summary:hover { background: var(--fm-paper); }
.gl-fm-collapsible[open] > .gl-fm-collapsible-summary {
    border-bottom: 1px dashed var(--fm-rule);
    background: var(--fm-paper);
}

.gl-fm-collapsible-tag {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    padding: 3px 8px;
    border: 1px solid currentColor;
    border-radius: 2px;
    flex-shrink: 0;
    align-self: center;
}
.gl-fm-collapsible--deepdive  .gl-fm-collapsible-tag { color: var(--fm-blueprint); background: var(--fm-blueprint-tint); }
.gl-fm-collapsible--realworld .gl-fm-collapsible-tag { color: var(--fm-survey);   background: var(--fm-survey-tint);   }
.gl-fm-collapsible--field     .gl-fm-collapsible-tag { color: var(--fm-ochre);    background: var(--fm-ochre-tint);    }

.gl-fm-collapsible-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1rem;
    font-weight: 600;
    font-variation-settings: "opsz" 36, "SOFT" 50;
    font-style: italic;
    color: var(--fm-ink);
    letter-spacing: -0.01em;
    line-height: 1.35;
}

.gl-fm-collapsible-chevron {
    font-size: 22px;
    color: var(--fm-ink-3);
    transition: transform 200ms ease;
    align-self: center;
}
.gl-fm-collapsible[open] > .gl-fm-collapsible-summary > .gl-fm-collapsible-chevron {
    transform: rotate(180deg);
    color: var(--fm-ink);
}

.gl-fm-collapsible-body {
    padding: 14px 18px 16px;
    font-family: 'Inter Tight', system-ui, sans-serif;
    font-size: 0.93rem;
    line-height: 1.7;
    color: var(--fm-ink);
}
.gl-fm-collapsible-narrative { color: var(--fm-ink); }
.gl-fm-collapsible-narrative + .gl-fm-collapsible-narrative,
.gl-fm-collapsible-narrative + .gl-fm-collapsible-sub,
.gl-fm-collapsible-narrative + .gl-fm-collapsible-pull { margin-top: 10px; }

.gl-fm-collapsible-lead {
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 1.02rem;
    color: var(--fm-ink-2);
    margin: 0 0 10px;
    padding-left: 12px;
    border-left: 2px solid var(--fm-ochre);
}
.gl-fm-collapsible--realworld .gl-fm-collapsible-lead { border-left-color: var(--fm-survey); }
.gl-fm-collapsible--deepdive  .gl-fm-collapsible-lead { border-left-color: var(--fm-blueprint); }

.gl-fm-collapsible-sub { margin-top: 12px; }
.gl-fm-collapsible-sub-heading {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 700;
    font-style: italic;
    color: var(--fm-ink);
    margin-bottom: 4px;
    font-size: 0.96rem;
}
.gl-fm-collapsible-sub-body { color: var(--fm-ink-2); }

.gl-fm-collapsible-pull {
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--fm-paper);
    border: 1px dashed var(--fm-rule);
    border-radius: 3px;
    display: flex;
    gap: 10px;
    align-items: baseline;
    flex-wrap: wrap;
}
.gl-fm-collapsible-pull-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.66rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 700;
    flex-shrink: 0;
}
.gl-fm-collapsible--realworld .gl-fm-collapsible-pull-label { color: var(--fm-survey); }
.gl-fm-collapsible--field     .gl-fm-collapsible-pull-label { color: var(--fm-ochre); }
.gl-fm-collapsible--deepdive  .gl-fm-collapsible-pull-label { color: var(--fm-blueprint); }
.gl-fm-collapsible-pull--exam .gl-fm-collapsible-pull-label { color: var(--fm-redline); }
.gl-fm-collapsible-pull-text { color: var(--fm-ink); font-size: 0.9rem; line-height: 1.6; }

/* Legacy classes retained for backward compat but no longer authored */
.gl-deep-dive, .gl-real-world, .gl-field-observation { /* Phase 9b: superseded by .gl-fm-collapsible */ }

/* ── 7. Worked-example MCQ (inline) ──────────────────────────────── */
.gl-inline-example-mcq {
    background: var(--fm-paper-2) !important;
    border: 1px solid var(--fm-rule) !important;
    border-radius: 4px !important;
}
.gl-inline-choice {
    background: var(--fm-paper) !important;
    border: 1px solid var(--fm-rule) !important;
    font-family: 'Inter Tight', sans-serif !important;
    color: var(--fm-ink) !important;
}
.gl-inline-choice span:first-child { color: var(--fm-phase-learn) !important; font-family: 'Fraunces', serif !important; font-weight: 700; }
.gl-inline-choice:hover:not([style*="pointer-events: none"]) {
    background: var(--fm-ochre-tint) !important;
    border-color: var(--fm-ochre) !important;
}

/* ── 8. Diagram slot (right rail SVG) ────────────────────────────── */
.v2-svg-placeholder {
    background: var(--fm-paper-2) !important;
    border: 1px solid var(--fm-rule);
    border-radius: 3px;
}

/* ── 9. Exam Trap callouts (Phase 4 authored) ───────────────────── */
.vector-callout--trap,
.gl-editorial-v2 [class*="trap"][class*="callout"] { font-family: 'Inter Tight', sans-serif; }

/* ── 10. Dark mode \u2014 midnight drafting ─────────────────────────── */
[data-theme="dark"] {
    --fm-paper:       #0F1419;
    --fm-paper-grain: #131A21;
    --fm-paper-2:     #161E25;
    --fm-ink:         #E4DDD0;
    --fm-ink-2:       #BAB1A3;
    --fm-ink-3:       #7A7468;
    --fm-rule:        #2B3640;
    --fm-rule-soft:   #1E252C;
    --fm-redline:     #E86F5E;
    --fm-redline-tint:#2A1714;
    --fm-blueprint:   #6FAAC8;
    --fm-blueprint-tint:#112632;
    --fm-survey:      #A0C07D;
    --fm-survey-tint: #1A2418;
    --fm-ochre:       #E6B867;
    --fm-ochre-tint:  #2A1F10;
    --fm-graphite:    #0A0F13;
}
[data-theme="dark"] .v2-editorial-card.v2-editorial-card,
[data-theme="dark"] .v2-editorial-card .gl-editorial-v2 {
    background:
        linear-gradient(var(--fm-paper), var(--fm-paper)),
        radial-gradient(circle, rgba(228, 221, 208, 0.06) 0.5px, transparent 0.6px) 0 0 / 12px 12px,
        radial-gradient(circle, rgba(228, 221, 208, 0.12) 0.8px, transparent 1px) 0 0 / 60px 60px;
    background-blend-mode: normal, screen, screen;
}
[data-theme="dark"] .gl-rail-drill-term {
    background: var(--fm-paper) !important;
    color: var(--fm-blueprint) !important;
    border-color: var(--fm-blueprint) !important;
}
[data-theme="dark"] .gl-comp-keyformulas { background: #05090C; border-color: #05090C; }
[data-theme="dark"] .gl-comp-formula-ref { color: #8BB5C3; background: rgba(139, 181, 195, 0.08); }

/* Legacy Phase 5 companion classes (kept for backwards compat, not used in Phase 6) */
.gl-principle-v2-layout { display: block; }
.gl-principle-companion, .gl-principle-flow { display: contents; }

/* Base companion card (legacy — kept for older callers) */
.gl-comp-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 0.88rem;
    line-height: 1.55;
    color: #1e293b;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.gl-comp-card-header { margin-bottom: 8px; }
.gl-comp-card-header h4 {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #64748b;
    margin: 0;
}

/* Key Formulas — dark card (matches V1 screenshots) */
.gl-comp-keyformulas {
    background: #0f172a;
    border-color: #1e293b;
    color: #e2e8f0;
}
.gl-comp-keyformulas .gl-comp-card-header h4 { color: #cbd5e1; }
.gl-comp-formula-list { display: flex; flex-direction: column; gap: 6px; }
.gl-comp-formula-ref {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.78rem;
    color: #93c5fd;
    padding: 6px 8px;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 6px;
    cursor: pointer;
    transition: background 120ms ease;
}
.gl-comp-formula-ref:hover { background: rgba(59, 130, 246, 0.18); }

/* Cross-Topic Connections */
.gl-comp-connections ul,
.gl-comp-examtips ul {
    margin: 0; padding-left: 18px;
}
.gl-comp-connections li { margin: 6px 0; font-size: 0.86rem; }
.gl-comp-why { color: #64748b; font-style: italic; }

/* Exam Tips */
.gl-comp-examtips {
    background: #fefce8;
    border-color: #fde68a;
}
.gl-comp-examtips .gl-comp-card-header h4 { color: #a16207; }
.gl-comp-examtips li { margin: 5px 0; font-size: 0.86rem; color: #713f12; }

/* Handbook Pill */
.gl-comp-handbook { background: #eff6ff; border-color: #bfdbfe; }
.gl-comp-handbook .gl-comp-card-header h4 { color: #1d4ed8; }
.gl-comp-hb-pill {
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: 6px 8px;
    align-items: center;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #93c5fd;
    border-radius: 10px;
    text-decoration: none;
    color: #1e3a5f;
    transition: background 120ms ease;
}
.gl-comp-hb-pill:hover { background: #dbeafe; }
.gl-comp-hb-pill .material-symbols-outlined { font-size: 18px; color: #2563eb; }
.gl-comp-hb-section { font-weight: 700; color: #1e40af; font-size: 0.9rem; }
.gl-comp-hb-page { font-size: 0.75rem; color: #64748b; justify-self: end; }
.gl-comp-hb-label { grid-column: 1 / -1; font-size: 0.82rem; color: #1e3a5f; }
.gl-comp-hb-target { grid-column: 1 / -1; font-size: 0.72rem; color: #64748b; font-style: italic; }

/* Mobile: stack companion above flow */
@media (max-width: 1024px) {
    .gl-principle-v2-layout {
        grid-template-columns: 1fr;
    }
    .gl-principle-companion {
        position: static;
        max-height: none;
        order: 2;
    }
}

/* Dark-theme overrides */
[data-theme="dark"] .gl-comp-card { background: #1e293b; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .gl-comp-card-header h4 { color: #94a3b8; }
[data-theme="dark"] .gl-comp-keyformulas { background: #020617; border-color: #1e293b; }
[data-theme="dark"] .gl-comp-examtips { background: rgba(252, 211, 77, 0.08); border-color: #78350f; }
[data-theme="dark"] .gl-comp-examtips .gl-comp-card-header h4 { color: #fbbf24; }
[data-theme="dark"] .gl-comp-examtips li { color: #fde68a; }
[data-theme="dark"] .gl-comp-handbook { background: rgba(59, 130, 246, 0.08); border-color: #1e3a5f; }
[data-theme="dark"] .gl-comp-hb-pill { background: #0f172a; border-color: #1e3a5f; color: #dbeafe; }
[data-theme="dark"] .gl-comp-hb-pill:hover { background: #1e3a5f; }
[data-theme="dark"] .gl-comp-hb-label { color: #dbeafe; }
[data-theme="dark"] .gl-comp-why { color: #94a3b8; }

/* ── Phase 2/3 inline example + micro-check polish ─────────── */
.gl-inline-choice:hover:not([style*="pointer-events: none"]) {
    background: #f0f9ff;
    border-color: #6366f1;
    transform: translateX(2px);
}
.gl-inline-choice { transition: all 140ms ease; }
.gl-pp-choice:hover:not([style*="pointer-events: none"]) {
    background: #faf5ff;
    border-color: #8b5cf6;
}
.gl-pp-choice { transition: all 140ms ease; }

/* ────────────────────────────────────────────────────── */
/* PHASE 10.5 — EXAM-PREP STEP + QUICK RANGE TABLE       */
/* (P.4e: renderers for authored data that was latent)   */
/* ────────────────────────────────────────────────────── */

/* ── Quick Range Table (inside inlineExample.estimation) ── */
.gl-v2-range-table {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--fm-rule, #c9c0ac);
}
.gl-v2-range-table-label {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--fm-ink, #1A1D1F);
    opacity: 0.58;
    margin-bottom: 4px;
}
.gl-v2-range-table-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}
.gl-v2-range-table-grid td {
    padding: 3px 6px;
    border-bottom: 1px dotted var(--fm-rule, #c9c0ac);
    vertical-align: top;
}
.gl-v2-range-table-grid tr:last-child td {
    border-bottom: none;
}
.gl-v2-range-table-cond {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    color: var(--fm-blueprint, #1E4E6B);
    white-space: nowrap;
    width: 1%;
}
.gl-v2-range-table-val {
    color: var(--fm-ink, #1A1D1F);
    font-family: 'Inter Tight', system-ui, sans-serif;
}

/* ── Exam Strategy (chapter-level triage) ── */
.gl-v2-exam-strategy {
    margin: 22px 0;
    padding: 20px 24px;
    background: var(--fm-paper, #F5EFE1);
    border-left: 4px solid var(--fm-ochre, #B8822A);
    border-radius: 0 10px 10px 0;
    box-shadow: 0 1px 3px rgba(26, 29, 31, 0.08);
}
.gl-v2-exam-strategy-header {
    margin-bottom: 14px;
}
.gl-v2-exam-strategy-badge {
    display: inline-block;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--fm-ochre, #B8822A);
    margin-bottom: 4px;
}
.gl-v2-exam-strategy-title {
    font-family: 'Fraunces', 'Georgia', serif;
    font-style: italic;
    font-weight: 500;
    font-size: 1.18rem;
    color: var(--fm-ink, #1A1D1F);
    margin: 2px 0 0;
}
.gl-v2-exam-strategy-lead {
    font-family: 'Inter Tight', system-ui, sans-serif;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--fm-ink, #1A1D1F);
    margin: 0 0 12px;
}
.gl-v2-exam-strategy-steps {
    margin: 10px 0 12px;
    padding-left: 22px;
    counter-reset: estep;
    list-style: none;
}
.gl-v2-exam-strategy-step {
    counter-increment: estep;
    position: relative;
    padding: 6px 0 6px 4px;
    font-family: 'Inter Tight', system-ui, sans-serif;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--fm-ink, #1A1D1F);
    border-bottom: 1px dashed var(--fm-rule, #c9c0ac);
}
.gl-v2-exam-strategy-step:last-child {
    border-bottom: none;
}
.gl-v2-exam-strategy-step::before {
    content: counter(estep);
    position: absolute;
    left: -22px;
    top: 6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--fm-ochre, #B8822A);
    color: var(--fm-paper, #F5EFE1);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}
.gl-v2-exam-strategy-wrap {
    font-family: 'Fraunces', 'Georgia', serif;
    font-style: italic;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--fm-ink, #1A1D1F);
    margin: 12px 0 0;
    padding-top: 10px;
    border-top: 1px solid var(--fm-rule, #c9c0ac);
    opacity: 0.88;
}

/* ── Exam Checklist (chapter-level pre-submit) ── */
.gl-v2-exam-checklist {
    margin: 22px 0;
    padding: 20px 24px;
    background: var(--fm-paper, #F5EFE1);
    border-left: 4px solid var(--fm-survey, #4F6B3A);
    border-radius: 0 10px 10px 0;
    box-shadow: 0 1px 3px rgba(26, 29, 31, 0.08);
}
.gl-v2-exam-checklist-header {
    margin-bottom: 12px;
}
.gl-v2-exam-checklist-badge {
    display: inline-block;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--fm-survey, #4F6B3A);
    margin-bottom: 4px;
}
.gl-v2-exam-checklist-title {
    font-family: 'Fraunces', 'Georgia', serif;
    font-style: italic;
    font-weight: 500;
    font-size: 1.18rem;
    color: var(--fm-ink, #1A1D1F);
    margin: 2px 0 0;
}
.gl-v2-exam-checklist-items {
    margin: 0;
    padding: 0;
    list-style: none;
}
.gl-v2-exam-checklist-item {
    padding: 8px 0 8px 4px;
    font-family: 'Inter Tight', system-ui, sans-serif;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--fm-ink, #1A1D1F);
    border-bottom: 1px dashed var(--fm-rule, #c9c0ac);
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.gl-v2-exam-checklist-item:last-child {
    border-bottom: none;
}
.gl-v2-exam-checklist-check {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    color: var(--fm-survey, #4F6B3A);
    font-size: 1rem;
    flex-shrink: 0;
    line-height: 1.4;
}

/* ── Mobile ≤900px ── */
@media (max-width: 900px) {
    .gl-v2-exam-strategy,
    .gl-v2-exam-checklist {
        padding: 16px 18px;
    }
    .gl-v2-exam-strategy-title,
    .gl-v2-exam-checklist-title {
        font-size: 1.05rem;
    }
}

/* ── Dark mode ── */
[data-theme="dark"] .gl-v2-exam-strategy,
[data-theme="dark"] .gl-v2-exam-checklist {
    background: #141a1f;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .gl-v2-exam-strategy-title,
[data-theme="dark"] .gl-v2-exam-checklist-title,
[data-theme="dark"] .gl-v2-exam-strategy-lead,
[data-theme="dark"] .gl-v2-exam-strategy-step,
[data-theme="dark"] .gl-v2-exam-checklist-item,
[data-theme="dark"] .gl-v2-exam-strategy-wrap,
[data-theme="dark"] .gl-v2-range-table-val {
    color: #e8e3d5;
}
[data-theme="dark"] .gl-v2-exam-strategy-step {
    border-bottom-color: #3a3a35;
}
[data-theme="dark"] .gl-v2-exam-checklist-item {
    border-bottom-color: #3a3a35;
}
[data-theme="dark"] .gl-v2-range-table {
    border-top-color: #3a3a35;
}
[data-theme="dark"] .gl-v2-range-table-grid td {
    border-bottom-color: #3a3a35;
}
[data-theme="dark"] .gl-v2-range-table-cond {
    color: #79a9c9;
}

