/* Kaplan & Sadock Study Companion
   Palette: indigo night, cool paper, and six spectral
   colors. Each color always means the same study mode. */

:root {
  --night: #1E2463;
  --night-deep: #141842;
  --night-ink: #E9EBFF;
  --night-ink-2: #AEB4E8;

  --paper: #F4F5FA;
  --surface: #FFFFFF;
  --tint: #ECEEF8;
  --ink: #1A1C33;
  --ink-2: #474B6A;
  --ink-3: #6A6F90;
  --rule: #D9DCEA;

  --m-guide: #D33840;
  --m-hy: #DF6418;
  --m-dx: #B98000;
  --m-case: #1F8B54;
  --m-pharm: #2867CC;
  --m-found: #6A4BE8;
  --m-gloss: #3B4199;

  --good: #1F8B54;
  --bad: #C2333B;
  --focus: #2867CC;
  --mark: #FFE59A;

  --serif: 'Literata', Georgia, 'Times New Roman', serif;
  --sans: 'Schibsted Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --wrap: 1180px;
  --measure: 68ch;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 18px;
  --top: 64px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #10132E;
  --surface: #181C42;
  --tint: #1F2450;
  --ink: #E7E9F8;
  --ink-2: #B9BDDA;
  --ink-3: #8C91B6;
  --rule: #2D3264;
  --m-guide: #FF6B72;
  --m-hy: #FF9550;
  --m-dx: #F2C14E;
  --m-case: #4CCB8A;
  --m-pharm: #6EA8FF;
  --m-found: #A68BFF;
  --m-gloss: #A9AEFF;
  --good: #4CCB8A;
  --bad: #FF6B72;
  --focus: #8DB8FF;
  --mark: #5B4A12;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10132E;
    --surface: #181C42;
    --tint: #1F2450;
    --ink: #E7E9F8;
    --ink-2: #B9BDDA;
    --ink-3: #8C91B6;
    --rule: #2D3264;
    --m-guide: #FF6B72;
    --m-hy: #FF9550;
    --m-dx: #F2C14E;
    --m-case: #4CCB8A;
    --m-pharm: #6EA8FF;
    --m-found: #A68BFF;
    --m-gloss: #A9AEFF;
    --good: #4CCB8A;
    --bad: #FF6B72;
    --focus: #8DB8FF;
    --mark: #5B4A12;
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 16px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.55 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; outline: none; }
img, svg { max-width: 100%; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px); }
.sr-only { 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: absolute; left: -999px; top: 8px; z-index: 50; background: var(--surface); padding: 8px 14px; border-radius: var(--r-sm); }
.skip:focus { left: 8px; }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
.loading { padding: 80px 0; color: var(--ink-3); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--night);
  color: var(--night-ink);
  padding-top: env(safe-area-inset-top, 0px);
  box-shadow: 0 1px 0 rgba(255,255,255,.06);
}
.topbar__inner {
  max-width: var(--wrap); margin: 0 auto; min-height: 64px;
  padding: 11px clamp(12px, 3vw, 32px);
  display: flex; flex-wrap: nowrap; align-items: center; gap: 10px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.brand img { border-radius: 9px; display: block; }
.brand__name { font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; font-size: 1.02rem; }
.brand__sub { display: block; font-weight: 500; color: var(--night-ink-2); font-size: .82rem; letter-spacing: 0; }

.search { position: relative; margin-left: auto; flex: 1 1 140px; min-width: 0; max-width: 440px; }
.search__icon { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--night-ink-2); pointer-events: none; }
.search input {
  width: 100%; height: 42px; border-radius: 21px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  color: var(--night-ink);
  padding: 0 40px 0 38px;
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--night-ink-2); }
.search input:focus { background: rgba(255,255,255,.14); outline: none; border-color: rgba(255,255,255,.45); }
.search input::-webkit-search-cancel-button { display: none; }
.search__kbd {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font: 600 .75rem/1 var(--sans); color: var(--night-ink-2);
  border: 1px solid rgba(255,255,255,.25); border-radius: 5px; padding: 3px 6px;
}
.search input:focus ~ .search__kbd { display: none; }

.suggest {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--rule); border-radius: var(--r-md);
  box-shadow: 0 18px 48px rgba(10, 12, 40, .28);
  max-height: min(70vh, 520px); overflow: auto; padding: 6px;
}
.suggest__item {
  display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none; cursor: pointer;
}
.suggest__item[aria-selected="true"], .suggest__item:hover { background: var(--tint); }
.suggest__meta { display: flex; gap: 8px; align-items: center; font-size: .78rem; color: var(--ink-3); margin-bottom: 2px; }
.suggest__text { font-size: .9rem; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.suggest__all { font-weight: 600; color: var(--m-pharm); }
.suggest__empty { padding: 14px 12px; color: var(--ink-3); font-size: .92rem; }

.histnav { display: flex; gap: 4px; flex-shrink: 0; }
.hist-btn {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; padding: 0;
  border: 1px solid rgba(255,255,255,.16); background: transparent; color: var(--night-ink); cursor: pointer;
  display: grid; place-items: center;
}
.hist-btn svg { width: 18px; height: 18px; }
.hist-btn:hover:not(:disabled) { background: rgba(255,255,255,.1); }
.hist-btn:disabled { opacity: .32; cursor: default; }
.hist-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.menu-btn, .theme-btn {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.16); background: transparent; color: var(--night-ink); cursor: pointer;
  display: grid; place-items: center;
}
.menu-btn svg, .theme-btn svg { width: 20px; height: 20px; }
.menu-btn:hover, .theme-btn:hover, .menu-btn[aria-expanded="true"] { background: rgba(255,255,255,.1); }
.menu-btn:focus-visible, .theme-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* chapters and tools menu */
.menu-scrim { position: fixed; inset: 0; z-index: 38; background: rgba(8,10,30,.45); }
.menu-panel {
  position: fixed; z-index: 39; left: max(10px, env(safe-area-inset-left, 0px)); top: calc(env(safe-area-inset-top, 0px) + 64px);
  width: min(440px, calc(100vw - 20px)); max-height: calc(100vh - env(safe-area-inset-top, 0px) - 80px); max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 80px);
  overflow-y: auto; overscroll-behavior: contain; padding: 8px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--r-md); box-shadow: 0 18px 48px rgba(8,10,30,.4);
}
.menu-panel[hidden], .menu-scrim[hidden] { display: none; }
.menu-panel h2 { font: 700 .72rem/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 12px 10px 6px; }
.menu-panel h2:first-child { margin-top: 6px; }
.menu-panel a { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 10px; text-decoration: none; color: var(--ink); font: 600 .95rem/1.25 var(--sans); }
.menu-panel a:hover { background: var(--paper); }
.menu-panel a.is-current { background: color-mix(in srgb, var(--m-hy) 14%, var(--surface)); }
.menu-panel .mn-num { flex: 0 0 2.1em; font: 700 .95rem/1 var(--mono, ui-monospace, monospace); color: var(--ink-3); text-align: right; }
.menu-panel .mn-ch { font-weight: 500; }
.menu-panel a.is-current .mn-ch { font-weight: 700; }
.menu-panel .badge { margin-left: auto; }
.menu-panel__tools a { padding: 9px 10px; }

/* ---------- mode pills (used in search, cards) ---------- */
.kind {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 .78rem/1 var(--sans); color: var(--ink-2);
}
.kind::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--ink-3)); }
.c-guide { --c: var(--m-guide); }
.c-hy { --c: var(--m-hy); }
.c-dx { --c: var(--m-dx); }
.c-case { --c: var(--m-case); }
.c-pharm { --c: var(--m-pharm); }
.c-found { --c: var(--m-found); }
.c-gloss { --c: var(--m-gloss); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 22px;
  font: 600 .95rem/1 var(--sans); text-decoration: none; cursor: pointer;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
}
.btn:hover { border-color: var(--ink-3); }
.btn--solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--solid:hover { opacity: .9; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- home ---------- */
.hero {
  background:
    radial-gradient(120% 140% at 18% 0%, #3A4AA0 0%, var(--night) 45%, var(--night-deep) 100%);
  color: var(--night-ink);
  overflow: hidden;
}
.hero__grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: clamp(24px, 4vw, 56px);
  align-items: center; padding-top: clamp(40px, 7vw, 88px); padding-bottom: clamp(40px, 7vw, 88px);
}
.hero h1 {
  font: 700 clamp(2.1rem, 4.4vw, 3.5rem)/1.04 var(--sans); letter-spacing: -0.03em; margin: 0 0 18px;
  max-width: 14ch;
}
.hero__lede { font: 400 1.12rem/1.6 var(--serif); color: var(--night-ink-2); max-width: 46ch; margin: 0 0 26px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero .btn { background: transparent; color: var(--night-ink); border-color: rgba(255,255,255,.3); }
.hero .btn:hover { border-color: rgba(255,255,255,.7); }
.hero .btn--solid { background: var(--night-ink); color: var(--night-deep); border-color: var(--night-ink); }

.refract { display: grid; grid-template-columns: 150px minmax(40px, 1fr) minmax(220px, 1.5fr); align-items: stretch; }
.refract__art { align-self: center; width: 150px; height: auto; position: relative; z-index: 1; filter: drop-shadow(0 10px 24px rgba(0,0,0,.35)); }
.refract__raybox { position: relative; min-height: 100%; margin-left: -34px; }
.refract__rays { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.refract__for { grid-column: 1 / -1; font: 500 .9rem/1.3 var(--sans); color: var(--night-ink-2); margin: 0 0 12px; }
.refract__for a { color: var(--night-ink); }
.spectrum { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-rows: 1fr; }
.spectrum a {
  display: block; height: 100%; text-decoration: none;
  padding: 9px 0 9px 16px; border-left: 4px solid var(--c);
}
.spectrum a:hover .spectrum__label, .spectrum a:focus-visible .spectrum__label { text-decoration: underline; text-underline-offset: 3px; }
.spectrum__label { display: block; font: 700 1.02rem/1.2 var(--sans); color: #fff; }
.spectrum__blurb { display: block; font-size: .86rem; color: var(--night-ink-2); line-height: 1.35; }
.hero .c-guide { --c: #FF5A63; } .hero .c-hy { --c: #FF8C42; } .hero .c-dx { --c: #FFD23F; }
.hero .c-case { --c: #4FD17A; } .hero .c-pharm { --c: #3FA2FF; } .hero .c-found { --c: #9A73FF; }

.home-section { padding-top: 48px; padding-bottom: 24px; }
.home-section h2 { font: 700 1.5rem/1.2 var(--sans); letter-spacing: -0.015em; margin: 0 0 18px; }
.chapter-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.chapter-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 22px; align-items: center;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg);
  padding: 22px 26px; text-decoration: none;
}
.chapter-row:hover { border-color: var(--ink-3); }
.chapter-row__num {
  font: 800 3.6rem/0.9 var(--sans); letter-spacing: -0.04em;
  color: transparent; -webkit-text-stroke: 2px var(--ink);
  min-width: 1.4ch; text-align: center;
}
.chapter-row h3 { font: 700 1.2rem/1.25 var(--sans); margin: 0 0 6px; letter-spacing: -0.01em; }
.chapter-row p { margin: 0; color: var(--ink-2); font-size: .95rem; max-width: 70ch; }
.chapter-row__stats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: .85rem; color: var(--ink-3); }
.chapter-row__stats b { color: var(--ink); font-weight: 700; }
.meter { width: 150px; }
.meter__label { font-size: .8rem; color: var(--ink-3); margin-bottom: 6px; text-align: right; }
.meter__bar { height: 6px; border-radius: 3px; background: var(--tint); overflow: hidden; }
.meter__bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--m-guide), var(--m-hy), var(--m-dx), var(--m-case), var(--m-pharm), var(--m-found)); }

.howto { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; padding-bottom: 56px; }
.howto h3 { font: 700 1rem/1.3 var(--sans); margin: 0 0 6px; }
.howto p { margin: 0; color: var(--ink-2); font-size: .95rem; }

