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

    :root {
      --black:        #0f0f0f;
      --ink:          #1a1a1a;
      --mid:          #444;
      --muted:        #888;
      --border:       #e8e8e8;
      --surface:      #ffffff;
      --paper:        #f7f7f5;
      --accent:       #1a7a4a;
      --accent-light: #edf7f1;
      --accent-dark:  #145538;
      --warn:         #b35a1a;
      --warn-light:   #fdf3eb;
      --warn-border:  #f0cda8;
      --danger:       #c0392b;
      --danger-light: #fdf0ee;
      --serif:        'Instrument Serif', Georgia, serif;
      --sans:         'DM Sans', sans-serif;
    }

    html { scroll-behavior: smooth; }

    body {
      font-family: var(--sans);
      background: var(--paper);
      color: var(--ink);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }

    /* ── NAV ─────────────────────────────────────── */
    nav {
      display: flex; align-items: center; justify-content: space-between;
      padding: 0 32px; height: 58px;
      border-bottom: 1px solid var(--border);
      background: rgba(255,255,255,0.96);
      position: sticky; top: 0; z-index: 100;
      gap: 16px;
    }

    .nav-logo {
      font-family: var(--serif); font-size: 20px;
      color: var(--black); text-decoration: none; flex-shrink: 0;
    }
    .nav-logo span { font-style: italic; color: var(--accent); }

    .nav-center { flex: 1; display: flex; align-items: center; justify-content: center; }
    .paper-title { font-size: 13px; font-weight: 500; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }

    .nav-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

    .timer {
      display: flex; align-items: center; gap: 6px;
      font-size: 13px; font-weight: 500; color: var(--muted);
      background: var(--paper); border: 1px solid var(--border);
      border-radius: 8px; padding: 6px 12px; transition: all .25s;
    }
    .timer svg { width: 13px; height: 13px; flex-shrink: 0; }
    .timer.warning { color: var(--warn); background: var(--warn-light); border-color: var(--warn-border); }
    .timer.danger  { color: var(--danger); background: var(--danger-light); border-color: #f5aea6; }

    .btn-submit-test {
      font-family: var(--sans); font-size: 13px; font-weight: 500;
      background: var(--black); color: #fff; border: none;
      border-radius: 8px; padding: 8px 16px; cursor: pointer;
      transition: opacity .2s; white-space: nowrap;
    }
    .btn-submit-test:hover:not(:disabled) { opacity: 0.85; }
    .btn-submit-test:disabled { opacity: .45; cursor: default; }

    /* ── PROGRESS BAR ────────────────────────────── */
    .top-progress { height: 3px; background: var(--border); position: sticky; top: 58px; z-index: 99; }
    .top-progress-fill { height: 100%; background: var(--accent); transition: width .4s ease; }

    /* ── REVIEW BANNER ───────────────────────────── */
    .review-banner {
      background: var(--accent-light); border-bottom: 1px solid #b2d9c3;
      padding: 9px 32px; font-size: 13px; color: var(--accent);
      font-weight: 500; text-align: center; display: none;
    }
    .review-banner.show { display: block; }

    /* ── COUNTER BAR ─────────────────────────────── */
    .counter-bar {
      display: flex; align-items: center; justify-content: center;
      gap: 10px; padding: 10px 32px;
      background: var(--surface); border-bottom: 1px solid var(--border);
    }

    .counter-pill {
      display: inline-flex; align-items: center; gap: 6px;
      background: var(--black); color: #fff; border-radius: 20px;
      padding: 6px 16px; font-size: 13px; font-weight: 500;
      cursor: pointer; user-select: none;
    }
    .counter-pill svg { width: 12px; height: 12px; }

    .mark-btn {
      display: inline-flex; align-items: center; gap: 6px;
      font-family: var(--sans); font-size: 12px; font-weight: 500;
      color: var(--muted); background: var(--surface);
      border: 1px solid var(--border); border-radius: 8px;
      padding: 6px 12px; cursor: pointer; transition: all .15s;
    }
    .mark-btn:hover { border-color: var(--warn); color: var(--warn); }
    .mark-btn.marked { background: var(--warn-light); border-color: var(--warn-border); color: var(--warn); }
    .mark-btn svg { width: 13px; height: 13px; }

    /* ── MAIN SPLIT LAYOUT ───────────────────────── */
    .split-layout {
      flex: 1; display: flex; min-height: 0;
      overflow: hidden; height: calc(100vh - 120px);
    }

    /* ── PASSAGE PANEL ───────────────────────────── */
    .passage-panel {
      width: 48%; flex-shrink: 0; overflow-y: auto;
      padding: 36px 40px; border-right: 1px solid var(--border);
      background: var(--surface);
    }

    .passage-label {
      font-size: 10px; font-weight: 600; letter-spacing: 1.2px;
      text-transform: uppercase; color: var(--accent);
      background: var(--accent-light); padding: 4px 10px;
      border-radius: 20px; display: inline-block; margin-bottom: 14px;
    }

    .passage-source {
      font-family: var(--serif); font-size: 13px; font-style: italic;
      color: var(--muted); margin-bottom: 20px; line-height: 1.6;
    }

    .passage-text {
      font-size: 15px; line-height: 1.9; color: var(--ink);
      font-weight: 300;
    }
    .passage-text p { margin-bottom: 16px; }
    .passage-text p:last-child { margin-bottom: 0; }

    /* ── RESIZER ─────────────────────────────────── */
    .resizer {
      width: 5px; background: var(--border);
      cursor: col-resize; flex-shrink: 0;
      transition: background .15s; position: relative;
    }
    .resizer:hover { background: #ccc; }
    .resizer::after {
      content: '⋮⋮'; position: absolute;
      top: 50%; left: 50%; transform: translate(-50%,-50%);
      font-size: 10px; color: var(--muted); letter-spacing: -1px;
    }

    /* ── QUESTION PANEL ──────────────────────────── */
    .question-panel {
      flex: 1; overflow-y: auto;
      padding: 36px 40px; background: var(--paper);
      display: flex; flex-direction: column;
    }

    /* ── STATES ──────────────────────────────────── */
    .loading-state, .error-state {
      flex: 1; display: flex; flex-direction: column;
      align-items: center; justify-content: center;
      gap: 14px; padding: 48px; color: var(--muted); font-size: 14px;
    }
    .spinner {
      width: 28px; height: 28px; border: 2px solid var(--border);
      border-top-color: var(--accent); border-radius: 50%;
      animation: spin .7s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* ── QUESTION META ───────────────────────────── */
    .q-meta {
      display: flex; align-items: center;
      justify-content: space-between; margin-bottom: 18px;
      flex-wrap: wrap; gap: 8px;
    }
    .q-subject {
      font-size: 10px; font-weight: 600; letter-spacing: 1px;
      text-transform: uppercase; color: var(--accent);
      background: var(--accent-light); padding: 4px 10px; border-radius: 20px;
    }
    .q-num-label { font-size: 12px; color: var(--muted); }

    .q-text {
      font-family: var(--serif); font-size: 16px;
      line-height: 1.75; color: var(--ink); margin-bottom: 24px;
    }

    /* ── OPTIONS ─────────────────────────────────── */
    .options-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }

    .option {
      display: flex; align-items: flex-start; gap: 14px;
      background: var(--surface); border: 1.5px solid var(--border);
      border-radius: 10px; padding: 14px 18px;
      cursor: pointer; transition: border-color .15s, background .15s, transform .1s;
      user-select: none;
    }
    .option:hover { border-color: var(--accent); background: #fafaf8; transform: translateX(2px); }
    .option.selected { border-color: var(--black); background: var(--black); color: #fff; }
    .option.selected .option-letter { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: #fff; }
    .option.correct { border-color: var(--accent); background: var(--accent-light); }
    .option.correct .option-letter { background: var(--accent); border-color: var(--accent); color: #fff; }
    .option.wrong { border-color: var(--danger); background: var(--danger-light); }
    .option.wrong .option-letter { background: var(--danger); border-color: var(--danger); color: #fff; }

    .option-letter {
      width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%;
      border: 1.5px solid var(--border); display: flex;
      align-items: center; justify-content: center;
      font-size: 13px; font-weight: 500; color: var(--muted);
      transition: all .15s; margin-top: 1px;
    }
    .option:hover .option-letter { border-color: var(--accent); color: var(--accent); }
    .option-text { font-size: 14px; line-height: 1.6; flex: 1; }

    /* ── EXPLANATION ─────────────────────────────── */
    .explanation-box {
      background: var(--surface); border: 1px solid var(--border);
      border-left: 3px solid var(--accent); border-radius: 10px;
      padding: 16px 20px; font-size: 13.5px; line-height: 1.7;
      color: var(--ink); display: none; margin-bottom: 24px;
    }
    .explanation-box.show { display: block; }
    .explanation-box strong { color: var(--accent); }

    /* ── NAVIGATION ──────────────────────────────── */
    .q-nav {
      display: flex; align-items: center; justify-content: space-between;
      gap: 12px; margin-top: auto; padding-top: 12px;
    }
    .btn-nav {
      font-family: var(--sans); font-size: 13px; font-weight: 500;
      background: var(--surface); color: var(--ink);
      border: 1.5px solid var(--border); border-radius: 8px;
      padding: 10px 20px; cursor: pointer; transition: all .15s;
    }
    .btn-nav:hover:not(:disabled) { border-color: var(--ink); }
    .btn-nav:disabled { opacity: .35; cursor: default; }
    .btn-nav-next { background: var(--black); color: #fff; border-color: var(--black); }
    .btn-nav-next:hover:not(:disabled) { opacity: 0.85; }

    /* ── SIDEBAR ─────────────────────────────────── */
    .sidebar {
      width: 220px; flex-shrink: 0; border-left: 1px solid var(--border);
      background: var(--surface); overflow-y: auto;
      display: flex; flex-direction: column;
    }
    .sidebar-header { padding: 18px 16px 12px; border-bottom: 1px solid var(--border); }
    .sidebar-title {
      font-size: 11px; font-weight: 600; letter-spacing: .8px;
      text-transform: uppercase; color: var(--muted);
      display: block; margin-bottom: 12px;
    }
    .legend { display: flex; flex-direction: column; gap: 6px; }
    .legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
    .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
    .dot.answered   { background: var(--black); }
    .dot.current    { background: var(--accent); }
    .dot.unanswered { background: var(--border); border: 1px solid #ccc; }
    .dot.marked     { background: var(--warn); }

    .q-grid {
      padding: 14px 16px; display: grid;
      grid-template-columns: repeat(5, 1fr); gap: 5px; flex: 1;
    }
    .q-dot {
      width: 34px; height: 34px; border-radius: 7px;
      border: 1.5px solid var(--border); background: var(--paper);
      font-size: 11px; font-weight: 500; color: var(--muted);
      cursor: pointer; display: flex; align-items: center; justify-content: center;
      transition: all .12s; font-family: var(--sans);
    }
    .q-dot:hover   { border-color: var(--accent); color: var(--accent); }
    .q-dot.current { border-color: var(--accent); background: var(--accent); color: #fff; }
    .q-dot.answered{ background: var(--black); border-color: var(--black); color: #fff; }
    .q-dot.marked  { background: var(--warn-light); border-color: var(--warn-border); color: var(--warn); }
    .q-dot.marked.answered { background: var(--warn); border-color: var(--warn); color: #fff; }

    .sidebar-stats {
      padding: 14px 16px; border-top: 1px solid var(--border);
      display: flex; gap: 6px;
    }
    .sstat { flex: 1; text-align: center; }
    .sstat-val { display: block; font-size: 18px; font-weight: 500; color: var(--ink); }
    .sstat-label { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }

    /* ── RESULT MODAL ────────────────────────────── */
    .modal-overlay {
      position: fixed; inset: 0;
      background: rgba(15,15,15,.55); backdrop-filter: blur(4px);
      display: flex; align-items: center; justify-content: center;
      z-index: 1000; padding: 20px;
    }
    .modal {
      background: var(--surface); border-radius: 16px;
      padding: 40px; max-width: 440px; width: 100%;
      text-align: center; box-shadow: 0 24px 64px rgba(0,0,0,.12);
    }
    .modal-icon {
      width: 52px; height: 52px; background: var(--accent-light);
      border-radius: 50%; display: flex; align-items: center;
      justify-content: center; margin: 0 auto 18px; color: var(--accent);
    }
    .modal-icon svg { width: 24px; height: 24px; }
    .modal h2 { font-family: var(--serif); font-size: 26px; font-weight: 400; margin-bottom: 8px; }
    .modal p  { font-size: 14px; color: var(--muted); margin-bottom: 24px; }

    .result-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 24px; }
    .result-stat  { background: var(--paper); border-radius: 10px; padding: 14px 8px; }
    .result-val   { display: block; font-size: 22px; font-weight: 500; letter-spacing: -.3px; }
    .result-label { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }

    .modal-actions { display: flex; gap: 10px; }
    .btn-review {
      flex: 1; font-family: var(--sans); font-size: 13px; font-weight: 500;
      background: var(--black); color: #fff; border: none;
      border-radius: 8px; padding: 12px; cursor: pointer; transition: opacity .2s;
    }
    .btn-review:hover { opacity: .85; }
    .btn-back {
      flex: 1; font-family: var(--sans); font-size: 13px; font-weight: 500;
      background: var(--paper); color: var(--ink);
      border: 1.5px solid var(--border); border-radius: 8px; padding: 12px;
      text-decoration: none; display: flex; align-items: center;
      justify-content: center; transition: border-color .15s;
    }
    .btn-back:hover { border-color: var(--ink); }

    /* ── TOAST ───────────────────────────────────── */
    .toast {
      position: fixed; right: 16px; bottom: 16px;
      padding: 10px 14px; border-radius: 10px;
      font-size: 13px; font-weight: 500; color: #fff;
      z-index: 9999; opacity: 0; transform: translateY(8px);
      transition: opacity .2s, transform .2s;
      box-shadow: 0 8px 24px rgba(0,0,0,.18);
    }
    .toast.show { opacity: 1; transform: translateY(0); }
    .toast.success { background: var(--accent); }
    .toast.error   { background: var(--danger); }

    /* ── FOOTER ──────────────────────────────────── */
    footer {
      border-top: 1px solid var(--border); padding: 16px 32px;
      display: flex; justify-content: space-between;
      font-size: 12px; color: var(--muted);
    }

    /* ── RESPONSIVE ──────────────────────────────── */
    @media (max-width: 900px) {
      nav { padding: 0 16px; }
      .counter-bar { padding: 8px 16px; }
      .paper-title { max-width: 180px; }

      .split-layout { flex-direction: column; overflow: auto; height: auto; }

      .passage-panel {
        width: 100%; border-right: none; border-bottom: 1px solid var(--border);
        padding: 24px 16px; max-height: 44vh; overflow-y: auto;
      }
      .resizer { display: none; }
      .question-panel { padding: 24px 16px; overflow: visible; }
      .sidebar { display: none; }
      footer { padding: 14px 16px; flex-direction: column; gap: 4px; }
    }
