/* Layout: a fixed study sidebar (navigation, search, the current page's outline) beside one
   reading column of about 70 characters set in a text serif; on phones the sidebar becomes a
   drawer behind a slim top bar. The memorable element is the information design inside the
   text: dotted glossary terms that open definition cards, evidence badges on claims, and
   module cross-links with preview cards. Everything else stays quiet. */

:root {
  --bg: #F5F7F2;
  --surface: #FFFFFF;
  --surface-2: #EAEFE7;
  --fg: #192120;
  --muted: #5C6A63;
  --rule: #D4DBD2;
  --accent: #0F6A5A;
  --accent-ink: #0A4F43;
  --accent-soft: #DCEEE7;
  --on-accent: #FFFFFF;
  --star: #A86F0E;
  --b-rct-bg: #DCEFDF;  --b-rct-fg: #1F5F2E;
  --b-ma-bg: #D9ECEC;   --b-ma-fg: #155E5E;
  --b-obs-bg: #E1E6F2;  --b-obs-fg: #3A4B7A;
  --b-mech-bg: #EADFF3; --b-mech-fg: #5B3A82;
  --b-con-bg: #E6E8EA;  --b-con-fg: #3F4A52;
  --b-cnt-bg: #F6E7C8;  --b-cnt-fg: #7A4F08;
  --shadow: 0 10px 30px rgba(25, 33, 32, 0.14);
  --font-body: 'Alegreya', 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  --font-ui: 'Alegreya Sans', 'Gill Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --fs-body: 1.15rem;
  --lh-body: 1.55;
  --side-w: 272px;
  --gutter: 16px;
  --measure: 70ch;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121715; --surface: #191F1C; --surface-2: #212925; --fg: #E7ECE8; --muted: #98A59E; --rule: #2B352F;
    --accent: #63C9A9; --accent-ink: #8FDCC3; --accent-soft: #16352C; --on-accent: #0F1A16; --star: #E3B452;
    --b-rct-bg: #1E3A27; --b-rct-fg: #9ED9AE; --b-ma-bg: #173838; --b-ma-fg: #8ED4D4; --b-obs-bg: #27304A; --b-obs-fg: #AEBCE6;
    --b-mech-bg: #352A47; --b-mech-fg: #CBB3E6; --b-con-bg: #2C3338; --b-con-fg: #B9C3CA; --b-cnt-bg: #4A3A14; --b-cnt-fg: #EBC56C;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121715; --surface: #191F1C; --surface-2: #212925; --fg: #E7ECE8; --muted: #98A59E; --rule: #2B352F;
  --accent: #63C9A9; --accent-ink: #8FDCC3; --accent-soft: #16352C; --on-accent: #0F1A16; --star: #E3B452;
  --b-rct-bg: #1E3A27; --b-rct-fg: #9ED9AE; --b-ma-bg: #173838; --b-ma-fg: #8ED4D4; --b-obs-bg: #27304A; --b-obs-fg: #AEBCE6;
  --b-mech-bg: #352A47; --b-mech-fg: #CBB3E6; --b-con-bg: #2C3338; --b-con-fg: #B9C3CA; --b-cnt-bg: #4A3A14; --b-cnt-fg: #EBC56C;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- frame ---------- */
.app { min-height: 100%; }

.sidebar {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  bottom: 0;
  left: 0;
  width: var(--side-w);
  background: var(--surface);
  border-right: 1px solid var(--rule);
  padding: 22px 18px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-family: var(--font-ui);
  z-index: 30;
}
.brand { display: flex; flex-direction: column; text-decoration: none; color: var(--fg); line-height: 1.2; }
.brand strong { font-family: var(--font-body); font-weight: 800; font-size: 1.35rem; letter-spacing: -0.01em; }
.brand small { color: var(--muted); font-size: 0.92rem; margin-top: 2px; }

.search { display: flex; border: 1px solid var(--rule); border-radius: 8px; background: var(--bg); overflow: hidden; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--fg); font: inherit; font-size: 0.98rem; padding: 8px 10px; }
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; }
.search:focus-within { border-color: var(--accent); }
.search button { border: 0; background: transparent; color: var(--muted); padding: 0 10px; cursor: pointer; display: flex; align-items: center; }
.search button:hover { color: var(--accent); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: block; padding: 7px 10px; border-radius: 6px; color: var(--fg); text-decoration: none; font-weight: 500; font-size: 1.02rem; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }

