/* White, neutral grays (no tint). Colour: the anatomy pictures, one solid green for the main action, and the right/wrong marks.
   Left sidebar + full-width content; working screens are two panes (controls left, picture right, sized to the screen).
   No outlined boxes: hover and selection only make the background lighter. Entrances are short fades.
   Light mode (soft gray, not white) and dark mode (charcoal, not black); the sidebar button switches, the system setting is the default. */
:root {
  color-scheme: light;
  --bg: #f3f3f3; --panel: #f8f8f8; --raise: #fcfcfc; --line: rgba(0,0,0,.08); --line2: rgba(0,0,0,.14);
  --ink: #161616; --soft: #4a4a4a; --mute: #767676; --white: #000000;  /* --white = strongest text; --panel = hover, --raise = selected */
  --ok: #2e7d4f; --bad: #c0392b; --accent: #2b4c7e; --accent-hover: #24406b; --accent-ink: #ffffff;
  --pin: #ffffff; --pin-ink: #1c1c1c; --pin-ring: rgba(0,0,0,.28); --pin-halo: rgba(0,0,0,.14);  /* pins match the name cards */
  --glass: rgba(243,243,243,.92); --inkline: #1a1a1a; --inkline2: #3a3a3a; --tip: #ffffff; --tip-ink: #1c1c1c;
  --r: 10px; --ease: cubic-bezier(.23, 1, .32, 1); --move: cubic-bezier(.77, 0, .175, 1);
  --side: 15rem; --gut: clamp(20px, 2.6vw, 48px); --pad: clamp(12px, 1.4vw, 24px);
  --paneh: calc(100dvh - 2 * var(--gut));  /* every right-hand picture box is this tall */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1f1f1f; --panel: #292929; --raise: #303030; --line: rgba(255,255,255,.08); --line2: rgba(255,255,255,.14);
  --ink: #ededed; --soft: #bdbdbd; --mute: #8c8c8c; --white: #ffffff;
  --ok: #6fcf97; --bad: #f08a7e; --accent: #8eb0e6; --accent-hover: #a3c0ec; --accent-ink: #10203a;
  --pin: #303030; --pin-ink: #f2f2f2; --pin-ring: rgba(255,255,255,.55); --pin-halo: rgba(255,255,255,.22);
  --glass: rgba(31,31,31,.9); --inkline: #d4d4d4; --inkline2: #b5b5b5; --tip: #303030; --tip-ink: #f2f2f2;
}
* { box-sizing: border-box; }
html { font-size: clamp(14px, .45vw + 8px, 18px); scrollbar-gutter: stable; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.55; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; overflow-x: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { display: block; max-width: 100%; }
::selection { background: #1c1c1c; color: #fff; }
.icw { display: inline-flex; flex: none; }
.ic { display: block; }

/* ---------- sidebar ---------- */
.top { position: fixed; inset: 0 auto 0 0; width: var(--side); border-right: 1px solid var(--line); padding: calc(var(--gut) - 8px) 12px calc(var(--gut) - 8px); z-index: 20; background: var(--bg); }
nav { display: flex; flex-direction: column; gap: 2px; height: 100%; }
nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; color: var(--mute); text-decoration: none; font-weight: 400; font-size: .93rem; white-space: nowrap; transition: background .15s ease, color .15s ease; }
nav a.on { background: var(--raise); color: var(--white); font-weight: 500; }
nav a.sub { white-space: nowrap; }

@media (hover: hover) and (pointer: fine) { nav a:not(.on):hover { background: var(--panel); color: var(--ink); } }

main { margin-left: var(--side); padding: var(--gut); }

.view { animation: fade .2s ease both; }
h1 { font-size: clamp(1.8rem, 2.4vw, 2.4rem); font-weight: 600; line-height: 1.1; letter-spacing: -.025em; color: var(--white); margin: 0 0 8px; }
h2 { font-size: .95rem; letter-spacing: -.005em; font-weight: 600; color: var(--ink); margin: 0 0 12px; }
.lead { color: var(--mute); font-size: 1.05rem; max-width: 62ch; margin: 0 0 28px; }
.muted, .note { color: var(--mute); }
.note { font-size: .92rem; margin: 6px 0 0; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 2.6rem; padding: 0 1.05rem; border-radius: 9px; border: 1px solid transparent;
  background: var(--panel); font-weight: 500; text-decoration: none; white-space: nowrap; transition: background .15s ease, border-color .15s ease, transform .12s var(--ease); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn .icw { display: none; }  /* icons only in the sidebar and on icon-only buttons */
.btn.ghost { background: transparent; border-color: transparent; color: var(--mute); }
.btn.big { height: 3rem; padding: 0 1.4rem; }
.btn.wide { width: 100%; }

.btn[disabled] { opacity: .4; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .btn:hover { background: var(--raise); } .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); } .btn.ghost:hover { color: var(--ink); background: var(--raise); } }
:is(.btn, .item, .check, .seg button, .pin, .choices button, .link, .iconbtn, nav a, .fig, .list button, .term, .opt, .page, .chip):focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #9a9a9a; }
.link { border: 0; background: none; padding: 0; color: var(--mute); font-size: .87rem; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .link:hover { color: var(--ink); } }
.iconbtn { width: 2.3rem; height: 2.3rem; flex: none; border-radius: 8px; border: 0; background: none; color: var(--mute); display: grid; place-items: center; text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .iconbtn:hover { background: var(--raise); color: var(--ink); } }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 22px; }
.actions.col { flex-direction: column; align-items: stretch; }
.titlerow + .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.titlerow + .actions > .btn { flex: 1; }

