/* ============================================================================
   exam.css — the papers page: setup, generating, exam room, results.

   The signature idea: when you are actually sitting a paper, the questions
   render as a light "sheet" resting on the dark Hungter "desk". Long-form
   reading and handwriting-style answering on a neon-dark surface is
   fatiguing, so Paper mode (on by default for written papers) gives students
   a print-like reading surface without leaving the app.
   ========================================================================= */

/* ── Shell ────────────────────────────────────────────────────────────── */
.gp-main { max-width: 1080px; margin: 0 auto; padding: 22px 16px 80px; }
.gp-main h1 { font-family: var(--font-display); margin: 0 0 6px; letter-spacing: -0.02em; }

.gp-card {
  background: rgba(13, 20, 40, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 26px;
  backdrop-filter: blur(14px);
  margin-bottom: 18px;
}
.gp-card.glow { border-color: var(--border-glow); box-shadow: var(--shadow); }

.gp-lede { color: var(--ink-soft); line-height: 1.65; margin: 0 0 4px; max-width: 62ch; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  border: 1px solid var(--border); background: transparent; color: var(--ink);
  border-radius: 999px; padding: 11px 20px; cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: 0.92rem;
  transition: border-color .15s ease, color .15s ease, transform .15s ease, box-shadow .2s ease;
  text-decoration: none; display: inline-flex; align-items: center; gap: 7px;
}
.btn:hover { border-color: var(--cyan); color: var(--cyan); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--gradient-brand); color: var(--bg-deep); border-color: transparent; box-shadow: var(--glow-lime); }
.btn.primary:hover { color: var(--bg-deep); transform: translateY(-1px); box-shadow: 0 0 28px rgba(200,255,77,0.5); }
.btn.danger { border-color: rgba(255,107,74,0.45); color: var(--coral); }
.btn.danger:hover { background: rgba(255,107,74,0.1); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.sm { padding: 8px 14px; font-size: 0.82rem; }

:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 6px;
}

/* ── Quick start: your subjects ───────────────────────────────────────── */
.quick { margin-bottom: 18px; }
.quick-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 12px;
}
.quick-head h2 {
  font-family: var(--font-display); font-size: 1.02rem; margin: 0; letter-spacing: -0.01em;
}
.quick-head .hint { font-size: 0.8rem; color: var(--ink-faint); }
.quick-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.quick-card {
  text-align: left; cursor: pointer; border: 1px solid var(--border);
  background: var(--surface); border-radius: var(--radius-sm); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 3px; color: var(--ink);
  font-family: var(--font-body); transition: border-color .16s ease, transform .16s ease, background .16s ease;
}
.quick-card:hover { border-color: var(--border-glow); transform: translateY(-2px); background: var(--surface-2); }
.quick-card .qc-code { font-family: var(--font-mono); font-size: 0.7rem; color: var(--lime); letter-spacing: 0.06em; }
.quick-card .qc-name { font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; }
.quick-card .qc-meta { font-size: 0.78rem; color: var(--ink-faint); }

/* Resume banner for an unfinished paper */
.resume {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border: 1px solid rgba(255, 209, 77, 0.38); background: rgba(255, 209, 77, 0.08);
  border-radius: var(--radius-sm); padding: 14px 18px; margin-bottom: 18px;
}
.resume .r-ico { font-size: 1.3rem; }
.resume .r-copy { flex: 1; min-width: 200px; }
.resume .r-copy strong { font-family: var(--font-display); display: block; font-size: 0.95rem; }
.resume .r-copy span { font-size: 0.83rem; color: var(--ink-soft); }

/* ── Setup: level tabs, selects, topic chips ─────────────────────────── */
.lvl-tabs {
  display: inline-flex; gap: 4px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px; margin: 6px 0 14px;
}
.lvl-tab {
  border: none; background: transparent; color: var(--ink-soft);
  font-family: var(--font-display); font-weight: 600; font-size: 0.86rem;
  padding: 8px 18px; border-radius: 999px; cursor: pointer; transition: all .16s ease;
}
.lvl-tab:hover { color: var(--ink); }
.lvl-tab.on { background: var(--gradient-brand); color: var(--bg-deep); }