.context { border-top: 1px solid var(--rule); padding-top: 14px; flex: 1; }
.context h4 { margin: 0 0 8px; font-size: 0.82rem; font-weight: 700; color: var(--muted); letter-spacing: 0.03em; }
.toc { display: flex; flex-direction: column; }
.toc a { display: block; padding: 4px 10px; color: var(--muted); text-decoration: none; font-size: 0.95rem; border-left: 2px solid transparent; line-height: 1.3; }
.toc a:hover { color: var(--accent-ink); border-left-color: var(--accent); }
.toc a .mid { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; margin-right: 6px; }

.sidefoot { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--muted); border-top: 1px solid var(--rule); padding-top: 12px; }
.btn-quiet { align-self: flex-start; border: 1px solid var(--rule); background: transparent; color: var(--fg); font: inherit; font-size: 0.92rem; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.btn-quiet:hover { border-color: var(--accent); color: var(--accent-ink); }

.topbar { display: none; }
.scrim { display: none; }

.main { padding-block: 28px 72px; padding-inline: var(--gutter); max-width: calc(var(--measure) + 2 * var(--gutter)); margin-inline: auto; }
.main:focus { outline: none; }
.loading { color: var(--muted); font-family: var(--font-ui); }

@media (min-width: 960px) {
  .main { margin-left: var(--side-w); padding-inline: 56px; padding-block: 44px 96px; max-width: none; }
  .main > * { max-width: var(--measure); }
  .main > h1 { max-width: 30ch; }
  .main.wide > * { max-width: 86ch; }
}
@media (max-width: 959px) {
  .topbar {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px var(--gutter);
    background: var(--surface);
    border-bottom: 1px solid var(--rule);
    font-family: var(--font-ui);
  }
  .brand-top { flex: 1; font-family: var(--font-body); font-weight: 800; font-size: 1.2rem; text-decoration: none; color: var(--fg); }
  .iconbtn { border: 0; background: transparent; color: var(--fg); width: 40px; height: 40px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
  .iconbtn:hover { background: var(--surface-2); }
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: none; width: min(var(--side-w), 86vw); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 28; }
  .scrim[hidden] { display: none; }
  body.nav-open { overflow: hidden; }
}

/* ---------- type ---------- */
h1, h2, h3, h4 { font-family: var(--font-body); font-weight: 700; line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: 2.15rem; letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; margin-top: 2.2rem; margin-bottom: 0.6rem; }
h3 { font-size: 1.18rem; margin-top: 1.6rem; margin-bottom: 0.4rem; }
p { margin: 0 0 1em; }
.content ul, .content ol { padding-left: 1.5em; margin: 0 0 1em; }
.content li { margin-bottom: 0.4em; }
.content li > p { margin-bottom: 0.4em; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.16em; }
a:hover { color: var(--accent-ink); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
code { font-family: ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace; font-size: 0.9em; background: var(--surface-2); padding: 0.05em 0.3em; border-radius: 3px; }
.content blockquote { margin: 1.2rem 0; padding: 0.2rem 0 0.2rem 1rem; border-left: 3px solid var(--rule); color: var(--muted); }
.content img { max-width: 100%; }
.tablewrap { overflow-x: auto; margin: 1rem 0 1.5rem; }
.content table { border-collapse: collapse; width: 100%; font-family: var(--font-ui); font-size: 0.95rem; }
.content th, .content td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.content th { font-weight: 700; color: var(--muted); }
.muted { color: var(--muted); }
.ui { font-family: var(--font-ui); }
.mid { font-family: var(--font-ui); font-weight: 700; font-variant-numeric: tabular-nums; }
.star { color: var(--star); }

/* ---------- information design ---------- */
.term {
  border-bottom: 1px dotted var(--accent);
  cursor: help;
  color: inherit;
  border-radius: 2px;
}
.term:hover, .term:focus-visible, .term.active { background: var(--accent-soft); border-bottom-style: solid; outline: none; }

.badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.74em;
  font-weight: 700;
  line-height: 1.35;
  padding: 0.02em 0.45em 0.08em;
  border-radius: 4px;
  vertical-align: 0.18em;
  margin: 0 0.08em;
  cursor: help;
  white-space: nowrap;
  background: var(--b-con-bg);
  color: var(--b-con-fg);
}
.badge.rct { background: var(--b-rct-bg); color: var(--b-rct-fg); }
.badge.ma { background: var(--b-ma-bg); color: var(--b-ma-fg); }
.badge.obs { background: var(--b-obs-bg); color: var(--b-obs-fg); }
.badge.mech { background: var(--b-mech-bg); color: var(--b-mech-fg); }
.badge.consensus { background: var(--b-con-bg); color: var(--b-con-fg); }
.badge.contested { background: var(--b-cnt-bg); color: var(--b-cnt-fg); }
.badge.open { background: transparent; border: 1px solid var(--rule); color: var(--muted); font-weight: 500; }

a.xlink { text-decoration-style: dotted; }
a.ext::after { content: ''; display: inline-block; width: 0.55em; height: 0.55em; margin-left: 0.25em; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: rotate(45deg) translateY(0.1em); opacity: 0.7; }

.tip {
  position: fixed;
  z-index: 100;
  width: max-content;
  max-width: min(340px, calc(100vw - 32px));
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-size: 0.97rem;
  line-height: 1.45;
}
.tip[hidden] { display: none; }
.tip .tiphead { font-family: var(--font-ui); font-size: 0.85rem; color: var(--muted); margin-bottom: 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tip .tiptitle { font-family: var(--font-ui); font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.tip p { margin: 0 0 0.55em; }
.tip p:last-child { margin-bottom: 0; }
.tip .tipmod, .tip .tipgo { font-family: var(--font-ui); font-size: 0.92rem; display: inline-block; margin-top: 2px; }
.tip .badge { cursor: default; }

/* ---------- callouts in lessons ---------- */
.content details {
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 10px 14px;
  margin: 1rem 0 1.2rem;
  background: var(--surface);
}
.content details > summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--font-ui);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent-ink);
}
.content details > summary::-webkit-details-marker { display: none; }
.content details > summary::before {
  content: '';
  flex: 0 0 auto;
  width: 7px; height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  margin-left: 2px;
}
.content details[open] > summary::before { transform: rotate(45deg); }
.content details[open] > summary { margin-bottom: 8px; }
.content details > :last-child { margin-bottom: 0; }
.content details.answer { background: var(--surface-2); border-color: transparent; }
.content details.answer > summary { color: var(--fg); font-weight: 500; }