/* ---------- home: the picture library ---------- */
.duebar { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 8px; border-radius: var(--r); background: var(--panel); text-decoration: none; transition: background .15s ease; }
.duebar > .icw:last-child { margin-left: auto; color: var(--mute); }
@media (hover: hover) and (pointer: fine) { .duebar:hover { background: var(--raise); } }
.sec { margin: 30px 0 0; }
.sec:first-child { margin-top: 0; }
.figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(150px, 12vw, 230px), 1fr)); gap: 24px 16px; }
.fig { display: block; text-decoration: none; }
.fig .thumb { position: relative; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; transition: background .15s ease; }
.fig .thumb img { position: absolute; inset: 8%; width: 84%; height: 84%; object-fit: contain; }
.fig .cap { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0 0; font-size: .87rem; color: var(--soft); line-height: 1.35; }
.fig .cap .n { color: var(--mute); font-variant-numeric: tabular-nums; }
@media (hover: hover) and (pointer: fine) { .fig:hover .thumb { background: var(--panel); } .fig:hover .cap { color: var(--white); } }
.bar { height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; flex: 1; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .4s var(--ease); }

/* ---------- two panes ---------- */
.split { display: grid; grid-template-columns: clamp(330px, 24vw, 440px) minmax(0, 1fr); gap: var(--gut); align-items: start; }
.split > .left { min-width: 0; }
.pic { position: sticky; top: var(--gut); min-width: 0; height: var(--paneh); padding: var(--pad); border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.pic.flush { padding: 0; overflow: hidden; }
.hint3d { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); margin: 0; font-size: .82rem; color: var(--soft); background: var(--glass); padding: 3px 10px; border-radius: 6px; pointer-events: none; white-space: nowrap; z-index: 4; }
.titlerow { display: flex; align-items: center; gap: 8px; margin: -4px 0 24px -8px; }
h1.figname { font-size: 1.3rem; font-weight: 600; letter-spacing: -.015em; margin: 0; }
.runhead { display: flex; align-items: center; gap: 12px; margin: -6px 0 26px -8px; font-size: .87rem; color: var(--mute); font-variant-numeric: tabular-nums; }
.count { min-width: 3.2em; text-align: right; }
.clock { min-width: 2.8em; text-align: right; color: var(--soft); }
.clock.low { color: var(--bad); }
.where { color: var(--mute); font-size: .87rem; margin: 0 0 6px; }
.qa.swap > * { animation: enter .22s var(--ease) both; }
.qa.swap > :nth-child(2) { animation-delay: 25ms; } .qa.swap > :nth-child(3) { animation-delay: 50ms; }
h1.q { font-size: 1.5rem; font-weight: 600; line-height: 1.3; letter-spacing: -.015em; margin: 0 0 22px; text-wrap: pretty; }
.answer input { width: 100%; height: 3.2rem; padding: 0 14px; border-radius: 9px; border: 1px solid transparent; background: var(--panel); outline: none; font-size: 1.15rem; transition: background .15s ease, border-color .15s ease; }
.answer input:focus { background: var(--raise); }
.answer input.shake { animation: shake .28s ease; }
.answer input:disabled { opacity: 1; color: var(--bad); text-decoration: line-through 1.5px; }
.answer input.good:disabled { color: var(--ok); text-decoration: none; }
.fb > * { animation: enter .2s var(--ease) both; }
.verdict { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 20px 0 4px; font-size: 1rem; }
.verdict.ok { color: var(--ok); } .verdict.bad { color: var(--bad); }
.answerline { font-size: 1.2rem; font-weight: 500; color: var(--white); margin: 4px 0 6px; }
.yours { margin: 0; color: var(--mute); }
.yours span:not(.m):not(.x) { color: var(--soft); }
.hint { margin: 8px 0 0; color: var(--soft); font-size: .95rem; line-height: 1.45; }
.tip { margin: 6px 0 0; color: var(--mute); font-size: .93rem; }
.blanks { white-space: pre-wrap; font-size: 1.1rem; font-weight: 500; line-height: 1.5; letter-spacing: .12em; margin-top: 12px; word-break: break-word; }
.diff { letter-spacing: .02em; }
.diff .x { color: var(--bad); text-decoration: underline; text-underline-offset: 3px; }
.diff .m { color: var(--bad); }
.choices { display: grid; gap: 4px; }
.choices button { display: flex; gap: 14px; align-items: baseline; text-align: left; padding: 13px 14px; border: 0; border-radius: 9px; background: none; transition: background .15s ease; }
.choices .key { color: var(--mute); width: 1ch; }
.choices button:disabled { cursor: default; }
.choices button.ok, .choices button.ok .key { color: var(--ok); }
.choices button.bad, .choices button.bad .key { color: var(--bad); }
.choices button.picked { background: var(--raise); color: var(--white); font-weight: 500; }
@media (hover: hover) and (pointer: fine) { .choices button:hover:enabled { background: var(--panel); } }