.gp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 6px 0 4px; }
.gp-field label, .field-label {
  display: block; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 6px; font-family: var(--font-mono);
}
.gp-field select {
  width: 100%; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink);
  border-radius: 10px; padding: 12px 12px; font-family: var(--font-body); font-size: 0.92rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.gp-field select:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(77,240,255,0.14); }

.paper-facts {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px;
}
.fact {
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-soft);
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: 8px; padding: 6px 11px;
}
.fact b { color: var(--ink); font-weight: 400; }

/* Mode segmented control (exam vs practice, and length) */
.seg { display: inline-flex; gap: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg button {
  border: none; background: transparent; color: var(--ink-soft); cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: 0.82rem;
  padding: 8px 14px; border-radius: 8px; transition: all .15s ease; white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface-solid); color: var(--lime); box-shadow: inset 0 0 0 1px var(--border-glow); }
.seg-note { font-size: 0.78rem; color: var(--ink-faint); margin: 8px 0 0; }

.topic-wrap { margin: 20px 0 4px; }
.topic-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 9px; }
.topic-head .hint { font-size: 0.78rem; color: var(--ink-faint); }
.topic-head button {
  background: none; border: none; color: var(--cyan); font-size: 0.78rem;
  cursor: pointer; text-decoration: underline; padding: 0; font-family: var(--font-body);
}
.chips { display: flex; flex-wrap: wrap; gap: 7px; max-height: 176px; overflow-y: auto; padding: 3px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-soft);
  border-radius: 999px; padding: 7px 13px; font-size: 0.8rem; cursor: pointer;
  transition: all .14s ease; font-family: var(--font-body);
}
.chip:hover { border-color: var(--cyan); color: var(--ink); }
.chip.on { background: rgba(200,255,77,0.12); border-color: var(--border-glow); color: var(--lime); }

.notice {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 16px;
  background: rgba(255, 209, 77, 0.08); border: 1px solid rgba(255, 209, 77, 0.3);
  border-radius: 10px; padding: 12px 15px; color: var(--gold); font-size: 0.85rem; line-height: 1.55;
}
.notice.member { background: rgba(200,255,77,0.07); border-color: rgba(200,255,77,0.3); color: var(--lime); }
.notice a { color: inherit; font-weight: 700; }
.err-line { color: var(--coral); margin: 12px 0 0; display: none; font-size: 0.9rem; }

/* ── Generating: staged progress ──────────────────────────────────────── */
.gen { display: none; }
.gen.on { display: block; }
.gen-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.gen-head h2 { font-family: var(--font-display); font-size: 1.15rem; margin: 0; }
.gen-elapsed {
  margin-left: auto; font-family: var(--font-mono); font-size: 0.86rem; color: var(--cyan);
  font-variant-numeric: tabular-nums;
}
.gen-sub { color: var(--ink-soft); font-size: 0.88rem; margin: 0 0 20px; }
.gen-steps { display: flex; flex-direction: column; gap: 2px; }
.gen-step {
  display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start;
  padding: 11px 0; border-bottom: 1px solid var(--border-soft); color: var(--ink-faint);
  transition: color .3s ease;
}
.gen-step:last-child { border-bottom: none; }
.gen-step .gs-ico { text-align: center; font-family: var(--font-mono); font-size: 0.85rem; }
.gen-step .gs-title { font-family: var(--font-display); font-weight: 600; font-size: 0.92rem; }
.gen-step .gs-desc { font-size: 0.82rem; margin-top: 2px; }
.gen-step.done { color: var(--ink-soft); }
.gen-step.done .gs-ico { color: var(--lime); }
.gen-step.live { color: var(--ink); }
.gen-step.live .gs-ico { color: var(--cyan); }
.gen-bar { height: 4px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 20px 0 0; }
.gen-bar span { display: block; height: 100%; width: 0%; background: var(--gradient-brand); transition: width 1s linear; }