.callout { margin: 2.2rem 0; border-radius: 8px; padding: 18px 22px 8px; }
.callout > h2 { margin-top: 0; font-size: 1.3rem; }
.callout.practice { background: var(--accent-soft); }
.callout.check { border: 1px solid var(--rule); background: var(--surface); }
.callout.check > p > strong { font-family: var(--font-body); }
.sources { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: 0.97rem; }
.sources h2 { font-size: 1.2rem; margin-top: 0; }
.sources li { overflow-wrap: anywhere; color: var(--muted); }
.sources li a { color: var(--accent); }

.lead { font-size: 1.22rem; border-left: 3px solid var(--accent); padding: 2px 0 2px 16px; margin: 1.6rem 0 2rem; }

/* ---------- lesson header and pager ---------- */
.lesson-head .crumbs { font-family: var(--font-ui); color: var(--muted); margin-bottom: 6px; }
.lesson-head .crumbs a { color: var(--muted); text-decoration: none; }
.lesson-head .crumbs a:hover { color: var(--accent-ink); text-decoration: underline; }
.lesson-head h1 .mid { color: var(--muted); font-weight: 500; margin-right: 0.35em; font-size: 0.8em; vertical-align: 0.08em; }
.lesson-head .meta { display: flex; flex-wrap: wrap; gap: 8px 20px; font-family: var(--font-ui); font-size: 0.95rem; color: var(--muted); margin-top: 12px; align-items: center; }
.lesson-head .meta .needs a { text-decoration: none; font-weight: 700; }