/* ---------- chapter header + modes ---------- */
.ch-head { background: var(--surface); border-bottom: 1px solid var(--rule); }
.ch-head__inner { padding-top: 26px; padding-bottom: 18px; }
.crumb { margin: 0 0 14px; font-size: .88rem; }
.crumb a { color: var(--ink-3); text-decoration: none; }
.crumb a:hover { color: var(--ink); text-decoration: underline; }
.ch-head__title { display: flex; align-items: center; gap: 20px; }
.ch-num {
  font: 800 clamp(3.4rem, 7vw, 5rem)/.85 var(--sans); letter-spacing: -0.05em;
  color: transparent; -webkit-text-stroke: 2px var(--ink);
}
.ch-head h1 { font: 700 clamp(1.45rem, 2.8vw, 2.1rem)/1.12 var(--sans); letter-spacing: -0.02em; margin: 0; max-width: 26ch; }
.modes {
  position: relative;
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  padding-top: 6px;
}
.modes::-webkit-scrollbar { display: none; }
.mode {
  flex: 1 0 auto; text-decoration: none; padding: 12px 14px 10px;
  font: 600 .93rem/1 var(--sans); color: var(--ink-2); white-space: nowrap;
  border-bottom: 4px solid color-mix(in srgb, var(--c) 30%, transparent);
  display: flex; align-items: center; gap: 8px; justify-content: center;
}
.mode:hover { color: var(--ink); border-bottom-color: color-mix(in srgb, var(--c) 65%, transparent); }
.mode.is-active { color: var(--ink); border-bottom-width: 6px; border-bottom-color: var(--c); padding-bottom: 8px; }
.mode__count { font-size: .75rem; font-weight: 700; color: var(--ink-3); background: var(--tint); border-radius: 10px; padding: 3px 7px; }

/* ---------- study guide ---------- */
.guide { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 48px; padding-top: 36px; padding-bottom: 72px; }
.toc { position: sticky; top: calc(var(--top) + 20px); align-self: start; max-height: calc(100vh - var(--top) - 40px); overflow: auto; padding-right: 6px; font-size: .9rem; }
.toc ol { list-style: none; margin: 0 0 18px; padding: 0; }
.toc__part { font: 700 .82rem/1.3 var(--sans); color: var(--ink-3); margin: 0 0 6px; padding-left: 12px; }
.toc a {
  display: grid; grid-template-columns: var(--nw, 3.1em) minmax(0, 1fr); gap: 6px; padding: 6px 10px 6px 12px; border-radius: 6px;
  text-decoration: none; color: var(--ink-2); line-height: 1.3; border-left: 3px solid transparent;
}
.toc a:hover { background: var(--tint); color: var(--ink); }
.toc a.is-current { color: var(--ink); background: var(--tint); border-left-color: var(--m-guide); font-weight: 600; }
.toc__n { white-space: nowrap; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.toc-mobile { display: none; }

.reading { min-width: 0; }
.reading__intro { font: 400 1.2rem/1.6 var(--serif); color: var(--ink-2); max-width: var(--measure); margin: 0 0 12px; }
.objectives { max-width: var(--measure); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 18px 22px; margin: 22px 0 8px; }
.objectives h2 { font: 700 1rem/1.3 var(--sans); margin: 0 0 8px; }
.objectives ul { margin: 0; padding-left: 1.2em; font: 400 1rem/1.55 var(--serif); }

.g-part { margin: 56px 0 0; padding-top: 18px; border-top: 2px solid var(--ink); max-width: var(--measure); }
.g-part p { margin: 0; font: 700 .95rem/1.3 var(--sans); color: var(--ink-3); }
.g-part h2 { font: 800 1.9rem/1.1 var(--sans); letter-spacing: -0.025em; margin: 4px 0 0; }
.g-sec { padding-top: 34px; }
.g-sec h3 { font: 700 1.4rem/1.2 var(--sans); letter-spacing: -0.015em; margin: 0 0 12px; max-width: var(--measure); display: flex; gap: 12px; align-items: baseline; }
.g-n { color: var(--m-guide); font-variant-numeric: tabular-nums; font-size: 1rem; font-weight: 700; flex-shrink: 0; }
.g-block { max-width: var(--measure); scroll-margin-top: calc(var(--top) + 24px); border-radius: 8px; transition: background-color .8s ease, box-shadow .8s ease; }
.g-block.is-flash { background: color-mix(in srgb, var(--mark) 60%, transparent); box-shadow: 0 0 0 8px color-mix(in srgb, var(--mark) 60%, transparent); }
.g-sec p, .g-sec li, .g-sec dd { font: 400 1.06rem/1.7 var(--serif); }
.g-sec p { margin: 0 0 14px; }
.g-sec h4 { font: 700 1.02rem/1.3 var(--sans); margin: 22px 0 8px; }
.g-sec ul, .g-sec ol { margin: 0 0 16px; padding-left: 1.3em; }
.g-sec li { margin-bottom: 6px; }
.g-sec li::marker { color: var(--ink-3); }
.g-sec strong { font-weight: 600; }
.cols { columns: 2 220px; column-gap: 32px; }
.cols li { break-inside: avoid; }

dl.defs { margin: 0 0 18px; display: grid; grid-template-columns: minmax(130px, max-content) 1fr; gap: 8px 18px; }
dl.defs dt { font: 700 .95rem/1.5 var(--sans); padding-top: 2px; }
dl.defs dd { margin: 0; }

.callout {
  border-left: 4px solid var(--c); background: var(--surface);
  border-radius: 0 var(--r-md) var(--r-md) 0; padding: 14px 18px; margin: 4px 0 18px;
}
.g-sec .callout__title { font: 700 .9rem/1.3 var(--sans); color: var(--c); margin: 0 0 4px; }
.callout p:last-child { margin-bottom: 0; }
.callout--pearl { --c: var(--m-case); }
.callout--exam { --c: var(--m-hy); }
.callout--caution { --c: var(--m-guide); }

.case { margin: 6px 0 20px; background: var(--tint); border-radius: var(--r-md); padding: 18px 20px; }
.case figcaption { font: 700 .95rem/1.3 var(--sans); margin-bottom: 6px; }
.g-sec .case p { font-size: 1rem; }
.g-sec .case__point { margin: 0; font: 500 .95rem/1.5 var(--sans); color: var(--ink-2); }
.case__point b { color: var(--ink); }

.table-wrap { overflow-x: auto; margin: 6px 0 20px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--surface); max-width: 100%; }
.g-block.is-wide { max-width: none; }
table { border-collapse: collapse; width: 100%; font: 400 .92rem/1.45 var(--sans); }
caption { text-align: left; font: 700 .95rem/1.3 var(--sans); padding: 12px 14px 4px; }
th, td { text-align: left; vertical-align: top; padding: 9px 14px; border-top: 1px solid var(--rule); }
thead th { background: var(--tint); font-weight: 700; border-top: none; white-space: nowrap; }
tbody th { font-weight: 700; }
.g-sec .table-note { font-size: .82rem; color: var(--ink-3); padding: 8px 14px 12px; margin: 0; border-top: 1px solid var(--rule); }
.table-group td { background: var(--tint); font-weight: 700; }

.g-block.timeline { max-width: 820px; }
.timeline { margin: 6px 0 22px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 16px 18px 12px; }
.g-sec .timeline__title { font: 700 .95rem/1.3 var(--sans); margin: 0 0 12px; }
.timeline__grid { display: grid; grid-template-columns: minmax(110px, 170px) 0.6fr repeat(3, minmax(0, 1fr)); row-gap: 10px; align-items: center; font-family: var(--sans); }
.timeline__head { font-size: .78rem; color: var(--ink-3); border-left: 1px dashed var(--rule); padding-left: 6px; }
.timeline__label { grid-column: 1; font-weight: 600; font-size: .9rem; padding-right: 10px; }
.timeline__bar { min-height: 28px; border-radius: 14px; background: var(--c); color: #fff; font-size: .78rem; line-height: 1.2; font-weight: 700; display: flex; align-items: center; padding: 5px 10px; }
.g-sec .timeline__note { grid-column: 2 / -1; font-size: .82rem; color: var(--ink-3); margin-top: -4px; }
[data-theme="dark"] .timeline__bar { color: #10132E; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .timeline__bar { color: #10132E; } }

.steps { list-style: none; padding: 0 !important; counter-reset: s; margin: 6px 0 20px; }
.steps li { counter-increment: s; position: relative; padding: 0 0 16px 46px; margin: 0; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
  background: var(--ink); color: var(--paper); font: 700 .9rem/30px var(--sans); text-align: center;
}
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 14px; top: 34px; bottom: 4px; width: 2px; background: var(--rule); }
.steps b { display: block; font: 700 1rem/1.4 var(--sans); margin-bottom: 2px; }

/* ---------- high yield ---------- */
.hy-page { padding-top: 32px; padding-bottom: 72px; }
.hy-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 14px 18px; margin-bottom: 26px;
}
.hy-tools p { margin: 0; color: var(--ink-2); font-size: .93rem; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.switch input { width: 40px; height: 22px; appearance: none; -webkit-appearance: none; background: var(--rule); border-radius: 11px; position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked { background: var(--m-hy); }
.switch input:checked::after { transform: translateX(18px); }
.hy-grid { columns: 2 420px; column-gap: 28px; }
.hy-topic { break-inside: avoid; background: var(--surface); border: 1px solid var(--rule); border-top: 4px solid var(--m-hy); border-radius: var(--r-md); padding: 18px 22px 8px; margin: 0 0 22px; }
.hy-topic h2 { font: 700 1.12rem/1.25 var(--sans); margin: 0 0 10px; letter-spacing: -0.01em; }
.hy-topic ul { margin: 0; padding-left: 1.15em; }
.hy-topic li { font: 400 .99rem/1.6 var(--serif); margin-bottom: 9px; scroll-margin-top: calc(var(--top) + 24px); border-radius: 6px; transition: background-color .8s; }
.hy-topic li.is-flash { background: var(--mark); }
.hy-topic li::marker { color: var(--m-hy); }
.hy-topic strong { font-weight: 600; }
.quiz-on .hy-topic strong {
  color: transparent; background: var(--tint); border-radius: 4px; cursor: pointer;
  box-shadow: inset 0 -2px 0 var(--m-hy); transition: color .15s;
}
.quiz-on .hy-topic strong.is-revealed { color: var(--ink); background: color-mix(in srgb, var(--m-hy) 14%, transparent); }

/* ---------- flashcards ---------- */
.cards-page { padding-top: 28px; padding-bottom: 72px; }
.decks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
.deck {
  text-decoration: none; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md);
  padding: 12px 14px; border-top: 4px solid var(--c);
}
.deck:hover { border-color: var(--ink-3); border-top-color: var(--c); }
.deck.is-active { box-shadow: 0 0 0 2px var(--c); border-color: transparent; }
.deck__name { display: block; font: 700 .98rem/1.2 var(--sans); }
.deck__meta { display: block; font-size: .82rem; color: var(--ink-3); margin-top: 3px; }

.deck-bar { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.deck-bar__opts { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--c, var(--ink)); }
.link-btn { background: none; border: none; color: var(--ink-3); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: .88rem; padding: 4px; }
.link-btn:hover { color: var(--ink); }

.tally { display: flex; align-items: center; gap: 14px; font-size: .88rem; color: var(--ink-3); margin-bottom: 10px; }
.tally__bar { flex: 1; height: 8px; border-radius: 4px; background: var(--tint); overflow: hidden; display: flex; }
.tally__known { background: var(--good); }
.tally__learn { background: var(--m-hy); }
.tally b { color: var(--ink); font-variant-numeric: tabular-nums; }

.stage { perspective: 1600px; }
.flashcard {
  display: grid; position: relative; min-height: 340px; cursor: pointer;
  transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2,.7,.2,1);
  border-radius: var(--r-lg);
}
.flashcard.is-flipped { transform: rotateY(180deg); }
.face {
  grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg);
  padding: clamp(20px, 4vw, 36px); display: flex; flex-direction: column;
  box-shadow: 0 1px 0 var(--rule), 0 14px 36px -18px rgba(20, 24, 66, .35);
  border-top: 6px solid var(--c);
}
.face--back { transform: rotateY(180deg); }
.face__top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; font-size: .82rem; color: var(--ink-3); }
.face__tag { font-weight: 700; color: var(--c); }
.face__q { font: 400 clamp(1.12rem, 2.2vw, 1.38rem)/1.55 var(--serif); margin: 0; }
.face__a { font: 400 clamp(1.05rem, 2vw, 1.22rem)/1.6 var(--serif); margin: 0; }
.face__a strong, .face__q strong { font-weight: 600; }
.face__why { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--rule); font: 400 1rem/1.6 var(--serif); color: var(--ink-2); }
.face__hint { margin-top: auto; padding-top: 22px; font-size: .84rem; color: var(--ink-3); }
.choices { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; }
.choice {
  width: 100%; text-align: left; display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start;
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 11px 14px; cursor: pointer;
  font: 400 1rem/1.45 var(--serif);
}
.choice:hover { border-color: var(--c); }
.choice__key { font: 700 .85rem/1.7 var(--sans); color: var(--ink-3); }
.face__recap { font: 400 .98rem/1.55 var(--serif); color: var(--ink-2); margin: 0; }
.choices--static .choice { cursor: default; }
.choices--static .choice:hover { border-color: var(--rule); }
.choice.is-correct, .choices--static .choice.is-correct:hover { border-color: var(--good); background: color-mix(in srgb, var(--good) 10%, var(--surface)); }
.choice.is-wrong, .choices--static .choice.is-wrong:hover { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--surface)); }
.choice__note { display: block; font: 700 .78rem/1.4 var(--sans); margin-top: 2px; }
.is-correct .choice__note { color: var(--good); }
.is-wrong .choice__note { color: var(--bad); }
.verdict { font: 700 1.05rem/1.3 var(--sans); margin: 0 0 10px; }
.verdict.is-right { color: var(--good); }
.verdict.is-wrong { color: var(--bad); }
.answer-line { font: 600 1.05rem/1.5 var(--sans); margin: 0 0 4px; }