/* ---------- picture board (fits the screen height, no grey bands) ---------- */
.board { width: 100%; display: flex; justify-content: center; align-items: center; }
.clip { position: relative; overflow: hidden; border-radius: var(--r); }
.clip.light, .paper.light { background: #fff; }  /* the drawn diagrams (cell, skin, bone tissue) have dark ink */
.frame { position: absolute; inset: 0; transform-origin: 0 0; transition: transform .5s var(--move); }
.frame > img { width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.frame svg.ov { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pin { position: absolute; transform: translate(-50%, -50%); width: 1.75rem; height: 1.75rem; border-radius: 50%; border: 0; padding: 0;
  background: var(--pin); color: var(--pin-ink); font: 600 .82rem var(--font); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--pin-ring), 0 1px 2px rgba(0,0,0,.3);
  transition: opacity .25s var(--ease), transform .25s var(--ease), width .2s var(--ease), height .2s var(--ease), background .2s ease, color .2s ease, box-shadow .2s ease; z-index: 2; }
.pin.dot { width: .85rem; height: .85rem; }
.pin.dim { opacity: .5; color: transparent; transform: translate(-50%, -50%) scale(.42); }  /* the other points shrink to small dots so the asked one stands out */
.pin.done { background: var(--pin-ink); color: var(--pin); box-shadow: 0 0 0 2px var(--pin); }
.pin.target { width: 2.1rem; height: 2.1rem; font-size: .95rem; z-index: 3; box-shadow: 0 0 0 2px var(--pin-ring), 0 0 0 6px var(--pin-halo); }
.pin.ok { background: #2e7d4f; color: #fff; }
.pin.bad { background: #c0392b; color: #fff; animation: shake .28s ease; }
.tag { position: absolute; z-index: 4; transform: translate(-50%, calc(-100% - 1.1rem)); padding: 5px 10px; border-radius: 7px; background: var(--tip); color: var(--tip-ink); box-shadow: 0 2px 8px rgba(0,0,0,.2);
  font-size: .85rem; font-weight: 500; white-space: nowrap; pointer-events: none; animation: tagin .22s var(--ease) both; }
.tag::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 8px; height: 8px; background: var(--tip); transform: translateX(-50%) rotate(45deg); }
.tag.left { transform: translate(-16px, calc(-100% - 1.1rem)); } .tag.left::after { left: 16px; }
.tag.right { transform: translate(calc(-100% + 16px), calc(-100% - 1.1rem)); } .tag.right::after { left: auto; right: 12px; transform: rotate(45deg); }
.tag.below { transform: translate(-50%, 1.1rem); } .tag.below::after { top: -4px; bottom: auto; }
.tag.left.below { transform: translate(-16px, 1.1rem); } .tag.right.below { transform: translate(calc(-100% + 16px), 1.1rem); }
.bracket { position: absolute; border: 2.5px solid var(--inkline); border-left: 0; width: 16px; border-radius: 0 6px 6px 0; pointer-events: none; }

/* ---------- name lists (study, 3D) ---------- */
.fieldhead { display: flex; justify-content: space-between; align-items: center; margin: 0 0 8px; }
.fieldhead label, .field > label { font-size: .85rem; color: var(--mute); font-weight: 400; }
.list { display: grid; border-top: 1px solid var(--line); }
.list button { display: grid; grid-template-columns: 1.8rem 1fr; text-align: left; padding: 8px 6px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--soft); transition: background .15s ease; }
.list .n { color: var(--mute); font-variant-numeric: tabular-nums; font-size: .85rem; padding-top: 1px; }
.list .t { font-weight: 400; transition: filter .2s ease; }

.list button.on { background: var(--panel); color: var(--white); }
.list.hide button:not(.on) .t { filter: blur(6px); }
@media (hover: hover) and (pointer: fine) { .list button:hover { background: var(--panel); } .list.hide button:hover .t { filter: none; } }

/* ---------- worksheet ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: -6px 0 18px; }
.toolbar .iconbtn { margin-left: -8px; }
.spacer { flex: 1; }
.paperwrap { display: flex; justify-content: flex-start; }
.paper { position: relative; color: var(--ink); border-radius: var(--r); box-sizing: content-box; padding: 16px 0; }
.paper > img { position: absolute; top: 16px; object-fit: contain; }
.paper svg.leaders { position: absolute; top: 16px; left: 0; pointer-events: none; overflow: visible; }
.leaders path { fill: none; stroke: var(--inkline2); stroke-width: 1.5; }
.leaders path.br { stroke: var(--inkline); stroke-width: 2; }
.leaders circle { fill: var(--inkline); }
.blank { position: absolute; display: grid; grid-template-columns: 1.4rem 1fr; align-items: end; gap: 6px; transform: translateY(calc(-100% + 16px + 4px)); padding: 0 10px; }
.blank.R { grid-template-columns: 1.4rem 1fr; }
.blank .num { font: 600 1rem var(--font); color: var(--mute); text-align: right; padding-bottom: 5px; }
.blank input { width: 100%; height: min(1.9rem, calc(var(--rowh, 40px) - 4px)); border: 0; border-bottom: 1.5px solid var(--line2); background: transparent; color: var(--ink); font-size: .95rem; padding: 0 2px; outline: none; border-radius: 0; }
.blank input:focus { border-bottom-color: var(--white); }
.blank.ok input { border-bottom-color: var(--ok); color: var(--ok); }
.blank.bad input { border-bottom-color: var(--bad); color: var(--bad); }

/* ---------- setup (Quiz, Practice Test, Print) ---------- */
.setup .left { position: sticky; top: var(--gut); }
.form { display: grid; gap: 24px; margin-bottom: 26px; }
.field { display: grid; gap: 8px; justify-items: start; }
.seg { display: inline-flex; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 7px; color: var(--mute); font-weight: 400; font-size: .92rem; transition: background .15s ease, color .15s ease; }
.seg button.on { background: var(--raise); color: var(--white); }
@media (hover: hover) and (pointer: fine) { .seg button:not(.on):hover { background: var(--panel); color: var(--ink); } }
.left > .field { margin-bottom: 20px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); column-gap: 28px; }
.check { display: flex; align-items: center; gap: 11px; padding: 11px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; color: var(--mute); transition: color .15s ease, background .15s ease; }
.check.on { color: var(--ink); }
.check .box { display: inline-flex; order: 3; margin-left: 10px; width: 18px; color: var(--white); }
.check .n { margin-left: auto; color: var(--mute); font-size: .85rem; font-variant-numeric: tabular-nums; }
.check { padding: 10px 10px; }
@media (hover: hover) and (pointer: fine) { .check:hover { background: var(--panel); } }

/* ---------- results ---------- */
.results .left { position: sticky; top: var(--gut); }
.big { font-size: 1.3rem; color: var(--mute); margin: 0 0 8px; }
.big b { font-size: 3.8rem; font-weight: 600; letter-spacing: -.04em; line-height: 1; color: var(--white); font-variant-numeric: tabular-nums; }
table.review { width: 100%; border-collapse: collapse; }
table.review b { font-weight: 500; }
table.review th { text-align: left; font-weight: 400; color: var(--mute); font-size: .85rem; padding: 0 12px 10px; border-bottom: 1px solid var(--line2); }
table.review td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.review td.mark { width: 2rem; color: var(--mute); }
table.review td .muted { font-size: .85rem; }

/* ---------- rows (3D list, print) ---------- */
.rows.two { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); column-gap: var(--gut); }
.item { display: grid; grid-template-columns: 1.4rem 1fr auto 1rem; gap: 14px; align-items: center; padding: 13px 10px; border-bottom: 1px solid var(--line); text-decoration: none; border-radius: 6px; transition: background .15s ease; }
.item .t { font-weight: 400; }
.item .n { color: var(--mute); font-size: .87rem; font-variant-numeric: tabular-nums; }
.item > .icw:first-child { color: var(--soft); }
.item > .icw:last-child { color: var(--mute); }
@media (hover: hover) and (pointer: fine) { .item:hover { background: var(--panel); } .item:hover > .icw:last-child { color: var(--ink); } }
.dlgroup { margin-bottom: 26px; }
.dlgroup h2 { margin-bottom: 6px; }