.status { font-family: var(--font-ui); font-size: 0.9rem; display: inline-flex; align-items: center; gap: 7px; color: var(--muted); white-space: nowrap; }
.status i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--muted); display: inline-block; flex: 0 0 auto; }
.status.started { color: var(--accent-ink); }
.status.started i { border-color: var(--accent); background: linear-gradient(90deg, var(--accent) 50%, transparent 50%); }
.status.done { color: var(--accent-ink); }
.status.done i { background: var(--accent); border-color: var(--accent); }

.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 3rem; border-top: 1px solid var(--rule); padding-top: 1.2rem; font-family: var(--font-ui); }
.pager a, .pager span { text-decoration: none; max-width: 48%; min-width: 0; color: var(--fg); }
.pager .next { text-align: right; margin-left: auto; }
.pager small { display: block; color: var(--muted); font-size: 0.85rem; }
.pager a:hover { color: var(--accent-ink); }
.pager .unwritten { color: var(--muted); }

/* ---------- home ---------- */
.home h1 { font-size: 2.4rem; margin-bottom: 0.4rem; }
.home .goal { font-size: 1.22rem; }
.home .goal p { margin-bottom: 0.6em; }
.progress-block { margin: 2rem 0 2.4rem; padding: 18px 20px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); font-family: var(--font-ui); }
.progress-block h2 { font-size: 1.15rem; margin: 0 0 10px; font-family: var(--font-ui); }
.progress { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; display: flex; }
.progress .done { background: var(--accent); }
.progress .started { background: color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.progress-row { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; color: var(--muted); font-size: 0.95rem; }
.progress-row strong { color: var(--fg); }
.nextup { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.btn { font-family: var(--font-ui); font-weight: 700; font-size: 1rem; background: var(--accent); color: var(--on-accent); padding: 10px 16px; border-radius: 6px; text-decoration: none; display: inline-block; border: 0; cursor: pointer; }
.btn:hover { background: var(--accent-ink); color: var(--on-accent); }
.quicklinks { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 1.5rem 0; font-family: var(--font-ui); }
.quicklinks a { display: block; padding: 14px 16px; border: 1px solid var(--rule); border-radius: 8px; text-decoration: none; color: var(--fg); background: var(--surface); }
.quicklinks a:hover { border-color: var(--accent); }
.quicklinks a strong { display: block; font-size: 1.05rem; }
.quicklinks a span { color: var(--muted); font-size: 0.92rem; }
.bigidea h2 { font-size: 1.6rem; }

/* ---------- roadmap ---------- */
.roadmap-controls { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; margin: 1.2rem 0 0.5rem; font-family: var(--font-ui); }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 6px 13px; color: var(--fg); cursor: pointer; font: inherit; font-size: 0.95rem; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 0.9rem; }
.part { margin-top: 2.6rem; scroll-margin-top: 80px; }
.part > h2 { font-size: 1.45rem; }
.part .pintro { color: var(--muted); font-style: italic; margin: 0.3rem 0 0.8rem; }
.part h3.group { font-family: var(--font-ui); font-size: 0.95rem; color: var(--muted); margin: 1.4rem 0 0.2rem; font-weight: 700; }
.mod { border-top: 1px solid var(--rule); padding: 9px 0; margin: 0; border-radius: 0; background: transparent; }
.part .mod:last-child { border-bottom: 1px solid var(--rule); }
.mod > summary { display: grid; grid-template-columns: 3.4em 1fr auto; gap: 8px 12px; align-items: baseline; cursor: pointer; list-style: none; }
.mod > summary::-webkit-details-marker { display: none; }
.mod > summary .mid { color: var(--muted); }
.mod > summary .mtitle { font-weight: 700; }
.mod > summary .mtitle .star { margin-left: 0.35em; font-size: 0.9em; }
.mod > summary:hover .mtitle { color: var(--accent-ink); }
.mod .mbody { padding: 8px 0 8px calc(3.4em + 12px); }
.mod .mbody p { margin: 0 0 0.6em; }
.mod .mbody .label { font-family: var(--font-ui); font-weight: 700; color: var(--muted); font-size: 0.9rem; margin-right: 0.4em; }
.mod .mbody .needs a { text-decoration: none; font-weight: 700; }
.mod .mbody .actions { font-family: var(--font-ui); margin-top: 4px; }
.mod.hidden { display: none; }
.mod.is-written > summary .mtitle { color: var(--accent-ink); }
@media (max-width: 520px) {
  .mod > summary { grid-template-columns: 3.4em 1fr; }
  .mod > summary .status { grid-column: 2; }
  .mod .mbody { padding-left: 0; }
}

/* ---------- glossary and library ---------- */
.filter { display: block; width: 100%; max-width: 32rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--fg); font: inherit; font-family: var(--font-ui); font-size: 1rem; padding: 9px 12px; margin: 1rem 0 1.4rem; }
.filter:focus { outline: none; border-color: var(--accent); }
.gletter { font-family: var(--font-ui); color: var(--muted); font-size: 1rem; margin-top: 2rem; }
.gterm { border-top: 1px solid var(--rule); padding: 14px 0; scroll-margin-top: 80px; }
.gterm h3 { margin: 0 0 2px; font-size: 1.2rem; }
.gterm .aliases { font-family: var(--font-ui); color: var(--muted); font-size: 0.92rem; }
.gterm p { margin: 6px 0; }
.gterm .gmod { font-family: var(--font-ui); font-size: 0.92rem; text-decoration: none; }
.gterm.hidden { display: none; }
.gterm.flash { background: var(--accent-soft); }
.library .content li.hidden { display: none; }
.library .content h3 { margin-top: 1.8rem; }
.count { font-family: var(--font-ui); color: var(--muted); font-size: 0.95rem; }