.card-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.card-nav__pos { font-size: .9rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rate { display: flex; gap: 10px; }
.btn--learn { border-color: var(--m-hy); }
.btn--known { background: var(--good); border-color: var(--good); color: #fff; }
[data-theme="dark"] .btn--known { color: #0E2A1C; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn--known { color: #0E2A1C; } }
.kbd-help { margin-top: 18px; font-size: .82rem; color: var(--ink-3); }
.kbd-help kbd { font: 600 .75rem/1 var(--sans); border: 1px solid var(--rule); border-radius: 4px; padding: 2px 6px; background: var(--surface); }
.empty { background: var(--surface); border: 1px dashed var(--rule); border-radius: var(--r-lg); padding: 40px 28px; text-align: center; }
.empty h2 { font: 700 1.2rem/1.3 var(--sans); margin: 0 0 8px; }
.empty p { color: var(--ink-2); margin: 0 auto 18px; max-width: 46ch; }

/* ---------- search page ---------- */
.search-page { padding-top: 36px; padding-bottom: 72px; max-width: 860px; }
.search-page h1 { font: 700 1.7rem/1.2 var(--sans); letter-spacing: -0.02em; margin: 0 0 6px; }
.search-page__sub { color: var(--ink-3); margin: 0 0 18px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.filter { border: 1px solid var(--rule); background: var(--surface); border-radius: 18px; padding: 7px 14px; cursor: pointer; font: 600 .88rem/1 var(--sans); color: var(--ink-2); }
.filter[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.results { list-style: none; margin: 0; padding: 0; }
.result { border-top: 1px solid var(--rule); }
.result a { display: block; padding: 16px 4px; text-decoration: none; }
.result a:hover .result__title { text-decoration: underline; text-underline-offset: 3px; }
.result__meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: .8rem; color: var(--ink-3); margin-bottom: 4px; }
.result__title { font: 700 1.04rem/1.3 var(--sans); margin: 0 0 4px; }
.result__text { margin: 0; color: var(--ink-2); font: 400 .98rem/1.55 var(--serif); }

/* ---------- footer ---------- */
.site-foot { background: var(--night-deep); color: var(--night-ink-2); margin-top: auto; padding-bottom: env(safe-area-inset-bottom, 0px); }
.site-foot__inner { padding-top: 26px; padding-bottom: 28px; }
.attribution { margin: 0 0 6px; color: var(--night-ink); font-weight: 600; }
.attribution a { color: var(--night-ink); text-underline-offset: 3px; }
.disclaimer { margin: 0; font-size: .84rem; max-width: 90ch; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .guide { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 22px; }
  .toc { display: none; }
  .toc-mobile { display: block; position: sticky; top: var(--top); z-index: 10; background: var(--paper); padding: 10px 0; margin-bottom: 8px; }
  .toc-mobile details { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); }
  .toc-mobile summary { padding: 12px 16px; font-weight: 700; cursor: pointer; }
  .toc-mobile .toc { display: block; position: static; max-height: 55vh; padding: 0 8px 8px; }
  .decks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero__grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .search__kbd { display: none; }
  .brand { display: none; }
  .topbar__inner { gap: 8px; }
  .histnav { gap: 2px; }
  .hist-btn { width: 34px; height: 34px; }
  .brand img { width: 30px; height: 30px; }
  .refract { grid-template-columns: minmax(0, 1fr); }
  .refract__raybox { display: none; }
  .refract__art { justify-self: center; width: 112px; margin: 0 0 16px; order: -1; }
  .chapter-row { grid-template-columns: auto minmax(0, 1fr); padding: 18px; gap: 16px; }
  .chapter-row .meter { grid-column: 1 / -1; width: 100%; }
  .meter__label { text-align: left; }
  .chapter-row__num { font-size: 2.6rem; }
  .howto { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .timeline__grid { grid-template-columns: 84px 0.5fr repeat(3, minmax(0, 1fr)); }
  .timeline__bar { font-size: .7rem; padding: 0 6px; }
  dl.defs { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  dl.defs dd { margin-bottom: 10px; }
  .flashcard { min-height: 300px; }
  .rate { width: 100%; }
  .rate .btn { flex: 1; }
}

/* ---------- site navigation ---------- */
.sitenav { display: none; gap: 2px; align-items: center; margin: 0 0 0 4px; flex-shrink: 0; }
.sitenav a {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 8px 12px; border-radius: 18px; text-decoration: none;
  font: 600 .9rem/1 var(--sans); color: var(--night-ink-2);
}
.sitenav a:hover { color: var(--night-ink); background: rgba(255,255,255,.08); }
.sitenav a.is-active { color: var(--night-ink); background: rgba(255,255,255,.14); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #FFD23F; color: #141842; font: 700 .72rem/20px var(--sans); text-align: center; font-variant-numeric: tabular-nums; }
.badge--warn { background: #FF8A8F; }
.sitenav .nav-long { text-transform: none; }
.badge[hidden] { display: none; }
@media (min-width: 1080px) {
  .sitenav { display: flex; }
  .sitenav a { padding: 8px 10px; }
  .menu-panel__tools { display: none; }
}
@media (min-width: 1320px) { .brand__name { display: block; } }
.brand__name { display: none; }

/* ---------- generic page ---------- */
.page { padding-top: 32px; padding-bottom: 72px; }
.page__head { margin-bottom: 22px; max-width: 76ch; }
.page__head h1 { font: 800 clamp(1.6rem, 3.4vw, 2.2rem)/1.15 var(--sans); letter-spacing: -0.02em; margin: 0 0 8px; }
.page__head p { color: var(--ink-2); margin: 0; }
.page__head .crumb { margin-bottom: 8px; }
.muted { color: var(--ink-3); font-weight: 400; }
.select { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--ink-2); }
.select select {
  font: 600 .92rem/1 var(--sans); color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule); border-radius: 18px; min-height: 38px; padding: 0 30px 0 14px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
.deck-bar__count { font-size: .9rem; color: var(--ink-3); }
.empty__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.btn.is-disabled { opacity: .45; pointer-events: none; }
.banner { background: color-mix(in srgb, var(--m-hy) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--m-hy) 40%, var(--rule)); border-radius: var(--r-md); padding: 16px 18px; margin-bottom: 22px; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; }
.banner p { margin: 0; font-weight: 600; }
.banner .empty__actions { justify-content: flex-start; }

/* ---------- home: today panel ---------- */
.today { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; }
.today__main { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: clamp(20px, 3vw, 30px); }
.today__main h2 { margin-top: 0; }
.today__big { font: 700 1.25rem/1.3 var(--sans); margin: 0 0 6px; }
.today__big span { font-size: 2.4rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.today__sub { color: var(--ink-2); margin: 0 0 16px; max-width: 52ch; }
.today__chapters { list-style: none; margin: 18px 0 0; padding: 14px 0 0; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: 8px; }
.today__chapters a { display: inline-flex; gap: 10px; padding: 7px 12px; border-radius: 16px; background: var(--tint); text-decoration: none; font-size: .88rem; font-weight: 600; }
.today__chapters a:hover { box-shadow: inset 0 0 0 1px var(--ink-3); }
.today__n { color: var(--ink-3); font-weight: 500; }
.tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tool { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--rule); text-decoration: none; }
.tool:hover { border-color: var(--ink-3); }
.tool__name { font: 700 1rem/1.25 var(--sans); }
.tool__meta { font-size: .86rem; color: var(--ink-3); }
.tool__ch { font: 600 .78rem/1 var(--sans); color: var(--ink-3); margin-top: 6px; }
.meter__learn { background: var(--m-hy); }
.meter__bar { display: flex; }

/* ---------- card player additions ---------- */
.face__src { margin-left: auto; }
.face__status { font-weight: 600; }
.face__q--small { font-size: 1rem; color: var(--ink-2); margin-bottom: 12px; }
.card-nav__main { display: flex; justify-content: center; flex: 1; min-width: 0; }
.rate { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.rate__b { flex-direction: column; gap: 3px; min-width: 84px; min-height: 52px; padding: 6px 14px; border-radius: 14px; }
.rate__b small { font: 500 .74rem/1 var(--sans); color: var(--ink-3); }
.rate__b--1 { border-color: color-mix(in srgb, var(--bad) 55%, var(--rule)); }
.rate__b--2 { border-color: color-mix(in srgb, var(--m-hy) 55%, var(--rule)); }
.rate__b--3 { border-color: color-mix(in srgb, var(--good) 55%, var(--rule)); }
.rate__b--4 { border-color: color-mix(in srgb, var(--m-pharm) 55%, var(--rule)); }
.rate__b.is-suggested { box-shadow: 0 0 0 2px currentColor inset; }
.rate__b--1.is-suggested { color: var(--bad); } .rate__b--1.is-suggested small { color: inherit; }
.rate__b--3.is-suggested { color: var(--good); } .rate__b--3.is-suggested small { color: inherit; }
.cleared { margin: 0 14px 0 0; font-weight: 700; align-self: center; }
.cleared.is-right { color: var(--good); }
.cleared.is-wrong { color: var(--bad); }
.kbd-help { font-size: .82rem; color: var(--ink-3); margin-top: 16px; text-align: center; }
.kbd-help kbd { font: 600 .74rem/1 var(--sans); border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; margin: 0 2px 0 8px; background: var(--surface); }

/* ---------- mistakes ---------- */
.mk-list { margin-top: 28px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); }
.mk-list summary { padding: 14px 18px; font-weight: 700; cursor: pointer; }
.mk-list ul { list-style: none; margin: 0; padding: 0 18px 8px; }
.mk { padding: 12px 0; border-top: 1px solid var(--rule); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
.mk__meta { display: flex; gap: 14px; font-size: .82rem; color: var(--ink-3); grid-column: 1 / -1; }
.mk__q { margin: 0; font: 400 .95rem/1.5 var(--serif); }

/* ---------- exam ---------- */
.exam-form { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: clamp(18px, 3vw, 28px); max-width: 720px; }
.exam-form fieldset { border: 0; padding: 0; margin: 0 0 20px; display: grid; gap: 10px; }
.exam-form legend { font: 700 .82rem/1 var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 10px; padding: 0; }
.exam-form .check { font-size: .98rem; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 18px; border: 1px solid var(--rule); border-radius: 20px; font: 600 .92rem/1 var(--sans); background: var(--surface); }
.seg input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.exam-form__sum { color: var(--ink-2); margin: 0 0 14px; }
.exam-hist { margin-top: 36px; max-width: 720px; }
.exam-hist table, .score-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.exam-hist th, .exam-hist td, .score-table th, .score-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--rule); }
.exam-hist thead th, .score-table thead th { font: 700 .78rem/1.2 var(--sans); color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; background: var(--tint); }
.exam-hist tr:last-child td, .score-table tr:last-child th, .score-table tr:last-child td { border-bottom: 0; }
.score-table tbody th { font-weight: 600; }

.exam-bar { position: sticky; top: var(--top); z-index: 12; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; background: var(--paper); padding: 12px 0; margin-bottom: 8px; border-bottom: 1px solid var(--rule); }
.exam-bar__pos { font-weight: 700; }
.exam-bar__clock { margin-right: auto; font: 700 1rem/1 var(--sans); font-variant-numeric: tabular-nums; color: var(--ink-2); padding: 6px 10px; border-radius: 8px; background: var(--tint); }
.exam-bar__clock.is-low { color: #fff; background: var(--bad); }
.exam-bar .btn[aria-pressed="true"] { border-color: var(--m-hy); color: var(--m-hy); }
.exam-grid { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 24px; align-items: start; }
.exam-q { background: var(--surface); border: 1px solid var(--rule); border-top: 6px solid var(--m-case); border-radius: var(--r-lg); padding: clamp(20px, 3.5vw, 34px); }
.exam-q__meta { font-size: .82rem; color: var(--ink-3); margin: 0 0 12px; font-weight: 600; }
.exam-q__stem { font: 400 clamp(1.08rem, 2vw, 1.28rem)/1.6 var(--serif); margin: 0; }
.choice.is-picked { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--tint); }
.choice.is-picked .choice__key { color: var(--ink); }
.exam-q .choice { --c: var(--m-case); }
.exam-nav { position: sticky; top: calc(var(--top) + 76px); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 14px; }
.exam-nav__title { font: 700 .78rem/1 var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 0 0 10px; }
.exam-nav__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; max-height: 50vh; overflow: auto; }
.qn { position: relative; height: 38px; border-radius: 8px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2); font: 600 .86rem/1 var(--sans); cursor: pointer; font-variant-numeric: tabular-nums; }
.qn.is-answered { background: color-mix(in srgb, var(--m-case) 22%, var(--surface)); color: var(--ink); border-color: var(--m-case); }
.qn.is-current { box-shadow: 0 0 0 2px var(--ink); }
.qn.is-flagged::after { content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--m-hy); }
.exam-nav__key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: .78rem; color: var(--ink-3); margin: 12px 0 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 6px; }
.dot--answered { background: color-mix(in srgb, var(--m-case) 22%, var(--surface)); border: 1px solid var(--m-case); margin-left: 0; }
.dot--flag { background: var(--m-hy); border-radius: 50%; }