/* ---------- 3D ---------- */
.stage3d { position: relative; width: 100%; height: 100%; min-height: 420px; overflow: hidden; }
.stage3d canvas { display: block; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { height: 2rem; padding: 0 12px; border-radius: 8px; background: var(--glass); border: 0; font-size: .85rem; color: var(--soft); transition: background .15s ease; }
.chip.on { background: var(--raise); color: var(--white); }
@media (hover: hover) and (pointer: fine) { .chip:not(.on):hover { background: var(--raise); } }
.pin3d { position: absolute; left: 0; top: 0; width: 25px; height: 25px; margin: -12.5px 0 0 -12.5px; border-radius: 50%; border: 0; padding: 0;
  background: var(--pin); color: var(--pin-ink); font: 600 12px var(--font); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--pin-ring), 0 1px 2px rgba(0,0,0,.3);
  transition: opacity .25s var(--ease), background .2s ease, box-shadow .2s ease; will-change: transform; }
.pin3d.hidden { opacity: .2; }
.pin3d.target { opacity: 1 !important; z-index: 4; box-shadow: 0 0 0 2px var(--pin-ring), 0 0 0 6px var(--pin-halo); }
.pin3d.dim { opacity: .3; }
.pin3d.ok { background: #2e7d4f; } .pin3d.bad { background: #c0392b; }
.pin3d .t { position: absolute; left: 28px; top: 50%; transform: translateY(-50%); white-space: nowrap; padding: 4px 9px; border-radius: 6px;
  background: var(--tip); color: var(--tip-ink); box-shadow: 0 2px 8px rgba(0,0,0,.2); font-weight: 500; font-size: 12.5px; pointer-events: none; animation: fade .15s ease both; }
.bonename { position: absolute; bottom: 44px; left: 50%; transform: translateX(-50%); padding: 7px 13px; border-radius: 8px; background: var(--tip); color: var(--tip-ink); box-shadow: 0 2px 8px rgba(0,0,0,.18);
  border: 0; font-weight: 500; animation: fade .15s ease both; z-index: 5; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; }
.loading::before { content: ""; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line2); border-top-color: var(--ink); animation: spin .8s linear infinite; }
.split > .left > .field { margin-bottom: 18px; }