.spinner {
  width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--cyan);
  border-radius: 50%; animation: spin 0.9s linear infinite; display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Exam room ────────────────────────────────────────────────────────── */
.exam { display: none; }
.exam.on { display: block; }

.exam-bar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: rgba(7, 11, 26, 0.92); backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 16px; margin-bottom: 16px; box-shadow: 0 6px 26px rgba(0,0,0,0.4);
}
.exam-id { min-width: 0; }
.exam-id .ei-title {
  font-family: var(--font-display); font-weight: 700; font-size: 0.96rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.exam-id .ei-meta { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-faint); margin-top: 2px; }
.exam-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.icon-btn {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--ink-soft);
  border-radius: 9px; width: 36px; height: 36px; display: grid; place-items: center;
  cursor: pointer; font-size: 0.95rem; transition: all .15s ease;
}
.icon-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.icon-btn.on { border-color: var(--border-glow); color: var(--lime); background: rgba(200,255,77,0.1); }

.timer {
  font-family: var(--font-mono); font-size: 1.05rem; font-variant-numeric: tabular-nums;
  color: var(--cyan); background: rgba(77, 240, 255, 0.08);
  border: 1px solid rgba(77, 240, 255, 0.3); border-radius: 9px; padding: 7px 14px;
}
.timer.low { color: var(--coral); border-color: rgba(255, 107, 74, 0.45); background: rgba(255, 107, 74, 0.09); animation: pulse 1.6s ease-in-out infinite; }
.timer.up { color: var(--ink-soft); border-color: var(--border); background: var(--surface-2); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.62; } }

/* Layout: sheet + navigator */
.exam-body { display: grid; grid-template-columns: minmax(0, 1fr) 208px; gap: 18px; align-items: start; }

/* ── The sheet ────────────────────────────────────────────────────────── */
.sheet { display: flex; flex-direction: column; gap: 12px; }
.q-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 20px 22px; scroll-margin-top: 84px;
  transition: border-color .2s ease;
}
.q-card:target, .q-card.current { border-color: rgba(77,240,255,0.4); }
.q-card.flagged { border-left: 3px solid var(--gold); }
.q-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 12px; }
.q-num { font-family: var(--font-display); font-weight: 700; color: var(--lime); font-size: 0.95rem; }
.q-cmd {
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--cyan); background: rgba(77, 240, 255, 0.08);
  border: 1px solid rgba(77, 240, 255, 0.24); border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.q-topic {
  font-size: 0.7rem; color: var(--violet); background: rgba(139, 92, 255, 0.1);
  border: 1px solid rgba(139, 92, 255, 0.3); border-radius: 999px; padding: 3px 10px;
}
.q-marks {
  margin-left: auto; font-size: 0.82rem; color: var(--ink-faint);
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
}
.q-flag {
  border: 1px solid var(--border); background: transparent; color: var(--ink-faint);
  border-radius: 8px; padding: 4px 9px; font-size: 0.74rem; cursor: pointer;
  font-family: var(--font-body); transition: all .15s ease;
}
.q-flag:hover { border-color: var(--gold); color: var(--gold); }
.q-flag.on { border-color: var(--gold); color: var(--gold); background: rgba(255,209,77,0.1); }
.q-text { font-size: 0.98rem; line-height: 1.65; margin-bottom: 14px; white-space: pre-wrap; }

