:root {
  color-scheme: light;
  --primary: #2c7da0;
  --primary-dark: #1a5276;
  --primary-soft: #eaf4fb;
  --accent: #e8956d;
  --accent-soft: #fdf0e8;
  --ink: #1a2027;
  --muted: #486278;
  --border: #dce6ec;
  --paper: #fff;
  --bg: #f6f8f8;
  --wrong: #843e27;
  --radius: 12px;
  --body: "DM Sans", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --zh: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }
html { color: var(--ink); background: var(--bg); font: 16px/1.65 var(--body); }
body { min-height: 100dvh; margin: 0; display: flex; flex-direction: column; }
button, input, textarea { font: inherit; }
a { color: var(--primary-dark); text-decoration: none; }
button { cursor: pointer; color: inherit; }
a:hover { color: var(--primary); }
button:disabled { cursor: default; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.35; }
h2 { font-size: 1.28rem; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
main:focus, .stem:focus, .explanation:focus { outline: none; }
.sr-only, .years input, .segmented input, .option input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip {
  position: fixed;
  z-index: 10;
  background: white;
  border: 2px solid var(--primary);
  padding: .5rem 1rem;
  top: .75rem;
  left: .75rem;
  clip-path: inset(50%);
}
.skip:focus { clip-path: none; }

.shell { width: min(100% - 64px, 1120px); margin-inline: auto; }
.main { flex: 1; padding-block: clamp(32px, 5vw, 62px) 68px; }
.site-header { background: var(--paper); border-bottom: 1px solid var(--border); }
.header-inner, .footer-inner { display: flex; align-items: center; justify-content: space-between; }
.header-inner { min-height: 68px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); white-space: nowrap; }
.wordmark strong { color: var(--primary-dark); font-size: 1.1rem; letter-spacing: -.015em; }
.wordmark img { display: block; border-radius: 9px; }
.wordmark > span > span { font-size: .91rem; font-weight: 600; }
.primary-nav { display: flex; gap: 28px; align-items: stretch; align-self: stretch; }
.primary-nav a { display: grid; align-content: center; min-width: 3.5em; color: var(--muted); text-align: center; border-bottom: 2px solid transparent; padding: 0 .35rem; white-space: nowrap; }
.primary-nav a:hover, .primary-nav [aria-current="page"] { border-color: var(--primary); color: var(--primary-dark); }
.primary-nav [aria-current="page"] { font-weight: 700; }
.site-footer { background: var(--paper); border-top: 1px solid var(--border); font-size: .86rem; }
.footer-inner { min-height: 62px; }
.footer-mark { font-size: .96rem; color: var(--primary-dark); white-space: nowrap; }