/* ---------- terms ---------- */
.searchwrap { position: relative; flex: 1; min-width: 200px; display: flex; align-items: center; }
.searchwrap .icw { position: absolute; left: 13px; color: var(--mute); pointer-events: none; }
.search { width: 100%; height: 2.6rem; padding: 0 14px 0 38px; border-radius: 9px; border: 0; background: var(--panel); outline: none; }
.search:focus { border-color: #7a7a7a; }
select { height: 2.6rem; padding: 0 12px; border-radius: 9px; border: 0; background: var(--panel); }
.termsview .toolbar { position: sticky; top: 0; z-index: 3; background: var(--bg); padding: var(--gut) 0 12px; margin-top: calc(-1 * var(--gut)); }
.terms { border-top: 1px solid var(--line); }
.term { padding: 14px 10px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 6px; transition: background .15s ease; }
.term.on { background: var(--panel); }
@media (hover: hover) and (pointer: fine) { .term:hover { background: var(--panel); } }
.term h3 { font-size: 1rem; font-weight: 500; margin: 0 0 3px; transition: filter .2s ease; }
.term p { margin: 0; color: var(--mute); font-size: .93rem; }
.termsview .toolbar { flex-wrap: wrap; }
.termsview .searchwrap { flex: 1 1 100%; }
.termsview .toolbar select { flex: 1; }
.terms { border-top: 0; }
.term { padding: 12px 12px; border-bottom: 0; }
.term h3 { font-size: .98rem; font-weight: 500; color: var(--ink); }
.term.on h3 { color: var(--white); }
.where .link { font-size: .82rem; }
.where .link.on { color: var(--white); text-decoration: underline; text-underline-offset: 3px; }

.terms.cover h3 { filter: blur(7px); }
@media (hover: hover) and (pointer: fine) { .terms.cover .term:hover h3 { filter: none; } }



/* ---------- print ---------- */
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(150px, 11vw, 220px), 1fr)); gap: 22px 16px; }
.page { border: 0; padding: 8px; border-radius: 12px; transition: background .15s ease; background: none; text-align: left; color: var(--mute); font-size: .85rem; border-radius: 4px; }
.page img { width: 100%; aspect-ratio: 8.5 / 11; object-fit: cover; border-radius: 4px; background: #fff; margin-bottom: 8px; transition: opacity .15s ease; }
@media (hover: hover) and (pointer: fine) { .page:hover { background: var(--panel); color: var(--ink); } }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.86); display: grid; place-items: center; padding: 24px; animation: fade .2s ease both; cursor: zoom-out; }
.lightbox img { max-height: 94vh; width: auto; border-radius: 4px; animation: zoomIn .22s var(--ease) both; }

