        /* ═══════════════════════════════════════════════════════════════════
           456A.APP - RED SEAL WELDER STUDY TOOL
           Design Theme: Digital Workshop - Industrial precision meets mobile efficiency
        ═══════════════════════════════════════════════════════════════════ */
        
        /* ═══════════════════════════════════════════════════════════════════
           THEME TOKEN SYSTEM — v1.1
           Three themes: blueprint (default), arc-blue, shop-floor.
           :root defines Blueprint as the baseline.
           [data-theme] blocks override surface/accent tokens per theme.
           Compatibility aliases map old variable names to new tokens so
           existing CSS rules continue to work without modification.
        ═══════════════════════════════════════════════════════════════════ */

        :root {
            color-scheme: dark;

            /* Fonts */
            --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
            --font-sans: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;

            /* Type scale */
            --text-xs: 0.72rem;
            --text-sm: 0.85rem;
            --text-md: 1rem;
            --text-lg: 1.2rem;
            --text-xl: 1.5rem;
            --text-2xl: 2rem;
            --text-3xl: 2.75rem;

            /* Spacing Scale */
            --space-xs: 0.25rem;
            --space-sm: 0.5rem;
            --space-md: 1rem;
            --space-lg: 1.5rem;
            --space-xl: 2rem;
            --space-2xl: 3rem;

            /* Border Radius */
            --radius-sm: 6px;
            --radius-md: 10px;
            --radius-lg: 16px;
            --radius-xl: 22px;

            /* Shadows */
            --shadow-sm: 0 2px 8px rgba(0,0,0,0.28);
            --shadow-md: 0 8px 24px rgba(0,0,0,0.32);
            --shadow-lg: 0 18px 50px rgba(0,0,0,0.45);

            /* ── Blueprint (default) surface tokens ── */
            --surface-primary:   #071220;
            --surface-secondary: #0D1B2F;
            --surface-card:      #10233A;
            --surface-elevated:  #162D49;
            --surface-soft:      rgba(77,184,255,0.07);

            /* ── Blueprint accent tokens ── */
            --accent-primary:   #4DB8FF;
            --accent-secondary: #00D4FF;
            --accent-muted:     rgba(77,184,255,0.14);

            /* ── Border ── */
            --border-subtle:   #1E3A5F;
            --border-emphasis: #3A78A8;

            /* ── Text ── */
            --text-primary:   #F4FAFF;
            --text-secondary: #B6CBE0;
            --text-muted:     #7891A8;
            --text-inverse:   #06111F;

            /* ── Semantic ── */
            --success: #4ADE80;
            --warning: #FBBF24;
            --danger:  #EF4444;

            /* ── Progress ── */
            --progress-track: rgba(255,255,255,0.08);
            --progress-fill:  linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));

            /* ════════════════════════════════════════════════════════════
               COMPATIBILITY ALIASES
               Old variable names used throughout existing CSS/JS.
               Mapped to new tokens — do not remove.
            ════════════════════════════════════════════════════════════ */
            --red-primary:  var(--accent-primary);
            --red-dark:     #146CA3;
            --red-bright:   var(--accent-secondary);

            --steel-dark:   var(--surface-secondary);
            --steel-mid:    #19324F;
            --steel-light:  #254867;
            --steel-bright: #356487;

            --spark-orange:    #FF9A33;
            --arc-blue:        var(--accent-secondary);
            --safety-yellow:   var(--warning);
            --ground-green:    var(--success);

            --bg-primary:   var(--surface-primary);
            --bg-secondary: var(--surface-secondary);
            --bg-tertiary:  #19324F;
            --bg-card:      var(--surface-card);
            --bg-elevated:  var(--surface-elevated);

            --focus-ring: var(--accent-secondary);
            --border: var(--border-subtle);
            --accent: var(--accent-primary);
        }

        /* ── Blueprint theme ── */
        [data-theme="blueprint"] {
            --surface-primary:   #071220;
            --surface-secondary: #0D1B2F;
            --surface-card:      #10233A;
            --surface-elevated:  #162D49;
            --surface-soft:      rgba(77,184,255,0.07);

            --accent-primary:   #4DB8FF;
            --accent-secondary: #00D4FF;
            --accent-muted:     rgba(77,184,255,0.14);

            --border-subtle:   #1E3A5F;
            --border-emphasis: #3A78A8;

            --text-primary:   #F4FAFF;
            --text-secondary: #B6CBE0;
            --text-muted:     #7891A8;

            --red-dark:     #146CA3;
            --steel-mid:    #19324F;
            --steel-light:  #254867;
            --steel-bright: #356487;
            --spark-orange: #FF9A33;
        }

        /* ── Arc Blue theme ── */
        [data-theme="arc-blue"] {
            --surface-primary:   #0F1117;
            --surface-secondary: #151922;
            --surface-card:      #1B2028;
            --surface-elevated:  #222833;
            --surface-soft:      rgba(255,255,255,0.055);

            --accent-primary:   #1D9BF0;
            --accent-secondary: #38BDF8;
            --accent-muted:     rgba(29,155,240,0.15);

            --border-subtle:   #2A3441;
            --border-emphasis: #3A4758;

            --text-primary:   #F8FAFC;
            --text-secondary: #CBD5E1;
            --text-muted:     #94A3B8;

            --red-dark:     #0E639C;
            --steel-mid:    #222A36;
            --steel-light:  #313B4A;
            --steel-bright: #445166;
            --spark-orange: #F97316;
        }

        /* ── Shop Floor theme ── */
        [data-theme="shop-floor"] {
            --surface-primary:   #111111;
            --surface-secondary: #191919;
            --surface-card:      #222222;
            --surface-elevated:  #2B2B2B;
            --surface-soft:      rgba(255,123,0,0.075);

            --accent-primary:   #FF7B00;
            --accent-secondary: #FF9A33;
            --accent-muted:     rgba(255,123,0,0.15);

            --border-subtle:   #3A2A1A;
            --border-emphasis: #A84F00;

            --text-primary:   #FFFFFF;
            --text-secondary: #D6D6D6;
            --text-muted:     #999999;

            --red-dark:     #CC5F00;
            --steel-mid:    #252525;
            --steel-light:  #383838;
            --steel-bright: #4A4A4A;
            --spark-orange: #FF7B00;
        }

        /* ── Blueprint body background (grid treatment) ── */
        [data-theme="blueprint"] body {
            background:
                linear-gradient(rgba(77,184,255,0.035) 1px, transparent 1px),
                linear-gradient(90deg, rgba(77,184,255,0.035) 1px, transparent 1px),
                radial-gradient(circle at 20% 0%, rgba(0,212,255,0.10), transparent 30%),
                var(--bg-primary);
            background-size: 28px 28px, 28px 28px, auto, auto;
        }

        /* ── Non-blueprint body backgrounds ── */
        [data-theme="arc-blue"] body,
        [data-theme="shop-floor"] body {
            background:
                radial-gradient(circle at 20% 0%, var(--accent-muted), transparent 35%),
                var(--bg-primary);
        }
        
        /* ─── RESET & BASE ─────────────────────────────────────────────── */
        
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
        
        body {
            font-family: var(--font-sans);
            background: var(--bg-primary);
            color: var(--text-primary);
            line-height: 1.5;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            overflow-x: hidden;
        }
        
        .app {
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }
        
        /* ─── LOADING STATE ────────────────────────────────────────────── */
        
        .loading-screen {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: var(--bg-primary);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 9999;
            transition: opacity 0.5s ease;
        }
        
        .loading-screen.hidden {
            opacity: 0;
            pointer-events: none;
        }
        
        .loader {
            text-align: center;
        }
        
        .loader-logo {
            font-family: var(--font-mono);
            font-size: 2.5rem;
            font-weight: 700;
            color: var(--red-primary);
            margin-bottom: var(--space-md);
            letter-spacing: 0.1em;
        }
        
        .loader-text {
            color: var(--text-secondary);
            font-size: 0.9rem;
            font-weight: 500;
        }

        /* Pending-approval screen — shown when /api/access reports status:pending.
           Cosmetic only: the Worker is the enforcement point and refuses every
           content route on its own. This just explains why the app is empty. */
        .pending-card {
            max-width: 30rem;
            padding: var(--space-xl);
            text-align: center;
        }

        .pending-title {
            font-size: var(--text-xl);
            font-weight: 700;
            color: var(--text-primary);
            margin-bottom: var(--space-md);
        }

        .pending-text {
            color: var(--text-secondary);
            font-size: var(--text-sm);
            line-height: 1.6;
            margin-bottom: var(--space-md);
        }

        .pending-muted {
            color: var(--text-secondary);
            opacity: 0.75;
        }

        .pending-id {
            font-family: var(--font-mono);
            font-size: var(--text-xs);
            color: var(--text-secondary);
            opacity: 0.6;
            word-break: break-all;
            margin-bottom: var(--space-lg);
        }

        .pending-btn {
            font-family: var(--font-sans);
            font-size: var(--text-sm);
            font-weight: 600;
            padding: var(--space-sm) var(--space-lg);
            margin: 0 var(--space-xs);
            border: 1px solid var(--red-primary);
            border-radius: var(--radius-sm);
            background: var(--red-primary);
            color: #fff;
            cursor: pointer;
        }

        .pending-btn-ghost {
            background: transparent;
            border-color: var(--text-secondary);
            color: var(--text-secondary);
        }

        .pending-btn:disabled {
            opacity: 0.45;
            cursor: default;
        }

        /* Contributor Terms acceptance (§11.2 — the checkbox is never pre-ticked). */
        .terms-link {
            color: var(--red-primary);
            font-weight: 600;
            text-decoration: underline;
        }

        .terms-check {
            display: flex;
            align-items: flex-start;
            gap: 0.6rem;
            text-align: left;
            font-size: var(--text-sm);
            color: var(--text-primary);
            line-height: 1.5;
            margin: var(--space-lg) 0;
            cursor: pointer;
        }

        .terms-check input {
            margin-top: 0.2rem;
            width: 1.05rem;
            height: 1.05rem;
            accent-color: var(--red-primary);
            flex-shrink: 0;
            cursor: pointer;
        }

        .terms-err {
            color: #ffb3ae;
            font-size: var(--text-sm);
            margin-bottom: var(--space-md);
        }

        .terms-err.hidden { display: none; }

        /* Raised over the flag modal (z-index 9999), which stays open beneath
           it so the filled-in form survives the acceptance round-trip. */
        #termsScreen { z-index: 10002; }

        /* Point-of-submission notice. Sits above the flag form on every open —
           not a tooltip, not a one-time dismissible. */
        .flag-terms-notice {
            background: rgba(255,193,7,0.07);
            border: 1px solid var(--safety-yellow);
            border-radius: 6px;
            padding: 10px 12px;
            margin: 0 0 18px 0;
            font-size: 13px;
            line-height: 1.5;
            color: var(--text-primary);
        }
        
        .loader-spinner {
            width: 3px;
            height: 20px;
            background: var(--red-primary);
            margin: var(--space-md) auto var(--space-sm);
            animation: pulse 1.5s ease-in-out infinite;
        }
        
        @keyframes pulse {
            0%, 100% { opacity: 0.3; transform: scaleY(0.5); }
            50% { opacity: 1; transform: scaleY(1); }
        }
        
        /* ─── HEADER ───────────────────────────────────────────────────── */
        
        .header {
            background: var(--bg-secondary);
            border-bottom: 1px solid var(--border-subtle);
            padding: var(--space-md);
            position: sticky;
            top: 0;
            z-index: 100;
            backdrop-filter: blur(10px);
        }
        
        .header-content {
            display: flex;
            align-items: center;
            justify-content: space-between;
            max-width: 480px;
            margin: 0 auto;
        }
        
        .logo {
            font-family: var(--font-mono);
            font-size: 1.2rem;
            font-weight: 700;
            color: var(--accent-primary);
            letter-spacing: 0.08em;
        }
        
        .status-indicator {
            display: flex;
            align-items: center;
            gap: var(--space-xs);
            font-size: 0.75rem;
            color: var(--text-secondary);
            font-family: var(--font-mono);
        }
        
        .status-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: var(--ground-green);
            animation: pulse-dot 2s infinite;
        }
        
        @keyframes pulse-dot {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.5; }
        }
        
        /* ─── MAIN LAYOUT ──────────────────────────────────────────────── */
        
        .main {
            flex: 1;
            padding: var(--space-lg) var(--space-md);
            max-width: 480px;
            margin: 0 auto;
            width: 100%;
        }
        
        .view {
            display: none;
            animation: fadeIn 0.3s ease;
        }
        
        .view.active {
            display: block;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        /* ─── HOME VIEW ────────────────────────────────────────────────── */

        .home-hero {
            text-align: center;
            padding: var(--space-xl) 0 var(--space-lg);
            margin-bottom: 0;
        }

        .hero-kicker {
            font-family: var(--font-mono);
            font-size: var(--text-xs);
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: var(--accent-primary);
            margin-bottom: var(--space-sm);
            opacity: 0.85;
        }

        .home-title {
            font-size: 1.9rem;
            font-weight: 700;
            margin-bottom: var(--space-sm);
            color: var(--text-primary);
            line-height: 1.2;
        }

        .home-subtitle {
            color: var(--text-secondary);
            font-size: 0.88rem;
            font-weight: 400;
            line-height: 1.5;
            max-width: 320px;
            margin: 0 auto var(--space-lg);
        }

        /* ── Theme selector ── */
        .theme-row {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: var(--space-sm);
            margin-bottom: var(--space-xl);
        }

        .theme-row label {
            font-family: var(--font-mono);
            font-size: var(--text-xs);
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.08em;
        }

        .theme-control {
            position: relative;
            display: inline-block;
        }

        .theme-control select {
            appearance: none;
            background: var(--bg-elevated);
            color: var(--text-secondary);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-sm);
            padding: 0.3rem 1.8rem 0.3rem 0.7rem;
            font-family: var(--font-mono);
            font-size: var(--text-xs);
            cursor: pointer;
            transition: border-color 0.15s ease;
        }

        .theme-control select:hover,
        .theme-control select:focus {
            border-color: var(--border-emphasis);
            outline: none;
        }

        .theme-control::after {
            content: '▾';
            position: absolute;
            right: 0.55rem;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-muted);
            pointer-events: none;
            font-size: 0.7rem;
        }

        /* ── Continue card ── */
        .continue-card {
            display: flex;
            align-items: center;
            justify-content: space-between;
            width: 100%;
            background: linear-gradient(
                135deg,
                rgba(77,184,255,.18),
                rgba(0,212,255,.08)
            );
            color: var(--text-primary);
            border: 1px solid var(--accent-primary);
            border-radius: var(--radius-md);
            padding: var(--space-md) var(--space-lg);
            cursor: pointer;
            margin-bottom: var(--space-lg);
            transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
            text-align: left;
        }

        .continue-card:hover {
            background: linear-gradient(
                135deg,
                rgba(77,184,255,.26),
                rgba(0,212,255,.14)
            );
            transform: translateY(-1px);
            box-shadow: 0 4px 16px rgba(77,184,255,.18);
        }

        .continue-card:active {
            transform: translateY(0);
        }

        .continue-card strong {
            display: block;
            font-size: 1rem;
            font-weight: 700;
            color: var(--accent-primary);
            margin-bottom: 3px;
        }

        .continue-card small {
            font-size: 0.78rem;
            color: var(--text-secondary);
            font-weight: 400;
        }

        .continue-arrow {
            font-size: 1.4rem;
            font-weight: 600;
            color: var(--accent-primary);
            flex-shrink: 0;
            margin-left: var(--space-md);
        }

        /* ── Rank strip ── */
        .rank-strip {
            background: var(--bg-card);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-md);
            padding: var(--space-md) var(--space-lg);
            margin-bottom: var(--space-md);
            display: flex;
            flex-direction: column;
            gap: var(--space-sm);
        }

        .rank-label {
            font-family: var(--font-mono);
            font-size: 1.1rem;
            font-weight: 700;
            color: var(--accent-primary);
            letter-spacing: 0.02em;
        }

        .rank-sub {
            font-size: 0.78rem;
            color: var(--text-muted);
            margin-top: -2px;
        }

        .rank-meter-top {
            display: flex;
            justify-content: space-between;
            font-family: var(--font-mono);
            font-size: var(--text-xs);
            color: var(--text-muted);
            margin-bottom: var(--space-xs);
        }

        .progress-track {
            height: 8px;
            background: var(--progress-track);
            border-radius: 999px;
            overflow: hidden;
            position: relative;
        }

        .progress-fill {
            height: 100%;
            background: var(--progress-fill);
            border-radius: 999px;
            transition: width 0.5s ease;
        }
        
        .mode-grid {
            display: grid;
            gap: var(--space-md);
            margin-bottom: var(--space-xl);
        }
        
        .mode-card {
            background: var(--bg-card);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-lg);
            padding: var(--space-lg);
            cursor: pointer;
            transition: all 0.2s ease;
            position: relative;
            overflow: hidden;
        }
        
        .mode-card:hover {
            border-color: var(--accent-primary);
            transform: translateY(-2px);
            box-shadow: var(--shadow-md);
        }
        
        .mode-card:active {
            transform: translateY(0);
        }
        
        .mode-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 2px;
            background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
            transform: scaleX(0);
            transition: transform 0.3s ease;
        }
        
        .mode-card:hover::before {
            transform: scaleX(1);
        }

        .mode-card-featured {
            border-color: var(--border-emphasis);
            background: var(--surface-elevated);
        }

        .mode-card-featured::before {
            transform: scaleX(1);
            opacity: 0.6;
        }
        
        .mode-header {
            display: flex;
            align-items: center;
            gap: var(--space-md);
            margin-bottom: var(--space-sm);
        }
        
        .mode-icon {
            width: 40px;
            height: 40px;
            border-radius: var(--radius-md);
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: var(--font-mono);
            font-weight: 600;
            font-size: 1.1rem;
            flex-shrink: 0;
        }
        
        .mode-title {
            font-size: 1rem;
            font-weight: 600;
            color: var(--text-primary);
        }
        
        .mode-subtitle {
            font-size: 0.82rem;
            color: var(--text-secondary);
            margin-bottom: var(--space-sm);
        }
        
        .mode-meta {
            display: flex;
            gap: var(--space-md);
            font-size: 0.72rem;
            color: var(--text-muted);
            font-family: var(--font-mono);
        }
        
        .mode-meta span {
            display: flex;
            align-items: center;
            gap: var(--space-xs);
        }
        
        /* Mode-specific icon colors */
        .mode-quick  .mode-icon { background: rgba(255,154,51,0.15); color: var(--spark-orange); }
        .mode-module    .mode-icon { background: var(--accent-muted);   color: var(--accent-secondary); }
        .mode-review .mode-icon { background: rgba(74,222,128,0.12); color: var(--success); }
        .mode-exam   .mode-icon { background: rgba(251,191,36,0.12); color: var(--warning); font-size: 0.75rem; }
        .mode-wrong  .mode-icon { background: rgba(239,68,68,0.12);  color: var(--danger); }
        
        /* ─── STATS SECTION ────────────────────────────────────────────── */
        
        .stats-section {
            background: var(--bg-card);
            border-radius: var(--radius-md);
            padding: var(--space-md) var(--space-lg);
            margin-bottom: var(--space-md);
            border: 1px solid var(--border-subtle);
        }
        
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: var(--space-md);
        }
        
        .stat-item {
            text-align: center;
        }
        
        .stat-value {
            font-family: var(--font-mono);
            font-size: 1.3rem;
            font-weight: 700;
            color: var(--text-primary);
            margin-bottom: var(--space-xs);
        }
        
        .stat-label {
            font-size: 0.68rem;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.06em;
        }
        
        /* ─── QUIZ VIEW ────────────────────────────────────────────────── */
        
        .quiz-container {
            height: 100vh;
            display: flex;
            flex-direction: column;
            margin: calc(-1 * var(--space-lg)) calc(-1 * var(--space-md)) 0;
        }
        
        .quiz-header {
            background: var(--bg-secondary);
            padding: var(--space-md);
            border-bottom: 1px solid var(--border-subtle);
            display: flex;
            flex-direction: column;
            gap: var(--space-xs);
        }

        .quiz-header-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        
        .quiz-progress {
            font-family: var(--font-mono);
            font-size: 0.82rem;
            color: var(--text-secondary);
        }
        
        .quiz-exit {
            background: none;
            border: 1px solid var(--border-subtle);
            color: var(--text-muted);
            padding: var(--space-xs) var(--space-sm);
            border-radius: var(--radius-sm);
            font-size: 0.78rem;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .quiz-exit:hover {
            border-color: var(--danger);
            color: var(--danger);
        }

        .quiz-progress-track {
            height: 3px;
            background: var(--progress-track);
            border-radius: 999px;
            overflow: hidden;
        }

        .quiz-progress-fill {
            height: 100%;
            background: var(--progress-fill);
            border-radius: 999px;
            transition: width 0.3s ease;
        }
        
        .quiz-content {
            flex: 1;
            padding: var(--space-lg) var(--space-md) var(--space-md);
            overflow-y: auto;
        }
        
        .question-card {
            background: var(--bg-card);
            border-radius: var(--radius-lg);
            padding: var(--space-xl);
            margin-bottom: var(--space-md);
            border: 1px solid var(--border-subtle);
        }
        
        .question-meta {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: var(--space-lg);
            font-size: 0.72rem;
            color: var(--text-muted);
            font-family: var(--font-mono);
        }
        
        .question-noa {
            background: var(--accent-muted);
            color: var(--accent-primary);
            padding: var(--space-xs) var(--space-sm);
            border-radius: var(--radius-sm);
            font-weight: 600;
            letter-spacing: 0.04em;
        }
        
        .question-text {
            font-size: 1.15rem;
            line-height: 1.65;
            margin-bottom: var(--space-xl);
            color: var(--text-primary);
            font-weight: 400;
        }
        
        .options-list {
            display: flex;
            flex-direction: column;
            gap: var(--space-sm);
        }
        
        .option-button {
            background: var(--bg-elevated);
            border: 1px solid var(--border-subtle);
            color: var(--text-primary);
            padding: var(--space-md) var(--space-lg);
            border-radius: var(--radius-md);
            text-align: left;
            cursor: pointer;
            transition: all 0.15s ease;
            font-size: 0.95rem;
            line-height: 1.4;
            position: relative;
            min-height: 52px;
        }
        
        .option-button:hover {
            border-color: var(--accent-primary);
            background: var(--surface-elevated);
        }
        
        .option-button.correct {
            border-color: var(--success);
            background: rgba(74,222,128,0.08);
            color: var(--success);
        }
        
        .option-button.incorrect {
            border-color: var(--danger);
            background: rgba(239,68,68,0.08);
            color: var(--danger);
        }
        
        .option-button.disabled {
            cursor: not-allowed;
            opacity: 0.65;
        }
        
        .option-letter {
            font-family: var(--font-mono);
            font-weight: 600;
            margin-right: var(--space-sm);
            color: var(--text-muted);
            font-size: 0.82rem;
        }
        
        /* ─── FEEDBACK ─────────────────────────────────────────────────── */
        
        .feedback {
            margin-top: var(--space-lg);
            padding: var(--space-lg);
            border-radius: var(--radius-md);
            font-size: 0.9rem;
            line-height: 1.55;
        }
        
        .feedback.correct {
            background: rgba(74,222,128,0.08);
            border: 1px solid var(--success);
            color: var(--success);
        }
        
        .feedback.incorrect {
            background: rgba(239,68,68,0.08);
            border: 1px solid var(--danger);
            color: var(--text-primary);
        }
        
        .feedback-title {
            font-weight: 600;
            margin-bottom: var(--space-sm);
        }
        
        /* ─── QUIZ ACTIONS ─────────────────────────────────────────────── */
        
        .quiz-actions {
            padding: var(--space-md);
            background: var(--bg-secondary);
            border-top: 1px solid var(--border-subtle);
        }
        
        .next-button {
            width: 100%;
            background: var(--accent-primary);
            color: var(--text-inverse);
            border: none;
            padding: var(--space-md);
            border-radius: var(--radius-md);
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .next-button:hover {
            opacity: 0.9;
            transform: translateY(-1px);
            box-shadow: var(--shadow-sm);
        }
        
        .next-button:disabled {
            background: var(--surface-elevated);
            color: var(--text-muted);
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }
        
        /* ─── RESULTS VIEW ─────────────────────────────────────────────── */
        
        .results-container {
            text-align: center;
            padding-top: var(--space-xl);
        }
        
        .results-score {
            font-size: 3.5rem;
            font-family: var(--font-mono);
            font-weight: 700;
            margin-bottom: var(--space-md);
            background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        
        .results-grade {
            font-size: 1.1rem;
            font-weight: 600;
            margin-bottom: var(--space-xl);
            color: var(--text-secondary);
        }
        
        /* Exam Sim only. Both containers are .hidden by default and are re-hidden
           on every start/result, so the other five modes never see them. */
        .exam-notice {
            background: var(--bg-card);
            border: 1px solid var(--border-subtle);
            border-left: 3px solid var(--warning);
            border-radius: var(--radius-sm);
            padding: var(--space-sm) var(--space-md);
            margin-bottom: var(--space-md);
            font-size: .82rem;
            color: var(--text-secondary);
            text-align: left;
        }
        .exam-notice-title { display: block; color: var(--warning); font-weight: 600; margin-bottom: 2px; }

        .bp-list { display: flex; flex-direction: column; gap: var(--space-xs); margin-bottom: var(--space-xl); text-align: left; }
        .bp-head {
            font-size: .7rem; font-family: var(--font-mono); text-transform: uppercase;
            letter-spacing: .05em; color: var(--text-muted); padding: 0 var(--space-xs) var(--space-xs);
        }
        .bp-row {
            display: flex; align-items: center; gap: var(--space-sm);
            background: var(--bg-card); border: 1px solid var(--border-subtle);
            border-radius: var(--radius-sm); padding: var(--space-sm) var(--space-md); font-size: .82rem;
        }
        .bp-row.bp-total { border-color: var(--border-emphasis); font-weight: 600; margin-top: var(--space-xs); }
        .bp-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
        .bp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .bp-short { font-size: .6rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .04em; color: var(--warning); }
        .bp-score { font-family: var(--font-mono); font-size: .78rem; color: var(--text-secondary); min-width: 54px; text-align: right; }
        .bp-pct { font-family: var(--font-mono); font-size: .78rem; min-width: 42px; text-align: right; }
        .bp-pct.pass { color: var(--success); }
        .bp-pct.below { color: var(--warning); }

        .results-actions {
            display: flex;
            flex-direction: column;
            gap: var(--space-md);
        }
        
        .action-button {
            background: var(--bg-elevated);
            border: 1px solid var(--border-subtle);
            color: var(--text-primary);
            padding: var(--space-md);
            border-radius: var(--radius-md);
            cursor: pointer;
            transition: all 0.2s ease;
            font-size: 1rem;
            font-weight: 500;
        }
        
        .action-button:hover {
            border-color: var(--accent-primary);
            background: var(--bg-card);
        }
        
        .action-button.primary {
            background: var(--accent-primary);
            border-color: var(--accent-primary);
            color: var(--text-inverse);
        }
        
        .action-button.primary:hover {
            opacity: 0.9;
        }
        
        /* ─── FOOTER ───────────────────────────────────────────────────── */
        
        .footer {
            background: var(--bg-secondary);
            padding: var(--space-md) var(--space-lg);
            border-top: 1px solid rgba(255,255,255,0.05);
            text-align: center;
            margin-top: auto;
        }
        
        .footer-content {
            max-width: 480px;
            margin: 0 auto;
        }
        
        .footer-text {
            font-size: 0.7rem;
            color: var(--text-muted);
            opacity: 0.6;
            margin-bottom: 2px;
        }
        
        .footer-version {
            font-family: var(--font-mono);
            font-size: 0.62rem;
            color: var(--text-muted);
            opacity: 0.5;
        }
        
        /* ─── RESPONSIVE ───────────────────────────────────────────────── */
        
        @media (min-width: 768px) {
            .mode-grid {
                grid-template-columns: repeat(2, 1fr);
            }
            
            .stats-grid {
                grid-template-columns: repeat(4, 1fr);
            }
        }
        
        /* ─── UTILITIES ────────────────────────────────────────────────── */
        
        .hidden { display: none; }
        .sr-only { 
            position: absolute; 
            width: 1px; 
            height: 1px; 
            padding: 0; 
            margin: -1px; 
            overflow: hidden; 
            clip: rect(0, 0, 0, 0); 
            border: 0; 
        }
        
        /* ─── ANIMATIONS ───────────────────────────────────────────────── */
        
        @media (prefers-reduced-motion: reduce) {
            *, *::before, *::after {
                animation-duration: 0.01ms !important;
                animation-iteration-count: 1 !important;
                transition-duration: 0.01ms !important;
            }
        }
    
        .question-actions { display: flex; justify-content: flex-end; margin-top: 12px; margin-bottom: 8px; }
        .flag-btn { display: inline-flex; align-items: center; gap: 6px; background: transparent; color: var(--text-secondary); border: 1px solid var(--steel-light); border-radius: 6px; padding: 6px 12px; font-size: 12px; font-family: inherit; cursor: pointer; transition: all 0.15s; }
        .flag-btn:hover { color: var(--safety-yellow); border-color: var(--safety-yellow); background: rgba(255,193,7,0.05); }
        .flag-btn.flagged { color: var(--safety-yellow); border-color: var(--safety-yellow); background: rgba(255,193,7,0.08); cursor: default; }
        .flag-btn:disabled { opacity: 0.4; cursor: not-allowed; }
        .flag-icon { font-size: 11px; line-height: 1; font-weight: 700; letter-spacing: 0.05em; }
        .flag-label { font-weight: 500; letter-spacing: 0.02em; }
        .flag-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center; z-index: 9999; padding: 20px; }
        .flag-modal.hidden { display: none; }
        .flag-modal-content { background: var(--bg-card); border: 1px solid var(--steel-light); border-radius: 12px; padding: 28px; max-width: 480px; width: 100%; max-height: 90vh; overflow-y: auto; }
        .flag-modal-title { font-size: 20px; font-weight: 700; color: var(--text-primary); margin: 0 0 4px 0; }
        .flag-modal-sub { font-size: 13px; color: var(--text-secondary); margin: 0 0 20px 0; }
        .flag-form { display: flex; flex-direction: column; gap: 16px; }
        .flag-reasons { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
        .flag-legend { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; padding: 0; }
        .flag-reason { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg-elevated); border: 1px solid var(--steel-light); border-radius: 6px; cursor: pointer; transition: all 0.15s; }
        .flag-reason:hover { border-color: var(--safety-yellow); background: rgba(255,193,7,0.04); }
        .flag-reason input[type="radio"] { accent-color: var(--safety-yellow); cursor: pointer; }
        .flag-reason span { font-size: 14px; color: var(--text-primary); }
        .flag-notes-label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.08em; }
        .flag-notes-label textarea { background: var(--bg-elevated); border: 1px solid var(--steel-light); border-radius: 6px; padding: 10px; color: var(--text-primary); font-family: inherit; font-size: 14px; text-transform: none; letter-spacing: 0; font-weight: normal; resize: vertical; min-height: 70px; }
        .flag-notes-label textarea:focus { outline: none; border-color: var(--safety-yellow); }
        .flag-modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 8px; }
        .flag-btn-cancel, .flag-btn-submit { padding: 10px 20px; border-radius: 6px; font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; transition: all 0.15s; border: 1px solid var(--steel-light); }
        .flag-btn-cancel { background: transparent; color: var(--text-secondary); }
        .flag-btn-cancel:hover { color: var(--text-primary); border-color: var(--text-secondary); }
        .flag-btn-submit { background: var(--safety-yellow); color: #000; border-color: var(--safety-yellow); }
        .flag-btn-submit:hover { background: #FFD43B; }
        .flag-btn-submit:disabled { opacity: 0.5; cursor: wait; }
        .flag-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ground-green); color: white; padding: 12px 20px; border-radius: 8px; font-weight: 600; display: flex; align-items: center; gap: 10px; z-index: 10000; box-shadow: 0 4px 20px rgba(0,0,0,0.4); }
        .flag-toast.hidden { display: none; }
        .flag-toast-icon { font-size: 14px; font-weight: bold; }

        /* ─── READINESS ENGINE (Phase 2) ───────────────────────────────── */
        .readiness-summary {
            margin: 0 0 var(--space-lg);
            background: var(--bg-card);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-lg);
            padding: var(--space-lg);
            cursor: pointer;
            transition: border-color .15s ease;
        }
        .readiness-summary:hover { border-color: var(--border-emphasis); }
        .readiness-summary-top {
            display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-sm);
        }
        .readiness-summary-label {
            font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em;
            text-transform: uppercase; color: var(--text-muted);
        }
        .readiness-summary-pct {
            font-family: var(--font-mono); font-size: 2.4rem; font-weight: 700; line-height: 1;
            color: var(--text-primary);
        }
        .readiness-summary-cta { font-size: .8rem; color: var(--accent-secondary); }
        .readiness-mini-track {
            position: relative; height: 8px; margin-top: var(--space-md);
            background: var(--steel-mid); border-radius: 999px; overflow: hidden;
        }
        .readiness-mini-fill { position: absolute; inset: 0 auto 0 0; background: var(--ground-green); border-radius: 999px; }
        .readiness-mini-pass {
            position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--safety-yellow); z-index: 2;
        }
        .readiness-mini-ceiling {
            position: absolute; top: 0; bottom: 0; right: 0; background:
            repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(255,107,26,.35) 3px, rgba(255,107,26,.35) 6px);
        }

        /* full view */
        #moduleSelectView .term-group {
            margin-bottom: 1.5rem;
        }
        #moduleSelectView .term-group-title {
            font-size: 0.7rem;
            font-family: var(--mono, monospace);
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: var(--text-muted);
            margin-bottom: 0.6rem;
            padding-bottom: 0.4rem;
            border-bottom: 1px solid var(--border-color, #1E3A5F);
        }
        #moduleSelectView .module-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0.7rem 0.85rem;
            border-radius: 8px;
            background: var(--card-bg, #10233A);
            border: 1px solid var(--border-color, #1E3A5F);
            margin-bottom: 0.4rem;
            cursor: pointer;
            transition: border-color 0.15s, background 0.15s;
        }
        #moduleSelectView .module-row:hover {
            border-color: var(--accent, #4DB8FF);
            background: rgba(77,184,255,0.05);
        }
        #moduleSelectView .module-row.disabled {
            opacity: 0.35;
            cursor: not-allowed;
        }
        #moduleSelectView .module-row.disabled:hover {
            border-color: var(--border-color, #1E3A5F);
            background: var(--card-bg, #10233A);
        }
        #moduleSelectView .module-code {
            font-family: var(--mono, monospace);
            font-size: 0.72rem;
            color: var(--accent, #4DB8FF);
            font-weight: 700;
            min-width: 42px;
        }
        #moduleSelectView .module-name {
            font-size: 0.85rem;
            color: var(--text-primary, #F4FAFF);
            flex: 1;
            padding: 0 0.75rem;
        }
        #moduleSelectView .module-count {
            font-family: var(--mono, monospace);
            font-size: 0.7rem;
            color: var(--text-muted);
            min-width: 70px;
            text-align: right;
        }
        #readinessView .view-head {
            display: flex; align-items: center; justify-content: space-between;
            margin-bottom: var(--space-lg);
        }
        #readinessView .view-title { font-size: 1.25rem; font-weight: 700; }
        .rd-back {
            background: var(--bg-tertiary); border: 1px solid var(--border-subtle); color: var(--text-secondary);
            border-radius: var(--radius-sm); padding: var(--space-xs) var(--space-md); font-size: .8rem; cursor: pointer;
        }
        .rd-hero { text-align: center; margin-bottom: var(--space-lg); padding-top: var(--space-sm); }
        .rd-hero-pct { font-family: var(--font-mono); font-size: 3.4rem; font-weight: 700; line-height: 1; }
        .rd-hero-sub { color: var(--text-secondary); font-size: .85rem; margin-top: var(--space-xs); }
        .rd-hero-covered { color: var(--text-muted); font-size: .8rem; margin-top: 2px; }
        .rd-ceiling-banner {
            display: flex; gap: var(--space-sm); align-items: flex-start;
            background: rgba(255,107,26,.08); border: 1px solid rgba(255,107,26,.4);
            border-radius: var(--radius-md); padding: var(--space-md); margin-bottom: var(--space-lg);
            font-size: .82rem; color: var(--text-secondary);
        }
        .rd-ceiling-banner b { color: var(--spark-orange); }

        /* blueprint stacked bar (encodes 16/22/18/44) */
        .rd-blueprint { margin-bottom: var(--space-lg); }
        .rd-blueprint-title, .rd-section-title {
            font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
            color: var(--text-muted); margin-bottom: var(--space-sm);
        }
        .rd-stack { display: flex; height: 40px; border-radius: var(--radius-sm); overflow: hidden; gap: 2px; }
        .rd-stack-seg { position: relative; min-width: 0; background: var(--steel-mid); overflow: hidden; }
        .rd-stack-fill { position: absolute; left: 0; bottom: 0; top: 0; opacity: .9; }
        .rd-stack-hatch {
            position: absolute; top: 0; bottom: 0; right: 0;
            background: repeating-linear-gradient(45deg, rgba(255,255,255,.04), rgba(255,255,255,.04) 4px, rgba(255,107,26,.5) 4px, rgba(255,107,26,.5) 8px);
        }
        .rd-stack-seg-label {
            position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
            font-family: var(--font-mono); font-size: .62rem; color: var(--text-primary); text-shadow: 0 1px 2px rgba(0,0,0,.8); z-index: 2;
        }
        .rd-stack-seg-label small { font-size: .55rem; color: var(--text-secondary); }

        /* per-MWA rows */
        .rd-mwa-row { margin-bottom: var(--space-md); }
        .rd-mwa-head { display: flex; justify-content: space-between; align-items: baseline; font-size: .8rem; margin-bottom: 4px; }
        .rd-mwa-name { font-weight: 600; }
        .rd-mwa-name span { color: var(--text-muted); font-weight: 400; font-family: var(--font-mono); font-size: .72rem; }
        .rd-mwa-vals { font-family: var(--font-mono); font-size: .74rem; color: var(--text-secondary); }
        .rd-mwa-track { position: relative; height: 14px; background: var(--progress-track); border-radius: 999px; overflow: hidden; }
        .rd-mwa-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
        .rd-mwa-uncov {
            position: absolute; top: 0; bottom: 0; right: 0;
            background: repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(255,107,26,.4) 3px, rgba(255,107,26,.4) 6px);
        }

        /* lists */
        .rd-list { display: flex; flex-direction: column; gap: var(--space-xs); margin-bottom: var(--space-lg); }
        .rd-item {
            display: flex; align-items: center; gap: var(--space-sm);
            background: var(--bg-card); border: 1px solid var(--border-subtle);
            border-radius: var(--radius-sm); padding: var(--space-sm) var(--space-md); font-size: .82rem;
        }
        .rd-item-mod { font-family: var(--font-mono); font-size: .72rem; color: var(--text-muted); min-width: 34px; }
        .rd-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .rd-item-val { font-family: var(--font-mono); font-size: .78rem; }
        .rd-badge { font-size: .6rem; font-family: var(--font-mono); text-transform: uppercase; padding: 1px 5px; border-radius: 3px; letter-spacing: .04em; }
        .rd-badge.trusted { background: rgba(76,175,80,.18); color: var(--ground-green); }
        .rd-badge.low { background: rgba(255,193,7,.18); color: var(--safety-yellow); }
        .rd-badge.none { background: var(--steel-mid); color: var(--text-muted); }
        .rd-badge.gap { background: rgba(255,107,26,.18); color: var(--spark-orange); }
        .rd-badge.prov { background: rgba(33,150,243,.18); color: var(--arc-blue); }
        .rd-badge.thin { background: rgba(255,107,26,.14); color: var(--spark-orange); }
        .rd-empty { color: var(--text-muted); font-size: .82rem; padding: var(--space-md); text-align: center; }

        /* ─── DASHBOARD CARDS ──────────────────────────────────────────── */

        .dashboard-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: var(--space-md);
            margin-bottom: var(--space-lg);
        }

        .dashboard-card {
            background: var(--bg-card);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-md);
            padding: var(--space-md) var(--space-md) var(--space-lg);
        }

        .dashboard-card-title {
            font-family: var(--font-mono);
            font-size: var(--text-xs);
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: var(--text-muted);
            margin-bottom: var(--space-sm);
        }

        .dashboard-card-big {
            font-size: 1rem;
            font-weight: 700;
            color: var(--text-primary);
            margin-bottom: var(--space-xs);
        }

        .dashboard-card-muted {
            font-size: 0.72rem;
            color: var(--text-muted);
            line-height: 1.4;
            margin-bottom: var(--space-sm);
        }

        .dashboard-focus-row {
            display: flex;
            align-items: center;
            gap: var(--space-sm);
            margin-top: var(--space-xs);
        }

        .dashboard-focus-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            flex: 1;
            gap: 2px;
        }

        .dashboard-focus-val {
            font-family: var(--font-mono);
            font-size: 1.1rem;
            font-weight: 700;
            color: var(--text-primary);
            line-height: 1;
            text-align: center;
        }

        .dashboard-focus-label {
            font-size: 0.62rem;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.06em;
            text-align: center;
        }

        .dashboard-focus-divider {
            width: 1px;
            height: 32px;
            background: var(--border-subtle);
            flex-shrink: 0;
        }

        .focus-list {
            display: flex;
            flex-direction: column;
            gap: var(--space-xs);
        }

        .focus-item {
            font-size: 0.78rem;
            color: var(--text-secondary);
        }

        .focus-item strong {
            color: var(--accent-primary);
            font-family: var(--font-mono);
        }

        /* ─── MODE SECTION ─────────────────────────────────────────────── */

        .mode-section {
            margin-bottom: var(--space-xl);
        }

        .section-head {
            margin-bottom: var(--space-md);
        }

        .section-head h2 {
            font-size: 0.95rem;
            font-weight: 700;
            color: var(--text-primary);
            margin-bottom: 2px;
        }

        .section-head p {
            font-size: 0.78rem;
            color: var(--text-muted);
        }

        /* ─── READINESS SUMMARY (v1.1 additions) ───────────────────────── */

        .readiness-summary-main {
            display: flex;
            align-items: center;
            gap: var(--space-lg);
            margin: var(--space-sm) 0 var(--space-md);
        }

        .readiness-summary-copy {
            flex: 1;
            min-width: 0;
        }

        .readiness-summary-copy strong {
            display: block;
            font-size: 0.82rem;
            color: var(--text-primary);
            margin-bottom: 2px;
        }

        .readiness-summary-copy span {
            font-size: 0.75rem;
            color: var(--text-muted);
        }

        /* ─── MASTERY MAP (v1.2.1) ─────────────────────────────────────── */

        .mm-summary {
            display: flex;
            flex-wrap: wrap;
            gap: var(--space-sm);
            margin-bottom: var(--space-md);
            padding: var(--space-md);
            background: var(--surface-elevated);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-md);
        }

        .mm-summary-item {
            display: flex;
            flex-direction: column;
            gap: 2px;
            flex: 1;
            min-width: 60px;
        }

        .mm-summary-val {
            font-family: var(--font-mono);
            font-size: 1.1rem;
            font-weight: 700;
            color: var(--text-primary);
            line-height: 1;
        }

        .mm-summary-label {
            font-size: var(--text-xs);
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.06em;
        }

        .mm-summary-divider {
            width: 1px;
            background: var(--border-subtle);
            align-self: stretch;
            flex: none;
            margin: 0 var(--space-xs);
        }

        .mm-summary-module {
            flex: 2;
            min-width: 100px;
        }

        .mm-summary-module .mm-summary-val {
            font-family: var(--font-sans);
            font-size: 0.82rem;
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .mm-row {
            display: flex;
            flex-direction: column;
            padding: var(--space-sm) 0;
            border-bottom: 1px solid var(--border-subtle);
            gap: 5px;
        }

        .mm-row:last-child {
            border-bottom: none;
        }

        .mm-row-head {
            display: flex;
            align-items: center;
            gap: var(--space-sm);
            min-width: 0;
        }

        .mm-name {
            flex: 1;
            font-size: 0.82rem;
            color: var(--text-primary);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            min-width: 0;
        }

        .mm-badges {
            display: flex;
            gap: 3px;
            flex-shrink: 0;
        }

        .mm-pct {
            font-family: var(--font-mono);
            font-size: 0.78rem;
            font-weight: 700;
            min-width: 2.8rem;
            text-align: right;
            flex-shrink: 0;
        }

        .mm-bar-track {
            height: 5px;
            background: var(--progress-track);
            border-radius: 999px;
            overflow: hidden;
        }

        .mm-bar-fill {
            height: 100%;
            border-radius: 999px;
            transition: width 0.4s ease;
        }
        .mm-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
            gap: 10px;
            margin-top: 8px;
        }
        .mm-tile {
            background: var(--bg-elevated, rgba(255,255,255,0.03));
            border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
            border-radius: 8px;
            padding: 10px;
            display: flex;
            flex-direction: column;
            gap: 6px;
            min-height: 90px;
        }
        .mm-tile-mod {
            font-size: 10px;
            opacity: 0.6;
            font-weight: 600;
            letter-spacing: 0.02em;
        }
        .mm-tile-name {
            font-size: 11px;
            font-weight: 600;
            line-height: 1.25;
            flex-grow: 1;
        }
        .mm-tile-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .mm-tile-pct {
            font-size: 17px;
            font-weight: 700;
        }
        .mm-tile-badges {
            display: flex;
            gap: 3px;
        }
        .mm-tile-badges .rd-badge {
            font-size: 8px;
            padding: 1px 4px;
        }
        .mm-bucket-summary {
            display: flex;
            gap: 16px;
            margin-bottom: 10px;
            font-size: 12px;
        }
        .mm-bucket-count {
            display: flex;
            align-items: center;
            gap: 5px;
        }
        .mm-bucket-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
        }
        .pr-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
            gap: 10px;
            margin-top: 8px;
        }
        .pr-card {
            background: var(--bg-elevated, rgba(255,255,255,0.03));
            border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
            border-radius: 8px;
            padding: 12px;
            text-align: center;
        }
        .pr-value {
            font-size: 22px;
            font-weight: 700;
            color: var(--accent-primary);
        }
        .pr-label {
            font-size: 10px;
            opacity: 0.65;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            margin-top: 4px;
        }

        /* ─── RECOMMENDED NEXT (v1.3a) ─────────────────────────────────── */

        .rn-item {
            display: flex;
            flex-direction: column;
            gap: 5px;
            padding: var(--space-md);
            background: var(--surface-card);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-md);
            margin-bottom: var(--space-sm);
        }

        .rn-item:last-child {
            margin-bottom: 0;
        }

        .rn-header {
            display: flex;
            align-items: baseline;
            gap: var(--space-sm);
            min-width: 0;
        }

        .rn-rank {
            font-family: var(--font-mono);
            font-size: 0.78rem;
            font-weight: 700;
            color: var(--accent-primary);
            flex-shrink: 0;
            min-width: 1.2rem;
        }

        .rn-name {
            font-size: 0.88rem;
            font-weight: 600;
            color: var(--text-primary);
            flex: 1;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .rn-mod {
            font-family: var(--font-mono);
            font-size: var(--text-xs);
            color: var(--text-muted);
            flex-shrink: 0;
        }

        .rn-badges {
            display: flex;
            gap: var(--space-xs);
            flex-wrap: wrap;
        }

        .rd-caption {
            font-size: var(--text-xs);
            color: var(--text-muted);
            margin-top: var(--space-sm);
            opacity: 0.7;
        }

        /* ─── UNIFIED PRODUCT THEMES (v1.4) ──────────────────────────────
           The storefront cream/orange system is the product default. The
           original navy workspace remains available for low-light use.
        ─────────────────────────────────────────────────────────────────── */

        [data-theme="light"] {
            color-scheme: light;
            --surface-primary: #f4f0e6;
            --surface-secondary: #ebe4d5;
            --surface-card: #fffaf0;
            --surface-elevated: #ded6c4;
            --surface-soft: rgba(201, 71, 28, 0.07);
            --accent-primary: #c9471c;
            --accent-secondary: #a93612;
            --accent-muted: rgba(201, 71, 28, 0.13);
            --border-subtle: #c9c0ae;
            --border-emphasis: #8d3c20;
            --text-primary: #171714;
            --text-secondary: #4f4a42;
            --text-muted: #6b6459;
            --text-inverse: #fffaf0;
            --success: #237a45;
            --success-soft: rgba(35, 122, 69, 0.12);
            --warning: #7a5700;
            --danger: #b22d25;
            --danger-soft: rgba(178, 45, 37, 0.11);
            --progress-track: rgba(23, 23, 20, 0.11);
            --red-dark: #8d3214;
            --steel-mid: #ded6c4;
            --steel-light: #c9c0ae;
            --steel-bright: #827968;
            --spark-orange: #c9471c;
            --bg-tertiary: #ded6c4;
            --mwa-a: #1769aa;
            --mwa-b: #c34812;
            --mwa-c: #795900;
            --mwa-d: #267040;
            --shadow-sm: 0 2px 8px rgba(58, 48, 32, 0.10);
            --shadow-md: 0 8px 24px rgba(58, 48, 32, 0.14);
            --shadow-lg: 0 18px 50px rgba(58, 48, 32, 0.18);
        }

        [data-theme="dark"] {
            color-scheme: dark;
            --surface-primary: #071220;
            --surface-secondary: #0d1b2f;
            --surface-card: #10233a;
            --surface-elevated: #162d49;
            --surface-soft: rgba(255, 123, 77, 0.08);
            --accent-primary: #ff7b4d;
            --accent-secondary: #ff9a70;
            --accent-muted: rgba(255, 123, 77, 0.16);
            --border-subtle: #29435f;
            --border-emphasis: #bd603e;
            --text-primary: #f8f5ee;
            --text-secondary: #c5cfda;
            --text-muted: #94a6b8;
            --text-inverse: #071220;
            --success: #55d487;
            --success-soft: rgba(85, 212, 135, 0.13);
            --warning: #f4c44e;
            --danger: #ff766e;
            --danger-soft: rgba(255, 118, 110, 0.13);
            --red-dark: #bd603e;
            --steel-mid: #19324f;
            --steel-light: #254867;
            --steel-bright: #477092;
            --spark-orange: #ff7b4d;
            --bg-tertiary: #19324f;
            --mwa-a: #62b5f3;
            --mwa-b: #ff8b55;
            --mwa-c: #f4c44e;
            --mwa-d: #62d18b;
        }

        [data-theme="light"] body {
            background:
                radial-gradient(circle at 18% 0%, rgba(201, 71, 28, 0.08), transparent 32%),
                var(--bg-primary);
        }

        [data-theme="dark"] body {
            background:
                linear-gradient(rgba(255, 123, 77, 0.025) 1px, transparent 1px),
                linear-gradient(90deg, rgba(255, 123, 77, 0.025) 1px, transparent 1px),
                radial-gradient(circle at 20% 0%, rgba(255, 123, 77, 0.10), transparent 30%),
                var(--bg-primary);
            background-size: 28px 28px, 28px 28px, auto, auto;
        }

        .theme-toggle {
            display: inline-flex;
            align-items: center;
            gap: 0.55rem;
            border: 1px solid var(--border-subtle);
            border-radius: 999px;
            background: var(--surface-card);
            color: var(--text-primary);
            padding: 0.38rem 0.62rem;
            font: 700 var(--text-xs) var(--font-mono);
            cursor: pointer;
        }

        .theme-toggle-track {
            width: 2rem;
            height: 1.08rem;
            border-radius: 999px;
            padding: 2px;
            background: var(--border-emphasis);
        }

        .theme-toggle-track span {
            display: block;
            width: 0.82rem;
            height: 0.82rem;
            border-radius: 50%;
            background: var(--text-inverse);
            transition: transform 160ms ease;
        }

        .theme-toggle[aria-pressed="true"] .theme-toggle-track span {
            transform: translateX(0.92rem);
        }

        .option-button.correct {
            border-color: var(--success);
            background: var(--success-soft);
        }

        .option-button.incorrect {
            border-color: var(--danger);
            background: var(--danger-soft);
        }

        .feedback.correct { background: var(--success-soft); }
        .feedback.incorrect { background: var(--danger-soft); }

        /* ─── STUDENT PROGRESSION DASHBOARD (v1.4) ───────────────────── */
        .dash-greeting-row, .next-step-card, .mastery-row-head, .mastery-meta,
        .dashboard-section-head, .module-drill-head, .access-strip {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: var(--space-md);
        }

        .tier-badge {
            min-width: 7.5rem;
            padding: 0.75rem 1rem;
            border: 1px solid var(--border-emphasis);
            background: var(--accent-muted);
            text-align: center;
            box-shadow: 4px 4px 0 var(--border-emphasis);
        }
        .tier-badge strong, .tier-badge span { display: block; }
        .tier-badge strong { font: 800 1rem var(--font-mono); letter-spacing: .1em; }
        .tier-badge span { margin-top: .2rem; color: var(--text-secondary); font-size: var(--text-xs); }

        .next-step-card, .mastery-card, .records-card, .weekly-card, .achievements-card, .access-strip {
            margin-bottom: var(--space-md);
            padding: clamp(1rem, 3vw, 1.5rem);
            border: 1px solid var(--border-subtle);
            background: var(--surface-card);
            box-shadow: var(--shadow-sm);
        }
        .next-step-card { border-left: 5px solid var(--accent-primary); }
        .next-step-card strong { display: block; margin: .2rem 0; font-size: var(--text-lg); }
        .next-step-card p { color: var(--text-secondary); }
        .dashboard-eyebrow { color: var(--accent-primary); font: 800 var(--text-xs) var(--font-mono); letter-spacing: .11em; text-transform: uppercase; }
        .dashboard-section-head { align-items: end; margin-bottom: 1rem; }
        .dashboard-section-head h2 { margin-top: .2rem; }
        .dashboard-section-head > span { color: var(--text-muted); font: var(--text-xs) var(--font-mono); }

        .mastery-rows { display: grid; gap: .65rem; }
        .mastery-row {
            width: 100%; padding: 1rem; border: 1px solid var(--border-subtle);
            border-radius: var(--radius-sm); background: var(--surface-primary);
            color: var(--text-primary); text-align: left; cursor: pointer;
        }
        .mastery-row:hover, .mastery-row:focus-visible { border-color: var(--border-emphasis); transform: translateY(-1px); }
        .mastery-row-head > span { display: flex; align-items: center; gap: .5rem; }
        .mastery-row-head b { color: var(--text-secondary); font: 700 var(--text-xs) var(--font-mono); }
        .mastery-track { display: block; height: .55rem; margin: .75rem 0 .55rem; border-radius: 99px; background: var(--progress-track); overflow: hidden; }
        .mastery-track i { display: block; height: 100%; border-radius: inherit; }
        .mastery-meta em { color: var(--accent-primary); font: 800 var(--text-xs) var(--font-mono); font-style: normal; text-transform: uppercase; }
        .mastery-meta span { color: var(--text-muted); font-size: var(--text-xs); }
        .module-drilldown { margin-top: 1rem; padding: 1rem; border: 1px dashed var(--border-emphasis); background: var(--surface-soft); }
        .module-drill-head { margin-bottom: .7rem; }
        .module-drill-head button { border: 0; background: none; color: var(--accent-primary); cursor: pointer; }
        .module-progress { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-top: 1px solid var(--border-subtle); font-size: var(--text-sm); }
        .module-progress b { margin-right: .35rem; font-family: var(--font-mono); }
        .module-progress em { flex: none; color: var(--text-muted); font-style: normal; }

        .records-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .65rem; margin-top: .8rem; }
        .records-grid > div { padding: .8rem; border: 1px solid var(--border-subtle); background: var(--surface-primary); text-align: center; }
        .records-grid strong, .records-grid span { display: block; }
        .records-grid strong { color: var(--accent-primary); font: 800 var(--text-xl) var(--font-mono); }
        .records-grid span { margin-top: .25rem; color: var(--text-muted); font-size: var(--text-xs); }
        .dashboard-lower-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: var(--space-md); }

        .weekly-bars { display: grid; grid-template-columns: repeat(8, 1fr); align-items: end; gap: .35rem; min-height: 9rem; margin-top: .75rem; }
        .weekly-column { display: grid; grid-template-rows: 1.2rem 5.5rem 1.2rem; gap: .25rem; text-align: center; }
        .weekly-column span, .weekly-column small { color: var(--text-muted); font: .62rem var(--font-mono); }
        .weekly-column i { position: relative; display: block; background: var(--progress-track); }
        .weekly-column b { position: absolute; inset: auto 0 0; background: var(--accent-primary); }
        .weekly-bars.weekly-empty {
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 9rem;
            padding: 1rem;
            color: var(--text-muted);
            text-align: center;
        }
        #dashboardAchievements { display: grid; gap: .45rem; margin-top: .75rem; }
        .achievement { display: grid; grid-template-columns: 1.4rem 1fr auto; gap: .4rem; align-items: center; padding: .48rem .6rem; border: 1px solid var(--border-subtle); color: var(--text-muted); font-size: var(--text-sm); }
        .achievement.earned { border-color: var(--success); color: var(--text-primary); background: var(--success-soft); }
        .achievement small { font-family: var(--font-mono); }
        .access-strip { box-shadow: none; color: var(--text-secondary); }
        .access-extension { border: 0; background: none; color: var(--accent-primary); font-weight: 700; cursor: pointer; text-align: right; }
        .dashboard-empty { padding: 1.5rem; color: var(--text-muted); text-align: center; }

        @media (max-width: 720px) {
            .dash-greeting-row, .next-step-card { align-items: stretch; flex-direction: column; }
            .tier-badge { align-self: flex-start; }
            .records-grid { grid-template-columns: repeat(2, 1fr); }
            .dashboard-lower-grid { grid-template-columns: 1fr; }
            .mastery-row-head, .mastery-meta { align-items: flex-start; flex-direction: column; gap: .25rem; }
            .weekly-column span { font-size: .55rem; }
            .access-strip { align-items: flex-start; flex-direction: column; }
        }
