/* Ruang Latih — accessible study dashboard and audited question banks. */
:root {
  color-scheme: light;
  --ink: #1D2841;
  --muted: #526178;
  --subtle: #66748B;
  --purple: #5943D5;
  --purple-hover: #4530B4;
  --purple-soft: #F0EDFF;
  --teal: #087E6C;
  --teal-soft: #E5F5EF;
  --red: #B42D46;
  --red-soft: #FFF0F3;
  --amber: #875700;
  --amber-soft: #FFF4D8;
  --white: #FFFFFF;
  --canvas: #F4F6FB;
  --line: #DCE2ED;
  --control-line: #8592A8;
  --radius: 16px;
  --shadow: 0 6px 24px rgb(29 40 65 / 5%);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 24px; }
body { margin: 0; min-width: 280px; min-height: 100vh; font-size: 16px; line-height: 1.6; }
button, input, select, textarea { font: inherit; }
button, select, summary { cursor: pointer; }
button { touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: .5; }
input, select, textarea { min-width: 0; }
button, a, input, select, summary, [tabindex] { -webkit-tap-highlight-color: transparent; }
:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 3px;
}
a { color: var(--purple); text-underline-offset: .2em; }
a:hover { color: var(--purple-hover); }
img, svg { vertical-align: middle; }
img { max-width: 100%; height: auto; }
svg { width: 20px; height: 20px; flex: none; }
h1, h2, h3, h4, p { overflow-wrap: break-word; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.3; }
h1, h2, h3, h4, figure { margin: 0; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
[hidden] { display: none !important; }
.sr-only, .visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link { position: fixed; left: 16px; top: -100px; z-index: 150; padding: 12px 18px; background: var(--white); border: 2px solid var(--purple); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); }
.lead { font-size: 16px; line-height: 1.7; }
.eyebrow, .panel-label, .pack-kicker {
  color: var(--purple); font-size: 12px; line-height: 1.5;
  font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
}
.page-title { margin: 5px 0 8px; font-size: clamp(25px, 2.7vw, 32px); letter-spacing: -.035em; }
.section-title { font-size: 20px; font-weight: 750; letter-spacing: -.02em; }
.section-caption { margin-top: 6px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.row-between > *, .top-left, .top-right, .dashboard-grid > *, .quiz-layout > * { min-width: 0; }

/* Persistent shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; align-self: flex-start; flex: 0 0 210px;
  width: 210px; height: 100vh; height: 100dvh; overflow-y: auto;
  padding: 25px 13px 18px; display: flex; flex-direction: column;
  background: var(--white); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 7px; margin-bottom: 29px; }
.brand-mark { display: grid; place-items: center; flex: none; width: 39px; height: 39px; border-radius: 12px; color: var(--white); background: var(--purple); font-size: 24px; font-weight: 850; }
.brand-name { font-size: 17px; font-weight: 800; line-height: 1.2; letter-spacing: -.035em; }
.brand-sub { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .07em; }
.nav-label { margin: 0 11px 10px; color: var(--subtle); font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.nav-list { display: grid; gap: 5px; }
.nav-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 47px; padding: 11px 10px; border: 1px solid transparent; border-radius: 10px; color: var(--muted); background: transparent; text-align: left; font-size: 14px; font-weight: 650; line-height: 1.4; }
.nav-btn svg { width: 19px; height: 19px; }
.nav-btn:hover { background: var(--canvas); color: var(--ink); }
.nav-btn.active, .nav-btn[aria-current="page"] { color: var(--purple); background: var(--purple-soft); font-weight: 750; }
.side-bottom { margin-top: auto; padding: 16px 11px 3px; border-top: 1px solid var(--line); }
.side-bottom .mini-cap { color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: .07em; }
.side-bottom strong { display: block; margin: 7px 0; font-size: 14px; line-height: 1.5; }
.side-bottom p { color: var(--muted); font-size: 12px; line-height: 1.7; }
.main { flex: 1 1 0; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 72px; padding: 12px 28px; background: var(--white); border-bottom: 1px solid var(--line); }
.top-left { flex: 1; display: flex; align-items: center; gap: 10px; }
.page-crumb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 14px; line-height: 1.6; }
.page-crumb strong { color: var(--ink); font-weight: 650; }
.top-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.name-label { display: block; color: var(--muted); font-size: 11px; line-height: 1.4; font-weight: 750; margin-bottom: 4px; }
.name-input { width: 195px; min-height: 44px; padding: 9px 12px; border: 1px solid var(--control-line); border-radius: 9px; background: var(--white); color: var(--ink); font-size: 15px; }
.avatar { display: grid; place-items: center; width: 39px; height: 39px; flex: none; border-radius: 12px; background: var(--purple-soft); color: var(--purple); font-size: 17px; font-weight: 800; }
.content { width: 100%; max-width: 1220px; margin-inline: auto; padding: 27px 28px 52px; min-width: 0; }
.mobile-header, .mobile-bottom { display: none; }

/* Shared controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px; max-width: 100%; padding: 11px 17px; border: 1px solid transparent; border-radius: 10px; font-size: 15px; font-weight: 700; line-height: 1.4; text-align: center; text-decoration: none; transition: background-color .15s, border-color .15s, box-shadow .15s; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--purple); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--purple-hover); color: var(--white); box-shadow: 0 4px 12px rgb(89 67 213 / 18%); }
.btn-outline { border-color: var(--control-line); background: var(--white); color: var(--ink); }
.btn-outline:hover:not(:disabled) { border-color: var(--purple); color: var(--purple); background: #F8F6FF; }
.btn-soft { background: var(--purple-soft); color: var(--purple); }
.btn-soft:hover:not(:disabled) { background: #E5DFFF; color: var(--purple-hover); }
.btn-light { border-color: var(--line); color: var(--purple); background: var(--white); }
.btn-dark { color: var(--white); background: #26364F; }
.btn-dark:hover:not(:disabled) { background: #18273E; color: var(--white); }
.btn-teal { color: var(--white); background: var(--teal); }
.btn-teal:hover:not(:disabled) { color: var(--white); background: #086653; }
.btn-sm { min-height: 44px; padding: 9px 13px; font-size: 14px; }
.btn-full, .full-width { width: 100%; }
.btn-link { min-height: 44px; border: 0; padding: 8px 5px; background: transparent; color: var(--purple); text-decoration: underline; text-underline-offset: 3px; font-weight: 650; }
.chev { font-size: 22px; line-height: 1; }
.filter-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.filter-btn { min-height: 44px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); color: var(--muted); font-size: 14px; line-height: 1.4; font-weight: 650; }
.filter-btn:hover { color: var(--purple); border-color: var(--purple); }
.filter-btn.active, .filter-btn[aria-pressed="true"] { background: var(--purple-soft); color: var(--purple); border-color: #B8ACEE; font-weight: 750; }
.badge, .pill, .status { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; border-radius: 999px; padding: 5px 10px; font-size: 12px; line-height: 1.45; font-weight: 700; }
.badge { background: var(--teal-soft); color: #086451; }
.badge.neutral { background: #EDF0F6; color: var(--muted); }
.badge.purple, .pill { background: var(--purple-soft); color: var(--purple); }
.badge.teal, .pill.teal { background: var(--teal-soft); color: #086451; }
.pill.gray { background: #EDF0F6; color: var(--muted); }
.pill svg { width: 15px; height: 15px; }
.notice { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: var(--white); font-size: 14px; line-height: 1.75; }
.notice > svg { color: var(--purple); margin-top: 3px; }
.notice strong { color: var(--ink); }
.footer-note { margin-top: 25px; color: var(--muted); font-size: 13px; line-height: 1.7; text-align: center; }
.empty-state { margin-top: 18px; padding: 30px 22px; border: 1px dashed #A8B2C5; border-radius: 14px; text-align: center; background: var(--white); }
.empty-state h3 { margin: 0 0 8px; font-size: 19px; }
.empty-state p { color: var(--muted); font-size: 15px; line-height: 1.7; margin-bottom: 18px; }
.empty-state.compact { padding: 18px; margin-top: 0; }
.empty-note, .small-note { color: var(--muted); font-size: 14px; line-height: 1.7; }

/* Compact dashboard: one subject and one package at a time. */
.dashboard-intro { margin-bottom: 22px; }
.dashboard-intro h1 { margin: 6px 0 8px; font-size: clamp(27px, 3vw, 34px); line-height: 1.2; font-weight: 800; letter-spacing: -.04em; }
.dashboard-intro p { max-width: 760px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.7; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(285px, .95fr); align-items: start; gap: 22px; }
.picker-card, .progress-card { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); padding: 24px; box-shadow: var(--shadow); }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.card-heading h2, .card-heading h3 { font-size: 20px; font-weight: 750; letter-spacing: -.025em; }
.card-heading p { color: var(--muted); font-size: 14px; line-height: 1.65; margin: 5px 0 0; }
.card-heading > svg { width: 24px; height: 24px; color: var(--purple); }
.field { display: flex; flex-direction: column; min-width: 0; gap: 7px; margin-bottom: 17px; }
.field label, .field > span:first-child, .field-label { font-size: 14px; line-height: 1.5; font-weight: 700; color: var(--ink); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 11px 12px; border: 1px solid var(--control-line);
  border-radius: 9px; background: var(--white); color: var(--ink); font-size: 16px; line-height: 1.5;
}
.field select { padding-right: 32px; text-overflow: ellipsis; }
.field input::placeholder, .modal input::placeholder { color: var(--subtle); opacity: 1; }
.field input:hover, .field select:hover { border-color: var(--purple); }
.field small, .field-hint { color: var(--muted); font-size: 13px; line-height: 1.55; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.subject-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 19px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--canvas); }
.subject-switch button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; min-width: 0; padding: 9px; border: 1px solid transparent; border-radius: 8px; color: var(--muted); background: transparent; font-size: 14px; font-weight: 700; line-height: 1.4; }
.subject-switch button.selected, .subject-switch button[aria-pressed="true"] { color: var(--purple); background: var(--white); border-color: #C5BCEF; box-shadow: 0 2px 7px rgb(29 40 65 / 6%); }
.subject-switch button[data-subject="math"].selected, .subject-switch button[data-subject="math"][aria-pressed="true"] { color: var(--teal); border-color: #83BEB0; }
.subject-switch button:hover:not(.selected) { color: var(--ink); background: #E9EDF5; }
.subject-switch svg { width: 19px; height: 19px; }
.selected-pack { border: 1px solid #DAD3F4; border-radius: 12px; padding: 19px; background: #F8F6FF; }
.selected-pack.math { border-color: #C3E2D9; background: #F2FAF7; }
.selected-pack h2, .selected-pack h3, .pack-title { margin: 5px 0 10px; font-size: 22px; font-weight: 750; line-height: 1.35; letter-spacing: -.025em; }
.selected-pack > p { color: var(--muted); font-size: 14px; line-height: 1.7; margin: 10px 0 0; }
.selected-pack.math .pack-kicker { color: var(--teal); }
.pack-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin: 10px 0; color: var(--muted); font-size: 14px; }
.pack-meta .badge { border: 1px solid var(--line); background: var(--white); color: var(--muted); }
.pack-topics { color: var(--muted); font-size: 14px; line-height: 1.8; margin: 11px 0 0; overflow-wrap: anywhere; }
ul.pack-topics { padding-left: 20px; }
.pack-topics strong { color: var(--ink); font-weight: 650; }
.picker-actions { display: grid; gap: 10px; margin-top: 19px; }
.picker-actions > .btn-primary, .picker-actions > .btn-dark, .picker-actions > .btn-teal { width: 100%; min-height: 50px; font-size: 16px; }
.picker-actions p { color: var(--muted); text-align: center; font-size: 13px; line-height: 1.6; }
.progress-aside, .dashboard-aside, .dashboard-grid > aside { display: grid; align-content: start; gap: 18px; min-width: 0; }
.progress-card { padding: 20px; }
.progress-card .card-heading { margin-bottom: 16px; }
.progress-card .card-heading h2, .progress-card .card-heading h3 { font-size: 18px; }
.quick-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick-stat, .quick-stats > div, .quick-stats > article { min-width: 0; padding: 14px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; }
.quick-stats strong, .quick-stats .stat-v { display: block; margin: 4px 0; color: var(--ink); font-size: 27px; line-height: 1.2; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.quick-stats span, .quick-stats small, .quick-stats .stat-k { color: var(--muted); font-size: 13px; line-height: 1.45; }
.quick-stats svg { margin-bottom: 5px; width: 19px; height: 19px; color: var(--purple); }
.quick-stats .teal svg, .quick-stats .green svg { color: var(--teal); }
.resume-list, .recent-list { display: grid; gap: 9px; padding: 0; margin: 0; list-style: none; }
.resume-row, .recent-row { display: flex; align-items: center; justify-content: space-between; gap: 11px; min-width: 0; padding: 13px 0; border-bottom: 1px solid var(--line); }
.resume-row:last-child, .recent-row:last-child { border-bottom: 0; padding-bottom: 0; }
.resume-row:first-child, .recent-row:first-child { padding-top: 0; }
.resume-row > div, .recent-row > div { min-width: 0; }
.resume-row strong, .recent-row strong { display: block; font-size: 14px; line-height: 1.55; font-weight: 700; }
.resume-row small, .recent-row small, .resume-row p, .recent-row p { display: block; color: var(--muted); font-size: 12px; line-height: 1.65; margin: 3px 0 0; }
.resume-row .btn, .recent-row .btn { flex-shrink: 0; padding-inline: 10px; font-size: 13px; }
.recent-score { color: var(--teal); font-size: 20px; line-height: 1.3; font-weight: 800; white-space: nowrap; }
.mini-progress, .progress-wrap { overflow: hidden; border-radius: 999px; background: #E1E6F0; }
.mini-progress { height: 6px; margin-top: 8px; }
.mini-progress i, .mini-progress span { display: block; height: 100%; border-radius: inherit; background: var(--purple); }
.how-it-works { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 23px 0 0; padding: 19px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.how-it-works > div, .how-it-works > article, .how-it-works > li { min-width: 0; }
.how-it-works > h2 { grid-column: 1 / -1; font-size: 18px; }
.how-it-works strong, .how-it-works h3 { display: block; color: var(--ink); font-size: 14px; line-height: 1.5; font-weight: 750; margin-bottom: 4px; }
.how-it-works p { font-size: 13px; color: var(--muted); line-height: 1.7; }
.step-number { display: inline-grid; place-items: center; width: 25px; height: 25px; margin-right: 7px; border-radius: 8px; background: var(--purple-soft); color: var(--purple); font-size: 12px; font-weight: 800; }
.info-details { margin-top: 19px; padding: 0 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); font-size: 14px; color: var(--muted); line-height: 1.75; }
.info-details summary { min-height: 48px; padding: 12px 0; color: var(--ink); font-weight: 700; }
.info-details summary::marker { color: var(--purple); }
.info-details[open] { padding-bottom: 16px; }
.info-details[open] summary { margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.info-details p, .info-details ul, .info-details ol { margin: 10px 0; }
.info-details ul, .info-details ol { padding-left: 22px; }

/* Exam layout, passage, diagrams and tables */
.quiz-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 15px 20px; margin-bottom: 16px; }
.quiz-toolbar > div:first-child { min-width: 0; flex: 1 1 300px; }
.quiz-toolbar h1, .quiz-toolbar .page-title { margin: 7px 0 4px; font-size: clamp(23px, 2.5vw, 29px); letter-spacing: -.03em; line-height: 1.3; }
.quiz-toolbar p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.quiz-toolbar .exam-meta { margin-bottom: 6px; }
.exam-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 11px; }
.time-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 11px; min-width: 155px; padding: 10px 15px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.time-card strong, .time-card #elapsed, .time-card #timer { color: var(--ink); font-size: 22px; font-weight: 750; line-height: 1.3; letter-spacing: -.02em; }
.time-card small { font-size: 12px; }
.time-card.warning, .time-card.urgent { color: var(--red); border-color: #D87080; background: var(--red-soft); }
.time-card.warning strong, .time-card.urgent strong { color: var(--red); }
.quiz-progress { margin: 0 0 21px; }
.progress-wrap { height: 8px; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--purple); transition: width .2s ease; }
.quiz-progress progress { display: block; width: 100%; height: 8px; border: 0; border-radius: 999px; accent-color: var(--purple); overflow: hidden; }
.quiz-progress progress::-webkit-progress-bar { background: #E1E6F0; }
.quiz-progress progress::-webkit-progress-value { background: var(--purple); border-radius: 999px; }
.quiz-progress progress::-moz-progress-bar { background: var(--purple); }
.exam-info, .progress-label { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-top: 9px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.quiz-layout { display: grid; align-items: start; gap: 20px; min-width: 0; }
.quiz-layout.bi, .exam-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.06fr); gap: 20px; align-items: start; }
.quiz-layout.math { grid-template-columns: minmax(0, 1fr) 292px; }
.quiz-layout.bi > .question-navigator { grid-column: 1 / -1; }
.question-panel, .reading-panel { min-width: 0; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.reading-panel { position: sticky; top: 24px; max-height: calc(100dvh - 48px); overflow-y: auto; scrollbar-gutter: stable; }
.quiz-layout.bi > .reading-panel { position: static; }
.reading-panel h2, .reading-panel h3 { font-size: 23px; line-height: 1.35; letter-spacing: -.025em; margin: 11px 0 17px; }
.reading-text { color: #27354D; font-size: 16px; line-height: 1.85; overflow-wrap: break-word; }
.passage-paragraph { margin: 0 0 1em; }
.passage-paragraph:last-child { margin-bottom: 0; }
.reading-text.poetry, .reading-text.poem { white-space: pre-line; }
.reading-hint { padding: 13px 15px; margin-top: 20px; border-radius: 10px; color: var(--muted); background: var(--canvas); font-size: 13px; line-height: 1.75; }
.reading-hint svg { width: 16px; height: 16px; margin-right: 5px; color: var(--purple); }
.question-title { margin: 16px 0 18px; font-size: clamp(18px, 1.65vw, 21px); line-height: 1.65; font-weight: 700; letter-spacing: -.015em; overflow-wrap: break-word; }
.question-instruction { margin: -7px 0 16px; color: #315C40; font-size: 14px; line-height: 1.5; font-weight: 600; }
.question-panel > .panel-label { font-size: 12px; }
.hint-small { margin: 0 0 13px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.question-media { margin: 18px 0 20px; min-width: 0; background: var(--white); }
.question-media img { display: block; width: auto; max-width: 100%; max-height: 460px; height: auto; object-fit: contain; margin: 0 auto; background: var(--white); }
.diagram-button { display: block; width: 100%; min-height: 44px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--white); color: var(--muted); cursor: zoom-in; }
.diagram-button:hover { border-color: var(--purple); }
.diagram-button img { pointer-events: none; }
.diagram-button span, .diagram-caption, .question-media figcaption { display: block; color: var(--muted); font-size: 13px; line-height: 1.7; margin-top: 9px; text-align: left; }
.diagram-button .zoom-label { color: var(--purple); text-align: center; font-weight: 650; }
.stimulus-table-wrapper { max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; margin: 18px 0; border: 1px solid #B7C2D2; border-radius: 10px; background: var(--white); }
.stimulus-table { width: 100%; border-collapse: collapse; table-layout: auto; color: var(--ink); font-size: 15px; line-height: 1.6; }
.stimulus-table th, .stimulus-table td { padding: 12px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; overflow-wrap: break-word; }
.stimulus-table th { color: #26364E; background: #EAF0F7; font-weight: 750; }
.stimulus-table tr:last-child td { border-bottom: 0; }
.stimulus-table :is(th, td):last-child { border-right: 0; }
.stimulus-table caption { padding: 12px 14px; font-weight: 700; text-align: left; background: var(--white); }
.stimulus-table td .math-frac, .stimulus-table th .math-frac { margin-block: 3px; }

/* Native selection controls remain visible and keyboard accessible. */
.question-options, .options { display: grid; gap: 11px; }
.option { display: grid; grid-template-columns: 20px 27px minmax(0, 1fr); align-items: start; gap: 11px; min-height: 58px; width: 100%; padding: 14px; border: 1px solid var(--control-line); border-radius: 11px; color: var(--ink); background: var(--white); font-size: 16px; line-height: 1.7; text-align: left; cursor: pointer; transition: background-color .15s, border-color .15s; }
.option:hover { border-color: var(--purple); background: #FAF9FF; }
.option.selected, .option:has(input:checked) { color: #302373; background: var(--purple-soft); border-color: var(--purple); box-shadow: inset 0 0 0 1px var(--purple); }
.option:has(input:focus-visible), .category-actions label:has(input:focus-visible) { outline: 3px solid var(--purple); outline-offset: 3px; }
.option input[type="radio"], .option input[type="checkbox"], .category-actions input { width: 20px; height: 20px; min-width: 20px; margin: 4px 0 0; accent-color: var(--purple); cursor: pointer; }
.opt-letter, .opt-mark { display: inline-grid; place-items: center; width: 27px; min-height: 27px; border-radius: 7px; color: var(--muted); background: #EDF0F6; font-size: 13px; font-weight: 800; }
.option.selected .opt-letter, .option:has(input:checked) .opt-letter { color: var(--white); background: var(--purple); }
.option-copy { min-width: 0; overflow-wrap: break-word; }
.option-copy .math-frac { margin-block: 2px; }
.category-list { display: grid; gap: 0; min-width: 0; }
.category-list > .category-row:last-child { margin-bottom: 0; }
.category-row { min-inline-size: 0; min-width: 0; margin: 0 0 13px; padding: 14px 16px 16px; border: 1px solid var(--control-line); border-radius: 11px; background: var(--white); }
.category-row legend { max-width: 100%; padding: 0 6px; color: var(--ink); font-size: 16px; font-weight: 600; line-height: 1.75; overflow-wrap: break-word; }
.category-row p { margin: 0 0 13px; font-size: 16px; line-height: 1.75; }
.category-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.category-actions label, .category-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px; padding: 10px 15px; border: 1px solid var(--control-line); border-radius: 9px; color: var(--ink); background: var(--white); font-size: 15px; line-height: 1.5; cursor: pointer; }
.category-actions input { margin: 0; }
.category-actions label.selected, .category-actions label:has(input:checked), .category-actions button.selected { color: var(--purple); border-color: var(--purple); background: var(--purple-soft); box-shadow: inset 0 0 0 1px var(--purple); }
.category-actions label:hover, .category-actions button:hover { border-color: var(--purple); }
.exam-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 23px; padding-top: 18px; border-top: 1px solid var(--line); }
.exam-bottom .btn { flex: 1 1 auto; min-height: 46px; padding-inline: 12px; font-size: 14px; }
.question-navigator { min-width: 0; padding: 19px; margin-top: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); }
.quiz-layout.math > .question-navigator { position: sticky; top: 24px; margin-top: 0; padding: 18px; }
.question-navigator h2, .question-navigator h3, .question-navigator .section-title { font-size: 17px; line-height: 1.4; }
.question-navigator > p { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 6px 0 0; }
.question-navigator .row-between { gap: 10px; }
.quiz-layout.math .question-navigator .row-between { align-items: flex-start; }
.quiz-layout.math .question-navigator .row-between .btn { width: 100%; }
.number-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); gap: 7px; margin-top: 16px; }
.quiz-layout.math .number-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.number-btn, .number-grid > button { display: grid; place-items: center; position: relative; min-width: 44px; min-height: 44px; padding: 4px; border: 1px solid #9BA7BA; border-radius: 9px; color: var(--muted); background: var(--white); font-size: 14px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.2; }
.number-btn:hover, .number-grid > button:hover { border-color: var(--purple); color: var(--purple); }
.number-btn.answered:not(.active) { border-color: #70AA9B; color: #086451; background: var(--teal-soft); }
.number-btn.answered:not(.active)::before { content: ""; position: absolute; bottom: 5px; left: calc(50% - 7px); width: 14px; height: 2px; background: currentColor; border-radius: 2px; }
.number-btn.active, .number-btn[aria-current="step"], .number-btn[aria-current="true"] { color: var(--white); background: var(--purple); border-color: var(--purple); }
.number-btn.flagged::after { content: ""; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border: 1px solid #6C4700; border-radius: 2px; background: #F4BE4F; box-shadow: 0 0 0 1px var(--white); }
.legend { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-top: 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend i, .legend-dot { display: inline-block; width: 11px; height: 11px; flex: none; border: 1px solid #95A2B6; border-radius: 3px; }
.legend .answered { background: var(--teal-soft); border-color: #70AA9B; }
.legend .current { background: var(--purple); border-color: var(--purple); }
.legend .flagged { background: #F4BE4F; border-color: #6C4700; }
.navigator-actions { display: grid; gap: 8px; margin-top: 18px; }
.navigator-actions .btn { width: 100%; }

/* Exact fractions from the question engine. */
.math-frac { display: inline-flex; flex-direction: column; align-items: stretch; justify-content: center; min-width: .7em; margin-inline: .1em; font-family: "Cambria Math", Cambria, Georgia, serif; font-size: 1em; line-height: 1.08; text-align: center; vertical-align: middle; white-space: nowrap; }
.math-num { display: block; padding: 0 .14em .08em; border-bottom: 1px solid currentColor; }
.math-den { display: block; padding: .08em .14em 0; }
.math-mixed { display: inline-flex; align-items: center; gap: .1em; vertical-align: middle; white-space: nowrap; }
.math-whole { display: inline-block; line-height: 1.1; }
.math-mixed .math-frac { margin-inline: 0; }

/* Results and explanatory review */
.result-hero { display: flex; align-items: center; gap: 25px; padding: 25px; margin: 22px 0; background: #F0EDFF; border: 1px solid #DAD3F4; border-radius: var(--radius); }
.score-circle { display: grid; place-items: center; position: relative; width: 130px; height: 130px; min-width: 130px; border-radius: 50%; background: conic-gradient(var(--purple) var(--pct, 0%), #D5CFF0 var(--pct, 0%)); }
.score-circle::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--white); }
.score-circle > div { position: relative; text-align: center; }
.score-circle strong { display: block; font-size: 38px; font-weight: 800; letter-spacing: -.04em; line-height: 1.15; color: #372578; font-variant-numeric: tabular-nums; }
.score-circle span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
.result-copy { min-width: 0; }
.result-copy h1, .result-copy h2 { margin: 7px 0 9px; font-size: 26px; letter-spacing: -.03em; line-height: 1.3; }
.result-copy p { color: var(--muted); font-size: 15px; line-height: 1.75; }
.result-stats { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.result-chip { min-width: 95px; padding: 11px 14px; border: 1px solid #DAD3F4; border-radius: 10px; background: var(--white); color: var(--muted); font-size: 13px; }
.result-chip strong { display: block; margin-bottom: 3px; color: var(--ink); font-size: 22px; font-weight: 750; line-height: 1.3; font-variant-numeric: tabular-nums; }
.review-list { display: grid; gap: 13px; margin-top: 18px; }
.review-card { min-width: 0; padding: 18px 20px; border: 1px solid var(--line); border-left: 4px solid #A3ADC0; border-radius: 12px; background: var(--white); overflow-wrap: break-word; }
.review-card.correct { border-left-color: var(--teal); }
.review-card.wrong { border-left-color: var(--red); }
.review-card.skipped { border-left-color: #A16A0B; }
.review-card > summary { display: flex; align-items: center; gap: 13px; min-height: 58px; margin: -18px -20px; padding: 17px 20px; list-style: none; font-size: 15px; font-weight: 650; }
.review-card > summary::-webkit-details-marker { display: none; }
.review-card > summary::after { content: "+"; flex: none; margin-left: auto; font-size: 24px; line-height: 1; color: var(--purple); }
.review-card[open] > summary { margin-bottom: 17px; border-bottom: 1px solid var(--line); }
.review-card[open] > summary::after { content: "−"; }
.review-card > summary .review-head { flex: 1; margin: 0; min-width: 0; }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.review-head > div { min-width: 0; }
.review-card h3 { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.7; }
.status { flex-shrink: 0; color: #086451; background: var(--teal-soft); font-size: 12px; }
.status.wrong { color: #98223A; background: var(--red-soft); }
.status.skipped { color: #775000; background: var(--amber-soft); }
.review-answer { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin: 16px 0; }
.answer-box { min-width: 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); }
.answer-box > span { display: block; color: var(--muted); margin-bottom: 7px; font-size: 12px; line-height: 1.5; font-weight: 700; letter-spacing: .04em; }
.answer-box > strong { display: block; color: var(--ink); font-size: 15px; font-weight: 650; line-height: 1.8; overflow-wrap: break-word; }
.explanation { padding: 16px 18px; border-left: 3px solid var(--purple); border-radius: 0 10px 10px 0; background: #F5F3FF; color: #35425B; font-size: 15px; line-height: 1.85; }
.explanation > strong { display: block; margin-bottom: 7px; color: var(--purple); font-size: 13px; font-weight: 750; }
.solution-steps { color: #35425B; font-size: 16px; line-height: 1.85; }
.solution-steps ol, ol.solution-steps { margin: 10px 0; padding-left: 25px; }
.solution-steps li { padding-left: 3px; }
.solution-steps li + li { margin-top: 8px; }
.review-stimulus { margin: 14px 0; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); font-size: 15px; line-height: 1.85; color: #35425B; }
.review-stimulus summary { min-height: 46px; padding: 11px 0; font-size: 14px; font-weight: 700; color: var(--purple); }
.review-stimulus[open] { padding-bottom: 14px; }
.review-options, .review-checks { display: grid; gap: 8px; margin: 15px 0; }
.review-option, .review-item { min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); color: #35425B; font-size: 15px; line-height: 1.8; }
.review-option > span:first-child { margin-right: 5px; font-weight: 800; color: var(--muted); }
.review-option b { display: inline-block; margin-left: 8px; font-size: 12px; color: #086451; }
.review-option.key, .review-item.ok { border-color: #A6D0C2; background: #F0FAF5; }
.review-option.user-wrong, .review-item.bad { border-color: #D9A0AA; background: #FFF3F5; }
.review-option.user-wrong b { color: #98223A; }
.review-item { display: flex; justify-content: space-between; gap: 12px; }
.review-item > div { min-width: 0; }
.review-item strong { font-weight: 650; color: var(--ink); }
.review-item small { display: block; margin-top: 5px; color: var(--muted); font-size: 14px; line-height: 1.75; }
.review-item > b { flex: none; font-size: 18px; color: var(--teal); }
.review-item.bad > b { color: var(--red); }
.review-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 23px; }

/* History and dialogs */
.table-wrap { min-width: 0; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; margin-top: 20px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; }
.history-table { width: 100%; min-width: 650px; border-collapse: collapse; font-size: 15px; line-height: 1.6; text-align: left; }
.history-table th { padding: 14px 16px; background: #EAF0F7; color: #35425B; font-size: 12px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.history-table td { padding: 15px 16px; border-top: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
.history-table strong { color: var(--ink); font-weight: 700; }
.history-table .muted { font-size: 13px; }
.history-table .btn { white-space: nowrap; }
.download-heading { margin-bottom: 20px; }
.download-heading .lead { max-width: 680px; }
.download-list { display: grid; gap: 12px; margin-top: 22px; }
.download-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 13px; background: var(--white); }
.download-detail { min-width: 0; }
.download-subject { display: block; margin-bottom: 4px; color: var(--purple); font-size: 12px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.download-detail h2 { margin: 0; color: var(--ink); font-size: 18px; line-height: 1.4; }
.download-detail p { margin: 5px 0 8px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.download-grade { display: inline-block; color: var(--purple); font-size: 14px; font-weight: 800; }
.download-card > .btn { flex: none; }
.modal-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; overflow-y: auto; background: rgb(20 29 53 / 56%); overscroll-behavior: contain; }
.modal { width: 100%; max-width: 480px; max-height: calc(100dvh - 48px); overflow-y: auto; padding: 26px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); box-shadow: 0 22px 70px rgb(10 20 43 / 25%); }
.modal h2, .modal h3 { margin: 0 0 10px; font-size: 23px; line-height: 1.35; letter-spacing: -.025em; }
.modal p { margin: 0 0 15px; color: var(--muted); font-size: 15px; line-height: 1.75; }
.modal label { display: block; margin: 17px 0 7px; font-size: 14px; font-weight: 700; }
.modal input:not([type="checkbox"]):not([type="radio"]) { display: block; width: 100%; min-height: 48px; padding: 11px 12px; color: var(--ink); background: var(--white); border: 1px solid var(--control-line); border-radius: 9px; font-size: 16px; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.modal-wide, .modal.diagram-modal, .modal.image-modal, .modal.zoom-modal { max-width: 1000px; }
.modal img, .zoom-image, .diagram-dialog img { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(100dvh - 180px); object-fit: contain; background: var(--white); margin-inline: auto; }
.modal-close { display: grid; place-items: center; width: 44px; height: 44px; margin-left: auto; border: 1px solid var(--control-line); border-radius: 9px; color: var(--ink); background: var(--white); }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: min(460px, calc(100vw - 32px)); padding: 13px 18px; border-radius: 11px; background: #25344F; color: var(--white); box-shadow: 0 8px 28px rgb(20 29 53 / 18%); font-size: 14px; line-height: 1.6; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translateY(0); }

/* Final app markup: dashboard activity, exam tools and detailed review. */
.brand { color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.page-crumb { min-width: 0; flex: 1; }
.page-crumb > span { margin-inline: 8px; color: var(--subtle); }
.participant-name { max-width: 225px; color: var(--ink); font-size: 14px; line-height: 1.4; font-weight: 650; text-align: right; overflow-wrap: anywhere; }
.participant-name small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.4; }
.side-bottom > span { display: block; margin-top: 9px; color: var(--muted); font-size: 12px; font-weight: 650; }
.picker-card > .card-heading { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: start; gap: 7px 11px; }
.picker-card > .card-heading > .badge { grid-column: 2; justify-self: start; margin-top: 2px; }
.section-step { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--purple-soft); color: var(--purple); font-size: 15px; font-weight: 800; }
.progress-card > h2 { margin-bottom: 15px; font-size: 18px; letter-spacing: -.02em; }
.pack-kicker { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.pack-kicker .badge { font-size: 11px; letter-spacing: 0; text-transform: none; }
.badge.draft { background: var(--amber-soft); color: #775000; }
.pack-meta > span { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }
.pack-meta svg { width: 16px; height: 16px; }
.draft-progress { margin-top: 16px; }
.draft-progress > div:first-child, .quiz-progress > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.draft-progress strong, .quiz-progress > div:first-child strong { color: var(--purple); font-variant-numeric: tabular-nums; }
.last-score { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 15px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--white); font-size: 14px; }
.last-score strong { color: var(--purple); font-size: 18px; font-variant-numeric: tabular-nums; }
.text-button { display: inline-flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 7px; min-height: 44px; max-width: 100%; padding: 9px 4px; border: 1px solid transparent; border-radius: 8px; color: var(--purple); background: transparent; font-size: 14px; font-weight: 650; line-height: 1.5; text-align: center; }
.text-button svg { width: 17px; height: 17px; }
.text-button:hover:not(:disabled) { color: var(--purple-hover); text-decoration: underline; text-underline-offset: 3px; }
.progress-card > .text-button { width: 100%; justify-content: space-between; margin-top: 13px; border-top: 1px solid var(--line); border-radius: 0; padding-top: 13px; padding-bottom: 0; }
.save-hint { display: flex; align-items: flex-start; gap: 8px; margin: 18px 0 0; color: var(--muted); font-size: 13px; line-height: 1.75; }
.save-hint svg { flex: none; margin-top: 3px; width: 17px; height: 17px; color: var(--teal); }
.study-note { padding: 20px; border: 1px solid #BBDDD1; border-radius: 14px; background: var(--teal-soft); }
.study-note .eyebrow { color: #086451; font-size: 11px; line-height: 1.7; }
.study-note h3 { margin: 8px 0; font-size: 20px; letter-spacing: -.025em; }
.study-note p { color: #365B53; font-size: 14px; line-height: 1.8; }
.resume-list > .resume-row, .recent-list > .recent-row { display: flex; align-items: center; width: 100%; min-height: 60px; min-width: 0; gap: 10px; margin: 0; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink); font: inherit; text-align: left; }
.resume-list > .resume-row:hover, .recent-list > .recent-row:hover { background: #F8F6FF; border-color: #B8ACEE; }
.resume-row > span:nth-child(2), .recent-row > span:first-child { flex: 1; min-width: 0; }
.subject-icon { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; color: var(--purple); background: var(--purple-soft); }
.subject-icon.teal { color: var(--teal); background: var(--teal-soft); }
.subject-icon svg { width: 19px; height: 19px; }
.resume-arrow { flex: none; color: var(--purple); font-size: 21px; line-height: 1; }
.recent-row > b { flex: none; color: var(--teal); font-size: 23px; line-height: 1.15; text-align: right; font-variant-numeric: tabular-nums; }
.recent-row > b small { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
.how-it-works > div { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: start; gap: 2px 10px; }
.how-it-works > div > span { display: grid; place-items: center; grid-row: 1 / 3; width: 28px; height: 28px; border-radius: 9px; color: var(--purple); background: var(--purple-soft); font-size: 12px; font-weight: 800; }
.how-it-works > div > strong, .how-it-works > div > p { grid-column: 2; }
.quiz-toolbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.time-card > div { min-width: 0; }
.time-card > div > strong { display: block; }
.time-card > div > span { display: block; max-width: 210px; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.question-topline { display: flex; align-items: center; justify-content: space-between; gap: 9px; flex-wrap: wrap; }
.question-tools { display: flex; align-items: center; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; padding-top: 12px; margin-top: 18px; border-top: 1px solid var(--line); }
.question-tools .text-button { font-size: 13px; padding-inline: 5px; }
.question-tools .is-flagged { padding-inline: 10px; color: #775000; border-color: #D4B064; background: var(--amber-soft); }
.question-tools + .exam-bottom { margin-top: 11px; padding-top: 0; border-top: 0; }
.finish-button { width: 100%; margin-top: 18px; }
.legend .legend-done { border-color: #70AA9B; background: var(--teal-soft); box-shadow: inset 0 -2px #086451; }
.legend .legend-empty { border-color: #95A2B6; background: var(--white); }
.legend .legend-flag { border-color: #6C4700; background: #F4BE4F; }
.result-heading, .history-heading { align-items: center; }
.review-toolbar { align-items: flex-end; margin-top: 25px; }
.result-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.result-actions > .btn-primary { margin-left: auto; }
.explanation > h4 { margin: 0 0 8px; color: var(--purple); font-size: 15px; line-height: 1.5; }
.option-explanations { margin-top: 16px; padding-top: 3px; border-top: 1px solid var(--line); }
.option-explanations > summary { min-height: 46px; padding: 12px 0; font-size: 14px; font-weight: 700; line-height: 1.6; color: var(--purple); }
.option-explanations > summary::marker { color: var(--purple); }
.option-explanations .review-options, .option-explanations .review-checks { margin-top: 7px; margin-bottom: 0; }
.review-option-top { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; }
.review-option-top > strong { flex: 1 1 240px; min-width: 0; color: var(--ink); font-weight: 650; }
.review-option-top > span { flex: 0 1 auto; padding: 3px 7px; border-radius: 6px; background: var(--white); color: var(--muted); font-size: 12px; line-height: 1.6; font-weight: 650; }
.review-option.key .review-option-top > span { color: #086451; }
.review-option.user-wrong .review-option-top > span { color: #98223A; }
.review-option p, .review-item p { margin: 10px 0 0; color: #35425B; font-size: 15px; line-height: 1.85; }
.review-choice-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0; font-size: 13px; color: var(--muted); line-height: 1.7; }
.review-choice-meta b { color: var(--ink); font-weight: 700; }
.choice-status { flex: none; width: 23px; font-size: 19px; line-height: 1.5; font-weight: 800; text-align: center; color: var(--teal); }
.review-item.bad .choice-status { color: var(--red); }
.history-controls { width: 100%; max-width: 420px; margin-top: 22px; }
.history-table td small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.history-table .history-score { color: var(--purple); font-size: 22px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.version-notice { margin: 17px 0; padding: 14px 16px; border-left: 3px solid #B68226; border-radius: 0 10px 10px 0; color: #694900; background: var(--amber-soft); font-size: 14px; line-height: 1.75; }
.modal .zoomed-image { display: block; margin: 16px auto 13px; background: var(--white); }

/* Tablet */
@media (max-width: 1100px) {
  .content { padding-inline: 22px; }
  .topbar { padding-inline: 22px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); gap: 18px; }
  .picker-card { padding: 21px; }
  .progress-card { padding: 17px; }
  .quiz-layout.math { grid-template-columns: minmax(0, 1fr); }
  .quiz-layout.math > .question-navigator { position: static; }
  .quiz-layout.math .number-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .quiz-layout.math .question-navigator .row-between .btn { width: auto; }
  .quiz-layout.bi, .exam-grid { grid-template-columns: minmax(0, 1fr); }
  .reading-panel { position: static; max-height: none; overflow: visible; scrollbar-gutter: auto; }
}
@media (max-width: 900px) {
  .sidebar { flex-basis: 78px; width: 78px; padding: 22px 10px; }
  .brand { justify-content: center; padding: 0; margin-bottom: 25px; }
  .brand-name, .nav-label, .nav-btn span, .side-bottom { display: none; }
  .nav-btn { justify-content: center; min-height: 49px; padding: 11px; }
  .nav-btn svg { width: 22px; height: 22px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr) minmax(240px, .8fr); }
  .field-row { gap: 12px; }
  .picker-card { padding: 19px; }
  .selected-pack { padding: 16px; }
  .selected-pack h2, .selected-pack h3, .pack-title { font-size: 21px; }
  .resume-row { align-items: flex-start; flex-wrap: wrap; }
  .resume-row .btn { width: 100%; }
  .quick-stats > div, .quick-stats > article { padding: 12px; }
}
@media (max-width: 760px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .progress-aside, .dashboard-aside, .dashboard-grid > aside { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .progress-aside > .quick-stats, .dashboard-aside > .quick-stats, .dashboard-grid > aside > .quick-stats { grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .resume-row .btn { width: auto; }
  .quiz-layout.math .number-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .how-it-works { gap: 12px; }
}
/* Phone */
@media (max-width: 640px) {
  html { scroll-padding-top: 14px; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .main { padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
  .topbar { min-height: 66px; padding: 10px 16px; gap: 10px; }
  .top-right { gap: 8px; }
  .participant-name { max-width: 150px; font-size: 13px; }
  .participant-name small { font-size: 11px; }
  .page-crumb { font-size: 13px; }
  .name-label { display: none; }
  .name-input { width: 136px; padding: 9px 10px; font-size: 16px; }
  .avatar { width: 35px; height: 35px; border-radius: 10px; font-size: 16px; }
  .content { padding: 22px 16px 30px; }
  .dashboard-intro { margin-bottom: 19px; }
  .dashboard-intro h1 { font-size: 28px; }
  .dashboard-intro p { font-size: 15px; }
  .dashboard-grid { gap: 17px; }
  .picker-card, .progress-card { padding: 18px; border-radius: 13px; }
  .card-heading { margin-bottom: 17px; }
  .card-heading h2, .card-heading h3 { font-size: 19px; }
  .field-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .subject-switch { gap: 4px; margin-bottom: 17px; }
  .subject-switch button { padding-inline: 7px; font-size: 13px; gap: 6px; }
  .subject-switch svg { width: 18px; height: 18px; }
  .selected-pack { padding: 16px; }
  .pack-topics { font-size: 14px; }
  .picker-actions > .btn { min-height: 50px; }
  .progress-aside, .dashboard-aside, .dashboard-grid > aside { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .progress-aside > .quick-stats, .dashboard-aside > .quick-stats, .dashboard-grid > aside > .quick-stats, .quick-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-stats > div, .quick-stats > article { padding: 15px; }
  .resume-row { flex-wrap: nowrap; }
  .resume-row .btn { width: auto; }
  .how-it-works { grid-template-columns: minmax(0, 1fr); gap: 15px; padding-block: 18px; margin-top: 19px; }
  .how-it-works strong, .how-it-works h3 { font-size: 15px; }
  .how-it-works p { font-size: 14px; }
  .info-details { padding-inline: 15px; }
  .quiz-toolbar { gap: 12px; margin-bottom: 15px; }
  .quiz-toolbar > div:first-child { flex-basis: 100%; }
  .quiz-toolbar-actions { width: 100%; gap: 9px; }
  .quiz-toolbar-actions > .btn { flex: 1 1 auto; }
  .quiz-toolbar-actions .time-card { flex: 1 1 165px; }
  .quiz-toolbar h1, .quiz-toolbar .page-title { font-size: 25px; }
  .time-card { flex: 1 1 auto; justify-content: flex-start; min-width: 0; padding: 10px 13px; }
  .time-card strong, .time-card #elapsed, .time-card #timer { font-size: 20px; }
  .quiz-toolbar > .btn { font-size: 14px; padding-inline: 12px; }
  .quiz-progress { margin-bottom: 17px; }
  .quiz-layout, .quiz-layout.bi, .quiz-layout.math, .exam-grid { grid-template-columns: minmax(0, 1fr); gap: 15px; }
  .question-panel, .reading-panel { padding: 18px; border-radius: 13px; }
  .reading-panel h2, .reading-panel h3 { font-size: 22px; }
  .reading-text { font-size: 16px; line-height: 1.85; }
  .question-title { font-size: 19px; line-height: 1.7; margin-top: 14px; }
  .question-panel > .row-between { gap: 9px; }
  .question-panel .pill { font-size: 11px; padding: 5px 8px; }
  .question-media { margin-block: 16px; }
  .diagram-button { padding: 8px; }
  .question-media img { max-height: 420px; }
  .stimulus-table th, .stimulus-table td { padding: 10px 11px; font-size: 14px; }
  .stimulus-table:has(th:nth-child(4)) { min-width: 410px; }
  .option { grid-template-columns: 20px 24px minmax(0, 1fr); gap: 8px; padding: 13px 11px; font-size: 16px; }
  .opt-letter, .opt-mark { width: 24px; min-height: 26px; font-size: 12px; }
  .category-row { padding: 12px 13px 14px; }
  .category-row legend { font-size: 16px; }
  .category-actions label, .category-actions button { flex: 1; min-height: 47px; padding-inline: 10px; }
  .exam-bottom { gap: 8px; }
  .exam-bottom .btn { flex: 1 1 calc(50% - 4px); min-height: 47px; font-size: 14px; }
  .exam-bottom .btn-soft { flex-basis: 100%; order: 3; }
  .question-navigator, .quiz-layout.math > .question-navigator { padding: 17px; border-radius: 13px; }
  .number-grid, .quiz-layout.math .number-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
  .number-btn, .number-grid > button { min-width: 0; min-height: 46px; font-size: 15px; }
  .legend { gap: 8px 12px; font-size: 12px; }
  .result-hero { gap: 18px; padding: 20px 18px; align-items: flex-start; flex-direction: column; }
  .score-circle { width: 115px; height: 115px; min-width: 115px; }
  .score-circle strong { font-size: 34px; }
  .result-copy h1, .result-copy h2 { font-size: 24px; }
  .result-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .result-chip { min-width: 0; }
  .review-card { padding: 16px; }
  .review-card > summary { margin: -16px; padding: 15px 16px; gap: 8px; }
  .review-card[open] > summary { margin-bottom: 15px; }
  .review-head { align-items: flex-start; gap: 8px; }
  .review-card h3 { font-size: 17px; line-height: 1.75; }
  .review-answer { grid-template-columns: minmax(0, 1fr); }
  .review-option-top > strong { flex-basis: 100%; }
  .result-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .result-actions > .btn { width: 100%; margin-left: 0; }
  .download-card { align-items: stretch; flex-direction: column; gap: 13px; padding: 17px; }
  .download-card > .btn { width: 100%; }
  .download-detail h2 { font-size: 17px; }
  .review-option, .review-item { padding: 11px 12px; font-size: 15px; }
  .review-item { gap: 9px; }
  .explanation { padding: 14px; font-size: 15px; }
  .solution-steps { font-size: 16px; }
  .filter-row { gap: 6px; }
  .filter-btn { padding: 9px 10px; font-size: 13px; }
  .notice { padding: 14px; font-size: 14px; }
  .modal-backdrop { padding: 16px; }
  .modal { max-height: calc(100dvh - 32px); padding: 21px; border-radius: 14px; }
  .modal h2, .modal h3 { font-size: 22px; }
  .modal-actions .btn { flex: 1; padding-inline: 12px; }
  .modal-wide, .modal.diagram-modal, .modal.image-modal, .modal.zoom-modal { padding: 14px; }
  .modal img, .zoom-image, .diagram-dialog img { max-height: calc(100dvh - 170px); }
  .mobile-bottom { display: flex; position: fixed; inset: auto 0 0; z-index: 35; align-items: stretch; justify-content: space-around; min-height: 66px; padding: 5px 8px max(6px, env(safe-area-inset-bottom, 0px)); background: var(--white); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgb(29 40 65 / 4%); }
  .mobile-bottom button { flex: 1; min-width: 0; min-height: 54px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4px; padding: 6px 3px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 11px; line-height: 1.35; font-weight: 700; }
  .mobile-bottom button.active, .mobile-bottom button[aria-current="page"] { background: var(--purple-soft); color: var(--purple); }
  .mobile-bottom svg { width: 21px; height: 21px; }
  .toast { right: 16px; bottom: calc(82px + env(safe-area-inset-bottom, 0px)); font-size: 14px; }
}
@media (max-width: 360px) {
  .content { padding-inline: 12px; }
  .topbar { padding-inline: 12px; }
  .top-right .avatar { display: none; }
  .name-input { width: 128px; }
  .picker-card, .question-panel, .reading-panel { padding: 15px; }
  .subject-switch button { font-size: 12px; }
  .subject-switch svg { display: none; }
  .question-navigator, .quiz-layout.math > .question-navigator { padding: 13px; }
  .number-grid, .quiz-layout.math .number-grid { gap: 7px; }
  .option { grid-template-columns: 20px 22px minmax(0, 1fr); gap: 7px; }
  .opt-letter { width: 22px; }
  .exam-bottom .btn { font-size: 13px; padding-inline: 9px; }
}
@media (max-width: 319px) {
  .number-grid, .quiz-layout.math .number-grid { grid-template-columns: repeat(4, minmax(44px, 1fr)); }
  .participant-name { max-width: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (forced-colors: active) {
  .option.selected, .option:has(input:checked), .category-actions label:has(input:checked), .nav-btn.active, .filter-btn.active { outline: 2px solid Highlight; }
  .number-btn.active { border: 3px solid Highlight; }
  .number-btn.flagged::after { background: Highlight; }
  .progress-fill { background: Highlight; }
}
@media print {
  @page { margin: 15mm; }
  :root, body { background: #FFFFFF; color: #000000; font-size: 11pt; }
  .sidebar, .topbar, .mobile-bottom, .btn, .btn-link, .text-button, .question-tools, .save-hint, .filter-row, .footer-note, .toast, .modal-backdrop, .question-navigator, .exam-bottom, .quiz-progress, .time-card { display: none !important; }
  .app-shell, .main { display: block; min-height: 0; padding: 0; }
  .content { max-width: none; width: 100%; padding: 0; margin: 0; }
  .quiz-layout, .quiz-layout.bi, .quiz-layout.math, .exam-grid, .dashboard-grid { display: block; }
  .reading-panel { position: static; max-height: none; overflow: visible; margin-bottom: 16px; }
  .question-panel, .reading-panel, .result-hero, .review-card { border-color: #B0B0B0; background: #FFFFFF; box-shadow: none; }
  .result-hero { margin-top: 15px; }
  .review-card { break-inside: avoid; margin-bottom: 12px; }
  .review-card > summary::after { display: none; }
  details::details-content { display: block !important; content-visibility: visible !important; }
  details > :not(summary) { display: block !important; }
  .question-media img { max-height: 100mm; }
  .diagram-button { border: 0; padding: 0; background: #FFFFFF; }
  .diagram-button .zoom-label { display: none; }
  .table-wrap, .stimulus-table-wrapper { overflow: visible; }
  .history-table { min-width: 0; }
  .stimulus-table th, .history-table th { background: #FFFFFF; color: #000000; }
  a { color: #000000; }
}