/* ---------- Chapter 1 ---------- */
.concept.noviz { grid-template-columns: minmax(0, 640px); }
.concept.noviz > .pic { display: none; }
.concept .qa h1.q { font-size: 1.35rem; }
.why { color: var(--soft); margin: 10px 0 0; }
dl.lesson { margin: 0; }
dl.lesson dt { color: var(--mute); font-size: .85rem; font-weight: 400; margin-top: 16px; }
dl.lesson dd { margin: 4px 0 0; color: var(--soft); }
#viewer { position: relative; width: 100%; height: 100%; overflow: hidden; }
#viewer canvas, #viewer .overlay { position: absolute; inset: 0; }
#viewer .label { font: 500 12.5px/1.3 var(--font); background: var(--tip); color: var(--tip-ink); box-shadow: 0 2px 8px rgba(0,0,0,.18); border-radius: 6px; padding: 3px 8px 3px 11px; white-space: nowrap; pointer-events: none; position: relative; }
#viewer .label::before { content: ""; position: absolute; left: -3px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--ink); }
#viewer .label.right { padding: 2px 9px 2px 6px; } #viewer .label.right::before { left: auto; right: -3px; }
#viewer .label.mark { background: none; color: var(--mute); font-weight: 600; font-size: 13px; padding: 0; }
#viewer .label.mark::before, #viewer .label.cell::before { display: none; }
#viewer .label.cell { padding: 1px 5px; font-size: 11px; white-space: pre; text-align: center; }
#viewer:not(.revealed) .secret, #viewer.side .lr { visibility: hidden; }