.score { display: flex; align-items: center; gap: 22px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 22px 26px; margin-bottom: 18px; flex-wrap: wrap; }
.score__big { font: 800 3.6rem/1 var(--sans); letter-spacing: -0.03em; margin: 0; font-variant-numeric: tabular-nums; }
.score__big span { font-size: 1.6rem; color: var(--ink-3); margin-left: 2px; }
.score__line { margin: 2px 0; color: var(--ink-2); }
.results-actions { justify-content: flex-start; margin-bottom: 30px; }
.results-sec { margin-bottom: 30px; }
.results-sec h2 { margin-bottom: 4px; }
.results-sec .muted { margin: 0 0 10px; font-size: .9rem; }
.bar-cell { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.score-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--tint); overflow: hidden; display: block; }
.score-bar span { display: block; height: 100%; }
.score-bar .is-good { background: var(--good); }
.score-bar .is-mid { background: var(--m-dx); }
.score-bar .is-low { background: var(--bad); }
.score-pct { font-weight: 700; font-variant-numeric: tabular-nums; width: 3.2em; text-align: right; }
.review-q .verdict { margin-bottom: 12px; }

/* ---------- glossary ---------- */
.gl {
  cursor: help; text-decoration: underline dotted; text-decoration-color: color-mix(in srgb, var(--ink-3) 80%, transparent);
  text-underline-offset: 3px; text-decoration-thickness: 1.5px; border-radius: 3px;
}
.gl:hover, .gl[aria-expanded="true"] { background: color-mix(in srgb, var(--m-gloss) 14%, transparent); text-decoration-color: var(--m-gloss); }
.glpop {
  position: absolute; z-index: 60; background: var(--surface); color: var(--ink);
  border: 1px solid var(--rule); border-top: 4px solid var(--m-gloss); border-radius: var(--r-md);
  box-shadow: 0 18px 44px -14px rgba(20, 24, 66, .45); padding: 14px 16px 12px;
}
.glpop__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.glpop__t { font: 700 1.02rem/1.3 var(--sans); margin: 0 0 6px; text-transform: none; }
.glpop__x { border: 0; background: none; color: var(--ink-3); font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 0 4px; margin: -4px -6px 0 0; }
.glpop__d { font: 400 .98rem/1.55 var(--serif); margin: 0 0 10px; }
.glpop__foot { display: flex; justify-content: space-between; gap: 10px; font-size: .8rem; color: var(--ink-3); margin: 0; }
.glpop__foot a { font-weight: 600; color: var(--ink); }
.gloss__tools { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; margin-bottom: 14px; }
.gloss__search { flex: 1 1 280px; max-width: 460px; }
.gloss__search input { width: 100%; min-height: 44px; border-radius: 22px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); padding: 0 18px; font: 400 1rem/1 var(--sans); }
.gloss__search input:focus { outline: none; border-color: var(--m-gloss); box-shadow: 0 0 0 3px color-mix(in srgb, var(--m-gloss) 25%, transparent); }
.gloss .switch input:checked { background: var(--m-gloss); }
.az { position: sticky; top: var(--top); z-index: 8; background: var(--paper); display: flex; flex-wrap: wrap; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.az a { min-width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; font: 700 .86rem/1 var(--sans); text-decoration: none; color: var(--ink-2); }
.az a:hover { background: var(--tint); color: var(--ink); }
.gloss__count { font-size: .86rem; color: var(--ink-3); margin: 12px 0 0; }
.gloss__group { scroll-margin-top: calc(var(--top) + 60px); }
.gloss__group h2 { font: 800 1.5rem/1 var(--sans); color: var(--m-gloss); margin: 26px 0 8px; }
.gloss__group dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.gloss__entry { padding: 12px 0; border-top: 1px solid var(--rule); scroll-margin-top: calc(var(--top) + 70px); border-radius: 6px; transition: background-color .8s; }
.gloss__entry.is-flash { background: var(--mark); }
.gloss__entry dt { font: 700 1rem/1.3 var(--sans); margin-bottom: 4px; }
.gloss__entry dd { margin: 0; font: 400 .96rem/1.55 var(--serif); color: var(--ink-2); }
.gloss__src { font: 600 .72rem/1 var(--sans); color: var(--m-gloss); border: 1px solid currentColor; border-radius: 10px; padding: 2px 7px; margin-left: 6px; vertical-align: 2px; }

/* ---------- diagnostic helper ---------- */
.helper-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.helper__grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.q-card, .result-card { background: var(--surface); border: 1px solid var(--rule); border-top: 6px solid var(--m-gloss); border-radius: var(--r-lg); padding: clamp(20px, 3.5vw, 32px); }
.q-card__step, .result-card__eyebrow { font: 700 .78rem/1 var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); margin: 0 0 10px; }
.q-card h2 { font: 700 clamp(1.2rem, 2.4vw, 1.45rem)/1.3 var(--sans); margin: 0 0 10px; }
.q-card__help { color: var(--ink-2); font: 400 .98rem/1.55 var(--serif); margin: 0 0 18px; }
.opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.opt { width: 100%; text-align: left; font: 500 1rem/1.4 var(--sans); color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 14px 16px; cursor: pointer; }
.opt:hover { border-color: var(--m-gloss); background: color-mix(in srgb, var(--m-gloss) 6%, var(--surface)); }
.result-card { border-top-color: var(--good); }
.result-card h2 { font: 800 clamp(1.4rem, 3vw, 1.8rem)/1.2 var(--sans); margin: 0 0 8px; letter-spacing: -0.01em; }
.result-card h2:focus { outline: none; }
.result-card__line { font: 400 1.05rem/1.55 var(--serif); margin: 0 0 18px; }
.result-card h3 { font: 700 .95rem/1.3 var(--sans); margin: 18px 0 8px; }
.result-card ul { margin: 0 0 4px; padding-left: 20px; font: 400 .98rem/1.55 var(--serif); }
.result-card li { margin-bottom: 6px; }
.result-card .empty__actions { justify-content: flex-start; margin-top: 18px; }
.helper__nav { display: flex; gap: 12px; align-items: center; margin-top: 14px; }
.trail { position: sticky; top: calc(var(--top) + 20px); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 16px 18px; }
.trail h2 { font: 700 .82rem/1 var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 0 0 12px; }
.trail ol { margin: 0; padding: 0 0 0 20px; }
.trail li { margin-bottom: 14px; }
.trail__q { margin: 0; font-size: .82rem; color: var(--ink-3); }
.trail__a { margin: 2px 0; font-weight: 700; font-size: .92rem; }
.trail__note { margin: 0; font: 400 .9rem/1.5 var(--serif); color: var(--ink-2); }
.trail .link-btn { padding: 2px 0; font-size: .8rem; }
.trail__empty { margin: 0; color: var(--ink-3); font-size: .9rem; }
.helper__caution { margin-top: 22px; font-size: .86rem; color: var(--ink-3); max-width: 80ch; }