.opt {
  display: flex; align-items: flex-start; gap: 11px; border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer;
  transition: all .12s ease; font-size: 0.93rem; line-height: 1.5;
}
.opt:hover { border-color: var(--cyan); background: var(--surface-2); }
.opt.picked { border-color: var(--lime); background: rgba(200, 255, 77, 0.08); }
.opt input { accent-color: #C8FF4D; margin-top: 3px; flex: 0 0 auto; }
.opt .ol { font-family: var(--font-mono); color: var(--ink-faint); flex: 0 0 auto; }
.opt.picked .ol { color: var(--lime); }
.opt.correct-reveal { border-color: var(--lime); background: rgba(200, 255, 77, 0.12); }
.opt.wrong-reveal { border-color: var(--coral); background: rgba(255, 107, 74, 0.1); }

.answer {
  width: 100%; min-height: 120px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--ink); padding: 13px 14px; font-family: var(--font-body);
  font-size: 0.94rem; line-height: 1.6; resize: vertical;
}
.answer:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(77,240,255,0.12); }
.answer-foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 7px; font-size: 0.76rem; color: var(--ink-faint); font-family: var(--font-mono);
}
.answer-foot .guide { color: var(--ink-soft); }
.saved-tick { color: var(--lime); opacity: 0; transition: opacity .3s ease; }
.saved-tick.show { opacity: 1; }

/* ── Navigator ────────────────────────────────────────────────────────── */
.qnav {
  position: sticky; top: 76px;
  background: rgba(13, 20, 40, 0.72); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px; backdrop-filter: blur(12px);
}
.qnav h3 {
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 11px;
}
.qnav-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.qnav-dot {
  aspect-ratio: 1; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-faint);
  border-radius: 8px; font-family: var(--font-mono); font-size: 0.76rem;
  transition: all .14s ease; font-variant-numeric: tabular-nums;
}
.qnav-dot:hover { border-color: var(--cyan); color: var(--ink); transform: scale(1.06); }
.qnav-dot.answered { background: rgba(200,255,77,0.14); border-color: var(--border-glow); color: var(--lime); }
.qnav-dot.flagged { border-color: var(--gold); color: var(--gold); }
.qnav-dot.flagged.answered { background: rgba(255,209,77,0.14); }
.qnav-dot.current { box-shadow: 0 0 0 2px var(--cyan); }
.qnav-legend { margin-top: 13px; display: flex; flex-direction: column; gap: 5px; font-size: 0.72rem; color: var(--ink-faint); }
.qnav-legend span { display: flex; align-items: center; gap: 7px; }
.qnav-legend i { width: 10px; height: 10px; border-radius: 3px; border: 1px solid var(--border); display: inline-block; }
.qnav-legend i.a { background: rgba(200,255,77,0.5); border-color: var(--border-glow); }
.qnav-legend i.f { border-color: var(--gold); background: rgba(255,209,77,0.35); }
.qnav-progress { margin-top: 13px; font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-soft); }
.qnav-progress b { color: var(--lime); font-weight: 400; }
.qnav .btn { width: 100%; justify-content: center; margin-top: 12px; }

/* ── Mobile action bar + navigator sheet ──────────────────────────────── */
.mobile-bar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
  background: rgba(7, 11, 26, 0.96); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border); padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  gap: 10px; align-items: center;
}
.mobile-bar .mb-prog { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-soft); }
.mobile-bar .mb-prog b { color: var(--lime); font-weight: 400; }
.mobile-bar .btn { flex: 1; justify-content: center; }
.qnav-sheet {
  position: fixed; inset: 0; z-index: 70; display: none;
  background: rgba(4, 6, 15, 0.72); backdrop-filter: blur(6px);
}
.qnav-sheet.open { display: block; }
.qnav-sheet-inner {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--surface-solid); border-top: 1px solid var(--border-glow);
  border-radius: 18px 18px 0 0; padding: 20px 18px calc(24px + env(safe-area-inset-bottom));
  max-height: 78vh; overflow-y: auto;
}
.qnav-sheet-inner .qnav-grid { grid-template-columns: repeat(6, 1fr); gap: 8px; }
.sheet-handle { width: 42px; height: 4px; border-radius: 999px; background: var(--border); margin: 0 auto 16px; }