/* ---------- Practice Test: question on the left, its picture on the right ---------- */
.testbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; margin: calc(-1 * var(--gut)) 0 0; padding: 14px 0; background: var(--bg); font-size: .9rem; color: var(--mute); border-bottom: 1px solid var(--line); }
.testbar .iconbtn { margin-left: -8px; }
.paperhead { padding: 40px 0 18px; }
.paperhead .sub { margin-bottom: 0; }
.qblock { display: grid; grid-template-columns: clamp(330px, 24vw, 440px) minmax(0, 1fr); gap: 0 var(--gut); align-items: start; padding: 34px 0; border-top: 1px solid var(--line); }
.qblock .qbody { grid-column: 1; } .qnum { margin: 0 0 6px; color: var(--mute); font-size: .85rem; }
/* before a question scrolls into view it sits toward the middle with no picture; then it slides left and the picture comes in */
@media (max-width: 900px) { .qblock { grid-template-columns: minmax(0, 1fr); } .qblock .qpic { grid-column: 1; margin-top: 16px; } }
.qn { font-size: 1.1rem; font-weight: 600; line-height: 1.6; color: var(--mute); font-variant-numeric: tabular-nums; }
.qtext { margin: 0 0 16px; font-size: 1.2rem; font-weight: 600; line-height: 1.4; color: var(--white); }
.qpic { --pad: 0px; --paneh: 70dvh; display: flex; justify-content: center; border-radius: 12px; }
.line input { width: 100%; height: 2.8rem; border: 0; border-bottom: 1px solid var(--line2); background: transparent; color: var(--ink); font-size: 1.1rem; padding: 0 2px; outline: none; border-radius: 0; transition: border-color .15s ease; }
.line input:focus { border-bottom-color: var(--white); }
.qblock.ok .line input { border-bottom-color: var(--ok); color: var(--ok); }
.qblock.bad .line input { border-bottom-color: var(--bad); color: var(--bad); }
.qblock.bad .line input:not(:placeholder-shown) { text-decoration: line-through; }
.opts { display: grid; gap: 4px; }
.opt { display: flex; gap: 14px; align-items: baseline; text-align: left; padding: 12px 14px; border: 0; border-radius: 9px; background: none; transition: background .15s ease; }
.opt .key { color: var(--mute); width: 1ch; }
.opt.picked { background: var(--raise); color: var(--white); font-weight: 500; }
.opt.right, .opt.right .key { color: var(--ok); }
@media (hover: hover) and (pointer: fine) { .opt:not(.picked):hover:enabled { background: var(--panel); } }
.qfix:empty { display: none; }
.qfix .verdict { margin-top: 14px; }
/* ---------- motion ---------- */
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes zoomIn { from { opacity: 0; transform: scale(.97); } }
@keyframes shake { 17%, 50%, 83% { translate: -4px 0; } 33%, 67% { translate: 4px 0; } }
@keyframes ring { 0% { box-shadow: 0 1px 3px rgba(0,0,0,.35), 0 0 0 0 rgba(22,163,74,.55); } 100% { box-shadow: 0 1px 3px rgba(0,0,0,.35), 0 0 0 14px rgba(22,163,74,0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .stagger > *, .fb > *, .qa.swap > * { animation-name: fade !important; }
  .pin.bad, .answer input.shake, .pin.target, .pin3d.target { animation: none !important; }
  .frame { transition: none; }
}

/* ---------- narrow screens (phone layout gets its own pass later) ---------- */
@media (max-width: 1000px) {
  :root { --side: 64px; --paneh: 62vh; }
  nav a { justify-content: center; padding: 10px; font-size: 0; gap: 0; }
  .split { grid-template-columns: 1fr; }
  .pic { position: static; order: -1; }
  .setup .left, .results .left { position: static; }
}

/* hover and selection: a lighter background, nothing else */
.list button, .check, .item, .term { border-radius: 8px; transition: background .15s ease, color .15s ease; }
@media (hover: hover) and (pointer: fine) { nav a:not(.on):hover, .list button:hover, .item:hover, .term:hover, .check:hover { background: var(--panel); } }
.list button.on, .term.on { background: var(--raise); }

.strong { color: var(--white); font-weight: 500; }
.sub { color: var(--mute); font-size: 1.02rem; margin: 0 0 34px; max-width: 60ch; }

/* start screens (Quiz, Practice Test, Chapter 1): title, a settings list with the name left and the choice right, then Start */
.start { max-width: 1000px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 520px; gap: 64px; align-items: start; }
.start.noart { grid-template-columns: minmax(0, 520px); justify-content: center; }
.startart { width: 100%; height: 360px; object-fit: contain; user-select: none; }  /* one of the bone renders, for colour */
@media (max-width: 1100px) { .start { grid-template-columns: minmax(0, 480px); justify-content: center; } .startart { display: none; } }
.start h1 { margin: 0 0 18px; }
.start .form { display: block; margin: 0; }
.start .form .field { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 58px; border-top: 1px solid var(--line); }
.start .form .field:last-child { border-bottom: 1px solid var(--line); }
.start .form .field > label { font-size: .95rem; color: var(--ink); }
.rowbtn { display: flex; align-items: center; gap: 6px; margin-right: -8px; padding: 8px; border: 0; border-radius: 8px; background: none; color: var(--mute); font-size: .92rem; transition: background .15s ease, color .15s ease; }
.rowbtn svg { transition: transform .2s ease; }
.rowbtn[aria-expanded="true"] svg { transform: rotate(90deg); }
@media (hover: hover) and (pointer: fine) { .rowbtn:hover { background: var(--panel); color: var(--ink); } }
.start .topics { margin: 10px 0 0; animation: enter .25s var(--ease) both; }
.start .topics .fieldhead { justify-content: flex-end; } .start .topics .fieldhead label { display: none; }
.start .checks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.startcol > .btn { width: 100%; min-width: 0; margin-top: 28px; }
.sheetbar { width: 100%; flex-wrap: nowrap; }
.sheetbar h1.figname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov { position: absolute; inset: 0; pointer-events: none; } .ov svg { width: 100%; height: 100%; display: block; }
.paper > .ov { inset: auto; }

/* fixed selection box: the selected name and its hint, so the list below never moves */
/* terms preview: the pictures a term appears in sit above it */
.preview { flex-direction: column; gap: 12px; justify-content: flex-start; }
.preview .board { flex: 1; min-height: 0; --paneh: calc(100dvh - 2 * var(--gut) - 52px); }
.views { display: flex; gap: 6px; width: 100%; align-items: center; }
.viewscroll { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1; mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
.views .chip { flex: none; }
.views .open { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.views .chip { background: transparent; }
.views .chip.on { background: var(--raise); color: var(--white); }
.seg.wait, .wait .seg { opacity: .4; pointer-events: none; }
.blank input::placeholder { color: #2f8a46; opacity: 1; }
.chip:disabled { opacity: .35; pointer-events: none; }
.tag { white-space: normal; width: max-content; max-width: min(15rem, 70%); text-align: center; }
.pin3d.flip .t { left: auto; right: 28px; }
.pin3d.hidden { pointer-events: none !important; }
.term { display: block; width: 100%; text-align: left; border: 0; background: none; color: inherit; }
.runhead:not(:has(.iconbtn)) { margin-left: 0; }
.paper { flex: none; }
nav .foot { margin-top: auto; display: flex; gap: 4px; align-items: center; } nav .foot a { flex: 1; }
nav a.sub { margin: 0; max-width: none; font-size: .93rem; }  /* Chapter 1 sits at the bottom; also undoes the page-subtitle .sub style it shares a name with */

/* shared left edge: row text lines up with the headings; hover backgrounds extend 12px outside */
.list button, .choices button, .opt, .term, .item, .check { padding-left: 12px; padding-right: 12px; margin-left: -12px; margin-right: -12px; }
@keyframes tagin { from { opacity: 0; scale: .96; } }
.tag.card { text-align: left; max-width: min(17rem, 80%); padding: 8px 12px; line-height: 1.35; }
.taghint { display: block; margin-top: 3px; font-weight: 400; font-size: .82rem; color: var(--mute); }
/* worksheet: the point and line for the blank you are on grow and darken */
.leaders circle { transition: r .2s var(--ease), fill .2s ease; }
.leaders path { transition: stroke .2s ease, stroke-width .2s ease; }
.leaders circle.on { r: 6.5px; fill: var(--white); }
.leaders path.on { stroke: var(--white); stroke-width: 2.2; }
.start .seg { flex-wrap: nowrap; }
.pin3d .t.card { white-space: normal; width: max-content; max-width: 16rem; padding: 7px 11px; line-height: 1.35; }
/* where the other points can be clicked, a small dot grows a little under the pointer */
@media (hover: hover) and (pointer: fine) { .pickable .pin.dim:hover { opacity: .95; transform: translate(-50%, -50%) scale(.75); cursor: pointer; } }
/* 3D page: the modes float on the picture; in Name and Find a progress line with the count sits under the title */
.stagemodes { position: absolute; top: 12px; left: 12px; z-index: 5; padding: 3px; border-radius: 10px; background: var(--glass); }
.stagetools { position: absolute; top: 12px; right: 12px; z-index: 5; display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 10px; background: var(--glass); }
.stagetools .link { padding: 7px 12px; border-radius: 7px; font-size: .92rem; color: var(--mute); }
.stagetools .iconbtn { width: 2.2rem; height: 2.2rem; }
@media (hover: hover) and (pointer: fine) { .stagetools .link:hover, .stagetools .iconbtn:hover { background: var(--panel); color: var(--ink); } }
.progrow { display: flex; align-items: center; gap: 12px; margin: 0 0 28px; } .progrow[hidden] { display: none; }
.progrow .bar { height: 4px; } .progrow .count { color: var(--mute); font-size: .87rem; font-variant-numeric: tabular-nums; }
/* result line: verdict left, Next right, details below in quieter text */
.qa > .fb:has(.resultrow) .answerline { margin: 0 0 2px; font-size: 1.2rem; }
.qa > .fb:has(.resultrow) > p { margin: 0 0 4px; }
.resultrow { display: flex; align-items: center; gap: 16px; margin-top: 18px; }
.resultrow .verdict { margin: 0; font-size: .95rem; }
.split > .left:has(.qa) { min-height: var(--paneh); display: flex; flex-direction: column; }
.split > .left > div:has(> .qa) { flex: 1; display: flex; flex-direction: column; }  /* 3D quiz body */
.qa { flex: 1; display: flex; flex-direction: column; }
.qa > .fb:has(.resultrow), .qa > .actions:not(:empty) { margin-top: auto; padding-top: 24px; }  /* Check and the result always sit at the bottom */
.qa > .fb:has(.resultrow) + .actions { display: none; }
.actions:empty { display: none; }
.choices button { align-items: center; }
.choices button .icw { margin-left: auto; }
.choices button.bad { background: var(--raise); }
.choices button:disabled:not(.ok):not(.bad) { color: var(--mute); }
/* study page: quiet action buttons with small icons, list without row lines */
.titlerow + .actions { gap: 2px; margin: 0 -12px 20px !important; flex-wrap: nowrap; }
.titlerow + .actions > .btn { flex: none; background: none; padding: 0 12px; height: 2.4rem; font-weight: 400; color: var(--soft); }
.titlerow + .actions .icw { display: inline-flex; color: var(--mute); }
@media (hover: hover) and (pointer: fine) { .titlerow + .actions > .btn:hover { background: var(--panel); color: var(--ink); } }
.list { border-top: 0; } .list button { border-bottom: 0; }
/* 3D page: the title row lines up with the controls on the picture; the list starts close under it */
.lab3d .titlerow { margin-bottom: 10px; }
.lab3d .pic { margin-top: -20px; top: calc(var(--gut) - 20px); height: calc(var(--paneh) + 20px); }  /* picture starts 20px higher so its controls sit on the title line */
/* 3D page: a divider line halfway between the left column and the model */
.lab3d.split { column-gap: calc(var(--gut) / 2); }
.lab3d .pic { border-left: 1px solid var(--line); border-radius: 0; padding-left: calc(var(--gut) / 2); }
/* 3D Find: the points you are not asked about are small dots, not big blank discs */
.pin3d:empty:not(.target):not(.ok):not(.bad) { width: 12px; height: 12px; margin: -6px 0 0 -6px; box-shadow: 0 0 0 1.5px var(--pin-ring); }
/* paper test: lecture questions have no picture, so they use the whole row; Lecture / Lab headings when both parts are on */
.qblock.text .qbody { grid-column: 1 / -1; max-width: 640px; }
.parthead { margin: 40px 0 0; padding-bottom: 10px; font-size: 1.25rem; }
