        /* ── Design tokens: aligned to Mock Test Mitra™ brand ── */
        :root {
            /* Brand — matches main.css --primary / --secondary */
            --primary-color:   #0d47a1;
            --primary-hover:   #1565c0;

            /* Semantic status — matches main.css --clr-* */
            --success-color:   #43a047;
            --warning-color:   #f5a623;
            --danger-color:    #e53935;

            /* Surfaces */
            --bg-color:        #ffffff;
            --text-color:      #111111;
            --border-color:    #e0e0e0;
            --card-bg:         #f5f7fa;
            --header-bg:       #f5f7fa;

            /* Question palette states */
            --answered-color:  #43a047;
            --marked-color:    #f5a623;
            --unanswered-color:#e53935;
            --unvisited-color: #757575;

            /* Compact spacing scale */
            --sp-1: 0.25rem;   /* 4px  */
            --sp-2: 0.5rem;    /* 8px  */
            --sp-3: 0.75rem;   /* 12px */
            --sp-4: 1rem;      /* 16px */
            --sp-5: 1.25rem;   /* 20px */
            --sp-6: 1.5rem;    /* 24px */

            /* Radius — mirrors main.css */
            --radius-sm: 5px;
            --radius-md: 8px;
            --radius-lg: 14px;

            /* Focus ring */
            --focus-ring: 0 0 0 3px rgba(13,71,161,0.25);
        }

        [data-theme="dark"] {
            --primary-color:   #90caf9;
            --primary-hover:   #64b5f6;
            --bg-color:        #121212;
            --text-color:      #e0e0e0;
            --border-color:    #333333;
            --card-bg:         #1e1e1e;
            --header-bg:       #1a1b2e;
            --answered-color:  #66bb6a;
            --marked-color:    #ffa726;
            --unanswered-color:#ef5350;
            --focus-ring:      0 0 0 3px rgba(100,181,246,0.25);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Poppins', 'Helvetica Neue', Arial, sans-serif;
            background-color: var(--bg-color);
            color: var(--text-color);
            line-height: 1.55;
            transition: background-color 0.25s ease, color 0.25s ease;
        }

        /* ── Header ──────────────────────────────────────────────────────────── */
        .header {
            background: #1a237e;
            border-bottom: none;
            padding: 0 1.25rem;
            height: 56px;
            position: sticky;
            top: 0;
            z-index: 100;
            box-shadow: 0 2px 6px rgba(0,0,0,0.28);
        }

        .header-content {
            max-width: 1400px;
            height: 100%;
            margin: 0 auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: nowrap;
            gap: var(--sp-3);
        }

        .test-title {
            font-size: 0.9rem;
            font-weight: 600;
            color: #fff;
            flex: 1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .header-right {
            display: flex;
            align-items: center;
            gap: var(--sp-2);
            flex-shrink: 0;
            flex-wrap: nowrap;
        }

        .timer {
            display: flex;
            align-items: center;
            gap: var(--sp-1);
            background: rgba(255,255,255,0.14);
            border: none;
            border-radius: 16px;
            padding: 4px 10px;
            margin-bottom: 0;
            color: #fff;
            white-space: nowrap;
        }

        .timer-display {
            font-size: 0.9rem;
            font-weight: 700;
            color: #fff;
            letter-spacing: 0.5px;
            font-variant-numeric: tabular-nums;
        }

        .timer-label {
            font-size: 0.7rem;
            color: rgba(255,255,255,0.7);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-top: 2px;
        }

        .timer.warning {
            background: #e65100;
            animation: pulse 1s infinite;
        }

        .timer.warning .timer-display { color: #fff; }

        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.55; }
        }

        .user-profile {
            display: flex;
            align-items: center;
            gap: var(--sp-1);
            color: #fff;
            font-size: 0.8rem;
            opacity: 0.9;
        }

        .theme-toggle {
            background: transparent;
            border: none;
            color: #fff;
            font-size: 1rem;
            padding: 0.2rem;
            border-radius: var(--radius-sm);
            cursor: pointer;
            transition: opacity 0.2s;
        }

        .theme-toggle:hover { opacity: 0.75; }

        /* Header submit/reset buttons */
        .header-right .btn-primary {
            background: #e65100;
            color: #fff;
            padding: 5px 12px;
            font-size: 0.8rem;
        }
        .header-right .btn-primary:hover:not(:disabled) { background: #bf360c; }
        .header-right .btn-secondary {
            background: rgba(255,255,255,0.14);
            color: #fff;
            padding: 5px 12px;
            font-size: 0.8rem;
        }
        .header-right .btn-secondary:hover:not(:disabled) {
            background: rgba(255,255,255,0.24);
            color: #fff;
        }

        /* ── Main layout ─────────────────────────────────────────────────────── */
        .main-container {
            max-width: 1400px;
            margin: 0.75rem auto;
            padding: 0 0.875rem;
            display: grid;
            grid-template-columns: 1fr 252px;
            gap: 1rem;
        }

        /* ── Question area card ──────────────────────────────────────────────── */
        .question-area {
            background: var(--card-bg);
            border-radius: var(--radius-md);
            padding: 1.125rem 1.375rem;
            box-shadow: 0 2px 4px rgba(0,0,0,0.08);
            border: 1px solid var(--border-color);
        }

        /* ── Progress bar ────────────────────────────────────────────────────── */
        .progress-section {
            margin-bottom: 0.875rem;
        }

        .progress-bar {
            width: 100%;
            height: 5px;
            background: var(--border-color);
            border-radius: 3px;
            overflow: hidden;
            margin-bottom: var(--sp-1);
        }

        .progress-fill {
            height: 100%;
            background: #e65100;
            transition: width 0.3s ease;
        }

        .progress-text {
            font-size: 0.78rem;
            color: var(--text-color);
            opacity: 0.7;
        }

        /* ── Question block ──────────────────────────────────────────────────── */
        .question-container {
            margin-bottom: 1rem;
        }

        .question-number {
            color: var(--text-color);
            opacity: 0.55;
            font-size: 0.73rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.4px;
            margin-bottom: 0.25rem;
        }

        .question-text {
            font-size: 1rem;
            margin-bottom: 0.875rem;
            line-height: 1.62;
            white-space: pre-line;
        }

        /* ── Options ─────────────────────────────────────────────────────────── */
        .options-container {
            display: flex;
            flex-direction: column;
            gap: 0.45rem;
        }

        /* ── Numerical Answer Type ──────────────────────────────────────────── */
        .numerical-input-wrapper {
            display: flex;
            flex-direction: column;
            gap: 0.6rem;
            padding: 1rem;
            border: 1.5px solid var(--border-color);
            border-radius: var(--radius-sm);
            background: var(--bg-color);
        }
        .numerical-label {
            font-size: 0.88rem;
            font-weight: 600;
            color: var(--text-color);
        }
        .numerical-row {
            display: flex;
            gap: 0.75rem;
            align-items: center;
        }
        .numerical-input {
            flex: 1;
            padding: 0.55rem 0.75rem;
            border: 1.5px solid var(--border-color);
            border-radius: var(--radius-sm);
            font-size: 1rem;
            background: var(--bg-color);
            color: var(--text-color);
        }
        .numerical-input:focus { outline: none; border-color: var(--accent); }
        .numerical-feedback {
            font-size: 0.82rem;
            color: #2e7d32;
            min-height: 1em;
        }
        .numerical-tolerance { font-size: 0.82rem; opacity: 0.7; }

        .option {
            position: relative;
            cursor: pointer;
            display: flex;
            align-items: flex-start;
            gap: var(--sp-2);
            padding: 0.575rem 0.875rem;
            border: 1.5px solid var(--border-color);
            border-radius: var(--radius-sm);
            transition: border-color 0.12s, background 0.12s;
            background: var(--bg-color);
            text-align: left;
            width: 100%;
            font-size: 0.92rem;
        }

        .option:hover {
            border-color: #1a237e;
            background: #f0f4ff;
        }

        .option.selected {
            border-color: #1a237e;
            background: #e8eaf6;
            font-weight: 600;
        }

        [data-theme="dark"] .option:hover    { background: #2a2a3a; }
        [data-theme="dark"] .option.selected { background: #1a2040; border-color: #90caf9; }

        .option input[type="radio"] {
            position: absolute;
            opacity: 0;
            width: 0;
            height: 0;
        }

        .option-text {
            display: flex;
            align-items: center;
            gap: var(--sp-2);
        }

        .option-letter {
            display: flex;
            align-items: center;
            justify-content: center;
            min-width: 24px;
            height: 24px;
            border-radius: 50%;
            border: 1.5px solid var(--border-color);
            background: var(--card-bg);
            color: var(--text-color);
            font-size: 0.73rem;
            font-weight: 700;
            flex-shrink: 0;
        }

        .option.selected .option-letter {
            border-color: #1a237e;
            background: #1a237e;
            color: #fff;
        }

        [data-theme="dark"] .option.selected .option-letter {
            border-color: #90caf9;
            background: #1a237e;
            color: #fff;
        }

        /* ── Navigation buttons ──────────────────────────────────────────────── */
        .navigation {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 0.875rem;
            flex-wrap: wrap;
            gap: var(--sp-2);
        }

        .nav-button {
            padding: 0.55rem 1.125rem;
            border: none;
            border-radius: var(--radius-sm);
            font-weight: 600;
            cursor: pointer;
            font-family: 'Poppins', inherit;
            transition: background-color 0.2s ease, box-shadow 0.2s ease;
            font-size: 0.875rem;
        }

        .btn-primary {
            background: #e65100;
            color: #fff;
        }

        .btn-primary:hover:not(:disabled) { background: #bf360c; }

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

        .btn-secondary:hover:not(:disabled) {
            background: #9e9e9e;
            color: #fff;
        }

        .btn-warning {
            background: #e3f2fd;
            color: #1565c0;
        }

        .btn-warning:hover:not(:disabled) {
            background: #1565c0;
            color: #fff;
        }

        .btn-warning.active {
            background: #1565c0;
            color: #fff;
        }

        [data-theme="dark"] .btn-warning {
            background: #1a2a4a;
            color: #90caf9;
        }
        [data-theme="dark"] .btn-warning:hover:not(:disabled),
        [data-theme="dark"] .btn-warning.active {
            background: #1565c0;
            color: #fff;
        }

        .nav-button:disabled {
            opacity: 0.45;
            cursor: not-allowed;
        }

        /* ── Question palette sidebar ─────────────────────────────────────────── */
        .question-palette {
            background: var(--card-bg);
            border-radius: var(--radius-md);
            padding: 0.875rem;
            box-shadow: 0 2px 4px rgba(0,0,0,0.08);
            border: 1px solid var(--border-color);
            position: sticky;
            top: 68px;
            max-height: calc(100vh - 84px);
            overflow-y: auto;
        }

        .palette-title {
            font-weight: 700;
            font-size: 0.82rem;
            color: #1a237e;
            margin-bottom: 0.5rem;
            padding-bottom: 0.375rem;
            border-bottom: 1px solid var(--border-color);
            text-transform: uppercase;
            letter-spacing: 0.4px;
        }

        [data-theme="dark"] .palette-title { color: #90caf9; }

        .palette-legend {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.3rem;
            margin-bottom: 0.625rem;
            font-size: 0.73rem;
        }

        .legend-item {
            display: flex;
            align-items: center;
            gap: var(--sp-1);
        }

        .legend-color {
            width: 10px;
            height: 10px;
            border-radius: 2px;
            flex-shrink: 0;
        }

        .palette-grid {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 0.35rem;
        }

        .palette-item {
            aspect-ratio: 1;
            border: 2px solid transparent;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.7rem;
            transition: transform 0.1s;
            background: var(--unvisited-color);
            color: #fff;
        }

        .palette-item:hover { transform: scale(1.1); }

        .palette-item.current     { border-color: #1a237e; }
        .palette-item.answered    { background: var(--answered-color); color: #fff; }
        .palette-item.marked      { background: var(--marked-color);   color: #fff; }
        .palette-item.unanswered  { background: var(--unanswered-color); color: #fff; }
        .palette-item.unvisited   { background: var(--unvisited-color); color: #fff; }

        .palette-actions {
            display: flex;
            flex-direction: column;
            gap: 0.45rem;
            margin-top: 0.75rem;
            padding-top: 0.625rem;
            border-top: 1px solid var(--border-color);
        }

        .palette-actions .nav-button {
            width: 100%;
            justify-content: center;
            font-size: 0.8rem;
            padding: 0.5rem 0.75rem;
        }

        /* ── Submit modal ────────────────────────────────────────────────────── */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.5);
            z-index: 1000;
            justify-content: center;
            align-items: center;
        }

        .modal.show { display: flex; }

        .modal-content {
            background: var(--card-bg);
            padding: 1.375rem 1.5rem;
            border-radius: var(--radius-md);
            max-width: 420px;
            width: 90%;
            text-align: left;
            box-shadow: 0 8px 28px rgba(0,0,0,0.22);
        }

        .modal-title {
            font-size: 1.1rem;
            font-weight: 700;
            color: #1a237e;
            margin-bottom: 0.5rem;
        }

        [data-theme="dark"] .modal-title { color: #90caf9; }

        .modal-content p {
            color: var(--text-color);
            opacity: 0.7;
            font-size: 0.875rem;
            margin-bottom: 0.875rem;
        }

        #submission-stats {
            background: var(--header-bg);
            border-radius: 7px;
            padding: 0.75rem;
            margin-bottom: 1rem;
            display: flex;
            gap: 0.75rem;
            justify-content: space-around;
            text-align: center;
        }

        [data-theme="dark"] #submission-stats { background: #2a2a2a; }

        .modal-buttons {
            display: flex;
            gap: var(--sp-2);
            justify-content: flex-end;
            margin-top: 1.125rem;
        }

        /* ── Results page ────────────────────────────────────────────────────── */
        .results-container {
            display: none;
            max-width: 960px;
            margin: 1rem auto;
            padding: 0 0.875rem;
        }

        .results-header {
            background: #1a237e;
            color: #fff;
            padding: 1.125rem 1.5rem;
            border-radius: var(--radius-md);
            margin-bottom: 1rem;
            text-align: center;
            box-shadow: 0 3px 12px rgba(0,0,0,0.18);
        }

        .results-header h2 {
            color: #fff;
            margin-bottom: 0.25rem;
            font-size: 1.15rem;
        }

        .score-display {
            font-size: 2.25rem;
            font-weight: 800;
            color: #fff;
            margin-bottom: 0.25rem;
            line-height: 1.1;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 0.625rem;
            margin: 0.875rem 0;
        }

        .stat-item {
            text-align: center;
            padding: 0.75rem;
            border-radius: var(--radius-md);
            border: 1px solid var(--border-color);
            background: var(--card-bg);
            box-shadow: 0 1px 4px rgba(0,0,0,0.04);
        }

        .stat-number {
            font-size: 1.65rem;
            font-weight: 700;
            margin-bottom: 0.125rem;
        }

        .stat-correct   .stat-number { color: var(--answered-color); }
        .stat-incorrect .stat-number { color: var(--danger-color); }
        .stat-unanswered .stat-number{ color: var(--unvisited-color); }

        /* ── Review section ──────────────────────────────────────────────────── */
        .review-section {
            background: var(--card-bg);
            padding: 1.125rem;
            border-radius: var(--radius-md);
            box-shadow: 0 2px 4px rgba(0,0,0,0.08);
            border: 1px solid var(--border-color);
        }

        .review-section > h3 {
            font-size: 0.95rem;
            font-weight: 700;
            color: #1a237e;
            margin-bottom: 0.875rem;
            padding-bottom: 0.5rem;
            border-bottom: 1px solid var(--border-color);
        }

        [data-theme="dark"] .review-section > h3 { color: #90caf9; }

        .review-question {
            margin-bottom: 0.625rem;
            padding: 0.75rem 0.875rem;
            border: 1px solid var(--border-color);
            border-radius: var(--radius-sm);
            background: var(--card-bg);
        }

        .review-question.correct   { border-left: 3px solid var(--answered-color); }
        .review-question.incorrect { border-left: 3px solid var(--danger-color); }
        .review-question.unanswered{ border-left: 3px solid var(--unvisited-color); }

        /* Header row inside each review card */
        .review-q-header {
            display: flex;
            align-items: center;
            gap: var(--sp-2);
            margin-bottom: 0.5rem;
        }

        .review-q-icon {
            font-size: 1.1rem;
            line-height: 1;
            flex-shrink: 0;
        }

        .review-q-label {
            font-size: 0.8rem;
            font-weight: 700;
            color: var(--text-color);
            opacity: 0.75;
            text-transform: uppercase;
            letter-spacing: 0.3px;
        }

        /* Question text inside review card */
        .review-q-text {
            font-size: 0.9rem;
            line-height: 1.58;
            margin-bottom: 0.5rem;
            color: var(--text-color);
        }

        .review-options {
            margin: 0.45rem 0;
            display: flex;
            flex-direction: column;
            gap: 0.25rem;
        }

        .review-option {
            padding: 4px 10px;
            border-radius: var(--radius-sm);
            font-size: 0.83rem;
            background: var(--bg-color);
            border: 1px solid var(--border-color);
            line-height: 1.5;
        }

        .review-option.correct {
            background: #e8f5e9;
            border-color: var(--answered-color);
            color: #1b5e20;
            font-weight: 600;
        }

        .review-option.user-selected {
            background: #fce4ec;
            border-color: var(--danger-color);
            color: #b71c1c;
        }

        .explanation {
            background: #fffde7;
            border: 1px solid #f9a825;
            border-radius: var(--radius-sm);
            padding: 0.625rem 0.75rem;
            margin-top: 0.5rem;
            font-size: 0.83rem;
            line-height: 1.58;
            color: #333;
            white-space: pre-line;
            word-wrap: break-word;
            overflow-wrap: break-word;
        }

        [data-theme="dark"] .explanation {
            background: #2a2800;
            border-color: #7a6000;
            color: #e0d080;
        }

        .explanation ul {
            margin: 0.25rem 0 0;
            padding-left: 1.125rem;
            list-style: disc;
        }

        .explanation li {
            margin: 0.15rem 0;
            line-height: 1.45;
        }

        .explanation li b {
            font-weight: bold;
            color: inherit;
        }

        .study-link {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            margin-top: 10px;
            padding: 6px 13px;
            background: var(--primary, #0d47a1);
            color: #fff;
            border-radius: var(--radius-sm);
            font-size: 0.78rem;
            font-weight: 600;
            text-decoration: none;
            transition: opacity 0.15s;
        }

        .study-link:hover { opacity: 0.82; }

        [data-theme="dark"] .study-link {
            background: #1565c0;
        }

        /* ── Footer ──────────────────────────────────────────────────────────── */
        .footer {
            background: var(--bg-color);
            border-top: 1px solid var(--border-color);
            padding: 1rem;
            text-align: center;
            margin-top: 1.5rem;
            font-size: 0.75rem;
            color: var(--text-color);
            opacity: 0.65;
        }

        .footer-content {
            max-width: 1400px;
            margin: 0 auto;
        }

        /* ── Start screen ────────────────────────────────────────────────────── */
        .start-screen {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: calc(100vh - 56px);
            background: var(--bg-color);
            color: var(--text-color);
            padding: 1.5rem 1rem;
        }

        .start-box {
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-md);
            box-shadow: 0 3px 16px rgba(0,0,0,0.07);
            padding: 1.75rem 1.5rem;
            max-width: 520px;
            width: 100%;
        }

        .start-box h3 {
            margin-bottom: 0.875rem;
            color: #1a237e;
            font-size: 1.15rem;
        }

        [data-theme="dark"] .start-box h3 { color: #90caf9; }

        .start-box ul {
            text-align: left;
            margin-bottom: 1.25rem;
            line-height: 1.55;
            display: flex;
            flex-direction: column;
            gap: 0.35rem;
        }

        .start-box li { font-size: 0.88rem; }

        .start-box .nav-button {
            width: 100%;
            padding: 11px;
            font-size: 0.95rem;
            font-weight: 700;
            border-radius: var(--radius-sm);
        }

        /* ── Match table ─────────────────────────────────────────────────────── */
        .match-table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 0.75rem;
            font-size: 0.88rem;
        }

        .match-table th, .match-table td {
            padding: 6px 8px;
            border: 1px solid var(--border-color);
        }

        .match-table th {
            background: var(--header-bg);
            font-weight: 600;
            font-size: 0.8rem;
        }

        /* ── SVG diagram options ──────────────────────────────────────────────── */
        .options-container.has-diagrams {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.625rem;
            align-items: stretch;
        }

        .option-header {
            display: flex;
            align-items: center;
            gap: var(--sp-2);
            margin-bottom: 0.375rem;
        }

        .option-label {
            font-weight: 500;
            color: var(--text-color);
            font-size: 0.88rem;
        }

        .option-diagram {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            border-radius: var(--radius-sm);
            background: var(--header-bg);
            padding: 0.2rem;
        }

        .option-diagram svg {
            width: 100%;
            height: auto;
            min-height: 140px;
            display: block;
        }

        .option-diagram img,
        .option-img {
            width: 100%;
            height: auto;
            display: block;
            border-radius: var(--radius-sm);
        }

        /* ── Question images ──────────────────────────────────────────────────── */
        .question-img {
            max-width: 100%;
            height: auto;
            display: block;
            margin: 0.625rem auto;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border-color);
        }

        /* ── Explanation diagram ──────────────────────────────────────────────── */
        .explanation-diagram {
            margin-top: 0.625rem;
            text-align: center;
        }

        .explanation-diagram svg {
            max-width: 100%;
            height: auto;
            display: inline-block;
        }

        .explanation-img {
            max-width: 100%;
            height: auto;
            display: inline-block;
            border-radius: var(--radius-sm);
        }

        /* ── Mobile bottom bar & palette sheet ───────────────────────────────── */
        .mobile-bottom-bar { display: none; }

        .palette-backdrop {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.45);
            z-index: 300;
        }

        .palette-backdrop.open { display: block; }

        .palette-sheet {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background: var(--card-bg);
            border-radius: 1rem 1rem 0 0;
            padding: 0.625rem 1rem 1.75rem;
            z-index: 310;
            max-height: 80vh;
            overflow-y: auto;
            transform: translateY(100%);
            transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
            box-shadow: 0 -4px 20px rgba(0,0,0,0.16);
        }

        .palette-sheet.open { transform: translateY(0); }

        .palette-sheet-handle {
            width: 36px;
            height: 3px;
            background: var(--border-color);
            border-radius: 2px;
            margin: 0 auto 0.625rem;
        }

        .palette-sheet-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.625rem;
        }

        .palette-sheet-header .palette-title {
            margin-bottom: 0;
            border-bottom: none;
            padding-bottom: 0;
        }

        .palette-sheet-close {
            background: none;
            border: none;
            font-size: 1.1rem;
            cursor: pointer;
            color: var(--text-color);
            padding: 0.2rem 0.4rem;
            line-height: 1;
        }

        /* ── Responsive ──────────────────────────────────────────────────────── */
        @media (max-width: 900px) {
            .main-container {
                grid-template-columns: 1fr 220px;
            }
        }

        @media (max-width: 768px) {
            .main-container {
                grid-template-columns: 1fr;
                gap: 0.75rem;
                padding-bottom: 4.5rem;
            }

            .question-palette { display: none; }

            .header {
                padding: 0 0.875rem;
                height: 50px;
            }

            .test-title {
                font-size: 0.85rem;
            }

            .timer {
                padding: 3px 8px;
                font-size: 0.8rem;
            }

            .timer-display { font-size: 0.8rem; }
            .timer-label   { display: none; }

            .header-right #submit-test,
            .header-right #reset-test { display: none; }

            .header-right { gap: var(--sp-2); }

            .user-profile {
                font-size: 0.78rem;
                max-width: 72px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            .question-area { padding: 0.875rem; }
            .navigation    { display: none; }

            /* Mobile bottom nav */
            .mobile-bottom-bar {
                display: flex;
                position: fixed;
                bottom: 0;
                left: 0;
                right: 0;
                background: var(--card-bg);
                border-top: 1px solid var(--border-color);
                box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
                z-index: 200;
                padding: 0.5rem 0.875rem;
                gap: 0.4rem;
                align-items: center;
                justify-content: space-between;
            }

            .mob-nav-btn {
                padding: 7px 12px;
                border: none;
                border-radius: var(--radius-sm);
                font-weight: 600;
                font-size: 0.78rem;
                cursor: pointer;
                white-space: nowrap;
                transition: opacity 0.2s;
            }

            .mob-nav-btn:disabled { opacity: 0.38; cursor: not-allowed; }

            .mob-nav-btn.btn-secondary { background: var(--border-color); color: var(--text-color); }
            .mob-nav-btn.btn-primary   { background: #e65100; color: #fff; }
            .mob-nav-btn.btn-warning   { background: #e3f2fd; color: #1565c0; }
            .mob-nav-btn.btn-warning.active { background: #1565c0; color: #fff; }

            .mob-palette-fab {
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
                gap: 0.1rem;
                background: #1a237e;
                color: #fff;
                border: none;
                border-radius: var(--radius-sm);
                padding: 6px 10px;
                font-size: 0.75rem;
                font-weight: 600;
                cursor: pointer;
                min-width: 54px;
            }

            .palette-sheet .palette-grid {
                grid-template-columns: repeat(8, 1fr);
                gap: 0.35rem;
            }

            .palette-sheet .palette-item {
                width: auto;
                height: 34px;
                font-size: 0.73rem;
            }

            .stats-grid { grid-template-columns: 1fr 1fr; }

            .start-screen { min-height: calc(100vh - 50px); }
        }

        @media (max-width: 640px) {
            .options-container.has-diagrams {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 480px) {
            .question-area { padding: 0.75rem; }

            .palette-sheet .palette-grid {
                grid-template-columns: repeat(7, 1fr);
            }

            .score-display { font-size: 1.9rem; }
            .stats-grid    { grid-template-columns: 1fr; }
        }

        /* ── Accessibility ───────────────────────────────────────────────────── */
        .sr-only {
            position: absolute;
            width: 1px; height: 1px;
            padding: 0; margin: -1px;
            overflow: hidden;
            clip: rect(0,0,0,0);
            white-space: nowrap;
            border: 0;
        }

        :focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }

        button:focus-visible,
        .option:focus-visible,
        .palette-item:focus-visible {
            outline: 2px solid var(--primary-color);
            outline-offset: 2px;
            box-shadow: var(--focus-ring);
        }

        @media (prefers-contrast: high) {
            :root {
                --border-color: #000000;
                --text-color:   #000000;
            }
            [data-theme="dark"] {
                --border-color: #ffffff;
                --text-color:   #ffffff;
            }
        }