/* ---------- search ---------- */
.results h2 { font-size: 1.2rem; }
.result { border-top: 1px solid var(--rule); padding: 12px 0; }
.result a.rtitle { font-weight: 700; text-decoration: none; }
.result .snippet { color: var(--muted); font-size: 0.98rem; margin: 2px 0 0; }
.result .snippet mark { background: var(--accent-soft); color: inherit; padding: 0 0.1em; }
.result .kind { font-family: var(--font-ui); font-size: 0.85rem; color: var(--muted); margin-right: 8px; }

.notice { font-family: var(--font-ui); color: var(--muted); border: 1px dashed var(--rule); border-radius: 8px; padding: 14px 16px; margin: 1rem 0; }

/* ---------- exams ---------- */
.exam-box { display: flex; gap: 14px; align-items: center; justify-content: space-between; border: 1px solid var(--rule); background: var(--surface); border-radius: 10px; padding: 14px 16px; margin: 2rem 0 1rem; font-family: var(--font-ui); }
.exam-box strong { display: block; } .exam-box span { color: var(--muted); font-size: 0.95rem; }
.btn.btn-alt { background: transparent; color: var(--accent-ink); border: 1px solid var(--accent); }
.btn.btn-alt:hover { background: var(--accent-soft); color: var(--accent-ink); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.exam { font-family: var(--font-ui); }
.exam h1 { font-family: var(--font-body); }
.exam-facts { display: flex; flex-wrap: wrap; gap: 12px; margin: 1rem 0; }
.exam-facts > div { border: 1px solid var(--rule); background: var(--surface); border-radius: 8px; padding: 10px 14px; color: var(--muted); }
.exam-facts b { color: var(--fg); font-size: 1.25rem; margin-right: 4px; }
.exam-rules li { margin: 0.4rem 0; }
.exam-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 1.2rem 0; }
.exam-table { border-collapse: collapse; width: 100%; max-width: 760px; margin: 0.6rem 0 1rem; }
.exam-table th, .exam-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--rule); }
.exam-table th { color: var(--muted); font-weight: 700; font-size: 0.92rem; }
.exam-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; position: sticky; top: 0; background: var(--bg); padding: 8px 0; z-index: 3; border-bottom: 1px solid var(--rule); }
.exam-mode { color: var(--muted); font-size: 0.9rem; margin-left: 8px; }
.exam-timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.3rem; } .exam-timer.low { color: #B3261E; }
.exam-grid { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.exam-grid button { width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--rule); background: var(--surface); color: var(--fg); font: inherit; cursor: pointer; }
.exam-grid button.done { background: var(--accent-soft); border-color: var(--accent); }
.exam-grid button.flag { outline: 2px solid var(--star); }
.exam-grid button.cur { background: var(--accent); color: var(--on-accent); }
.exam-q { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 18px 18px 14px; max-width: 820px; }
.exam-qhead { color: var(--muted); font-size: 0.92rem; margin-bottom: 6px; } .flagtag { color: var(--star); font-weight: 700; margin-left: 6px; }
.exam-stem { font-family: var(--font-body); font-size: 1.2rem; line-height: 1.45; margin: 0.4rem 0 1rem; white-space: pre-wrap; }
.exam-hint { color: var(--muted); margin: 0 0 8px; } .exam-hint.warn { color: var(--star); }
.exam-opts { display: flex; flex-direction: column; gap: 8px; }
.exam-opt { display: flex; gap: 10px; align-items: flex-start; text-align: left; font: inherit; font-size: 1.02rem; border: 1px solid var(--rule); background: var(--bg); color: var(--fg); border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.exam-opt:hover:not(:disabled) { border-color: var(--accent); }
.exam-opt .ol { flex: 0 0 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--muted); display: inline-flex; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 700; }
.exam-opt.on { border-color: var(--accent); background: var(--accent-soft); } .exam-opt.on .ol { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.exam-opt.key { border-color: #2E7D32; background: color-mix(in srgb, #2E7D32 16%, var(--bg)); } .exam-opt.wrong { border-color: #B3261E; background: color-mix(in srgb, #B3261E 14%, var(--bg)); }
.exam-conf { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 6px; } .exam-conf > span { color: var(--muted); margin-right: 4px; }
.conf { font: inherit; font-weight: 700; border: 1px solid var(--rule); background: var(--bg); color: var(--fg); border-radius: 18px; padding: 6px 14px; cursor: pointer; }
.conf.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.exam-fb { margin-top: 12px; padding: 10px 12px; border-radius: 8px; border-left: 4px solid var(--accent); background: var(--surface-2); } .exam-fb.bad { border-left-color: #B3261E; }
.exam-nav { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.exam-confirm { max-width: 640px; }
.exam-verdict { display: flex; gap: 18px; align-items: center; border-radius: 10px; padding: 16px 18px; border: 1px solid var(--rule); background: var(--surface); margin: 1rem 0; }
.exam-verdict .big { font-size: 2.6rem; font-weight: 800; font-family: var(--font-body); }
.exam-verdict.pass { border-color: #2E7D32; } .exam-verdict.fail { border-color: #B3261E; }
.exam-rev { border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); margin: 8px 0; padding: 4px 12px; max-width: 820px; }
.exam-rev > summary { cursor: pointer; padding: 6px 0; } .exam-rev .num { display: inline-block; min-width: 1.6em; font-weight: 700; } .exam-rev .tag { color: var(--muted); font-size: 0.88rem; margin-left: 6px; }
.exam-rev.bad { border-left: 4px solid #B3261E; } .exam-rev.ok { border-left: 4px solid #2E7D32; } .exam-rev.part { border-left: 4px solid var(--star); }
.rev-opts { list-style: none; padding: 0; } .rev-opts li { padding: 4px 8px; border-radius: 6px; margin: 3px 0; } .rev-opts li.key { background: color-mix(in srgb, #2E7D32 16%, transparent); } .rev-opts li.mine:not(.key) { background: color-mix(in srgb, #B3261E 14%, transparent); }
.exam .muted { color: var(--muted); }
@media (max-width: 640px) { .exam-box { flex-direction: column; align-items: stretch; } .exam-verdict { flex-direction: column; align-items: flex-start; } }