@media (max-width: 980px) {
  .today { grid-template-columns: minmax(0, 1fr); }
  .exam-grid, .helper__grid { grid-template-columns: minmax(0, 1fr); }
  .exam-nav, .trail { position: static; }
  .exam-nav__grid { grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); }
}
@media (max-width: 720px) {
  .tools { grid-template-columns: minmax(0, 1fr); }
  .gloss__group dl { grid-template-columns: minmax(0, 1fr); }
  .rate__b { min-width: 0; flex: 1; padding: 6px 8px; }
  .card-nav__main { order: -1; flex-basis: 100%; }
  .exam-bar { flex-wrap: nowrap; gap: 8px; }
  .exam-bar .lg { display: none; }
  .exam-bar .btn { min-height: 38px; padding: 0 14px; }
  .score__big { font-size: 2.8rem; }
  .mk { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  .histnav, .sitenav, .glpop { display: none !important; }
  .gl { text-decoration: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .flashcard { transition: none; }
  .g-block, .hy-topic li { transition: none; }
}

@media print {
  .topbar, .modes, .toc, .toc-mobile, .site-foot, .hy-tools { display: none !important; }
  .guide { display: block; }
  body { background: #fff; color: #000; }
}

/* ---------- educator tools: shared bits ---------- */
.btn--small { min-height: 36px; padding: 0 14px; font-size: .86rem; }
.deck-bar__right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hy-tools__print { margin-left: auto; min-height: 38px; }
.tools--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tool__links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tool__links a { font: 600 .86rem/1 var(--sans); padding: 8px 12px; border-radius: 16px; background: var(--tint); text-decoration: none; }
.tool__links a:hover { box-shadow: inset 0 0 0 1px var(--ink-3); }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0 0 12px; font-weight: 600; }
.foot-links a { color: var(--night-ink); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.foot-links a:hover { text-decoration: underline; text-underline-offset: 3px; }
.upd { display: inline-block; vertical-align: 3px; margin-left: 8px; font: 700 .7rem/1 var(--sans); letter-spacing: .04em; text-transform: uppercase; color: #fff; background: var(--m-guide); border-radius: 10px; padding: 4px 8px; }
[data-theme="dark"] .upd { color: #1A0B0D; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .upd { color: #1A0B0D; } }

/* ---------- what's new ---------- */
.news-strip-wrap { margin-top: 28px; }
.news-strip { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--m-guide); text-decoration: none; }
.news-strip:hover { border-color: var(--ink-3); border-left-color: var(--m-guide); }
.news-strip__tag, .news__new { font: 700 .72rem/1 var(--sans); text-transform: uppercase; letter-spacing: .05em; color: #fff; background: var(--m-guide); border-radius: 10px; padding: 4px 8px; }
.news-strip__text { font-weight: 600; flex: 1; min-width: 12em; }
.news-strip__go { font-size: .88rem; color: var(--ink-3); text-decoration: underline; text-underline-offset: 3px; }
.news .page__head .news__new { vertical-align: 1px; }
.news__entry { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 8px 28px; padding: 24px 0; border-top: 1px solid var(--rule); max-width: 980px; }
.news__date { font: 600 .9rem/1.4 var(--sans); color: var(--ink-3); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.news__entry.is-new .news__date { color: var(--ink); }
.news__body h2 { font: 700 1.2rem/1.3 var(--sans); margin: 0 0 10px; }
.news__body ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.news__body li { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; align-items: baseline; font: 400 1rem/1.55 var(--serif); }
.news__type { font: 700 .72rem/1.2 var(--sans); text-transform: uppercase; letter-spacing: .05em; color: var(--c, var(--ink-3)); }
.news__type--chapter { --c: var(--m-case); }
.news__type--feature { --c: var(--m-pharm); }
.news__type--correction { --c: var(--m-guide); }
.news__type--update { --c: var(--m-hy); }
.news__text a { font-family: var(--sans); font-weight: 600; font-size: .9rem; white-space: nowrap; }
.news__note { color: var(--ink-3); font-size: .92rem; border-top: 1px solid var(--rule); padding-top: 18px; max-width: 980px; }

/* ---------- printable handout ---------- */
.handout-tools { display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 18px 20px; margin-bottom: 22px; }
.handout-tools__row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.handout-tools__label { font: 700 .78rem/1 var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); width: 70px; }
.handout-topics summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.handout-topics__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 18px; padding: 10px 0 2px; }
.handout-tools__go { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; }
.handout-fit { margin: 0; color: var(--good); font-weight: 600; font-size: .92rem; }
.handout-fit.is-warn { color: var(--bad); }

/* ---------- all high-yield PDFs (educators) ---------- */
.ahy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 4px; }
.ahy-grid .btn { width: 100%; justify-content: center; }
.ahy-status { margin: 10px 0 0; font-weight: 600; font-size: .92rem; color: var(--ink-3); min-height: 1.3em; }
.ahy-status.is-warn { color: var(--bad); }
.ahy-subhead { margin: 36px 0 6px; font-size: 1.3rem; }
.ahy-sub { margin: 0 0 14px; color: var(--ink-3); max-width: 70ch; }
.sheet-frame { position: relative; overflow: hidden; }
.sheets { transform-origin: top left; display: grid; gap: 24px; width: max-content; }
.sheet {
  background: #fff; color: #111; box-shadow: 0 2px 4px rgba(0,0,0,.08), 0 18px 40px -16px rgba(20,24,66,.35);
  padding: 5mm 6mm 4mm; display: flex; flex-direction: column; overflow: hidden;
  font-family: var(--sans); -webkit-print-color-adjust: exact; print-color-adjust: exact;
  -webkit-text-size-adjust: none; text-size-adjust: none;
}
.sheet__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 6mm; border-bottom: 1.2pt solid #1E2463; padding-bottom: 2.4mm; margin-bottom: 3mm; }
.sheet__kicker { margin: 0 0 1mm; font: 700 7pt/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: #C2333B; }
.sheet__head h1 { margin: 0; font: 800 14pt/1.15 var(--sans); letter-spacing: -0.01em; color: #1E2463; }
.sheet__src { margin: 0; font: 400 7pt/1.5 var(--sans); color: #555; text-align: right; }
.sheet__body { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; align-items: stretch; font-size: 8pt; }
.sheet__col { flex: 1 1 0; min-width: 0; height: 100%; overflow: hidden; padding: 0 2.25mm; border-left: .4pt solid #D9DCEA; }
.sheet__col:first-child { padding-left: 0; border-left: 0; }
.sheet__col:last-child { padding-right: 0; }
.sheet__h { font: 700 1.04em/1.2 var(--sans); color: #1E2463; margin: .7em 0 .3em; padding-bottom: .15em; border-bottom: .6pt solid #DF6418; }
.sheet__col > .sheet__h:first-child { margin-top: 0; }
.sheet__list { margin: 0; padding-left: 1.05em; }
.sheet__list li { font: 400 1em/1.26 var(--serif); margin: 0 0 .16em; overflow-wrap: break-word; }
.sheet__list li::marker { color: #DF6418; }
.sheet__list strong { font-weight: 700; }
.sheet--blank .sheet__list strong { color: transparent; border-bottom: .7pt solid #333; }
.sheet__topic { margin: 0 0 .7em; }
.sheet__topic h2 { font: 700 1.04em/1.2 var(--sans); color: #1E2463; margin: 0 0 .3em; padding-bottom: .15em; border-bottom: .6pt solid #DF6418; break-after: avoid; }
.sheet__topic ul { margin: 0; padding-left: 1.05em; }
.sheet__topic li { font: 400 1em/1.26 var(--serif); margin: 0 0 .16em; break-inside: avoid; }
.sheet__topic li::marker { color: #DF6418; }
.sheet__topic strong { font-weight: 700; }
.sheet--blank .sheet__topic strong { color: transparent; border-bottom: .7pt solid #333; }
.sheet__none { color: #777; }
.sheet__foot { margin-top: 2mm; padding-top: 1.6mm; border-top: .5pt solid #ccc; font: 400 6.5pt/1.3 var(--sans); color: #555; }

@media print {
  body.print-handout { background: #fff !important; }
  body.print-handout .topbar, body.print-handout .site-foot, body.print-handout .skip, body.print-handout .no-print { display: none !important; }
  body.print-handout .page { padding: 0 !important; margin: 0 !important; max-width: none !important; width: auto !important; }
  body.print-handout .sheet-frame { height: auto !important; overflow: visible; }
  body.print-handout .sheets { transform: none !important; display: block; gap: 0; }
  body.print-handout .sheet { box-shadow: none !important; padding: 0 !important; height: auto !important; break-inside: avoid; break-after: page; }
  /* columns are already filled by script; let them size to their content so nothing is clipped or pushed over */
  body.print-handout .sheet__body { flex: none; overflow: visible; }
  body.print-handout .sheet__col { height: auto !important; overflow: visible; }
  body.print-handout .sheet:last-child { break-after: auto; }
}

/* ---------- teaching mode ---------- */
.teach-setup .exam-form .select select { min-width: 260px; max-width: 100%; }
.teach-setup__hint { margin: 2px 0 0; font-size: .9rem; }
.teach-list { margin-top: 32px; max-width: 900px; }
.teach-list ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.teach-item { width: 100%; text-align: left; display: grid; gap: 4px; padding: 12px 16px; border-radius: var(--r-md); border: 1px solid var(--rule); background: var(--surface); color: var(--ink); cursor: pointer; }
.teach-item:hover { border-color: var(--m-case); }
.teach-item__meta { font: 600 .78rem/1.2 var(--sans); color: var(--ink-3); }
.teach-item__q { font: 400 .98rem/1.5 var(--serif); }

body.is-teaching { overflow: hidden; }
.teach {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column;
  background: radial-gradient(120% 100% at 15% 0%, #2B3585 0%, #1E2463 40%, #141842 100%);
  color: #E9EBFF; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.teach__bar { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; padding: 14px clamp(16px, 4vw, 48px); }
.teach__meta { font: 700 .95rem/1.2 var(--sans); color: #FFD23F; }
.teach__pos { font: 600 .95rem/1.2 var(--sans); color: #AEB4E8; font-variant-numeric: tabular-nums; }
.teach__spacer { flex: 1; }
.tbtn { min-height: 44px; padding: 0 20px; border-radius: 22px; border: 1px solid rgba(255,255,255,.28); background: transparent; color: #E9EBFF; font: 600 1rem/1 var(--sans); cursor: pointer; }
.tbtn:hover { border-color: rgba(255,255,255,.7); }
.tbtn[disabled] { opacity: .35; cursor: default; }
.tbtn--solid { background: #E9EBFF; color: #141842; border-color: #E9EBFF; min-width: 200px; }
.tbtn:focus-visible, .tchoice:focus-visible { outline: 3px solid #FFD23F; outline-offset: 3px; }
.teach__stage { flex: 1; min-height: 0; overflow-y: auto; padding: 0 clamp(16px, 5vw, 64px); }
.teach__inner { max-width: 1100px; margin: 0 auto; padding: clamp(8px, 3vh, 40px) 0 32px; }
.teach__title { font: 800 clamp(1.6rem, 3vw, 2.6rem)/1.15 var(--sans); margin: 0 0 .6em; color: #fff; letter-spacing: -0.01em; }
.teach__stem { font: 400 clamp(1.35rem, 2.5vw, 2.3rem)/1.5 var(--serif); margin: 0; color: #fff; }
.teach__stem strong { font-weight: 600; }
.teach__prompt { margin: 1.4em 0 0; font: 600 clamp(1rem, 1.6vw, 1.35rem)/1.4 var(--sans); color: #AEB4E8; }
.teach__choices { list-style: none; margin: clamp(18px, 3vh, 34px) 0 0; padding: 0; display: grid; gap: clamp(8px, 1.4vh, 14px); }
.tchoice { width: 100%; display: flex; gap: 18px; align-items: baseline; text-align: left; padding: clamp(12px, 1.8vh, 18px) 22px; border-radius: 14px; border: 1.5px solid rgba(255,255,255,.2); background: rgba(255,255,255,.05); color: #fff; font: 400 clamp(1.1rem, 1.9vw, 1.65rem)/1.4 var(--serif); cursor: pointer; }
.tchoice:hover:not([disabled]) { border-color: rgba(255,255,255,.55); background: rgba(255,255,255,.09); }
.tchoice__key { font: 800 .8em/1.6 var(--sans); color: #AEB4E8; min-width: 1.2em; }
.tchoice.is-picked { border-color: #FFD23F; background: rgba(255,210,63,.14); }
.tchoice.is-picked .tchoice__key { color: #FFD23F; }
.tchoice.is-correct { border-color: #4CCB8A; background: rgba(76,203,138,.2); }
.tchoice.is-correct .tchoice__key { color: #4CCB8A; }
.tchoice.is-wrong { border-color: #FF6B72; background: rgba(255,107,114,.16); }
.tchoice.is-dim { opacity: .45; }
.tchoice[disabled] { cursor: default; }
.teach__answer { margin-top: clamp(18px, 3vh, 32px); padding: clamp(16px, 2.4vh, 26px) clamp(18px, 2.4vw, 28px); border-radius: 16px; background: rgba(255,255,255,.08); border-left: 5px solid #4CCB8A; }
.teach__answer p { margin: 0; font: 400 clamp(1.1rem, 1.9vw, 1.6rem)/1.5 var(--serif); color: #fff; }
.teach__answer .teach__label { font: 700 clamp(.9rem, 1.3vw, 1.1rem)/1.3 var(--sans); color: #4CCB8A; text-transform: uppercase; letter-spacing: .06em; margin-bottom: .5em; }
.teach__inner.is-revealed .teach__stem { font-size: clamp(1.1rem, 1.9vw, 1.7rem); }
.teach__inner.is-revealed .teach__title { font-size: clamp(1.3rem, 2.2vw, 2rem); }
.teach__inner.is-revealed .teach__choices { margin-top: clamp(12px, 2vh, 20px); gap: 8px; }
.teach__inner.is-revealed .tchoice { padding: 8px 20px; font-size: clamp(1rem, 1.55vw, 1.35rem); }
.teach__inner.is-revealed .teach__answer { margin-top: clamp(12px, 2vh, 20px); }
.teach__inner.is-revealed .teach__answer p { font-size: clamp(1.05rem, 1.7vw, 1.45rem); }
.teach__nav { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 14px clamp(16px, 4vw, 48px) 6px; }
.teach__keys { text-align: center; font: 500 .8rem/1 var(--sans); color: #8C91D0; margin: 0 0 14px; }
.teach .gl { text-decoration-color: rgba(255,255,255,.55); }
.teach .gl:hover, .teach .gl[aria-expanded="true"] { background: rgba(255,255,255,.12); }
.glpop { z-index: 200; }

@media (max-width: 980px) {
  .tools--3 { grid-template-columns: minmax(0, 1fr); }
  .news__entry { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .news__date { flex-direction: row; align-items: center; }
}
@media (max-width: 720px) {
  .news__body li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .hy-tools__print { margin-left: 0; }
  .teach__keys { display: none; }
  .teach__nav { gap: 8px; }
  .teach__nav .tbtn { padding: 0 14px; }
  .tbtn--solid { min-width: 0; flex: 1; }
  .teach__bar .tbtn { min-height: 38px; padding: 0 14px; font-size: .9rem; }
}
@media (max-height: 780px) and (min-width: 721px) {
  .teach__bar { padding-top: 10px; padding-bottom: 6px; }
  .teach__keys { display: none; }
  .teach__nav { padding-bottom: 12px; padding-top: 10px; }
  .teach__inner { padding-top: 4px; padding-bottom: 16px; }
  .teach__inner.is-revealed .teach__stem { font-size: clamp(1.05rem, 1.7vw, 1.45rem); line-height: 1.42; }
  .teach__inner.is-revealed .tchoice { padding: 6px 18px; font-size: clamp(.98rem, 1.4vw, 1.2rem); }
  .teach__inner.is-revealed .teach__answer { padding: 12px 20px; }
  .teach__inner.is-revealed .teach__answer p { font-size: clamp(1rem, 1.5vw, 1.3rem); }
}
.teach-setup .exam-form fieldset { min-width: 0; }
.teach-setup .exam-form .select { max-width: 100%; }
.teach-setup .exam-form .select select { min-width: 0; width: 100%; text-overflow: ellipsis; }
@media (min-width: 721px) { .teach-setup .exam-form .select select { min-width: 260px; width: auto; } }

/* Long compound terms in headings wrap instead of widening the page on phones. */
h1, h2, h3 { overflow-wrap: break-word; }

/* ---------- bookmarks ---------- */
.g-sec__head { display: flex; align-items: flex-start; gap: 14px; max-width: var(--measure); }
.g-sec__head h3 { flex: 1 1 auto; min-width: 0; }
.ribbon { flex: 0 0 auto; width: 34px; height: 40px; margin: -6px -4px 0 0; padding: 4px 7px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink-3); cursor: pointer; display: grid; place-items: center; }
.ribbon svg { width: 20px; height: 28px; fill: transparent; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; transition: fill .15s, transform .15s; }
.ribbon:hover { background: var(--tint); color: var(--m-guide); }
.ribbon:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ribbon.is-on { color: var(--m-guide); }
.ribbon.is-on svg { fill: var(--m-guide); }
.ribbon:active svg { transform: translateY(2px); }
.toc a.is-bm { position: relative; padding-right: 22px; }
.toc a.is-bm::after { content: ""; position: absolute; right: 6px; top: 9px; width: 8px; height: 11px; background: var(--m-guide); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%); }
.toc__bookmarks { display: inline-flex; align-items: center; gap: 8px; margin: 4px 0 8px; padding: 6px 8px; font: 600 .86rem/1.2 var(--sans); color: var(--ink-2); text-decoration: none; border-radius: var(--r-sm); }
.toc__bookmarks:hover { background: var(--tint); color: var(--ink); }
.toc__bookmarks svg { width: 10px; height: 14px; fill: var(--m-guide); }
.tool--wide { grid-column: 1 / -1; }
.bm-group { margin-top: 26px; }
.bm-group h2 { font: 700 1.05rem/1.3 var(--sans); margin: 0 0 10px; }
.bm-group h2 a { color: var(--ink); text-decoration: none; }
.bm-group h2 a:hover { text-decoration: underline; }
.bm-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bm { display: flex; align-items: flex-start; gap: 8px; background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--m-guide); border-radius: var(--r-md); padding: 12px 10px 12px 16px; }
.bm__link { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; }
.bm__link:hover .bm__title { text-decoration: underline; }
.bm__meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font: 500 .8rem/1.3 var(--sans); color: var(--ink-3); }
.bm__n { color: var(--m-guide); font-weight: 700; font-variant-numeric: tabular-nums; }
.bm__title { font: 700 1.05rem/1.3 var(--sans); color: var(--ink); overflow-wrap: break-word; }
.bm__snip { font: 400 .95rem/1.5 var(--serif); color: var(--ink-2); }
.empty__ribbon svg { width: 26px; height: 36px; fill: var(--m-guide); margin-bottom: 8px; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 60; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: var(--r-md); background: var(--night); color: var(--night-ink); font: 500 .92rem/1.4 var(--sans); box-shadow: 0 8px 24px rgba(0,0,0,.25); transition: opacity .2s, transform .2s; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast a { color: #FFD23F; margin-left: 6px; }
@media print { .ribbon, .toc__bookmarks, .toast { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .toast, .ribbon svg { transition: none; } }

/* ---------- teaching mode: group tally, facilitator notes, session summary ---------- */
.teach__votes { font: 700 .95rem/1.2 var(--sans); color: #fff; background: rgba(255,255,255,.14); padding: 6px 12px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.tc-row { display: flex; gap: 10px; align-items: stretch; }
.tc-row .tchoice { position: relative; overflow: hidden; flex: 1; min-width: 0; }
.tchoice__txt { flex: 1; min-width: 0; position: relative; }
.tchoice__key { position: relative; }
.tchoice__n { position: relative; margin-left: auto; padding-left: 12px; font: 700 .8em/1.6 var(--sans); color: #FFD23F; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tchoice__bar { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,.14); pointer-events: none; transition: width .35s ease; }
.tchoice.is-correct .tchoice__bar { background: rgba(76,203,138,.32); }
.tchoice.is-wrong .tchoice__bar { background: rgba(255,107,114,.3); }
.tchoice.is-correct .tchoice__n { color: #4CCB8A; }
.tminus { flex: none; width: 44px; border-radius: 12px; border: 1px solid rgba(255,255,255,.2); background: transparent; color: #AEB4E8; font: 700 1.3rem/1 var(--sans); cursor: pointer; }
.tminus:hover { border-color: rgba(255,255,255,.6); color: #fff; }
.tminus:focus-visible { outline: 3px solid #FFD23F; outline-offset: 3px; }
.teach__verdict { margin: 0 0 .4em !important; font: 600 clamp(1rem, 1.6vw, 1.3rem)/1.4 var(--sans) !important; color: #FFD23F !important; }
@media (prefers-reduced-motion: reduce) { .tchoice__bar { transition: none; } }

/* facilitator notes: shared by the in-page panel and the presenter window */
.pn { font: 400 .95rem/1.5 var(--sans); color: var(--ink); }
.pn h3 { font: 700 .78rem/1.2 var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 18px 0 6px; }
.pn p { margin: 0 0 8px; }
.pn ul { margin: 0 0 6px; padding-left: 1.2em; }
.pn li { margin: 0 0 6px; }
.pn__hint, .pn__warn { color: var(--ink-3); font-size: .86rem; }
.pn__watch, .pn__live { padding: 8px 12px; border-radius: 8px; background: var(--tint); }
.pn__wrong { list-style: none; padding: 0; }
.pn__wrong li { padding: 6px 0; border-bottom: 1px solid var(--rule); }
.pn__tag { display: inline-block; font: 600 .76rem/1.3 var(--sans); padding: 1px 8px; border-radius: 999px; background: var(--tint); color: var(--ink-2); margin-left: 4px; }
.pn__tag.is-top { background: #FFE9B8; color: #5A3B00; }
.pn__tag.is-ok { background: #CFEFDD; color: #0E4A2A; }
.pn__links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; }
.teach__notes { position: fixed; z-index: 150; top: 64px; right: 16px; bottom: 16px; width: min(440px, calc(100vw - 32px)); overflow-y: auto; background: var(--surface, #fff); color: var(--ink, #111); border-radius: 16px; padding: 14px 18px 18px; box-shadow: 0 12px 40px rgba(0,0,0,.45); }
.pn__head { display: flex; align-items: center; justify-content: space-between; }
.pn__x { border: 0; background: transparent; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--ink-2); padding: 4px 8px; min-height: 44px; min-width: 44px; }

body.is-presenter .topbar, body.is-presenter .site-foot { display: none; }
.presenter { max-width: 720px; padding-top: 18px; }
.pres__meta { color: var(--ink-3); font-size: .86rem; margin: 0 0 10px; }
.pres__stem { font: 400 1.02rem/1.55 var(--serif); margin: 0 0 12px; }
.pres__choices { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.pres__choices li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); }
.pres__choices li.is-answer { border-color: #2E9E64; }
.pres__key { font: 800 .85rem/1 var(--sans); color: var(--ink-3); min-width: 1.2em; }
.pres__txt { flex: 1; min-width: 0; font-size: .95rem; }
.pres__ctl { display: flex; align-items: center; gap: 6px; }
.pres__ctl button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--rule); background: var(--tint); color: var(--ink); font: 700 1.2rem/1 var(--sans); cursor: pointer; }
.pres__ctl button[disabled] { opacity: .35; cursor: default; }
.pres__n { min-width: 1.8em; text-align: center; font-variant-numeric: tabular-nums; }
.pres__tot { color: var(--ink-2); margin: 0 0 12px; }
.pres__nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 6px; }

.teach-past { margin-top: 32px; max-width: 720px; }
.teach-past ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.teach-past a { display: block; padding: 10px 14px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--surface); color: var(--ink); text-decoration: none; }
.teach-past a:hover { border-color: var(--m-case); }
.ts-miss { margin: 12px 0 0; padding-left: 1.4em; display: grid; gap: 22px; }
.ts-miss li { break-inside: avoid; }
.ts-miss__meta { font: 600 .8rem/1.3 var(--sans); color: var(--ink-3); margin: 0 0 4px; }
.ts-miss__q { font: 400 1.02rem/1.55 var(--serif); margin: 0 0 6px; }
.ts-miss__dist { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.ts-miss__dist span { font: 600 .82rem/1 var(--sans); padding: 5px 9px; border-radius: 999px; background: var(--tint); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ts-miss__dist span.is-ok { background: #CFEFDD; color: #0E4A2A; }
.ts-miss__why { color: var(--ink-2); }
@media print {
  .no-print, .teach-summary .crumb { display: none !important; }
  .teach-summary { padding: 0; }
}
@media (max-width: 720px) {
  .teach__nav { flex-wrap: wrap; }
  .teach__nav .tbtn--solid { flex: 1 1 100%; order: -1; min-height: 48px; }
  #t-presenter { display: none; }
  .teach__notes { top: 56px; right: 8px; left: 8px; width: auto; }
}

/* teaching mode: recall rating rows and fill-in-the-blank */
.teach__choices--rate { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.teach__choices--rate .tchoice { min-height: 64px; }
.teach__stem--hy { line-height: 1.7; }
.hyblank { display: inline-block; height: 1.1em; vertical-align: -0.15em; margin: 0 .1em; border-bottom: 3px solid #FFD23F; background: rgba(255,210,63,.14); border-radius: 3px 3px 0 0; }
.hyfill { background: rgba(76,203,138,.28); color: #fff; padding: 0 .2em; border-radius: 4px; font-weight: 600; }
.teach__why { margin-top: .6em !important; color: #D3D7F5 !important; font-size: .92em !important; }
.pres__ans { color: var(--ink-2); }
.pn .hyfill, .presenter .hyfill, .ts-miss .hyfill { background: #CFEFDD; color: #0E4A2A; }
@media (max-width: 720px) { .teach__choices--rate { grid-template-columns: minmax(0, 1fr); } }

/* back up and restore */
.progress-page .score-table { max-width: 520px; }
.pg-file { display: block; margin: 8px 0 14px; max-width: 100%; }
.pg-bad { color: #B3261E; font-weight: 600; }
#backup-nudge .news-strip { border-left-color: #E0A100; }

/* chapter navigator in the chapter header */
.ch-head__top { display: flex; align-items: center; justify-content: flex-start; gap: 8px 20px; flex-wrap: wrap; margin-bottom: 14px; }
.ch-head__top .crumb { margin: 0; }
.chnav { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.chnav__step { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); text-decoration: none; font: 700 1.4rem/1 var(--sans); }
.chnav__step:hover { border-color: var(--ink-3); }
.chnav__step.is-off { opacity: .35; }
.chnav__pick select { height: 40px; max-width: min(340px, 56vw); padding: 0 32px 0 12px; border-radius: 10px; border: 1px solid var(--rule); background-color: var(--surface); color: var(--ink); font: 600 .92rem/1 var(--sans); text-overflow: ellipsis; }
.chnav__step:focus-visible, .chnav__pick select:focus-visible { outline: 3px solid var(--m-guide, #3B5BDB); outline-offset: 2px; }
@media print { .chnav { display: none; } }

/* ---------- post-publication update boxes ---------- */
:root { --upd: #A86A00; --upd-bg: #FFF7E3; --upd-rule: #E2B65A; }
:root[data-theme="dark"] { --upd: #F2C14E; --upd-bg: #2A2614; --upd-rule: #8A7330; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --upd: #F2C14E; --upd-bg: #2A2614; --upd-rule: #8A7330; } }
.update { background: var(--upd-bg); border: 2px dashed var(--upd-rule); border-radius: var(--r-md); padding: 16px 18px; margin: 6px 0 20px; }
p.update__kicker, .g-sec .update p.update__kicker { margin: 0 0 6px; font: 700 .74rem/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--upd); }
p.update__title, .g-sec .update p.update__title { margin: 0 0 6px; font: 700 1.02rem/1.3 var(--sans); color: var(--ink); }
p.update__text, .g-sec .update p.update__text { margin: 0 0 10px; font: 400 1rem/1.6 var(--serif); }
p.update__links, .g-sec .update p.update__links { margin: 8px 0 0; font: 600 .82rem/1.5 var(--sans); color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.update__links > span:first-child { color: var(--upd); text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; }
.update__links a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.update__links a::after { content: " \2197"; }
p.update__src, .g-sec .update p.update__src { margin: 0; font: 400 .82rem/1.45 var(--sans); color: var(--ink-3); }

/* ---------- drug links ---------- */
a.dl { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--m-pharm) 70%, transparent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a.dl:hover { background: color-mix(in srgb, var(--m-pharm) 12%, transparent); }
.dpop__g { margin: -2px 0 8px; font: 600 .8rem/1.3 var(--sans); color: var(--m-pharm); }
.dpop__dose { margin: 0 0 10px; font: 400 .9rem/1.45 var(--sans); color: var(--ink-2); }

/* ---------- drugs pages ---------- */
.dtools { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 20px; }
.dfilters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 0 0 18px; }
.dfilters__low { flex-basis: 100%; margin: 0; }
.dsearch input { font: 500 .92rem/1 var(--sans); color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: 18px; min-height: 38px; padding: 0 14px; width: min(260px, 70vw); }
.dclass { margin: 0 0 34px; }
.dclass__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin-bottom: 10px; }
.dclass__head h2 { margin: 0; font: 800 1.5rem/1.2 var(--sans); letter-spacing: -0.01em; }
.dclass__head a { font-size: .9rem; color: var(--ink-3); }
.dclass__intro { color: var(--ink-2); margin: 0 0 18px; max-width: 80ch; }
.dgroup { margin: 0 0 24px; }
.dgroup__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin: 0 0 10px; }
.dgroup__head h3 { margin: 0; font: 700 1.08rem/1.3 var(--sans); }
.dgroup__acts { display: flex; flex-wrap: wrap; gap: 8px; }
.dgrid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.dcard { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 14px 16px; background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--m-pharm); border-radius: var(--r-md); text-decoration: none; color: var(--ink); }
.dcard:hover { border-color: var(--m-pharm); }
.dcard__name { font: 700 1.05rem/1.25 var(--sans); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dcard__brand { font: 500 .84rem/1.3 var(--sans); color: var(--ink-3); }
.dcard__sum { font: 400 .92rem/1.45 var(--sans); color: var(--ink-2); }
.dcard__mini { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.dmini { display: inline-flex; align-items: center; gap: 5px; font: 600 .72rem/1 var(--sans); color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.dbadge { display: inline-block; font: 700 .68rem/1 var(--sans); letter-spacing: .04em; text-transform: uppercase; padding: 4px 7px; border-radius: 10px; }
.dbadge--new { background: color-mix(in srgb, var(--upd) 18%, transparent); color: var(--upd); }
.dbadge--upd { background: color-mix(in srgb, var(--upd) 10%, transparent); color: var(--upd); border: 1px dashed var(--upd-rule); }
.pips { display: inline-flex; gap: 2px; vertical-align: middle; }
.pips i { width: 14px; height: 7px; border-radius: 2px; background: var(--rule); }
.pips--1 i.on { background: var(--good); }
.pips--2 i.on { background: var(--m-dx); }
.pips--3 i.on { background: var(--bad); }
.pips--na { color: var(--ink-3); font-size: .9rem; }
.pips--0 i { background: var(--rule); }
.dnote { margin-top: 28px; font-size: .84rem; color: var(--ink-3); max-width: 80ch; }

.drug-page { max-width: 900px; }
.dhead h1 { font: 800 clamp(1.8rem, 4vw, 2.5rem)/1.1 var(--sans); letter-spacing: -0.02em; margin: 0 0 4px; }
.dhead__brand { margin: 0 0 8px; color: var(--ink-3); font-weight: 500; }
.dhead__sum { margin: 0 0 10px; font: 400 1.08rem/1.55 var(--serif); color: var(--ink-2); max-width: 70ch; }
.dhead__tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
.dquick { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 0 0 16px; }
.dquick div { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 10px 14px; }
.dquick dt { font: 700 .72rem/1 var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--m-pharm); margin-bottom: 6px; }
.dquick dd { margin: 0; font: 500 .92rem/1.4 var(--sans); }
.dacts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 22px; }
.dacts__read a { font-size: .92rem; }
.dsec { border-top: 1px solid var(--rule); padding: 16px 0 6px; }
.dsec h2 { font: 700 1.15rem/1.3 var(--sans); margin: 0 0 10px; color: var(--m-pharm); }
.dsec h3 { font: 700 .82rem/1.2 var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 12px 0 6px; }
.dsec p, .dsec li, .dsec dd { font-family: var(--serif); }
.dsec ul { margin: 0 0 12px; padding-left: 1.2em; }
.dsec li { margin: 0 0 4px; }
.dforms { color: var(--ink-2); }
h3.dserious { color: var(--bad); }
.dserious__list li::marker { color: var(--bad); }
.dprofile { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 18px; margin: 0 0 10px; }
.dprofile__row { display: flex; align-items: center; gap: 10px; font: 500 .9rem/1.3 var(--sans); }
.dprofile__row > span:first-child { flex: 1; }
.dprofile__w { font: 500 .78rem/1 var(--sans); color: var(--ink-3); min-width: 56px; }
.dpager { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; font-weight: 600; }

.cmp-picks .filter[disabled] { opacity: .4; cursor: not-allowed; }
.cmp-count { color: var(--ink-3); font-size: .9rem; margin: -6px 0 14px; }
.cmp-wrap { overflow-x: auto; }
table.cmp { border-collapse: collapse; width: 100%; min-width: 560px; background: var(--surface); }
table.cmp th, table.cmp td { border: 1px solid var(--rule); padding: 10px 12px; vertical-align: top; text-align: left; font-size: .9rem; line-height: 1.45; }
table.cmp thead th { background: var(--tint); font: 700 1rem/1.2 var(--sans); position: relative; padding-right: 30px; }
table.cmp thead th a { color: var(--ink); }
table.cmp tbody th { width: 140px; min-width: 120px; font: 700 .8rem/1.3 var(--sans); color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; background: var(--tint); position: sticky; left: 0; z-index: 1; }
table.cmp ul { margin: 0; padding-left: 1.1em; }
table.cmp tr.cmp__prof td { white-space: nowrap; }
.cmp__x { position: absolute; top: 6px; right: 6px; border: 0; background: none; color: var(--ink-3); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.upd-year h2 { font: 800 1.4rem/1.2 var(--sans); margin: 24px 0 10px; }
.upd-item__where { margin: 0 0 4px; font: 600 .9rem/1.3 var(--sans); }
@media (max-width: 720px) {
  table.cmp tbody th { width: 96px; min-width: 96px; }
  .dgroup__acts .btn { flex: 1 1 auto; }
}
.dpop { border-top-color: var(--m-pharm); }

.cmp-pick { margin: 0 0 14px; }
.cmp-pick summary { cursor: pointer; font: 700 .95rem/1.3 var(--sans); padding: 8px 0; }
.cmp-pick .filters { margin: 8px 0 0; }
@media (min-width: 1080px) and (max-width: 1319px) {
  .sitenav .nav-long { display: none; }
  .sitenav a { text-transform: capitalize; padding: 8px 8px; }
}
.nav-short { display: none; }
@media (min-width: 1080px) and (max-width: 1199px) {
  .sitenav .nav-full { display: none; }
  .sitenav .nav-short { display: inline; }
}

/* ---------- bottom tab bar (phones and tablets) ---------- */
.tabbar { display: none; }
@media (max-width: 1079px) {
  .tabbar {
    display: flex; position: fixed; z-index: 37; left: 0; right: 0; bottom: 0;
    background: var(--night); color: var(--night-ink-2);
    padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    box-shadow: 0 -6px 20px rgba(0,0,0,.22);
    transition: transform .22s cubic-bezier(.2,.7,.2,1);
  }
  .tabbar a, .tabbar button {
    flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
    min-height: 48px; padding: 6px 4px; border: 0; border-radius: 12px; background: none; cursor: pointer;
    color: inherit; text-decoration: none; font: 600 .7rem/1 var(--sans);
  }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar a.is-active { color: var(--night-ink); background: rgba(255,255,255,.14); }
  .tabbar .badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 16px; height: 16px; font-size: .62rem; line-height: 16px; padding: 0 4px; }
  body.tabbar-hidden .tabbar { transform: translateY(105%); box-shadow: none; }
  body.is-teaching .tabbar { display: none; }
  .site-foot { padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 1079px) and (prefers-reduced-motion: reduce) { .tabbar { transition: none; } }
@media print { .tabbar { display: none !important; } }

/* ---------- learning layer: checks, look-alikes, pre/post-test, visual summaries ---------- */
.checks { max-width: var(--measure); margin: 18px 0 6px; padding: 14px 18px 10px; border-radius: var(--r-md); background: var(--tint); border-left: 4px solid var(--m-guide); }
.g-sec .checks__title { margin: 0; font: 800 .8rem/1.2 var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--m-guide); }
.g-sec .checks__hint { margin: 4px 0 8px; font: 400 .86rem/1.4 var(--sans); color: var(--ink-3); }
.g-sec .checks ol { margin: 0; padding: 0; list-style: none; }
.g-sec .checks li { margin: 0 0 6px; font: inherit; }
.checks summary { cursor: pointer; font: 600 .98rem/1.45 var(--sans); padding: 4px 0; list-style-position: outside; }
.checks summary::marker { color: var(--m-guide); }
.checks details[open] summary { color: var(--ink-2); }
.g-sec .checks details p { margin: 4px 0 10px 1.15em; font: 400 .98rem/1.55 var(--serif); }
.g-sec .g-compare { max-width: var(--measure); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 10px 0 4px; font: 600 .86rem/1.3 var(--sans); }
.g-sec .g-compare span { color: var(--ink-3); }
.g-sec .g-compare a { padding: 4px 10px; border: 1px solid var(--rule); border-radius: 14px; text-decoration: none; color: var(--ink); background: var(--surface); }
.g-sec .g-compare a:hover { border-color: var(--m-guide); }
.g-listen { flex: 0 0 auto; width: 34px; height: 34px; margin: -3px -6px 0 0; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink-3); cursor: pointer; display: grid; place-items: center; }
.g-listen svg { width: 20px; height: 20px; }
.g-listen:hover { background: var(--tint); color: var(--m-guide); }
.g-listen:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.is-speaking { background: color-mix(in srgb, var(--m-guide) 12%, transparent); box-shadow: -10px 0 0 color-mix(in srgb, var(--m-guide) 12%, transparent), 10px 0 0 color-mix(in srgb, var(--m-guide) 12%, transparent); border-radius: 6px; }
.prepost { max-width: var(--measure); margin: 14px 0 8px; padding: 18px 22px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--surface); }
.prepost h2 { font: 700 1rem/1.3 var(--sans); margin: 0 0 6px; }
.prepost__intro p { margin: 0 0 14px; color: var(--ink-2); font-size: .94rem; }
.prepost__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.prepost__slot { border: 1px solid var(--rule); border-radius: var(--r-md); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.prepost__label { margin: 0; font: 800 .74rem/1 var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
.prepost__score { margin: 0; font: 800 1.8rem/1 var(--sans); }
.prepost__score span { font-size: .9rem; font-weight: 700; color: var(--ink-3); }
.prepost__score.is-up { color: var(--good); }
.prepost__score.is-down { color: var(--bad); }
.prepost__meta { margin: 0; font-size: .84rem; color: var(--ink-3); }
.prepost__slot .btn { margin-top: auto; }
.choice__why { display: block; margin-top: 4px; font: 400 .9rem/1.45 var(--serif); color: var(--ink-2); }
.choice__why::before { content: "Why not: "; font: 700 .78rem/1 var(--sans); color: var(--ink-3); }
.is-correct .choice__why { display: none; }
.pn__why { color: var(--ink-3); font-style: italic; }
.dom-tools { display: flex; gap: 8px; margin-bottom: 2px; }
.exam-form legend .muted { text-transform: none; letter-spacing: 0; font-weight: 600; }
/* look-alikes */
.cmp-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.cmp-item { display: flex; flex-direction: column; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--surface); }
.cmp-item[hidden] { display: none; }
.cmp-item:hover { border-color: var(--m-guide); }
.cmp-card { display: flex; flex-direction: column; gap: 6px; flex: 1; padding: 16px 18px 10px; color: var(--ink); text-decoration: none; border-radius: var(--r-md) var(--r-md) 0 0; }
.cmp-card:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.cmp-item__pdf { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 14px; }
.cmp-tools { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; margin: 0 0 10px; }
.cmp-tools__field { display: flex; flex-direction: column; gap: 6px; font: 700 .78rem/1 var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.cmp-tools__field select, .cmp-tools__field input { min-height: 42px; padding: 8px 12px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: 500 .95rem/1.2 var(--sans); text-transform: none; letter-spacing: 0; max-width: 100%; }
.cmp-tools__search { flex: 1 1 220px; }
.cmp-count { margin: 0 0 12px; color: var(--ink-3); font-size: .9rem; }
.cmp-pdf { margin-top: 32px; max-width: 760px; }
.cmp-pdf h2 { font: 700 1.1rem/1.3 var(--sans); margin: 0 0 6px; }
.cmp-pdf > p { margin: 0 0 14px; font-size: .92rem; }
.cmp-detail-pdf { margin-top: 18px; align-items: center; }
.g-lookalikes { max-width: var(--measure); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 12px 0 4px; font: 600 .88rem/1.3 var(--sans); }
.g-lookalikes b { color: var(--ink-2); margin-right: 2px; }
.g-lookalikes a { padding: 4px 10px; border: 1px solid var(--rule); border-radius: 14px; text-decoration: none; color: var(--ink); background: var(--surface); }
.g-lookalikes a:hover { border-color: var(--m-guide); }
.g-lookalikes a.g-lookalikes__all { border-style: dashed; color: var(--ink-2); }
.cmp-card__title { font: 700 1.02rem/1.3 var(--sans); }
.cmp-card__meta { font-size: .9rem; color: var(--ink-2); }
.cmp-card__ch { margin-top: auto; font: 700 .78rem/1 var(--sans); color: var(--ink-3); }
.cmp-table { min-width: 560px; }
.cmp-table thead th { position: sticky; top: 0; background: var(--surface); }
.cmp-table tbody th { font-weight: 700; white-space: normal; min-width: 130px; }
.cmp-table td, .cmp-table th { vertical-align: top; }
.cmp-keys, .cmp-links { max-width: var(--measure); margin-top: 26px; }
.cmp-keys h2, .cmp-links h2 { font: 700 1.1rem/1.3 var(--sans); margin: 0 0 8px; }
.cmp-keys li { font: 400 1rem/1.55 var(--serif); margin-bottom: 8px; }
.cmp-src { margin-top: 24px; font-size: .84rem; }
/* visual summaries */
.heatmap h4, .chrono h4 { margin: 0 0 8px; }
table.hm { border-collapse: separate; border-spacing: 3px; width: auto; }
table.hm th, table.hm td { border: 0; }
table.hm thead th { position: relative; font: 700 .74rem/1.2 var(--sans); text-align: center; vertical-align: bottom; padding: 4px 3px; min-width: 64px; max-width: 104px; white-space: normal; overflow-wrap: normal; }
table.hm tbody th { position: sticky; left: 0; z-index: 1; background: var(--surface); font: 600 .86rem/1.3 var(--sans); text-align: left; padding: 4px 10px 4px 4px; white-space: nowrap; }
@media (max-width: 720px) { table.hm tbody th { font-size: .78rem; white-space: normal; min-width: 92px; max-width: 110px; } }
table.hm td { position: relative; vertical-align: middle; width: 52px; min-width: 44px; height: 34px; text-align: center; font: 800 .8rem/1 var(--sans); border-radius: 6px; padding: 0; }
.hm-0 { background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink-3); }
.hm-1 { background: color-mix(in srgb, var(--m-guide) 24%, var(--surface)); color: var(--ink); }
.hm-2 { background: color-mix(in srgb, var(--m-guide) 55%, var(--surface)); color: #fff; }
.hm-3 { background: var(--m-guide); color: #fff; }
.g-sec .hm-legend { font-family: var(--sans); display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 0; font-size: .82rem; color: var(--ink-2); }
.hm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.hm-legend i { font-style: normal; display: inline-grid; place-items: center; width: 30px; height: 20px; border-radius: 4px; font: 800 .72rem/1 var(--sans); }
.chrono ol { list-style: none; margin: 0; padding: 0 0 0 4px; border-left: 2px solid var(--rule); }
.chrono li { position: relative; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 6px 0 10px 16px; }
.chrono li::before { content: ""; position: absolute; left: -7px; top: 12px; width: 12px; height: 12px; border-radius: 50%; background: var(--m-guide); border: 2px solid var(--paper); }
.chrono__year { font: 800 .92rem/1.5 var(--sans); color: var(--m-guide); }
.chrono__what { font: 400 1rem/1.5 var(--serif); }
.chrono__what small { display: block; font-size: .86rem; color: var(--ink-3); }
/* sharing */
.share { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 22px; align-items: start; max-width: 860px; margin-top: 22px; padding: 20px 22px; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--surface); }
.share h2 { font: 700 1.1rem/1.3 var(--sans); margin: 0 0 12px; }
.share__label { display: block; font: 700 .78rem/1 var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 12px 0 6px; }
.share__input { width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--paper); color: var(--ink); font: 500 .92rem/1.3 var(--sans); }
.share .empty__actions { margin-top: 14px; }
.share__note { font-size: .86rem; margin: 12px 0 0; }
.share__qr { background: #fff; border-radius: var(--r-md); padding: 6px; border: 1px solid var(--rule); }
.share__qr svg { display: block; width: 100%; height: auto; }
@media (max-width: 720px) { .share { grid-template-columns: minmax(0, 1fr); } .share__qr { max-width: 260px; } }
.quiz-landing .eyebrow { margin: 0 0 4px; font: 800 .78rem/1 var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
/* display settings */
.display-btn span { font: 800 1rem/1 var(--sans); letter-spacing: -.02em; }
.display-btn small { font-size: .7em; }
.display-panel { position: fixed; z-index: 45; top: calc(env(safe-area-inset-top, 0px) + var(--top) + 6px); right: max(10px, env(safe-area-inset-right, 0px)); width: min(360px, calc(100vw - 20px)); padding: 16px 18px; background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--r-md); box-shadow: 0 14px 40px rgba(0,0,0,.25); }
.display-panel__title { margin: 0 0 8px; font: 800 .76rem/1 var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
.display-panel .seg { margin-bottom: 16px; }
.seg--full { display: flex; }
.seg--full span { padding: 0 12px; }
.display-panel__note { margin: 0; font-size: .84rem; color: var(--ink-2); }
/* read-aloud player */
.tts { position: fixed; z-index: 36; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: min(560px, calc(100vw - 20px)); display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 16px; border-radius: 28px; background: var(--night); color: var(--night-ink); box-shadow: 0 10px 30px rgba(0,0,0,.3); transition: bottom .22s cubic-bezier(.2,.7,.2,1); }
.tts[hidden] { display: none; }
.tts__label { flex: 1; min-width: 0; font: 600 .86rem/1.2 var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tts__btns { display: flex; gap: 4px; }
.tts button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; color: inherit; display: grid; place-items: center; cursor: pointer; }
.tts button:disabled { opacity: .35; cursor: default; }
.tts button:hover:not(:disabled) { background: rgba(255,255,255,.12); }
.tts button:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.tts .tts__play { background: rgba(255,255,255,.16); }
.tts svg { width: 20px; height: 20px; }
body.tts-on .site-foot { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 1079px) {
  .tts { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
  body.tabbar-hidden .tts { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  body.tts-on .site-foot { padding-bottom: calc(140px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) { .tts { transition: none; } }
@media print { .checks, .g-listen, .prepost, .g-compare, .tts, .display-panel, .share { display: none !important; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hm-3, :root:not([data-theme="light"]) .hm-2 { color: #1A0B0D; } }
:root[data-theme="dark"] .hm-3, :root[data-theme="dark"] .hm-2 { color: #1A0B0D; }

/* top bar fitting (see fitTopbar in app.js) */
.nav-nobrand .brand__name { display: none !important; }
.nav-compact .sitenav .nav-long, .nav-compact .sitenav .nav-full { display: none; }
.nav-compact .sitenav .nav-short { display: inline; }
.nav-compact .sitenav a { text-transform: capitalize; padding: 8px 8px; }
.nav-tight .sitenav { display: none !important; }
.nav-tight .menu-panel__tools { display: block !important; }