.hero { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(235px, .55fr); align-items: end; border-bottom: 1px solid #c6d7e0; gap: 30px; padding: 0 0 clamp(24px, 4.2vw, 48px); margin-bottom: 26px; }
.hero h1 { font-family: var(--zh); font-size: clamp(2.35rem, 5.2vw, 4.15rem); font-weight: 700; line-height: 1.22; letter-spacing: -.06em; color: #20313c; }
.hero h1 span { display: block; margin-top: 4px; color: var(--primary-dark); }
.hero-stats { display: flex; align-items: flex-end; justify-content: flex-end; gap: clamp(18px, 4vw, 46px); color: var(--primary-dark); }
.hero-stats div { padding-left: 17px; border-left: 1px solid #c6d7e0; }
.hero-stats dt { font-size: .83rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
.hero-stats dd { font-size: clamp(1.9rem, 3.1vw, 2.9rem); font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.055em; white-space: nowrap; }
.hero-stats dd span { font-size: .82rem; font-weight: 500; letter-spacing: normal; }

.panel { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.exam-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
.exam-card { display: flex; flex-direction: column; gap: 20px; padding: clamp(20px, 3vw, 32px); }
.topic-entry { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; padding: 17px clamp(17px, 3vw, 32px); color: var(--primary-dark); background: var(--primary-soft); }
.topic-entry > span { font-size: .9rem; white-space: nowrap; }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 12px; }
.topic-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; min-height: 72px; }
.topic-card strong { color: var(--ink); line-height: 1.45; }
.topic-card span { color: var(--muted); font-size: .84rem; text-align: right; flex-shrink: 0; }
.topic-entry:hover, .topic-card:hover { border-color: var(--primary); }
.study-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.study-chip { display: inline-flex; align-items: center; min-height: 32px; padding: 2px 10px; border: 1px solid var(--border); border-radius: 16px; background: var(--paper); font-size: .84rem; }
.study-chip.topic { background: var(--primary-soft); font-weight: 650; }
.study-chip:hover { border-color: var(--primary); text-decoration: underline; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; }
.card-title h2 { color: #20313c; }
.card-title > span { color: var(--muted); font-weight: 600; font-size: .9rem; white-space: nowrap; }
.years { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.years label, .segmented label { position: relative; min-width: 0; }
.years span, .segmented span {
  display: grid;
  place-items: center;
  font-weight: 600;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 9px;
  min-height: 45px;
  color: var(--primary-dark);
  cursor: pointer;
  white-space: nowrap;
}
.years input:checked + span, .segmented input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); }
.years input:focus-visible + span, .segmented input:focus-visible + span, .option input:focus-visible + .letter { outline: 3px solid var(--primary); outline-offset: 3px; }
.years span:hover, .segmented span:hover { border-color: var(--primary); }
.segmented { display: inline-grid; grid-template-columns: repeat(2, minmax(76px, 1fr)); gap: 5px; border: 1px solid var(--border); padding: 4px; border-radius: 11px; background: #f7fafb; align-self: flex-start; }
.segmented span { min-height: 36px; padding: 0 .65rem; font-size: .88rem; }
.segmented input:not(:checked) + span { border-color: transparent; background: transparent; }
.setup-controls { display: flex; flex-direction: column; gap: 22px; margin-top: auto; }
.mix-fields { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.amount { display: inline-flex; align-items: center; min-height: 46px; gap: 6px; border: 1px solid var(--border); border-radius: 10px; color: var(--muted); padding: 0 11px; white-space: nowrap; font-size: .91rem; }
.amount input { width: 64px; min-height: 36px; border: 0; background: transparent; color: var(--ink); font-weight: 600; padding-left: .25em; }
.help { color: var(--muted); min-height: 1.3em; font-size: .83rem; margin: -9px 0 -6px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .45em; min-height: 43px; max-width: 100%; padding: .48em .9em; border: 1px solid transparent; border-radius: 10px; font-weight: 650; font-size: .9rem; line-height: 1.3; white-space: nowrap; text-align: center; }
.button.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.button.primary:hover:not(:disabled) { background: #245f80; border-color: #245f80; color: #fff; }
.button.secondary { color: var(--primary-dark); border-color: var(--border); background: #fff; }
.button.secondary:hover:not(:disabled) { border-color: var(--primary); color: var(--primary-dark); }
.button.selected { background: var(--primary-soft); color: var(--primary-dark); border-color: var(--primary); }
.button.text { padding-inline: .35em; color: var(--primary-dark); background: transparent; }
.button.text:hover { text-decoration: underline; }
.button.small { min-height: 38px; font-size: .84rem; }
.button:disabled { opacity: 1; background: #edf1f4; border-color: var(--border); color: #576776; }
.resume-panel { display: flex; gap: 16px; align-items: center; justify-content: space-between; background: var(--accent-soft); border: 1px solid #efd4c5; border-radius: var(--radius); padding: 13px 17px; margin-bottom: 20px; }
.resume-panel strong { color: #692f20; white-space: nowrap; }
.resume-panel div span { color: #744d3d; margin-left: .5em; font-size: .89rem; }
.mode-help { margin-top: 20px; font-size: .89rem; color: var(--muted); }
.mode-help summary { cursor: pointer; width: fit-content; }
.mode-help p { padding-top: 8px; }

.page-title { margin-bottom: 25px; }
.page-title h1, .page-heading { color: #20313c; font-size: clamp(1.8rem, 3.4vw, 2.65rem); letter-spacing: -.045em; }
.inline-title { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.back-link { display: inline-flex; font-weight: 600; font-size: .89rem; margin-bottom: 12px; }
.session-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 17px; }
.session-name { display: flex; align-items: center; gap: .6em; font-weight: 700; color: #20313c; white-space: nowrap; }
.session-name a { display: grid; border: 1px solid var(--border); background: #fff; border-radius: 9px; place-items: center; min-width: 36px; min-height: 40px; font-size: 1.3rem; line-height: 1; }
.session-name > span:first-of-type, .resume-panel strong { white-space: normal; overflow-wrap: anywhere; }
.session-mode { font-size: .83rem; color: var(--muted); font-weight: 500; border-left: 1px solid var(--border); padding-left: 9px; }
.session-layout { display: grid; align-items: start; grid-template-columns: minmax(0, 1fr) minmax(227px, 280px); gap: 18px; }
.session-main { min-width: 0; }
.question-card { padding: clamp(20px, 3.6vw, 42px); }
.question-header { display: flex; align-items: start; justify-content: space-between; gap: 10px; margin-bottom: 21px; }
.question-header > div:first-child { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.question-source { font-size: .87rem; color: var(--primary-dark); font-weight: 700; white-space: nowrap; }
.type { font-size: .76rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.question-actions { display: flex; align-items: center; gap: 7px; }
.stem { font-size: clamp(1.22rem, 1.95vw, 1.65rem); line-height: 1.6; letter-spacing: -.025em; margin-bottom: 21px; white-space: pre-line; overflow-wrap: anywhere; }
.options { border: 0; padding: 0; margin: 0; display: grid; gap: 9px; min-width: 0; }
.option {
  min-height: 56px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: start;
  padding: 11px 13px;
  position: relative;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.option:not(:has(input:disabled)):hover { border-color: var(--primary); }
.option:has(input:disabled) { cursor: default; }
.option:has(input:checked), .option.correct { background: var(--primary-soft); border-color: #8bb4c9; }
.option.incorrect:has(input:checked) { background: var(--accent-soft); border-color: #e4ad94; }
.option .letter { border: 1px solid #8da7b6; background: #fff; border-radius: 50%; display: grid; place-items: center; width: 30px; height: 30px; font-size: .83rem; font-weight: 700; color: var(--primary-dark); }
.option:has(input[type="checkbox"]) .letter { border-radius: 6px; }
.option:has(input:checked) .letter { color: white; background: var(--primary-dark); border-color: var(--primary-dark); }
.option.incorrect:has(input:checked) .letter { color: white; background: var(--wrong); border-color: var(--wrong); }
.option-text { padding-block: 2px; white-space: pre-line; overflow-wrap: anywhere; }
.option-result { align-self: center; color: var(--primary-dark); font-weight: 700; min-width: 15px; }
.option.incorrect .option-result { color: var(--wrong); }
.answer-action { display: flex; justify-content: flex-end; margin-top: 16px; }
.question-steps { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding-top: 18px; color: var(--muted); }
.question-steps strong { color: var(--primary-dark); }
.map-card { padding: 14px; }
.map-card summary { display: flex; align-items: baseline; justify-content: space-between; cursor: pointer; font-size: .93rem; font-weight: 700; color: var(--primary-dark); gap: 10px; }
.map-card summary::-webkit-details-marker { display: none; }
.map-card summary::after { content: "+"; order: 3; font-size: 1.05rem; }
.map-card[open] summary::after { content: "−"; }
.map-card summary > span { margin-left: auto; font-size: .81rem; font-weight: 600; }
.map-card progress { appearance: none; display: block; width: 100%; margin: 12px 0; height: 5px; color: var(--primary); }
.map-card progress::-webkit-progress-bar { background: var(--primary-soft); border-radius: 4px; }
.map-card progress::-webkit-progress-value { background: var(--primary); border-radius: 4px; }
.map-card progress::-moz-progress-bar { background: var(--primary); border-radius: 4px; }
.question-numbers { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; max-height: min(65dvh, 460px); overflow: auto; padding: 3px; }
.nav-number { min-height: 35px; min-width: 0; padding: .2em 0; border: 1px solid var(--border); border-radius: 6px; background: #fff; font-size: .84rem; color: var(--muted); }
.nav-number.answered, .nav-number.correct { border-color: #93b8cc; background: var(--primary-soft); color: var(--primary-dark); }
.nav-number.wrong { background: var(--accent-soft); border-color: #e4ad94; color: var(--wrong); }
.nav-number[aria-current] { outline: 2px solid var(--primary-dark); outline-offset: 1px; color: var(--ink); font-weight: 700; }

.figures { display: flex; flex-wrap: wrap; gap: 14px; margin: -1px 0 20px; }
.figure-button { padding: 0; display: inline-flex; flex-direction: column; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; max-width: 100%; }
.figure-button img { display: block; width: auto; height: auto; max-width: 100%; max-height: 235px; object-fit: contain; }
.figure-button > span { align-self: stretch; padding: 5px 10px; text-align: right; border-top: 1px solid var(--border); font-size: .79rem; font-weight: 600; color: var(--primary-dark); }

.explanation { background: #f6fafb; border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 8px; display: grid; gap: 14px; align-items: start; margin-top: 23px; padding: 17px; overflow-wrap: anywhere; }
.answer-line { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; color: var(--primary-dark); line-height: 1.45; }
.outcome { color: var(--muted); border: 1px solid var(--border); font-size: .77rem; font-weight: 700; min-height: 26px; border-radius: 6px; padding: 2px 7px; white-space: nowrap; align-content: center; }
.outcome.correct { color: var(--primary-dark); background: var(--primary-soft); border-color: #bad3e1; }
.outcome.wrong { color: var(--wrong); background: var(--accent-soft); border-color: #e9c7b7; }
.explanation h3 { font-size: 1rem; color: #20313c; }
.explanation h3:not(:first-child) { margin-top: 13px; }
.evidence-status { display: inline-block; font-size: .74rem; color: var(--muted); margin-left: 5px; font-weight: 600; vertical-align: middle; }
.explanation-copy { margin-top: 5px; white-space: pre-line; }
.option-review-section { padding-top: 12px; border-top: 1px solid var(--border); }
.option-reviews { display: grid; gap: 0; margin: 6px 0 0; padding: 0; list-style: none; }
.option-review { display: grid; grid-template-columns: 1.65rem minmax(0, 1fr); gap: .65rem; padding: 10px 0; }
.option-review + .option-review { border-top: 1px solid var(--border); }
.option-review-letter { display: grid; place-items: center; align-self: start; width: 1.65rem; height: 1.65rem; border: 1px solid var(--border); border-radius: 6px; color: var(--primary-dark); background: var(--paper); line-height: 1; }
.option-review-copy { white-space: pre-line; }
.option-review-limit { display: block; width: fit-content; padding: 0 .4em; margin-bottom: 3px; border-radius: 4px; background: var(--accent-soft); color: var(--wrong); font-size: .78rem; font-weight: 650; }
.option-review-sources, .supporting-notice { display: flex; flex-wrap: wrap; align-items: center; gap: 0 .7em; }
.option-source { min-height: 32px; padding: 0 .35rem; margin-inline-start: -.35rem; border: 0; border-radius: 4px; color: var(--primary-dark); background: transparent; font-size: .84rem; font-weight: 650; text-decoration: underline; text-underline-offset: .19em; white-space: nowrap; }
.option-source:hover { color: var(--primary); }
[data-live-sources]:empty { display: none; }
.references { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 9px; font-size: .9rem; color: var(--muted); }
.references li { border-top: 1px solid var(--border); padding-top: 8px; scroll-margin-block-start: 6rem; }
.references li:focus { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 4px; background: var(--primary-soft); }
.references li strong { color: var(--ink); }
.source-number { display: inline-block; margin-inline-end: .65em; color: var(--primary-dark); font-size: .82rem; white-space: nowrap; }
.references a { text-decoration: underline; }
.references .button { margin-top: 6px; }
.references a.button { text-decoration: none; }
.book-page { width: min(32rem, calc(100% - 2rem)); margin: 12vh auto; padding: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--paper); }
.book-page h1 { font-size: 1.45rem; }
.book-page #book-picker { display: grid; gap: .55rem; margin-top: 1.25rem; }
.book-page input[type="file"] { max-width: 100%; }
.remember-book { display: flex; align-items: center; gap: .4rem; }
.source-group { margin-top: 16px; }
.source-support { margin: 6px 0 0; color: var(--ink); line-height: 1.55; }
.source-note { font-size: .83rem; color: var(--muted); }
.formal-status { margin: 4px 0 8px; }
.note-editor { display: grid; gap: 9px; margin-top: 21px; }
.note-editor label { font-weight: 650; }
.note-editor textarea { padding: 11px; resize: vertical; width: 100%; border: 1px solid var(--border); border-radius: 9px; color: var(--ink); min-height: 100px; }
.note-editor .button { justify-self: start; }

.score-card { padding: 22px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.score { display: grid; gap: 5px; color: var(--primary-dark); }
.score span, .score-card dt { font-size: .89rem; color: var(--muted); }
.score strong { font-size: clamp(2.25rem, 5vw, 3.65rem); line-height: 1; letter-spacing: -.065em; }
.score small { font-weight: 600; font-size: .47em; color: var(--muted); }
.score-card dl { display: flex; gap: 21px; }
.score-card dl div { border-left: 1px solid var(--border); padding-left: 12px; }
.score-card dd { font-weight: 700; font-size: 1.35rem; color: #263949; }
.list-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.pillbar { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.entry-list { margin: 0; padding: 0; list-style: none; }
.entry-list li + li { border-top: 1px solid var(--border); }
.entry { min-height: 64px; color: var(--ink); text-align: left; line-height: 1.48; display: flex; align-items: center; width: 100%; gap: 12px; padding: 12px 16px; background: transparent; border: 0; }
.entry:hover { color: var(--primary-dark); background: #f3f8fb; }
.entry-list li:first-child .entry { border-radius: 11px 11px 0 0; }
.entry-list li:last-child .entry { border-radius: 0 0 11px 11px; }
.entry-main { min-width: 0; flex: 1; }
.entry-number, .entry-stat { color: var(--primary-dark); font-weight: 700; font-variant-numeric: tabular-nums; }
.entry-number { min-width: 23px; text-align: center; }
.entry-meta, .entry-title, .entry-note { display: block; }
.entry-meta { color: var(--muted); font-size: .79rem; }
.entry-title { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; margin-top: 3px; overflow-wrap: anywhere; }
.entry-note { color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; margin-top: 3px; font-size: .89rem; }
.empty { padding: 22px; color: var(--muted); }
.empty h1 { color: var(--ink); margin-bottom: .55em; }
.empty .button { margin-top: 12px; }
.data-panel, .about-panel { padding: clamp(19px, 3vw, 34px); }
.data-panel { margin-top: 22px; }
.data-panel p, .about-panel p { margin-block: 7px 15px; }
.data-panel p:last-child, .about-panel p:last-child { margin-bottom: 0; }
.about-panel, .inspection { width: min(100%, 760px); }
.about-panel h2:not(:first-child) { margin-top: 20px; }
.production { padding-left: 12px; border-left: 3px solid var(--accent); font-weight: 650; }
#backup-status { color: var(--primary-dark); }
.storage-warning { width: min(100% - 32px, 1120px); margin: 12px auto 0; padding: 10px 12px; color: var(--wrong); background: var(--accent-soft); border: 1px solid #e4ad94; border-radius: 8px; }

dialog { color: var(--ink); border: 1px solid var(--border); border-radius: var(--radius); background: #fff; width: min(calc(100% - 28px), 420px); padding: 0; box-shadow: 0 2px 8px rgb(0 0 0 / .06); }
dialog::backdrop { background: rgb(26 38 48 / .67); }
.dialog-body { padding: 22px; }
.dialog-body p { color: var(--muted); margin-top: 10px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 19px; }
.figure-dialog { width: min(calc(100% - 24px), 960px); max-height: calc(100dvh - 30px); overflow: auto; padding: 12px; text-align: center; }
.figure-dialog form { display: flex; justify-content: flex-end; margin-bottom: 9px; }
.figure-dialog img { display: block; width: auto; height: auto; max-width: 100%; max-height: min(73dvh, 760px); object-fit: contain; margin: 0 auto; }

@media (max-width: 899px) {
  .session-layout { display: flex; flex-direction: column; }
  .session-main, .question-map { width: 100%; }
  .question-map { order: -1; }
  .question-numbers { grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); max-height: 200px; }
}

@media (max-width: 700px) {
  .shell { width: calc(100% - 36px); }
  .main { padding-block: 28px 44px; }
  .header-inner { min-height: 55px; }
  .primary-nav {
    position: fixed;
    inset: auto 0 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    z-index: 3;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .primary-nav a { min-height: 56px; border-bottom: 0; border-top: 2px solid transparent; font-size: .92rem; }
  .primary-nav [aria-current] { background: var(--primary-soft); }
  body { padding-bottom: calc(57px + env(safe-area-inset-bottom, 0px)); }
  .hero { grid-template-columns: 1fr; gap: 18px; padding-bottom: 19px; margin-bottom: 17px; }
  .hero h1 { font-size: clamp(2rem, 8.9vw, 3rem); }
  .hero-stats { justify-content: flex-start; }
  .hero-stats div { padding-left: 11px; }
  .hero-stats dd { font-size: 1.8rem; }
  .exam-grid { grid-template-columns: 1fr; gap: 12px; }
  .exam-card { gap: 15px; padding: 17px; }
  .primary-nav { box-shadow: 0 -2px 8px rgb(26 38 48 / .04); }
  .setup-controls { gap: 13px; }
  .resume-panel { gap: 10px; padding: 11px; }
  .resume-panel div span { display: block; margin-left: 0; }
  .question-header { flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
  .question-card { padding: 16px; }
  .stem { margin-bottom: 16px; }
  .question-actions .small { padding-inline: .52em; }
  .option { gap: 8px; padding: 10px; }
  .question-steps { padding-top: 13px; }
  .list-header { align-items: flex-start; }
  .entry { gap: 8px; padding: 10px; }
}

@media (max-width: 343px) {
  .shell { width: calc(100% - 24px); }
  .exam-card { padding: 13px; }
  .years, .segmented { gap: 5px; }
  .resume-panel { align-items: flex-start; flex-direction: column; }
  .resume-panel .button { align-self: stretch; }
}

@media (prefers-reduced-motion: no-preference) {
  .button, .option, .years span { transition: background-color .14s ease-out, border-color .14s ease-out; }
}
