/* Quiz-only names, mapped onto the study site's tokens.css (copied unchanged). */
:root {
  --stroke: var(--outline);
  --ok: var(--right);
  --ok-soft: var(--right-tint);
  --no: var(--wrong);
  --no-soft: var(--wrong-tint);
  --teal: var(--right);
  --teal-tint: var(--right-tint);
  --brass: #E9B54A;               /* "middle" scores: rings, meters, stat cards */
  --brass-tint: var(--butter);
  --mint-strong: var(--progress);
  --lilac-strong: var(--accent);
  --lilac-text: var(--accent-text);
  --peach-strong: #F07E5A;
  --lift-sm: 3px 3px 0 var(--shadow);   /* the offset "sticker" shadow */
  --lift: 6px 6px 0 var(--shadow);
  color-scheme: light;
}

/* base: global.css from the study site */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh; display: flex; flex-direction: column;
  /* graph paper */
  background-color: var(--ground);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--ink-2);
  font: 400 17px/1.55 var(--font-body);
}
@media (max-width: 640px) { body { font-size: 16px; } }
/* Phones: room for the fixed bottom tab bar, at the end of the page and when a focused control scrolls into view. */
@media (max-width: 760px) {
  html { scroll-padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 8px); }
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; color: var(--ink); margin: 0 0 .4em; }
h1 { font-size: 56px; line-height: 1.05; }
h2 { font-size: 28px; line-height: 1.15; font-weight: 600; }
h3 { font-size: 22px; line-height: 1.2; font-weight: 600; }
@media (max-width: 640px) { h1 { font-size: 38px; } }
button, input { font: inherit; color: inherit; }
a { color: var(--teal); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
#app:focus { outline: none; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 max(var(--gutter), env(safe-area-inset-right, 0px)) 0 max(var(--gutter), env(safe-area-inset-left, 0px)); width: 100%; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.caption { font-size: 14px; color: var(--muted); }
.lead { color: var(--muted); margin: 0; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.err { color: var(--no); margin: 0; font-size: .9rem; font-weight: 600; }
.err:empty { display: none; }
.loading { padding: 4rem 0; text-align: center; color: var(--muted); }

.skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link:focus {
  position: fixed; z-index: 1000; top: max(12px, env(safe-area-inset-top, 0px)); left: max(12px, env(safe-area-inset-left, 0px));
  display: inline-flex; align-items: center; min-height: 44px; padding: 10px 18px; border-radius: var(--r-pill);
  background: var(--brass); color: var(--night); font: 700 16px/1.2 var(--font-body); text-decoration: none;
  box-shadow: 0 6px 20px rgb(0 0 0 / .35); outline: 3px solid var(--on-night); outline-offset: 2px;
}

/* header: Header.astro from the study site. White notebook strip with a dashed edge. */
.site-header { background: var(--paper); border-bottom: 2px dashed var(--line-2); }
.site-header .bar { display: flex; align-items: center; gap: 20px; min-height: 68px; flex-wrap: wrap; padding-block: 10px; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; color: var(--ink); }
.logo { flex: 0 0 auto; }
.wordmark { font: 700 22px/1 var(--font-display); }
.top-nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
.top-nav a {
  display: inline-flex; align-items: center; gap: 3px; min-height: 44px; padding: 0 16px; border-radius: var(--r-pill);
  color: var(--ink); text-decoration: none; font-weight: 800;
}
.top-nav a:hover { background: var(--sand); }
.top-nav a[aria-current] { background: var(--ink); color: var(--paper); }
.tools { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.top-nav + .tools { margin-left: 0; }
.theme, .lang {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 6px 14px;
  border: var(--border) solid var(--outline); border-radius: var(--r-pill); background: var(--paper);
  color: var(--ink); font: 800 14px/1 var(--font-body); cursor: pointer; justify-content: center;
}
.theme:hover, .lang:hover { background: var(--sand); }
.theme-icon { display: inline-flex; }
.to-light { display: none; }
:root[data-theme='dark'] .to-light { display: inline; }
:root[data-theme='dark'] .to-dark { display: none; }
@media (max-width: 1000px) {
  .top-nav a { padding: 0 12px; }
  .theme-label { display: none; }
}
/* Phone tab bar. display:none (not just off-screen) so only one nav is in the accessibility tree. */
.tab-bar { display: none; }
@media (max-width: 760px) {
  .top-nav { display: none; }
  .tools, .top-nav + .tools { margin-left: auto; }
  .tab-bar {
    display: flex; position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
    background: var(--paper); border-top: 2px solid var(--outline);
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  }
  .tab-bar a {
    flex: 1 1 0; min-width: 0; min-height: var(--tabbar-h); position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 2px;
    color: var(--muted); font: 700 12px/1.1 var(--font-body); text-decoration: none; text-align: center;
  }
  .tab-bar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tab-bar a:focus-visible { outline-offset: -4px; border-radius: 10px; }
  /* Current section: ink, bolder, and a mint tab behind the icon (not colour alone: the tab is a shape). */
  .tab-bar a[aria-current] { color: var(--ink); font-weight: 800; }
  .tab-bar a[aria-current] svg { stroke-width: 2.3; background: var(--mint); border-radius: 10px; padding: 2px 10px; box-sizing: content-box; }
}
@media (max-width: 380px) {
  .site-header .bar { column-gap: 8px; }
  .wordmark { font-size: 19px; }
  .tools { gap: 6px; }
  .theme, .lang { padding: 6px 10px; }
}
@media (max-width: 340px) {
  .brand { gap: 6px; }
  .wordmark { font-size: 17px; }
  .logo { width: 34px; height: 34px; }
}
@media (forced-colors: active) {
  .top-nav a[aria-current] { outline: 2px solid Highlight; }
}

/* main is a grid so a hero can run full width while everything else keeps the 848px column */
main {
  flex: 1; isolation: isolate;
  display: grid; align-content: start;
  grid-template-columns: [full-start] minmax(var(--gutter), 1fr) [content-start] min(848px, 100% - 2 * var(--gutter)) [content-end] minmax(var(--gutter), 1fr) [full-end];
  padding: 1.5rem 0 2.5rem;
}
main > * { grid-column: content; min-width: 0; }
main:has(> .hero:first-child) { padding-top: 0; }
/* a hero that ends the screen grows to meet the footer, so no strip of plain page shows between the bands */
main:has(> .hero:last-child) { align-content: stretch; padding-bottom: 0; }
main:has(> .hero:last-child) > .hero:last-child { margin-bottom: 0; }
main:has(> .hero:last-child) + .site-footer { margin-top: 0; }
.card { background: var(--paper); border: 2px solid var(--stroke); border-radius: var(--r-card); padding: 22px; margin-bottom: 1rem; }

/* small text: global.css */
.eyebrow { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }

/* hero: a notebook page taped onto the graph paper (two strips of washi tape) */
.hero {
  position: relative; margin: 28px 0 28px;
  background: var(--paper); border: 2px solid var(--stroke); border-radius: 18px;
  padding: 34px 32px 28px; box-shadow: var(--lift);
}
.hero::before, .hero::after {
  content: ""; position: absolute; height: 26px; opacity: .9; pointer-events: none;
}
.hero::before { top: -14px; left: 40px; width: 120px; background: var(--peach); transform: rotate(-3deg); }
.hero::after { top: -12px; right: 60px; width: 90px; background: var(--lilac); transform: rotate(4deg); }
.hero h1 { max-width: 18ch; }
.hero .lead { max-width: 46ch; font-size: 18px; color: var(--ink-2); }
.hero-stats { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.2rem 0 0; padding: 0; }
.hero-stats li { border: 2px solid var(--stroke); border-radius: var(--r-pill); padding: 4px 12px; font-size: 14px; font-weight: 700; color: var(--ink); }
.hero-stats li:nth-child(1) { background: var(--mint); }
.hero-stats li:nth-child(2) { background: var(--lilac); }
.hero-stats li:nth-child(3) { background: var(--peach); }
.hero-stats b { font-weight: 800; }
.hero-sm { padding: 26px 26px 22px; }
@media (max-width: 640px) {
  .hero { padding: 28px 18px 22px; margin-top: 22px; }
  .hero .lead { font-size: 17px; }
}

/* buttons: global.css .btn-solid (.btn), .btn-outline (.btn.ghost), .btn-text (.linkbtn) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 12px 22px; border-radius: var(--r-btn);
  font: 800 16px/1 var(--font-body); text-decoration: none; cursor: pointer;
  background: var(--night); border: 2px solid var(--night); color: var(--on-night);
  white-space: nowrap;
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.study-links { margin-top: .7rem; }
.btn:hover { box-shadow: var(--lift-sm); transform: translate(-1px, -1px); }
:root[data-theme='dark'] .btn:not(.ghost) { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.ghost { background: var(--paper); color: var(--ink); border-color: var(--stroke); }
.btn.ghost:hover { background: var(--brass-tint); }
.btn.danger { color: var(--no); border-color: var(--no); }
.linkbtn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; margin: 0 -8px;
  background: none; border: 0; color: var(--teal); cursor: pointer; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
}
.linkbtn[hidden] { display: none; }

/* setup */
.step-h { display: flex; align-items: center; gap: .6rem; font-size: 24px; margin-bottom: 1rem; }
.step { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 10px; background: var(--mint); color: var(--ink); border: 2px solid var(--stroke); font: 700 1rem/1 var(--font-display); }
.options .step { background: var(--lilac); }
.resume { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; background: var(--brass-tint); }
/* Tingkatan tabs: global.css .seg (segmented control) */
.tabs {
  display: inline-flex; flex-wrap: wrap; gap: 4px; max-width: 100%; padding: 4px; margin: 0 0 .8rem;
  background: var(--paper); border: 2px solid var(--stroke); border-radius: 26px;
}
.tab {
  flex: 1 1 auto; min-width: 44px; min-height: 44px; padding: 8px 18px; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--ink-2); font: 600 15px/1.2 var(--font-body); cursor: pointer; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.tab:hover { background: var(--sand); color: var(--ink); }
.tab[aria-selected="true"] { background: var(--night); color: var(--on-night); }
.tab:focus-visible { position: relative; z-index: 1; }
:root[data-theme='dark'] .tab[aria-selected="true"] { background: var(--ink); color: var(--ground); }
@media (forced-colors: active) {
  .tab[aria-selected="true"] { outline: 2px solid ButtonText; outline-offset: -4px; }
}

.chapter { border-top: 1px solid var(--line); }
.chapter:first-child { border-top: 0; }
.ch-head { display: flex; align-items: center; gap: .75rem; padding: .25rem 0; }
.ch-all-hit { flex: none; display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; margin: 0 -.5rem 0 -.25rem; cursor: pointer; }
.toggle {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: .8rem;
  min-height: 44px; background: none; border: 0; padding: .55rem .5rem; margin-right: -.5rem; text-align: left; cursor: pointer;
  border-radius: 10px; transition: background-color .15s;
}
.toggle:hover { background: var(--sand); }
.ch-num {
  flex: none; display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 10px;
  background: var(--sand); color: var(--ink); border: 2px solid var(--stroke); font: 700 1.05rem/1 var(--font-display);
  transition: background-color .15s, color .15s;
}
.chapter:nth-child(3n+1) .ch-num { background: var(--mint); }
.chapter:nth-child(3n+2) .ch-num { background: var(--lilac); }
.chapter:nth-child(3n+3) .ch-num { background: var(--peach); }
.chapter.picked .ch-num { background: var(--night); color: var(--on-night); }
:root[data-theme='dark'] .chapter.picked .ch-num { background: var(--ink); color: var(--ground); }
.ch-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ch-title { font-weight: 800; line-height: 1.3; color: var(--ink); }
.ch-meta { color: var(--muted); font-size: .82rem; }
.ch-picked { color: var(--lilac-text); font-weight: 700; }
.chev { flex: none; width: .6rem; height: .6rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s; margin: 0 .5rem; }
.toggle.open .chev { transform: rotate(-135deg) translate(-2px, -2px); }
.chapter .subs { padding: .1rem 0 .75rem 3.1rem; }
.chapter .subs:not([hidden]) { animation: drop .18s ease-out; }
.sub { display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .7rem; align-items: baseline; align-content: center; min-height: 44px; padding: .4rem .55rem; margin: 0 -.55rem; cursor: pointer; border-radius: 8px; }
.sub:hover { background: var(--sand); }
.sub:has(input:checked) { background: var(--teal-tint); }
.sub input { transform: translateY(2px); }
.sub-num { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: .15rem; }
.sub-meta { color: var(--muted); font-size: .85rem; white-space: nowrap; }
@media (max-width: 560px) { .sub-meta { grid-column: 2; } .chapter .subs { padding-left: .6rem; } }
input[type=checkbox], input[type=radio] { accent-color: var(--teal); width: 1.1rem; height: 1.1rem; flex: none; cursor: pointer; }
.acc { font-weight: 600; margin-left: .2rem; padding: 0 .4rem; border-radius: 6px; font-size: .82rem; }
.acc.good { color: var(--ok); background: var(--ok-soft); }
.acc.mid { color: var(--ink); background: var(--brass-tint); }
.acc.low { color: var(--no); background: var(--no-soft); }

.options .opt { display: grid; grid-template-columns: 160px 1fr; gap: .45rem 1rem; align-items: center; padding: .6rem 0; }
.options .opt + .opt { border-top: 1px dashed var(--line); }
.options .opt[hidden] { display: none; }
.opt-label { font-weight: 600; }
.opt .check { grid-column: 1 / -1; min-height: 44px; display: flex; gap: .6rem; align-items: center; cursor: pointer; }
.seg { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: inline-flex; align-items: center; min-height: 44px; padding: .4rem .95rem; border: 2px solid var(--stroke); font-weight: 700; border-radius: 999px; cursor: pointer; background: var(--paper); transition: background-color .12s, border-color .12s, color .12s; }
.seg label:hover span { background: var(--brass-tint); }
.seg input:checked + span { background: var(--night); border-color: var(--night); color: var(--on-night); }
:root[data-theme='dark'] .seg input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.seg.count input[type=number] { position: static; opacity: 1; width: 5.5rem; min-height: 44px; padding: .4rem .7rem; border: 2px solid var(--stroke); border-radius: 10px; background: var(--paper); }
#ptitle { width: 100%; min-height: 44px; padding: .5rem .75rem; border: 2px solid var(--stroke); border-radius: 10px; background: var(--paper); }

/* sticky action bar */
.actionbar {
  position: sticky; bottom: 12px; z-index: 6;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem;
  background: var(--paper);
  border: 2px solid var(--stroke); border-radius: calc(var(--r-card) + 2px);
  padding: .7rem .7rem .7rem 1.1rem; margin-top: 1.25rem;
  box-shadow: var(--lift);
}
.actionbar-info { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .9rem; min-width: 0; }
.actionbar-info .err { flex-basis: 100%; }
/* phones: the sticky bar sits above the fixed tab bar */
@media (max-width: 760px) { .actionbar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 8px); } }
@media (max-width: 560px) {
  .options .opt { grid-template-columns: 1fr; }
  .card { padding: 18px 16px; }
  .actionbar { padding: .6rem .6rem .6rem .9rem; }
  .actionbar .btn { padding-inline: 18px; }
  .actionbar-info { font-size: .9rem; }
  .actionbar-info .bankcount { display: none; }
}

/* quiz */
.quiz-head { margin-bottom: 1rem; }
/* progress: a ruler-marked tube filling with mint */
.thread {
  position: relative; height: 16px; border-radius: 999px; overflow: hidden; margin-bottom: .7rem;
  background: var(--paper) repeating-linear-gradient(90deg, transparent 0 23px, var(--line) 23px 24px);
  border: 2px solid var(--stroke);
}
.thread > span {
  position: absolute; top: 0; bottom: 0; left: 0; max-width: 100%;
  background: var(--mint-strong); border-right: 2px solid var(--stroke);
  transition: width .3s ease-out;
}
@media (forced-colors: active) {
  .thread { border: 1px solid CanvasText; }
  .thread > span { top: 0; bottom: 0; background: Highlight; forced-color-adjust: none; }
}
.quiz-meta { gap: .5rem; }
.qcount { color: var(--muted); }
.qcount b { color: var(--ink); font-size: 1.1rem; }
.pill { display: inline-flex; align-items: center; padding: .15rem .7rem; border-radius: 999px; font-size: .85rem; font-weight: 800; border: 2px solid var(--stroke); background: var(--paper); color: var(--ink); }
.scorepill { background: var(--brass-tint); }
.tier-R { background: var(--mint); }
.tier-S { background: var(--lilac); }
.tier-T { background: var(--peach); }
.qcard { position: relative; padding: 1.8rem 1.6rem 1.4rem; box-shadow: var(--lift); }
.qcard::before { content: ""; position: absolute; top: -11px; left: 50%; width: 84px; height: 20px; margin-left: -42px; background: var(--mint); opacity: .9; transform: rotate(-2deg); }
.quiz.fresh .qcard { animation: rise .25s ease-out; }
.qnum { margin: 0 0 .35rem; color: var(--lilac-text); font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.stem { font: 500 1.3rem/1.4 var(--font-display); color: var(--ink); margin: 0 0 1rem; }
.roman { list-style: none; padding: .6rem .9rem; margin: 0 0 1.1rem; background: var(--brass-tint); border: 2px dashed var(--stroke); border-radius: 10px; }
.roman li { display: flex; gap: .7rem; padding: .2rem 0; }
.rn { flex: none; width: 2.2rem; font-weight: 700; color: var(--ink); font-family: var(--font-display); }
.choices { display: grid; gap: .6rem; }
.choice {
  position: relative; display: flex; gap: .85rem; align-items: center; text-align: left;
  background: var(--paper); border: 2px solid var(--stroke); border-radius: 12px; color: var(--ink);
  padding: .8rem 2.6rem .8rem .9rem; cursor: pointer;
  transition: border-color .12s, background-color .12s, transform .12s, box-shadow .12s;
}
.choice:hover:not(:disabled) { background: var(--brass-tint); transform: translate(-1px, -1px); box-shadow: var(--lift-sm); }
.choice:hover:not(:disabled) .key { background: var(--night); border-color: var(--night); color: var(--on-night); }
.choice:disabled { cursor: default; }
.choice:disabled:not(.right):not(.wrong) { opacity: .65; }
.key { flex: none; display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 2px solid var(--stroke); font-weight: 800; font-size: .85rem; transition: background-color .12s, color .12s, border-color .12s; }
.choice.right, .opts-static .right { border-color: var(--ok); background: var(--ok-soft); }
.choice.right .key, .opts-static .right .key { background: var(--ok); color: #fff; border-color: var(--ok); }
.choice.wrong, .opts-static .wrong { border-color: var(--no); background: var(--no-soft); }
.choice.wrong .key, .opts-static .wrong .key { background: var(--no); color: #fff; border-color: var(--no); }
:root[data-theme='dark'] .choice.right .key, :root[data-theme='dark'] .opts-static .right .key, :root[data-theme='dark'] .choice.wrong .key, :root[data-theme='dark'] .opts-static .wrong .key { color: #10201A; }
.choice.right::after, .choice.wrong::after { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); font-weight: 800; font-size: 1.1rem; }
.choice.right::after { content: "✓"; color: var(--ok); }
.choice.wrong::after { content: "✗"; color: var(--no); }
.choice.right { animation: pop .3s ease-out; }
.choice.wrong { animation: shake .3s ease-out; }
.feedback { margin-top: 1.1rem; padding: .9rem 1.1rem; border-radius: 12px; border: 2px dashed; animation: rise .25s ease-out; }
.feedback p { margin: .2rem 0; }
.feedback.ok { border-color: var(--ok); background: var(--ok-soft); }
.feedback.no { border-color: var(--no); background: var(--no-soft); }
.verdict { font-weight: 700; font-size: 1.05rem; }
.feedback.ok .verdict { color: var(--ok); }
.feedback.no .verdict { color: var(--no); }
.ref { color: var(--muted); font-size: .875rem; }
.hint { text-align: center; margin-top: 1.2rem; }
@media (hover: none) { .hint { display: none; } }
@media (max-width: 560px) { .qcard { padding: 1.2rem 1rem 1.1rem; } .stem { font-size: 1.08rem; } }

/* results */
.result { text-align: center; padding: 2.2rem 1.2rem 2rem; position: relative; overflow: hidden; }
.result { overflow: visible; box-shadow: var(--lift); margin-top: 1rem; }
.result::before { content: ""; position: absolute; top: -12px; left: 50%; width: 110px; height: 22px; margin-left: -55px; background: var(--lilac); opacity: .9; transform: rotate(2deg); }
.ring {
  --c: var(--night);
  width: 168px; height: 168px; margin: 1rem auto 1.1rem; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--sand) 0);
  border: 2px solid var(--stroke);
  animation: rise .4s ease-out;
}
.ring.good { --c: var(--mint-strong); }
.ring.mid { --c: var(--brass); }
.ring.low { --c: var(--peach-strong); }
.ring > div { width: 130px; height: 130px; border-radius: 50%; background: var(--paper); border: 2px solid var(--stroke); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-score { font-family: var(--font-display); font-weight: 700; font-size: 2.6rem; line-height: 1; color: var(--ink); }
.ring-score small { font-size: 1.1rem; color: var(--muted); }
.ring-pct { color: var(--muted); font-weight: 600; margin-top: .3rem; }
.result .lead { font-size: 1.05rem; }
.result .row { margin-top: 1.3rem; }
.review { margin-top: 1.75rem; }
.review .qcard::before { background: var(--peach); }
.opts-static { list-style: none; padding: 0; margin: 0 0 .9rem; display: grid; gap: .4rem; }
.opts-static li { display: flex; gap: .65rem; align-items: center; padding: .45rem .65rem; border: 1.5px solid transparent; border-radius: 10px; }

/* progress */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.stat { text-align: center; display: flex; flex-direction: column; border-top-width: 10px; border-top-color: var(--lilac-strong); }
.stat.good { border-top-color: var(--mint-strong); }
.stat.mid { border-top-color: var(--brass); }
.stat.low { border-top-color: var(--peach-strong); }
.stat .big { font: 700 2.1rem/1.2 var(--font-display); color: var(--ink); }
.ptable { width: 100%; border-collapse: collapse; font-size: .95rem; }
.ptable th, .ptable td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ptable thead th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.ptable .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ptable .chrow th { background: var(--sand); font-weight: 800; color: var(--ink); }
.meter { display: inline-block; width: 100px; height: 10px; background: var(--sand); border: 1.5px solid var(--stroke); border-radius: 99px; overflow: hidden; vertical-align: middle; margin-right: .45rem; }
.meter span { display: block; height: 100%; border-radius: 99px; }
.meter .good { background: var(--mint-strong); }
.meter .mid { background: var(--brass); }
.meter .low { background: var(--peach-strong); }
.sessions { list-style: none; margin: 0; padding: 0; }
.sessions li { display: flex; gap: .3rem 1rem; flex-wrap: wrap; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.sessions li:last-child { border-bottom: 0; }
@media (max-width: 560px) {
  .stats { gap: .5rem; }
  .stat { padding: 1rem .5rem; }
  .stat .big { font-size: 1.6rem; }
  .meter { width: 50px; }
}

/* print paper (screen preview) */
.print-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; background: var(--brass-tint); }
.paper { background: #fff; color: #111; border: 1px solid var(--line); border-radius: 4px; padding: 2rem 2.2rem; margin-bottom: 1.5rem; font-family: Georgia, "Times New Roman", serif; box-shadow: var(--lift); }
.paper h1 { font-family: Georgia, "Times New Roman", serif; letter-spacing: 0; }
.paper-head { border-bottom: 2px solid #111; margin-bottom: 1.2rem; padding-bottom: .8rem; }
.paper-head h1 { margin: 0 0 .3rem; font-size: 1.5rem; }
.paper-head p { margin: .15rem 0; }
.fields { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; margin-top: .8rem; }
.fields span { display: flex; align-items: baseline; gap: .3rem; white-space: nowrap; }
.fields .f-name { flex: 1 1 12rem; }
.fields i { display: inline-block; border-bottom: 1px solid #111; height: 1em; }
.fields .f-name i { flex: 1; min-width: 8rem; }
.fields i.f-class { width: 5rem; }
.fields i.f-date { width: 6.5rem; }
.fields i.short { width: 2.5rem; }
.pq { list-style: none; padding: 0; margin: 0; }
.pitem { padding: .5rem 0 .7rem; break-inside: avoid; page-break-inside: avoid; }
.pitem .stem { font-size: 1rem; font-weight: 400; margin: 0 0 .35rem; display: flex; gap: .6rem; }
.pn { flex: none; min-width: 1.6rem; font-weight: 700; }
.pitem .roman { margin: 0 0 .35rem 2.2rem; padding: 0; background: none; border: 0; border-radius: 0; }
.pitem .rn { color: inherit; font-family: inherit; }
.popts { list-style: none; padding: 0; margin: 0 0 0 2.2rem; display: grid; gap: .15rem; }
.popts li { display: flex; gap: .5rem; }
.popts .key, .keygrid .key { border: 0; width: auto; height: auto; font-weight: 700; display: inline; }
.keygrid { list-style: none; padding: 0; margin: 0 0 1.2rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: .3rem .8rem; }
.keygrid span { display: inline-block; min-width: 1.8rem; text-align: right; }
.keyexp { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.keyexp li { padding: .3rem 0; border-top: 1px solid #ddd; break-inside: avoid; }
.keyexp .ref { color: #555; font-size: .85rem; }
@media (max-width: 560px) { .paper { padding: 1.2rem 1rem; } }

/* footer: Footer.astro from the study site */
.site-footer {
  background: var(--paper); border-top: 2px dashed var(--line-2);
  margin-top: 64px; padding: 24px 0 36px; font-size: 15px; color: var(--ink-2);
}
.site-footer p { margin: 0 0 6px; }
.site-footer .caption { color: var(--muted); }
.foot-nav { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 20px; margin-bottom: 14px; }
.foot-nav ul { display: flex; flex-wrap: wrap; gap: 0 20px; margin: 0; padding: 0; list-style: none; grid-column: 1; }
.foot-nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-decoration: none; }
.foot-nav a:hover { text-decoration: underline; }
.foot-main a { font-weight: 800; }
.foot-ref { font-size: 14px; }
.foot-ref a { color: var(--accent-text); font-weight: 700; }
.foot-nav .top { grid-column: 2; grid-row: 1; align-self: start; font-weight: 700; }
@media (max-width: 480px) {
  .foot-nav { grid-template-columns: minmax(0, 1fr); }
  .foot-nav ul { column-gap: 16px; }
  .foot-nav .top { grid-column: 1; grid-row: auto; justify-self: start; }
}

/* high contrast: no graph paper behind text */
@media (prefers-contrast: more) {
  body { background-image: none; }
}

/* motion */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.015); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  @page { margin: 16mm 14mm; }
  body { background: #fff; background-image: none; color: #000; font-size: 11pt; display: block; min-height: 0; }
  .no-print, .print-bar, .skip-link, .site-header, .tab-bar, .site-footer { display: none !important; }
  body { padding-bottom: 0 !important; }
  main { display: block; padding: 0; }
  .hero { background: none !important; border: 0; box-shadow: none; color: #000 !important; padding: 0 0 1rem; }
  .hero h1, .hero .lead, .hero .eyebrow, .hero-stats li, .hero-stats b { color: #000 !important; }
  .hero-stats li { background: none !important; border-color: #999; }
  .hero::before, .hero::after, .result::before, .qcard::before { display: none; }
  .paper { border: 0; padding: 0; margin: 0; border-radius: 0; box-shadow: none; }
  .paper.answers { break-before: page; page-break-before: always; }
}
