:root {
  color-scheme: light;
  --canvas: #f5f3ed;
  --paper: #fffefa;
  --ink: #1b2b26;
  --muted: #40534a;
  --line: #d3dbd1;
  --primary: #174a3a;
  --dark: #173c32;
  --lime: #e9f1d3;
  --tint: #eaf2eb;
  --wrong: #962e2b;
  --focus: #78580d;
  --radius: 16px;
  --serif: Georgia, 'Times New Roman', serif;
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
h1, h2, p, dl, dd, ol, ul, pre, fieldset { margin: 0; }
h1, h2 { line-height: 1.12; letter-spacing: -.025em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); font-family: var(--serif); font-weight: 400; }
h2 { font-size: clamp(1.35rem, 3vw, 1.85rem); }
a { color: inherit; }
button, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .46; cursor: default; }
button, a, label, select, textarea, [tabindex] { scroll-margin-block: 6rem 2rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.skip:focus { position: fixed; z-index: 20; top: .8rem; left: .8rem; color: #fff; background: var(--dark); border-radius: 8px; padding: .8rem 1rem; }
.shell { width: min(1200px, calc(100% - 64px)); margin-inline: auto; }
.top { position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--line); background: var(--canvas); }
.top-inner { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.brand { display: inline-flex; min-height: 44px; align-items: center; gap: .68rem; font-weight: 720; text-decoration: none; }
.mark { display: flex; align-items: end; justify-content: center; gap: 2px; padding-bottom: 9px; width: 35px; height: 35px; border-radius: 9px; background: var(--dark); flex: 0 0 auto; }
.mark i { width: 4px; background: var(--lime); height: 11px; }
.mark i:nth-child(2) { height: 18px; }
.mark i:nth-child(3) { height: 14px; }
.nav-button { background: transparent; padding: .6rem .45rem; border: 0; font-weight: 650; min-height: 44px; white-space: nowrap; }
.nav-button:hover, .brand:hover { color: var(--primary); text-decoration: underline; text-underline-offset: .27em; }
.btn {
  min-height: 46px; padding: .63rem 1rem; border: 1px solid transparent; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font-weight: 680;
  font-size: .94rem; line-height: 1.25; text-decoration: none; text-align: center;
  transition: background .16s ease, transform .16s ease, border-color .16s ease;
}
.btn:not(:disabled):hover { transform: translateY(-2px); }
.btn:not(:disabled):active { transform: translateY(1px); }
.primary { background: var(--primary); color: #fff; }
.primary:not(:disabled):hover { background: #10392c; }
.secondary { background: var(--paper); border-color: #9bab9f; color: var(--primary); }
.secondary:not(:disabled):hover, .quiet:not(:disabled):hover { background: var(--tint); }
.quiet { color: var(--primary); background: transparent; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.hero-inner {
  display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1fr);
  min-height: calc(100svh - 70px); align-items: center; column-gap: clamp(2rem, 8vw, 7rem);
  padding-block: 3.5rem;
}
.hero[data-enter] .hero-copy { animation: enter .48s both ease-out; }
.hero[data-enter] .overview { animation: enter .48s .08s both ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
.eyebrow { color: var(--primary); font-weight: 750; margin-bottom: .65rem; letter-spacing: .085em; text-transform: uppercase; font-size: .84rem; }
.display { max-width: 9.5em; font-size: clamp(3rem, 6.35vw, 5.85rem); line-height: .96; letter-spacing: -.054em; }
.lead { color: var(--muted); font-size: clamp(1.05rem, 1.6vw, 1.25rem); max-width: 39ch; margin-top: 1.25rem; }
.hero-actions { margin-top: 1.75rem; }
.resume-note { margin-top: 1.3rem; padding: .8rem .9rem; border-left: 3px solid var(--primary); background: var(--tint); }
.resume-note p { color: var(--muted); }
.resume-note .btn { padding-left: 0; }
.overview { border-radius: var(--radius); overflow: hidden; color: var(--lime); background: var(--dark); }
.overview-top { padding: 1.15rem clamp(1rem, 3vw, 2rem); display: flex; justify-content: space-between; gap: .7rem; border-bottom: 1px solid #5f7c6c; }
.overview-top span { font-weight: 650; }
.overview-top strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.overview-body { padding: clamp(1rem, 3vw, 2rem); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; margin-bottom: 1.3rem; }
.facts > div { display: flex; flex-direction: column-reverse; border: 1px solid #5f7c6c; border-radius: 10px; padding: .7rem .85rem; }
.facts dd { font: 400 clamp(1.6rem, 2.4vw, 1.83rem)/1.08 var(--serif); margin-bottom: .3rem; }
.facts dt, .overview-note { font-size: .9rem; }
.format-list { display: grid; padding: 0; list-style: none; }
.format-list li { display: flex; justify-content: space-between; gap: .7rem; padding: .45rem 0; border-top: 1px solid #5f7c6c; }
.format-list li span:last-child { white-space: nowrap; }
.overview-note { margin-top: .9rem; color: #d6e5d7; }
.library { border-top: 1px solid var(--line); padding-block: 3rem 1.7rem; scroll-margin-top: 80px; }
.section-head { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 1.35rem; }
.section-head p { color: var(--muted); margin-top: .45rem; }
.test-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
.test-list li {
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: .65rem .75rem .65rem 1rem;
  display: flex; justify-content: space-between; align-items: center; gap: .6rem;
}
.test-list .btn { flex: 0 1 auto; }
.test-list strong { display: block; }
.complete-label { display: block; color: var(--primary); font-size: .83rem; }
.quick-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; padding: 1.35rem 0; border-top: 1px solid var(--line); }
.quick { scroll-margin-top: 88px; }
.quick p { margin-top: .55rem; max-width: 40ch; color: var(--muted); }
.quick form { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .8rem; align-items: end; }
.quick label[for="quick-form-number"] { grid-row: 1; grid-column: 2; }
.quick .btn { justify-self: start; grid-column: 1 / -1; margin-top: .4rem; }
label, .select-group label { font-weight: 650; }
select, textarea { width: 100%; background: var(--paper); border: 1px solid #8e9e94; border-radius: 8px; padding: .56rem .8rem; min-height: 46px; }
footer { color: var(--muted); font-size: .9rem; text-align: center; padding: 2rem 0; }
.setup-layout, .testing, .writing, .results, .loading { margin-block: 1.75rem 3rem; }
.setup-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 270px); gap: 1rem; align-items: start; }
.stage { padding: clamp(1rem, 4vw, 2.25rem); }
.stage-head { display: flex; justify-content: space-between; align-items: start; gap: .9rem; margin-bottom: 1.1rem; }
.stage-meta { font-weight: 700; margin-bottom: .6rem; }
.stage-note { max-width: 64ch; margin-bottom: .7rem; }
.hint { color: var(--muted); margin-top: .6rem; font-size: .94rem; }
.stage > .controls { margin-top: 1.4rem; }
.notice { padding: .65rem .8rem; background: var(--tint); margin-bottom: .9rem; border-radius: 8px; }
.stage-map { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem; }
.stage-map h2 { font-size: 1.16rem; }
.stage-map ol { margin-top: .65rem; list-style: none; padding: 0; }
.stage-map li { display: flex; align-items: center; gap: .55rem; min-height: 42px; padding: .25rem .4rem; }
.stage-map li[aria-current] { background: var(--tint); border-radius: 7px; color: var(--primary); font-weight: 700; }
.stage-map small { color: var(--muted); }
.step-dot { flex: 0 0 1rem; text-align: center; }
.timer { min-width: 100px; padding: .52rem .7rem; background: var(--tint); color: var(--primary); border-radius: 9px; text-align: right; }
.timer span { display: block; font-size: .83rem; }
.timer strong { display: block; font-size: 1.35rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.timer.urgent { color: var(--wrong); background: #f9e8e3; }


.question-layout { max-width: 760px; }
.question-layout.has-passage {
  max-width: none; display: grid; grid-template-columns: minmax(0, .96fr) minmax(0, 1fr);
  align-items: start; gap: clamp(1rem, 3vw, 2rem);
}
.passage { border: 1px solid var(--line); background: #f7f8f2; border-radius: 12px; padding: 1.15rem; min-width: 0; }
.passage h2 { font-size: 1.26rem; }
.passage-group { color: var(--muted); font-size: .9rem; margin-top: .22rem; }
.passage-text {
  max-height: min(58vh, 620px); overflow: auto; margin: .75rem -.45rem -.35rem 0; padding: 0 .45rem .35rem 0;
  font: 1.1rem/1.58 var(--serif);
}
.passage-text p + p { margin-top: .8rem; }
.verse .passage-text p { white-space: pre-line; }
.question-card { min-width: 0; }
.question-head { display: flex; justify-content: space-between; gap: .55rem; align-items: start; margin-bottom: .85rem; }
.question-index { font-weight: 720; }
.question-order { color: var(--muted); font-size: .87rem; margin-top: .15rem; }
.flag-btn[aria-pressed="true"], .flag-btn[aria-pressed="true"]:hover { background: #f1e4bc; color: #574207; }
.question-prompt { font-size: 1.13rem; font-weight: 650; margin-bottom: 1rem; overflow-wrap: anywhere; }
.prompt-text + .prompt-text, .figure + .prompt-text { margin-top: .6rem; }
.figure {
  overflow: auto; font: 500 .9rem/1.4 ui-monospace, Consolas, monospace; background: #f4f5ee;
  border: 1px solid var(--line); border-radius: 8px; padding: .7rem; margin: .55rem 0; width: max-content; max-width: 100%;
}
.choices, .prompts { display: grid; gap: .45rem; border: 0; min-width: 0; padding: 0; list-style: none; }
.choice {
  position: relative; display: flex; min-height: 48px; align-items: center; gap: .65rem;
  padding: .48rem .62rem; border: 1px solid var(--line); border-radius: 8px; font-weight: 480; overflow-wrap: anywhere;
}
label.choice { cursor: pointer; }
label.choice:hover { background: #f6f7f1; }
.choice:has(input:checked), .choice.is-correct { background: var(--tint); border-color: #7d9d89; }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
.choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.choice-letter {
  display: grid; place-items: center; flex: 0 0 28px; min-height: 28px; border-radius: 5px;
  background: #eeefe8; color: var(--ink); font-size: .87rem; font-weight: 740;
}
.choice:has(input:checked) .choice-letter, .is-correct .choice-letter { background: var(--primary); color: #fff; }
.choice.is-wrong { background: #f9ebe6; border-color: #d3a6a0; }
.choice.is-wrong .choice-letter { background: var(--wrong); color: #fff; }
.choice small { margin-left: auto; text-align: right; color: var(--muted); font-weight: 700; }
.clear-row { min-height: 48px; display: flex; align-items: center; }
.clear-row .btn { padding-left: 0; padding-right: .55rem; }
.question-controls { display: flex; justify-content: space-between; gap: .65rem; }
.review-choices + .question-controls { margin-top: 1rem; }
.question-map { border-top: 1px solid var(--line); margin-top: 1.25rem; padding-top: 1rem; }
.map-title { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .55rem; }
.map-title span { color: var(--muted); font-size: .9rem; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: .4rem; }
.map-item { min-height: 44px; padding: 0; position: relative; background: var(--paper); border: 1px solid #aeb9ad; border-radius: 6px; font-size: .87rem; font-weight: 650; }
.map-item:hover, .map-item.answered, .map-item.correct { background: var(--tint); border-color: #71917d; }
.map-item.incorrect { background: #f9ebe6; border-color: #d1a09a; }
.map-item[aria-current] { outline: 2px solid var(--primary); outline-offset: -2px; font-weight: 800; }
.map-item.flagged::after { content: ''; position: absolute; width: 6px; height: 6px; border-radius: 8px; top: 5px; right: 5px; background: #8d5d08; }
.stage-actions { justify-content: space-between; }
.writing { max-width: 920px; margin-inline: auto; }
.prompts legend, .essay-label { font-weight: 700; margin-bottom: .55rem; }
.essay-label { display: block; margin-top: 1.15rem; }
.writing textarea { display: block; resize: vertical; line-height: 1.55; min-height: 180px; }
.writing-footer { display: flex; justify-content: space-between; color: var(--muted); margin-top: .35rem; gap: .5rem; font-size: .88rem; }
.results > h1 + .lead, .results > .lead + .btn { margin-top: .8rem; }
.score-panel, .review, .essay-review { padding: clamp(1rem, 3vw, 1.85rem); margin-top: 1rem; }
.review { scroll-margin-top: 90px; }
.score-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; }
.score-head p { color: var(--muted); margin-top: .4rem; }
.score-head > strong { color: var(--primary); text-align: right; font-size: clamp(1.45rem, 4vw, 2.7rem); white-space: nowrap; line-height: 1.03; }
.score-head small { font-size: .53em; font-weight: 600; }
.table-wrap { overflow: auto; margin-top: .8rem; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .68rem .4rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { font-variant-numeric: tabular-nums; }
.score-panel .controls { margin-top: .9rem; }
.status { flex-shrink: 0; font-size: .87rem; font-weight: 700; padding: .35rem .6rem; border-radius: 5px; }
.status.right { color: var(--primary); background: var(--tint); }
.status.wrong { color: var(--wrong); background: #f9ebe6; }
.status.neutral { background: #f0eee6; }
.select-group label { display: block; margin-bottom: .25rem; }
.essay-review summary { font-weight: 700; cursor: pointer; min-height: 44px; padding-block: .55rem; }
.essay-review p { font-weight: 650; margin-block: .45rem; }
.essay-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.history-list { display: grid; list-style: none; padding: 0; gap: .55rem; margin-top: .95rem; }
.history-list li { padding: .75rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.history-list p { color: var(--muted); font-size: .9rem; }
.empty { padding: 1.2rem; margin-top: .9rem; }
.empty .btn { margin-top: .8rem; }
.inline-status:empty { display: none; }
.inline-status:not(:empty) { color: var(--primary); margin: 0 0 1.3rem; }
dialog { width: min(470px, calc(100vw - 32px)); padding: 1.25rem; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
dialog p { margin: .8rem 0 1rem; }
dialog::backdrop { background: rgb(18 37 31 / 55%); }

@media (max-width: 1015px) {
  .test-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-inner { column-gap: 2rem; }
}
@media (max-width: 740px) {
  .shell { width: calc(100% - 32px); }
  .top-inner { min-height: 58px; }
  .hero-inner { grid-template-columns: 1fr; gap: 1.5rem; padding-block: 2rem; min-height: auto; }
  .display { max-width: 12ch; }
  .lead { margin-top: .8rem; }
  .hero-actions { margin-top: 1rem; }
  .overview-top { padding-block: .7rem; }
  .overview-body { padding: .85rem 1rem; }
  .format-list li { padding-block: .25rem; }
  .library { padding-top: 1.6rem; }
  .quick-inner { grid-template-columns: 1fr; padding: 1rem 0; gap: 1rem; }
  .quick .btn { justify-self: stretch; }
  .question-layout.has-passage, .setup-layout { grid-template-columns: 1fr; }
  .passage-text { max-height: 36vh; }
  .section-head { align-items: flex-start; }
}
@media (max-width: 465px) {
  .brand { gap: .45rem; }
  .mark { width: 31px; height: 31px; padding-bottom: 7px; }
  .test-list { grid-template-columns: 1fr; }
  .section-head { flex-wrap: wrap; }
  .stage-head { margin-bottom: .9rem; }
  .stage-head h1 { font-size: 1.95rem; }
  .timer { min-width: 78px; padding: .5rem; }
  .btn { padding-inline: .7rem; }
  .hero-actions { display: grid; grid-template-columns: 1fr; }
  .question-head { flex-wrap: wrap; }
  .map-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
  .map-title span { font-size: .82rem; }
  table { font-size: .82rem; }
  th, td { padding-inline: .22rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


.question-head, .passage { scroll-margin-top: 86px; }