/* ── PAPER MODE — a light sheet resting on the dark desk ──────────────── */
.exam.paper .sheet .q-card {
  background: #FBFBF8;
  border-color: #DCDCD3;
  color: #16181C;
  box-shadow: 0 1px 2px rgba(0,0,0,.28), 0 10px 30px rgba(0,0,0,.34);
}
.exam.paper .sheet .q-text,
.exam.paper .sheet .opt { font-family: Georgia, 'Times New Roman', serif; }
.exam.paper .sheet .q-text { color: #16181C; font-size: 1.03rem; line-height: 1.7; }
.exam.paper .sheet .q-num { color: #8A1020; }
.exam.paper .sheet .q-marks { color: #5C6470; }
.exam.paper .sheet .q-cmd { color: #0C6A6A; background: #E6F2F1; border-color: #9FCFCB; }
.exam.paper .sheet .q-topic { color: #5A3FA8; background: #F0EBFB; border-color: #C7B8EC; }
.exam.paper .sheet .q-flag { color: #6B7280; border-color: #D6D6CD; }
.exam.paper .sheet .q-flag.on { color: #8A6100; border-color: #C8A23A; background: #FBF3DC; }
.exam.paper .sheet .opt { border-color: #D9D9D0; color: #16181C; }
.exam.paper .sheet .opt:hover { border-color: #0C6A6A; background: #F1F5F4; }
.exam.paper .sheet .opt.picked { border-color: #8A1020; background: #FBEFF0; }
.exam.paper .sheet .opt .ol { color: #6B7280; }
.exam.paper .sheet .opt.picked .ol { color: #8A1020; }
.exam.paper .sheet .answer {
  background: #FFFFFF; border-color: #D0D0C6; color: #16181C;
  font-family: Georgia, 'Times New Roman', serif; line-height: 1.75;
  /* faint ruled lines, like an answer booklet */
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 27px, #EDEDE4 27px, #EDEDE4 28px);
}
.exam.paper .sheet .answer:focus { border-color: #0C6A6A; box-shadow: 0 0 0 3px rgba(12,106,106,.14); }
.exam.paper .sheet .answer-foot { color: #6B7280; }
.exam.paper .sheet .answer-foot .guide { color: #4A5260; }
.exam.paper .sheet .saved-tick { color: #0C6A6A; }
.exam.paper .sheet .q-card.flagged { border-left-color: #C8A23A; }

/* ── Submit confirmation ──────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; padding: 20px;
  background: rgba(4, 6, 15, 0.7); backdrop-filter: blur(8px); }
.modal.open { display: flex; }
.modal-card {
  max-width: 420px; width: 100%; background: var(--surface-solid);
  border: 1px solid var(--border-glow); border-radius: var(--radius);
  padding: 28px 26px; box-shadow: var(--shadow); text-align: center;
}
.modal-card h3 { font-family: var(--font-display); font-size: 1.2rem; margin: 10px 0 8px; }
.modal-card p { color: var(--ink-soft); line-height: 1.6; margin: 0 0 18px; font-size: 0.92rem; }
.modal-card .mrow { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.modal-stat { font-family: var(--font-mono); font-size: 0.84rem; color: var(--gold); margin-bottom: 4px; }

/* ── Results ──────────────────────────────────────────────────────────── */
.results { display: none; }
.results.on { display: block; }
.score-hero { text-align: center; padding: 12px 0 6px; }
.score-ring { position: relative; width: 148px; height: 148px; margin: 0 auto 14px; }
.score-ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.score-ring .ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 10; }
.score-ring .ring-fg { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.22,1,.36,1); }
.score-ring .ring-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 2.3rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.score-sub { color: var(--ink-soft); font-size: 0.95rem; }
.grade-badge {
  display: inline-block; margin-top: 12px; font-family: var(--font-display); font-weight: 700;
  font-size: 1rem; border-radius: 999px; padding: 7px 20px;
  border: 1px solid var(--border-glow); background: var(--surface-2);
}
.res-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }

.topic-bars { margin-top: 8px; }
.topic-bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 9px; }
.topic-bar-label { flex: 0 0 170px; font-size: 0.85rem; color: var(--ink-soft); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-bar-track { flex: 1; height: 11px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.topic-bar-fill { height: 100%; border-radius: 999px; width: 0; transition: width .9s cubic-bezier(.22,1,.36,1); }
.topic-bar-pct { flex: 0 0 44px; font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.chip-weak, .chip-strong {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px;
  padding: 6px 14px; font-size: 0.85rem; margin: 4px 6px 4px 0;
}
.chip-weak { background: rgba(255, 107, 74, 0.1); border: 1px solid rgba(255, 107, 74, 0.35); color: var(--coral); }
.chip-strong { background: rgba(200, 255, 77, 0.08); border: 1px solid rgba(200, 255, 77, 0.35); color: var(--lime); }

.review-verdict { font-family: var(--font-display); font-weight: 600; margin-top: 10px; font-size: 0.9rem; }
.review-verdict.good { color: var(--lime); }
.review-verdict.part { color: var(--gold); }
.review-verdict.bad { color: var(--coral); }
.model-answer {
  background: rgba(200, 255, 77, 0.06); border: 1px solid rgba(200, 255, 77, 0.25);
  border-radius: 10px; padding: 11px 15px; margin-top: 11px; font-size: 0.88rem; color: var(--ink-soft); line-height: 1.6;
}
.model-answer strong { color: var(--lime); }
.ms-box {
  background: rgba(77,240,255,0.05); border: 1px solid rgba(77,240,255,0.22);
  border-radius: 10px; padding: 11px 15px; margin-top: 10px; font-size: 0.87rem; color: var(--ink-soft);
}
.ms-box strong {
  color: var(--cyan); display: block; margin-bottom: 6px; font-size: 0.66rem;
  letter-spacing: 0.1em; text-transform: uppercase; font-family: var(--font-mono);
}
.ms-box ul { margin: 0; padding-left: 18px; }
.ms-box li { margin: 3px 0; line-height: 1.55; }
.your-answer { font-size: 0.88rem; color: var(--ink-soft); white-space: pre-wrap; line-height: 1.6;
  border-left: 2px solid var(--border); padding-left: 12px; margin: 4px 0 0; }
.feedback-line { font-size: 0.86rem; color: var(--ink-soft); margin-top: 9px; font-style: italic; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .exam-body { grid-template-columns: 1fr; }
  .qnav { display: none; }
  .mobile-bar { display: flex; }
  .exam { padding-bottom: 76px; }
  .exam-bar { padding: 9px 13px; gap: 10px; }
  .timer { font-size: 0.95rem; padding: 6px 11px; }
  /* Push the cookie banner clear of the exam action bar so it can never sit on
     top of Submit. `in-exam` is set on <body> only while a paper is open. */
  body.in-exam { --consent-lift: 62px; }
  /* Thumb-sized targets on touch screens. */
  .q-flag { min-height: 38px; padding: 8px 14px; }
  .icon-btn { width: 40px; height: 40px; }
  .btn.sm { padding: 10px 16px; }
  .opt { padding: 14px; }
  .chip { padding: 9px 14px; }
}
@media (max-width: 560px) {
  .gp-main { padding: 16px 12px 80px; }
  .gp-card { padding: 18px 16px; }
  .q-card { padding: 16px 15px; }
  .topic-bar-label { flex-basis: 104px; font-size: 0.78rem; }
  .quick-row { grid-template-columns: 1fr; }
  .exam-id .ei-title { font-size: 0.88rem; }
  .icon-btn { width: 34px; height: 34px; }
}

/* ── Print: a clean question paper ────────────────────────────────────── */
@media print {
  body { background: #fff !important; }
  .site-nav, .top-bar, .exam-bar, .qnav, .mobile-bar, .btn, .q-flag, .answer-foot, .site-footer { display: none !important; }
  .exam { display: block !important; }
  .q-card { background: #fff !important; border: none !important; border-bottom: 1px solid #ccc !important;
    color: #000 !important; box-shadow: none !important; page-break-inside: avoid; border-radius: 0 !important; }
  .q-text, .opt { color: #000 !important; font-family: Georgia, serif !important; }
  .answer { min-height: 150px; border: 1px solid #999 !important; background: #fff !important; }
}

/* ── Motion preferences ───────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* Visually hidden but announced by screen readers (timer warnings, status). */
.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;
}
