/* FractureLink: the lightbox. Tokens follow docs/DESIGN_PLAN.md section 2; DESIGN.md has the rules.
   Images (radiographs, CT, the 3D stage, thumbnails) sit on --film in both modes; only the page,
   panels and text change between light and dark. No colour literal appears outside this block
   except inside SVG data. */

:root {
  color-scheme: light dark;

  /* colour, light (section 2.2) */
  --bg: #E4E8EB;            /* page surface */
  --surface: #EEF1F3;       /* panels, sheets, cards, bars */
  --surface-2: #F6F8F9;     /* inputs, selected rows, hover */
  --text: #1D252C;
  --text-2: #56626D;        /* secondary text, labels */
  --hair: #C3CAD0;          /* hairline rules */
  --hair-strong: #77828C;   /* control borders: 3:1 against every background they sit on (D14) */
  --accent: #2B5CA6;        /* the one interactive colour */
  --accent-hover: #234C8A;  /* a filled accent button under the pointer */
  --accent-wash: #D8E2F2;   /* selected option, active tab */
  --on-accent: #FFFFFF;     /* text on a filled accent button */
  --film: #10161C;          /* image wells, CT, 3D stage */
  --ok: #256B44;
  --bad: #A63D32;
  --review: #7A560E;        /* needs review */
  --focus: #2B5CA6;
  --scrim: rgba(16, 22, 28, .55);   /* behind a dialog */

  /* colour on film, the same in both modes */
  --film-deep: #0A0F14;     /* CT pane ground (matches the canvas fill in ct.js) */
  --film-line: #1E2A35;     /* rule between a film and its caption */
  --film-hair: #7A858E;     /* control borders on film: 3:1 against film and the selected fill (D14) */
  --film-sel: #1F3A5F;      /* selected control or label on film */
  --film-scrim: rgba(10, 14, 18, .97);  /* full-screen viewer */
  --veil: rgba(16, 22, 28, .9);         /* labels and hints over an image */
  --veil-soft: rgba(16, 22, 28, .78);   /* controls over the 3D stage */
  --on-film: #C9D1D8;
  --on-film-dim: #8B97A2;
  --on-film-hi: #F2F4F5;    /* hover and selected text on film, the wordmark */
  --on-film-accent: #86A9E6;  /* accent and focus ring on film */
  --on-film-review: #E6C77D;  /* needs-review mark on film */
  --bone: #E6DCC6;          /* bone in 3D and diagrams */
  --diagram: #FFFFFF;       /* the Learn diagrams are drawn on white */
  --viewer: #000000;        /* the full-screen film viewer */

  /* type (section 2.3): the system stack, HIG text styles; line heights are ratios so they scale */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;   /* slice counters only */
  --fs-caption2: .6875rem;  /* 11: tab labels, bone map counts */
  --fs-caption1: .75rem;    /* 12: bone map labels */
  --fs-caption: .8125rem;  --lh-caption: 1.385;   /* 13 / 18 */
  --fs-sub: .9375rem;      --lh-sub: 1.333;       /* 15 / 20 */
  --fs-body: 1.0625rem;    --lh-body: 1.412;      /* 17 / 24 */
                           --lh-head: 1.294;      /* 17 / 22 */
  --fs-title3: 1.25rem;    --lh-title3: 1.25;     /* 20 / 25 */
  --fs-title2: 1.5rem;     --lh-title2: 1.208;    /* 24 / 29 */
  --fs-title1: 1.875rem;   --lh-title1: 1.2;      /* 30 / 36 */
  --t-caption: 400 var(--fs-caption)/var(--lh-caption) var(--font);
  --t-footnote: 500 var(--fs-caption)/var(--lh-caption) var(--font);
  --t-sub: 400 var(--fs-sub)/var(--lh-sub) var(--font);
  --t-body: 400 var(--fs-body)/var(--lh-body) var(--font);
  --t-head: 600 var(--fs-body)/var(--lh-head) var(--font);
  --t-title3: 600 var(--fs-title3)/var(--lh-title3) var(--font);
  --t-title2: 600 var(--fs-title2)/var(--lh-title2) var(--font);
  --t-title1: 700 var(--fs-title1)/var(--lh-title1) var(--font);

  /* spacing, radius, elevation, targets (section 2.4) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --gap: 24px;              /* page gutter: 16 on phones */
  --measure: 68ch;          /* reading column */
  --r-small: 4px;           /* labels on film, swatches, key caps */
  --r-control: 8px;         /* buttons, inputs, segmented controls, chips, thumbnails */
  --r-card: 12px;           /* cards, image wells, panels */
  --r-sheet: 16px;          /* bottom sheets, top corners only */
  --shadow-sheet: 0 -1px 0 var(--hair), 0 -8px 24px rgba(0, 0, 0, .08);
  --hit: 40px;              /* 44 on touch */
  --bar: 52px;              /* top bar; 0 on phones, which have the tab bar instead */
  --tabbar: 0px;
  --actionbar: 0px;         /* the fixed action bar on phone case pages */
  --panel-w: 380px;

  font-family: var(--font);
  font-size: 16px;          /* the rem base; body text is var(--t-body) */
  color: var(--text);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
:root[data-theme="light"] { color-scheme: light; }
/* dark: the same values twice, for the stored override and for the system setting */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161C22; --surface: #1D252C; --surface-2: #242E37; --text: #E4E8EB; --text-2: #A9B2BA;
  --hair: #2E3840; --hair-strong: #757F88; --accent: #86A9E6; --accent-hover: #A8C1EC; --accent-wash: #233650;
  --on-accent: #0F1620; --film: #0B1014; --ok: #5FB07F; --bad: #E07B70; --review: #D1A143; --focus: #86A9E6;
  --scrim: rgba(0, 0, 0, .6); --shadow-sheet: 0 -1px 0 var(--hair), 0 -8px 24px rgba(0, 0, 0, .4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #161C22; --surface: #1D252C; --surface-2: #242E37; --text: #E4E8EB; --text-2: #A9B2BA;
    --hair: #2E3840; --hair-strong: #757F88; --accent: #86A9E6; --accent-hover: #A8C1EC; --accent-wash: #233650;
    --on-accent: #0F1620; --film: #0B1014; --ok: #5FB07F; --bad: #E07B70; --review: #D1A143; --focus: #86A9E6;
    --scrim: rgba(0, 0, 0, .6); --shadow-sheet: 0 -1px 0 var(--hair), 0 -8px 24px rgba(0, 0, 0, .4);
  }
}
@media (pointer: coarse) { :root { --hit: 44px; } }
@media (max-width: 767px) { :root { --gap: 16px; --fs-title1: 1.5rem; --lh-title1: 1.208; --bar: 0px; --tabbar: calc(56px + env(safe-area-inset-bottom)); --actionbar: calc(64px + env(safe-area-inset-bottom)); } }
* { box-sizing: border-box; }
html { background: var(--bg); scroll-padding-top: calc(var(--bar) + 12px); scroll-padding-bottom: calc(var(--tabbar) + 6rem); }
body { margin: 0; background: var(--bg); color: var(--text); font: var(--t-body); }
img { max-width: 100%; }

/* focus is always visible; motion only where it means something */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.film :focus-visible, .viewer3d :focus-visible, .xray-open:focus-visible, .ct :focus-visible, .lightbox :focus-visible,
.reveal .reveal-tools :focus-visible, .reveal .drawer-toggle:focus-visible, .thumb:focus-visible .film { outline-color: var(--on-film-accent); }
.topnav a:focus-visible, .brand:focus-visible { outline-offset: -2px; }
.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; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0 0 var(--s2); }
h1 { font: var(--t-title1); }
h2 { font: var(--t-title2); }
h3 { font: var(--t-title3); }
h4 { font: var(--t-head); }
p { margin: var(--s2) 0; }
.muted { color: var(--text-2); }
.small { font-size: var(--fs-caption); }
.big { font-size: var(--fs-title3); font-weight: 600; }
.tight { margin: var(--s1) 0 var(--s3); padding-left: var(--s4); }
.tight li { margin: var(--s1) 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: var(--s2) var(--s3); z-index: 100; }
.skip:focus { left: 8px; }

/* controls */
button, .btn {
  font: var(--t-head); color: var(--text); background: var(--surface-2);
  border: 1px solid var(--hair-strong); border-radius: var(--r-control); padding: var(--s2) var(--s3); cursor: pointer;
  min-height: var(--hit); display: inline-flex; align-items: center; gap: var(--s2); text-decoration: none;
}
button:hover:not(:disabled), .btn:hover { border-color: var(--text); text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); min-height: 44px; }
button.primary:hover:not(:disabled), .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:disabled { color: var(--text-2); border-color: var(--hair); background: transparent; cursor: not-allowed; }
button.primary:disabled { background: transparent; border: 1px dashed var(--hair-strong); color: var(--text-2); }
button.toggle.on { border-color: var(--accent); background: var(--accent-wash); color: var(--text); }
select { font: var(--t-sub); color: var(--text); background: var(--surface-2); border: 1px solid var(--hair-strong); border-radius: var(--r-control); padding: var(--s2) var(--s2); min-height: var(--hit); max-width: 100%; text-overflow: ellipsis; }
kbd { font: var(--t-footnote); border: 1px solid var(--hair-strong); border-bottom-width: 2px; border-radius: var(--r-small); padding: 0 var(--s1); background: var(--surface-2); color: var(--text); }

/* app shell (DESIGN_PLAN 2.5): a slim top bar from 768 px, a bottom tab bar on phones; the footer links
   About and Privacy at every width */
.icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.topbar { display: flex; align-items: center; gap: var(--s5); height: var(--bar); padding: 0 var(--gap); background: var(--surface); border-bottom: 1px solid var(--hair); position: sticky; top: 0; z-index: 30; }
.brand { font: var(--t-head); color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.topnav { display: flex; align-self: stretch; gap: var(--s5); }
.topnav a { display: flex; align-items: center; padding-top: 2px; border-bottom: 2px solid transparent; color: var(--text-2); font: 500 var(--fs-sub)/var(--lh-sub) var(--font); white-space: nowrap; }
.topnav a:hover { color: var(--text); text-decoration: none; }
.topnav a.active { color: var(--accent); border-bottom-color: var(--accent); }
.topsearch { position: relative; display: flex; align-items: center; margin-left: auto; }
.topsearch .icon { position: absolute; left: var(--s2); width: 18px; height: 18px; color: var(--text-2); pointer-events: none; }
.topsearch input { width: 240px; height: 36px; padding: 0 var(--s3) 0 var(--s6); font: var(--t-sub); color: var(--text); background: var(--surface-2); border: 1px solid var(--hair-strong); border-radius: var(--r-control); }
.topsearch input:focus { width: 360px; }
.topsearch input::placeholder, .search-field::placeholder { color: var(--text-2); opacity: 1; }
.more-menu { position: relative; }
.more-menu > summary { list-style: none; display: flex; align-items: center; justify-content: center; width: var(--hit); min-height: var(--hit); padding: 0; border-radius: var(--r-control); color: var(--text-2); }
.more-menu > summary::-webkit-details-marker { display: none; }
.more-menu > summary:hover, .more-menu[open] > summary { color: var(--text); background: var(--surface-2); }
.more-menu .menu { position: absolute; right: 0; top: calc(100% + var(--s1)); z-index: 31; display: grid; min-width: 160px; padding: var(--s1); background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-card); }
.more-menu .menu a { display: flex; align-items: center; min-height: var(--hit); padding: 0 var(--s3); border-radius: var(--r-control); color: var(--text); }
.more-menu .menu a:hover, .more-menu .menu a.active { background: var(--surface-2); text-decoration: none; }
.tabbar { display: none; }
.site-foot { display: flex; justify-content: center; gap: var(--s5); max-width: 1640px; margin: 0 auto; padding: var(--s4) var(--gap) var(--s6); border-top: 1px solid var(--hair); font-size: var(--fs-caption); }
.site-foot a { display: inline-flex; align-items: center; min-height: var(--hit); color: var(--text-2); }
/* a link or row to a part this site does not show (site.js); the footer's line naming the site */
[data-off] { display: none !important; }
.site-foot { flex-wrap: wrap; }
.site-note { flex-basis: 100%; text-align: center; color: var(--text-2); }
@media (max-width: 767px) {
  .topbar { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: var(--tabbar);
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); background: var(--surface); border-top: 1px solid var(--hair); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 44px; color: var(--text-2); font: 500 var(--fs-caption2)/1.2 var(--font); }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.active { color: var(--accent); }
  .tabbar a.active .arc { stroke-width: 3.5; }
  .tabbar a:focus-visible { outline-offset: -4px; }
  body { padding-bottom: var(--tabbar); }
}
main { padding: var(--gap) var(--gap) var(--s7); max-width: 1640px; margin: 0 auto; }

/* status marks: a dot and a word, never a pill */
.badge { display: inline-flex; align-items: center; gap: var(--s1); font: var(--t-footnote); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--hair-strong); }
.badge.verified { color: var(--ok); } .badge.verified::before { background: var(--ok); }
.badge.needs_review { color: var(--review); } .badge.needs_review::before { background: var(--review); }
.badge.done { color: var(--accent); } .badge.done::before { background: var(--accent); }
.badge.draft::before { background: var(--text-2); }

/* notices: a rule, not a box */
.notice { border-left: 3px solid var(--ok); padding: var(--s2) 0 var(--s2) var(--s4); margin: 0 0 var(--s4); max-width: 80ch; }
.notice.warn { border-left-color: var(--review); }
.error { border-left: 3px solid var(--bad); padding: var(--s2) var(--s4); }

/* page furniture */
.page-head { display: flex; align-items: baseline; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s2); }
.lede { font-size: var(--fs-body); max-width: var(--measure); color: var(--text); margin: 0 0 var(--s5); }
.crumbs { font-size: var(--fs-caption); color: var(--text-2); display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; margin-bottom: var(--s1); }
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { color: var(--hair-strong); }
.section { border-top: 1px solid var(--hair); padding-top: var(--s4); margin-top: var(--s5); }
.card { padding: var(--s4) 0; border-top: 1px solid var(--hair); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); column-gap: var(--s6); }
.card h2 a, .card h3 a { color: var(--text); }
.card h2 a:hover, .card h3 a:hover { color: var(--accent); }
.card .meta { color: var(--text-2); font-size: var(--fs-caption); margin-top: var(--s1); }
.row-actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; margin-top: var(--s2); }
table.list { width: 100%; border-collapse: collapse; font-size: var(--fs-sub); }
table.list th, table.list td { text-align: left; padding: var(--s2) var(--s2) var(--s2) 0; border-bottom: 1px solid var(--hair); vertical-align: top; }
table.list th { color: var(--text-2); font-weight: 500; font-size: var(--fs-caption); }
dl { margin: var(--s2) 0; } dt { font-weight: 600; margin-top: var(--s2); } dd { margin: 2px 0 0; }
details > summary { cursor: pointer; color: var(--accent); font-size: var(--fs-sub); }

/* case browser */
.browser-group { margin-top: var(--s6); }
.browser-group > h2 { font-size: var(--fs-title2); padding-bottom: var(--s2); border-bottom: 2px solid var(--text); margin-bottom: 0; }
.thumb { flex: none; width: clamp(128px, 10.5vw, 168px); scroll-snap-align: start; color: var(--text); }
.thumb:hover { text-decoration: none; }
.thumb .film { display: block; aspect-ratio: 4 / 5; background: var(--film); border-radius: var(--r-control); overflow: hidden; position: relative; }
.thumb .film img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .film .mark { position: absolute; top: 6px; right: 6px; font: var(--t-footnote); padding: 0 var(--s1); border-radius: var(--r-small); background: var(--veil); }
.thumb .film .mark.needs_review { color: var(--on-film-review); }
.thumb .film .mark.attempted { color: var(--on-film-accent); top: auto; bottom: 6px; }
.thumb:hover .cap span { text-decoration: underline; text-underline-offset: 3px; }
.thumb .cap { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-caption); margin-top: var(--s1); }

/* case workstation */
.case-head { display: flex; align-items: center; gap: var(--s4) var(--s5); flex-wrap: wrap; margin-bottom: var(--s3); }
.case-head h1 { font-size: var(--fs-title2); margin: 0; }
.case-head .grow { flex: 1; }
.stepper { display: flex; gap: 0; margin: 0 0 var(--s4); border-bottom: 1px solid var(--hair); overflow-x: auto; padding-top: var(--s1); }
.stepper .step { font: 500 var(--fs-sub)/var(--lh-sub) var(--font); color: var(--text-2); padding: var(--s2) var(--s4) var(--s2) 0; margin-right: var(--s5); border-bottom: 2px solid transparent; white-space: nowrap; background: none; border-top: 0; border-left: 0; border-right: 0; border-radius: 0; min-height: 0; cursor: default; }
.stepper .step .n { color: inherit; margin-right: var(--s2); }
.stepper .step.done { color: var(--text); cursor: pointer; }
.stepper .step:disabled { cursor: not-allowed; }
.stepper .step:focus-visible { outline-offset: -2px; }
.stepper .step.done:hover { color: var(--accent); }
.stepper .step.active { color: var(--text); border-bottom-color: var(--accent); }
.case-grid { display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-w); gap: var(--gap); align-items: start; }
.stage { min-width: 0; }
.side { background: var(--surface); border-left: 1px solid var(--hair); padding: var(--s4) var(--s4) var(--s5); position: sticky; top: calc(var(--bar) + 12px); max-height: calc(100vh - var(--bar) - 24px); overflow: auto; }
.side h2 { font-size: var(--fs-title3); margin-top: var(--s4); }
.side h2:first-child { margin-top: 0; }
.side h3 { font-size: var(--fs-sub); font-weight: 600; margin: var(--s4) 0 var(--s1); }
.side p, .side li, .side dd { font: var(--t-body); }
.side .small, .side .muted.small { font-size: var(--fs-caption); }
.side p.note, .side .note { font: var(--t-sub); color: var(--text); }
.side:has(> .side-foot) { padding-bottom: 0; }
.side .side-foot { position: sticky; bottom: 0; z-index: 2; background: var(--surface); padding: var(--s3) var(--s4) var(--s4); margin: var(--s2) calc(-1 * var(--s4)) 0; border-top: 1px solid var(--hair); }
.side .side-foot .small { margin-top: var(--s1); }
@media (max-width: 900px) {
  .case-grid { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; border-left: 0; border-top: 1px solid var(--hair); }
}
.toolbar { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; margin: 0 0 var(--s2); }

/* radiographs */
.xray-grid { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: var(--s3); align-items: start; }
@media (max-width: 1100px) { .xray-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }
@media (max-width: 700px) { .xray-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.xray-grid.compact { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.xray-fig { margin: 0; background: var(--film); border-radius: var(--r-card); overflow: hidden; position: relative; }
.xray-open { display: block; width: 100%; padding: 0; margin: 0; border: 0; border-radius: 0; background: none; min-height: 0; cursor: zoom-in; color: inherit; font: inherit; text-align: left; }
.xray-open:hover:not(:disabled) { border: 0; }
.xray-fig .imgwrap { position: relative; }
.xray-fig img { display: block; width: 100%; height: auto; }
.xray-fig svg.overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.xray-fig figcaption { font-size: var(--fs-caption); color: var(--on-film-dim); padding: var(--s1) var(--s2); background: var(--film); border-top: 1px solid var(--film-line); }
.lightbox { position: fixed; inset: 0; background: var(--film-scrim); z-index: 50; display: flex; flex-direction: column; color: var(--on-film); }
.lightbox .lb-bar { display: flex; gap: var(--s2); align-items: center; padding: var(--s2) var(--s4); }
.lightbox .lb-bar button { background: transparent; color: var(--on-film); border-color: var(--film-hair); white-space: nowrap; flex: none; }
.lightbox .lb-bar .grow { flex: 1; }
.lightbox .lb-view { flex: 1; overflow: hidden; position: relative; cursor: grab; touch-action: none; }
.lightbox .lb-inner { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.lightbox .lb-inner img { display: block; }
.lightbox .lb-inner svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* CT */
.ct { background: var(--film); border-radius: var(--r-card); padding: var(--s3); color: var(--on-film); }
.ct-toolbar { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; margin-bottom: var(--s2); }
.ct-toolbar button { background: transparent; color: var(--on-film); border-color: var(--film-hair); min-height: 34px; padding: var(--s1) var(--s3); }
.ct-toolbar button:hover:not(:disabled) { color: var(--on-film-hi); border-color: var(--on-film); }
.ct-toolbar button.on, .ct-toolbar button.toggle.on { background: var(--film-sel); border-color: var(--on-film-accent); color: var(--on-film-hi); }
.ct-toolbar .muted, .ct .muted { color: var(--on-film-dim); }
.ct-panes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
@media (max-width: 900px) { .ct-panes { grid-template-columns: 1fr; } }
.ct-pane { background: var(--film-deep); border-radius: var(--r-control); overflow: hidden; display: flex; flex-direction: column; position: relative; }
.ct-pane.focus::after { content: ""; position: absolute; inset: 0; border: 1px solid var(--on-film-accent); border-radius: var(--r-control); pointer-events: none; }
.ct-pane .pane-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); font-size: var(--fs-caption); color: var(--on-film); padding: var(--s1) var(--s2); }
.ct-pane .pane-head > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-pane .pane-head > span:last-child { flex: none; white-space: nowrap; }
.ct-toolbar .seg { display: inline-flex; align-items: center; gap: 0; }
.ct-toolbar .seg button { border-radius: 0; margin-left: -1px; }
.ct-toolbar .seg button:first-of-type { border-radius: var(--r-control) 0 0 var(--r-control); margin-left: 0; }
.ct-toolbar .seg button:last-of-type { border-radius: 0 var(--r-control) var(--r-control) 0; }
.ct-toolbar .group-label { font-size: var(--fs-caption); color: var(--on-film-dim); margin: 0 var(--s1) 0 var(--s2); }
.ct-pane .canvas-wrap { position: relative; display: flex; align-items: center; justify-content: center; height: 420px; }
.ct-pane canvas { width: 100%; height: 100%; object-fit: contain; cursor: crosshair; touch-action: none; }
.ct-pane input[type=range] { width: calc(100% - 12px); margin: var(--s1) var(--s2) var(--s2); accent-color: var(--on-film-accent); }
.ct-pane .orient { position: absolute; font-size: var(--fs-caption); font-weight: 600; color: var(--on-film); pointer-events: none; background: var(--veil-soft); padding: 0 var(--s1); border-radius: var(--r-small); }
.ct-pane .orient.t, .ct-pane .orient.b { transform: translateX(-50%); }
.ct-pane .orient.l, .ct-pane .orient.r { transform: translateY(-50%); }
.progress { color: var(--on-film-dim); padding: var(--s6); text-align: center; }

/* answers */
.question { border: 0; border-top: 1px solid var(--hair); padding: var(--s3) 0 var(--s1); margin: 0 0 var(--s2); min-width: 0; }
.question legend { font: 600 var(--fs-sub)/var(--lh-sub) var(--font); padding: 0 var(--s2) 0 0; }
.question .opts, .options { display: grid; gap: var(--s1); margin: var(--s2) 0 var(--s3); }
.question label.opt, .opt { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s2) var(--s2); border: 1px solid var(--hair-strong); border-radius: var(--r-control); cursor: pointer; background: var(--surface-2); font: var(--t-sub); }
.question label.opt:hover, .opt:hover { border-color: var(--text-2); }
.opt:has(input:checked), .question label.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); }
.opt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.opt input:focus-visible { outline: none; }
.opt:has(input:disabled) { cursor: default; }
.question .conf label { display: inline-flex; align-items: center; gap: var(--s1); min-height: var(--hit); padding: 0 var(--s1); }
.opt input, .question label.opt input { margin-top: var(--s1); accent-color: var(--accent); }
.question .conf { display: flex; gap: var(--s4); align-items: center; margin-top: var(--s1); font-size: var(--fs-sub); flex-wrap: wrap; }
.question .conf input { accent-color: var(--accent); }
.question details { font-size: var(--fs-sub); margin-top: var(--s2); }
.question details dt { font-size: var(--fs-sub); }
.question details dd { font-size: var(--fs-sub); }
.result-row { display: grid; grid-template-columns: 6.5rem 1fr; gap: var(--s1) var(--s3); font-size: var(--fs-sub); margin: var(--s2) 0 var(--s3); }
.ok { color: var(--ok); } .no { color: var(--bad); }

/* 3D: the reveal is the one bold moment */
.viewer3d { position: relative; height: 560px; background: var(--film); border-radius: var(--r-card); overflow: hidden; }
.viewer3d svg.leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.viewer3d svg.leaders line { stroke-width: 1; opacity: .85; }
.viewer3d canvas { display: block; width: 100%; height: 100%; }
.viewer3d .labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.viewer3d .label3d { position: absolute; transform: translate(-50%, -50%); font: var(--t-footnote); color: var(--on-film-hi); padding: 2px var(--s2); border-radius: var(--r-small); background: var(--veil); border-left: 3px solid; width: max-content; max-width: 14rem; }
.viewer3d .label3d.sel { background: var(--film-sel); }
.viewer3d .label3d.occluded, .viewer3d .label3d.behind { color: var(--on-film-dim); }
.viewer3d .label3d.sel, .viewer3d .label3d.sel.occluded, .viewer3d .label3d.sel.behind { color: var(--on-film-hi); }
.viewer3d .hint { position: absolute; bottom: .6rem; left: var(--gap); font-size: var(--fs-caption); color: var(--on-film-dim); pointer-events: none; }
.reveal { position: relative; margin: 0 calc(-1 * var(--gap)); overflow-x: clip; }
.reveal .viewer3d { height: calc(100vh - var(--reveal-top, 190px) - 12px); min-height: 480px; border-radius: 0; }
.reveal .reveal-tools select { max-width: 20rem; }
.reveal .reveal-tools { position: absolute; top: 12px; left: var(--gap); z-index: 5; display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; max-width: calc(100% - var(--panel-w) - 2 * var(--gap)); }
.reveal .reveal-tools button, .reveal .reveal-tools select { background: var(--veil-soft); color: var(--on-film); border-color: var(--film-hair); }
.reveal .reveal-tools button.on { background: var(--film-sel); border-color: var(--on-film-accent); color: var(--on-film-hi); }
.reveal .reveal-tools .note { color: var(--on-film); font-size: var(--fs-caption); }
.reveal .reveal-tools .note:not(:empty) { background: var(--veil); padding: var(--s1) var(--s2); border-radius: var(--r-small); }
.reveal .side.drawer { position: absolute; top: 12px; right: var(--gap); bottom: 12px; width: var(--panel-w); max-height: none; z-index: 6; border-left: 0; box-shadow: none; transition: transform .35s ease, opacity .35s ease, visibility 0s linear 0s; }
.reveal.drawer-closed .side.drawer { transform: translateX(calc(100% + var(--gap))); opacity: 0; pointer-events: none; visibility: hidden; transition: transform .35s ease, opacity .35s ease, visibility 0s linear .35s; }
.reveal .drawer-toggle { position: absolute; right: var(--gap); bottom: 18px; z-index: 7; }
.reveal.drawer-open .drawer-toggle { right: calc(var(--panel-w) + var(--gap) + 10px); }
.reveal .drawer-toggle { background: var(--veil); color: var(--on-film); border-color: var(--film-hair); }
.reveal-below { margin-top: var(--s4); }
.viewer3d.exposing canvas { animation: expose .75s cubic-bezier(.2, .6, .2, 1) both; }
.viewer3d.exposing .labels { animation: labels-in .35s .55s both; }
@keyframes expose { from { filter: brightness(.08) contrast(1.6) saturate(0); } to { filter: none; } }
@keyframes labels-in { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 900px) {
  .reveal { margin: 0; }
  .reveal .viewer3d { height: 64vh; min-height: 360px; border-radius: var(--r-card); }
  .reveal .side.drawer { position: static; width: auto; transform: none !important; opacity: 1 !important; pointer-events: auto !important; visibility: visible !important; margin-top: var(--s4); }
  .ct-toolbar button { min-height: var(--hit); }
  .reveal .drawer-toggle { display: none; }
}
.legend { list-style: none; padding: 0; margin: var(--s1) 0; display: grid; gap: 2px; }
.legend li { display: flex; gap: var(--s1); align-items: center; border-radius: var(--r-small); font: var(--t-sub); }
.legend .frag-pick { flex: 1; display: flex; gap: var(--s2); align-items: center; text-align: left; border: 0; background: none; padding: var(--s1) var(--s2); min-height: var(--hit); font: var(--t-sub); color: var(--text); }
.legend .frag-pick:hover:not(:disabled) { border: 0; background: transparent; }
.legend li:hover { background: var(--surface-2); }
.legend li.sel { background: var(--accent-wash); }
.legend .sw { width: 12px; height: 12px; border-radius: var(--r-small); flex: none; }
.legend li .eye { margin-left: auto; font-size: var(--fs-caption); color: var(--text-2); padding: 2px var(--s2); min-height: var(--hit); min-width: 44px; justify-content: center; }
.legend li.hidden .frag-pick span:not(.sw) { color: var(--text-2); text-decoration: line-through; text-decoration-thickness: 1px; }
.legend li.hidden .sw { opacity: .4; }

/* treatment + catalog */
.option { display: block; width: 100%; text-align: left; font: inherit; color: inherit; background: none; border: 0; border-top: 1px solid var(--hair); border-radius: 0; padding: var(--s3) var(--s3) var(--s2); cursor: pointer; min-height: 0; }
.option:hover:not(:disabled) { border: 0; border-top: 1px solid var(--hair); }
.option .opt-meta { margin: 0 0 var(--s1); }
.option:hover { background: var(--surface-2); }
.option.sel { box-shadow: inset 3px 0 0 var(--accent); background: var(--accent-wash); }
.option h3 { display: block; font-size: var(--fs-body); margin: 0 0 var(--s1); }
.option h3 .badge { align-self: center; flex: none; }
.catalog-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 var(--s5); margin-top: var(--s2); }
.pcard { border-top: 1px solid var(--hair); padding: 2px 0 var(--s2); font-size: var(--fs-sub); }
.pcard a { display: inline-block; padding: var(--s2) 0 2px; }
.pcard .co { color: var(--text-2); font-size: var(--fs-caption); margin-top: 2px; }
.filters { display: flex; gap: var(--s2); flex-wrap: wrap; margin: var(--s2) 0 var(--s4); align-items: center; }
.filters select { flex: 1 1 14rem; min-width: 0; }
.bar { height: 8px; background: var(--hair); border-radius: 0; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--text-2); }
.bar.post-ct > span { background: var(--accent); }
.statgrid { display: grid; grid-template-columns: 9rem minmax(120px, 1fr) 3.5rem; gap: var(--s2) var(--s3); align-items: center; font-size: var(--fs-sub); max-width: 720px; }

/* learn */
.learn-intro { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, var(--measure))); gap: var(--s2) var(--s7); margin: var(--s5) 0 var(--s4); }
.learn-intro h2, h2.how { font-size: var(--fs-title3); margin-top: var(--s2); }
.learn-intro p, .learn-sub p, .learn-sub li, .how-to-read li { font: var(--t-body); }
.how-to-read { max-width: var(--measure); }
.learn-key { display: flex; gap: var(--s4); overflow-x: auto; padding: var(--s1) var(--s1) var(--s3); margin: 0 calc(-1 * var(--s1)) var(--s5); scroll-snap-type: x proximity; }
@media (min-width: 901px) { .learn-key { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); overflow: visible; } }
.key-cell { flex: 0 0 200px; display: flex; flex-direction: column; gap: var(--s1); color: var(--text); scroll-snap-align: start; font: var(--t-caption); }
.key-cell:hover { text-decoration: none; }
.key-cell:hover strong { color: var(--accent); }
.key-cell img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--film); border-radius: var(--r-control); }
.key-cell strong { font-size: var(--fs-sub); }
.learn-sub { padding: var(--s5) 0; border-top: 1px solid var(--hair); scroll-margin-top: calc(var(--bar) + 16px); }
.learn-sub-grid { display: grid; grid-template-columns: minmax(0, var(--measure)) minmax(320px, 1fr); gap: var(--s7); }
@media (max-width: 1000px) { .learn-sub-grid { grid-template-columns: 1fr; } }
.learn-sub h3 { font-size: var(--fs-body); margin: var(--s5) 0 var(--s1); }
.learn-figs { display: grid; gap: var(--s4); align-content: start; }
.learn-figs figure { margin: 0; }
.learn-figs img { width: 100%; height: auto; display: block; border-radius: var(--r-card); background: var(--film); }
.learn-figs figure.diagram img { max-height: 380px; object-fit: contain; }
.learn-figs figcaption { font-size: var(--fs-caption); color: var(--text-2); margin-top: var(--s1); }
.learn-index-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s4) var(--s5); align-items: center; padding: var(--s4) 0; border-top: 1px solid var(--hair); }
.learn-index-row .mini { display: flex; gap: var(--s2); }
.learn-index-row .mini img { width: 84px; aspect-ratio: 4 / 3; object-fit: contain; background: var(--film); border-radius: var(--r-control); display: block; }
@media (max-width: 700px) { .learn-index-row .mini img:nth-child(n+3) { display: none; } }
.learn-index-row h3 { font-size: var(--fs-body); margin: 0 0 var(--s1); }
.learn-index-row .types { font-size: var(--fs-caption); color: var(--text-2); }
@media (max-width: 700px) { .learn-index-row { grid-template-columns: 1fr; } }

/* apply: the vignette reads like a requisition slip */
.vignette { background: var(--surface-2); border: 1px solid var(--hair); border-top: 3px solid var(--text); padding: var(--s4) var(--s4); margin: 0 0 var(--s4); }
.vignette .slip-row { display: grid; grid-template-columns: 7.5rem 1fr; gap: var(--s1) var(--s4); padding: var(--s1) 0; }
.vignette .slip-row .k { font: var(--t-footnote); color: var(--text-2); padding-top: var(--s1); }
.vignette .slip-row .v { font-size: var(--fs-body); }
.vignette .system { font: var(--t-footnote); color: var(--text-2); margin-bottom: var(--s1); }
@media (max-width: 600px) { .vignette .slip-row { grid-template-columns: 1fr; } }
.feedback h3 { margin-top: var(--s4); }
.feedback li.picked::marker { color: var(--bad); }
.score { border-top: 2px solid var(--text); padding-top: var(--s4); max-width: 860px; }
.score .tally { display: flex; gap: var(--s7); margin: var(--s2) 0 var(--s4); }
.score .tally .num { font: var(--t-title1); }
.score .tally .lab { font-size: var(--fs-caption); color: var(--text-2); }
.mixed { border-top: 1px solid var(--hair); padding: var(--s4) 0 0; margin: var(--s2) 0 var(--s4); }

/* shortcut sheet */
.keysheet { position: fixed; inset: 0; z-index: 60; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: var(--s4); }
.keysheet .sheet { background: var(--surface); max-width: 600px; width: 100%; padding: var(--s5) var(--s5); border-top: 2px solid var(--text); max-height: 90vh; overflow: auto; }
.keysheet kbd { margin-right: 2px; }
.keysheet table { width: 100%; border-collapse: collapse; font-size: var(--fs-sub); }
.keysheet td { padding: var(--s1) var(--s2) var(--s1) 0; border-bottom: 1px solid var(--hair); vertical-align: top; }
.keysheet td:first-child { white-space: nowrap; width: 9rem; }
@media (max-width: 600px) { .keysheet tr { display: block; border-bottom: 1px solid var(--hair); padding: var(--s1) 0; } .keysheet td, .keysheet td:first-child { display: block; border: 0; padding: 2px 0; width: auto; white-space: normal; } }

/* narrow windows */
@media (max-width: 700px) {
  .ct-pane .canvas-wrap { height: 300px; }
  .viewer3d { height: 420px; }
}

/* offline renders (tools/learn_renders.py) */
body.snapshot .topbar, body.snapshot .tabbar, body.snapshot .site-foot { display: none; }
body.snapshot main { padding: 0; }
body.snapshot .viewer3d .hint { display: none; }
body.snapshot #snap .viewer3d { height: 100% !important; border-radius: 0; }
body.snapshot .viewer3d .label3d { font-size: 16px; padding: 2px var(--s2); }
.side .vignette { background: transparent; border: 0; border-top: 3px solid var(--text); border-bottom: 1px solid var(--hair); padding: var(--s3) 0; }
.side .vignette .slip-row { grid-template-columns: 1fr; gap: 0; padding: var(--s1) 0; }
.side .vignette .slip-row .k { padding-top: 0; }

/* reading measures for long text on plain pages */
.prose { max-width: var(--measure); }
.prose p, .prose li { font: var(--t-body); }
.notes { max-width: var(--measure); font: var(--t-sub); color: var(--text-2); }
.film-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 180px)); gap: var(--s4); margin: var(--s4) 0 var(--s5); }
.film-grid .thumb { width: auto; }
.film-grid .thumb .ans { font-size: var(--fs-caption); color: var(--text-2); margin-top: 2px; }
.empty { font-size: var(--fs-body); max-width: var(--measure); }
details > summary { padding: var(--s2) 0; min-height: var(--hit); box-sizing: border-box; }
@media (max-width: 760px) {
  .crumbs a, .case-head a, .row-actions.small a, .actions-row a { display: inline-flex; align-items: center; min-height: var(--hit); }
}
@media (max-width: 700px) {
  .stepper .step { font-size: var(--fs-caption); margin-right: var(--s2); padding-right: var(--s1); }
  .stepper .step .n { margin-right: var(--s1); }
}

/* treatment option: the name is the button, the row is also clickable */
.option .pick { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 0; padding: 0; min-height: 0; font: var(--t-head); color: var(--text); cursor: pointer; }
.option .pick:hover:not(:disabled) { border: 0; color: var(--accent); }
.option.sel .pick { color: var(--accent); }
.option p { font: var(--t-sub); margin: var(--s1) 0; }
.option p strong { font-weight: 600; font-size: var(--fs-caption); }
/* the case history as a requisition slip at the top of the report panel */
.side .vignette.history { margin-bottom: var(--s4); }
.side .vignette.history .v { font: var(--t-sub); }
details.guide { margin: var(--s1) 0 var(--s2); }
details.guide > summary { font-size: var(--fs-sub); }
h1[tabindex="-1"]:focus { outline: none; }

.xray-open .imgwrap { display: block; }
.lightbox .lb-bar .hint { color: var(--on-film-dim); }
.lightbox .lb-bar #lb-title { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (max-width: 700px) { .lightbox .lb-bar { flex-wrap: wrap; } .lightbox .lb-bar .hint { display: none; } }
.ct-toolbar .seg:first-child .group-label { margin-left: 0; }
/* list markup for the film strips and the Learn key */
.film-grid, .learn-key { list-style: none; }
.film-grid { padding: 0; }
.learn-key > li { flex: 0 0 200px; display: flex; scroll-snap-align: start; }
.learn-key > li > .key-cell { flex: 1; }
.key-title { font-size: var(--fs-title3); margin: var(--s4) 0 var(--s2); }
.learn-index-row .mini:hover img { outline: 1px solid var(--hair-strong); }
.feedback h3:focus { outline: none; }
.feedback { scroll-margin-top: calc(var(--bar) + 12px); }
body.snapshot .viewer3d .label3d { max-width: 16rem; }

/* round 2 */
.learn-index-row { grid-template-columns: calc(4 * 84px + 3 * var(--s2)) minmax(0, 1fr) auto; }
@media (max-width: 700px) { .learn-index-row { grid-template-columns: 1fr; } h2, .browser-group > h2 { font-size: var(--fs-title3); } }
.learn-key { scroll-padding-inline: 4px; }
@media (min-width: 701px) { .filters select { flex: 0 1 22rem; } }
.cat-section { margin-bottom: var(--s5); scroll-margin-top: calc(var(--bar) + 12px); }
.cat-jump-wrap { margin: var(--s1) 0 var(--s4); }
.cat-jump { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); padding: var(--s2) 0; max-width: 72rem; }
.cat-jump a { font-size: var(--fs-sub); }
.typical, .cat-section > p.small { max-width: 72rem; }

/* round 2: case steps */
.case-grid > .side { position: sticky; top: calc(var(--bar) + 12px); max-height: calc(100vh - max(var(--panel-top, 195px), var(--bar) + 12px) - 12px); overflow: auto; overscroll-behavior: contain; scroll-padding-bottom: 6rem; }
@media (max-width: 900px) { .case-grid > .side { position: static; max-height: none; overflow: visible; } }
.reveal .side.drawer { padding-bottom: 0; }
.xray-open:focus-visible { outline: none; }
.xray-fig:has(> .xray-open:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.xray-grid:not(.compact) { align-items: stretch; }
.xray-fig { display: flex; flex-direction: column; }
.xray-fig .xray-open { flex: 1; display: flex; align-items: center; justify-content: center; }
/* each film is capped so a tall AP femur fits under the fold; --ar is width / height */
.xray-open .imgwrap { display: block; position: relative; width: min(100%, calc((100vh - var(--bar) - 256px) * var(--ar, 1))); }
.xray-grid.compact .xray-open .imgwrap { width: 100%; }
.xray-fig figcaption { margin-top: auto; }
.viewer3d canvas:focus-visible { outline: 2px solid var(--on-film-accent); outline-offset: -3px; }
/* label and other segmented controls on the 3D stage */
.reveal .reveal-tools .seg, .tools3d .seg { display: inline-flex; align-items: center; }
.reveal .reveal-tools .seg button, .tools3d .seg button { border-radius: 0; margin-left: -1px; }
.reveal .reveal-tools .seg button:first-of-type, .tools3d .seg button:first-of-type { border-radius: var(--r-control) 0 0 var(--r-control); margin-left: 0; }
.reveal .reveal-tools .seg button:last-of-type, .tools3d .seg button:last-of-type { border-radius: 0 var(--r-control) var(--r-control) 0; }
.reveal .reveal-tools .group-label, .tools3d .group-label { font-size: var(--fs-caption); color: var(--on-film-dim); margin: 0 var(--s2) 0 var(--s1); }
.stage > .tools3d { position: absolute; top: 12px; left: var(--gap); right: var(--gap); z-index: 5; display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.tools3d button { background: var(--veil-soft); color: var(--on-film); border-color: var(--film-hair); }
.tools3d button:hover:not(:disabled) { color: var(--on-film-hi); border-color: var(--on-film); }
.tools3d button.on { background: var(--film-sel); border-color: var(--on-film-accent); color: var(--on-film-hi); }
.tools3d :focus-visible { outline-color: var(--on-film-accent); }
.model-caption { margin: var(--s2) 0 0; }
@media (max-width: 700px) {
  .stepper { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: visible; }
  .stepper .step { margin: 0; padding: var(--s1) var(--s1); min-height: 44px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; white-space: normal; font: var(--t-footnote); }
  .stepper .step .n { margin: 0; }
}
.ct .ct-hint { margin: var(--s2) 0 0; }
/* round 2: Learn and Apply */
@media (min-width: 901px) { .learn-key { grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); } }
.opt kbd { margin-left: auto; color: var(--text-2); background: transparent; border-color: var(--hair); flex: none; }
.score { border-top: 1px solid var(--hair); margin-top: var(--s4); }
.score .misses td { vertical-align: middle; }
.score .misses img { width: 72px; aspect-ratio: 4 / 5; object-fit: cover; background: var(--film); border-radius: var(--r-control); display: block; }
.side [id^="h-q2-"] { font-size: var(--fs-title3); margin-top: var(--s4); }
.card h2 { font-size: var(--fs-title3); }
table.list.cols4 { table-layout: fixed; width: 100%; max-width: 860px; }
.stage-title, .reveal-below > .stage-title { font-size: var(--fs-title3); margin: var(--s4) 0 var(--s2); }

@media (max-width: 900px) { .side .side-foot { position: static; } }
.case-head .case-nav { display: inline-flex; gap: var(--s5); }

/* Orthobullets reference lines */
.ob-line { font: var(--t-sub); margin: var(--s1) 0 var(--s2); max-width: 72rem; }
.ob-line .ob-label { color: var(--text-2); }
.side .ob-line, .side p.ob-line { font: var(--t-caption); margin: var(--s1) 0 var(--s2); }
.learn-ref { margin: 2px 0 var(--s4); }
.learn-sub .ob-line { margin-top: calc(-1 * var(--s1)); }

/* final panel round 1 / design round 3 */
.viewer3d .hint, .reveal .reveal-tools .group-label, .tools3d .group-label { background: var(--veil); padding: 2px var(--s2); border-radius: var(--r-small); }
.question label.opt, .opt { min-height: var(--hit); }
.ct-pane input[type=range] { height: 28px; }
.question .q-prompt { font: var(--t-sub); color: var(--text); margin: 2px 0 var(--s1); }
.side > p.intro { font: var(--t-caption); color: var(--text-2); margin: 0 0 var(--s3); }
.xray-grid.compact { align-items: stretch; }
.xray-grid.compact figcaption { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .feedback ul.small li { font: var(--t-sub); }
.side .feedback h3 { font-size: var(--fs-title3); margin-top: var(--s4); }
.score table.misses { table-layout: fixed; width: 100%; max-width: 860px; }
.score .misses th:nth-child(1) { width: 88px; }
.score .misses th:nth-child(3), .score .misses th:nth-child(4) { width: 8.5rem; }
h2.section { max-width: 860px; }
.stats-block { max-width: 860px; }
.ct-pane .pane-head .key-note { color: var(--on-film-accent); }
.stage { position: relative; }
@media (max-width: 900px) { .stepper .step { min-height: 44px; } }
@media (max-width: 700px) {
  .lightbox .lb-bar #lb-title { order: 3; flex-basis: 100%; font-size: var(--fs-caption); -webkit-line-clamp: 3; }
}
/* the key tiles share text baselines across a row */
@media (min-width: 901px) {
  .learn-key > li { display: grid; grid-row: span 3; grid-template-rows: subgrid; }
  .learn-key > li > .key-cell { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: var(--s1); }
}

.legend li.sel .frag-pick { font-weight: 500; }

/* the cheat sheet: definitions behind a deliberate click during a test */
details.cheat { margin: var(--s2) 0 var(--s2); border-top: 1px dashed var(--hair-strong); }
details.cheat > summary { font: 500 var(--fs-sub)/var(--lh-sub) var(--font); }
details.cheat dl { margin: var(--s1) 0 var(--s2); }
details.cheat dt { font: 600 var(--fs-caption)/var(--lh-caption) var(--font); margin-top: var(--s2); }
details.cheat dd { margin: 2px 0 0; font: var(--t-sub); }
details.cheat h4 { font: 600 var(--fs-caption)/var(--lh-caption) var(--font); margin: var(--s2) 0 var(--s1); }
details.cheat dd .sign { display: block; margin-top: 2px; font-size: var(--fs-caption); }
.nowrap { white-space: nowrap; }
.note-line { font: var(--t-sub); color: var(--text-2); max-width: 44rem; margin: calc(-1 * var(--s2)) 0 var(--s5); }

/* collapsible regions on the Cases page */
button.linkish { background: none; border: 0; padding: var(--s2) 0; min-height: 0; color: var(--accent); font: var(--t-sub); cursor: pointer; }
button.linkish:hover:not(:disabled) { border: 0; text-decoration: underline; }

/* the reveal's films and CT under the model; the stage leaves the heading in view */
@media (min-width: 901px) { .reveal .viewer3d { height: calc(100vh - var(--reveal-top, 190px) - 64px); } }
.reveal-ct { margin-top: var(--s3); }
.xray-grid.compact { grid-template-columns: repeat(auto-fill, minmax(170px, 250px)); }

/* Learn: one live 3D viewer for the page's types */
.type-explorer { margin: var(--s2) 0 var(--s5); }
.type-explorer .explorer-types { display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 var(--s2); }
.type-explorer .explorer-types button { border-radius: 0; margin-left: -1px; min-height: 36px; }
.type-explorer .explorer-types button:first-child { border-radius: var(--r-control) 0 0 var(--r-control); margin-left: 0; }
.type-explorer .explorer-types button:last-child { border-radius: 0 var(--r-control) var(--r-control) 0; }
.type-explorer .explorer-caption { margin: var(--s2) 0 0; max-width: 60rem; }

/* the bone map on the Cases page */
.bonemap { display: grid; grid-template-columns: minmax(280px, 560px) minmax(0, 1fr); gap: var(--gap); margin: var(--s2) 0 var(--s5); }
.bonemap-view { position: relative; background: var(--film); border-radius: var(--r-card); height: 640px; overflow: hidden; }
.bonemap-stage { position: absolute; inset: 0; }
.bonemap-stage canvas { width: 100%; height: 100%; display: block; touch-action: pan-y; }
.bonemap-pins { position: absolute; inset: 0; pointer-events: none; }
.bonemap-pin { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; background: none; border: 0; padding: 0; min-height: 0; color: var(--on-film); font: var(--t-footnote); cursor: pointer; }
.bonemap-pin .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--on-film-accent); box-shadow: 0 0 0 3px var(--veil-soft); flex: none; }
.bonemap-pin.cluster .dot { width: 18px; height: 18px; display: grid; place-items: center; font: 600 var(--fs-caption2)/1 var(--font); color: var(--film); }
.bonemap-pin .lab { position: absolute; left: calc(100% + 2px); top: 50%; transform: translateY(-50%); pointer-events: none; background: var(--veil); padding: 1px var(--s2); border-radius: var(--r-small); opacity: 0; transition: opacity .12s; white-space: nowrap; }
.bonemap-pin:hover .lab, .bonemap-pin:focus-visible .lab, .bonemap-pin.on .lab { opacity: 1; }
.bonemap-pin:hover, .bonemap-pin:focus-visible, .bonemap-pin.on { z-index: 2; }
.bonemap-pin.on .dot { background: var(--on-film-hi); box-shadow: 0 0 0 3px var(--on-film-accent); }
.bonemap-pin.far:not(.on) .dot { opacity: .35; }
.bonemap-pin:hover:not(:disabled) { border: 0; }
.bonemap-pin:focus-visible { outline: 2px solid var(--on-film-accent); outline-offset: 0; border-radius: var(--r-control); }
.bonemap-hint { position: absolute; left: 12px; bottom: 8px; margin: 0; font-size: var(--fs-caption); color: var(--on-film-dim); background: var(--veil); padding: 2px var(--s2); border-radius: var(--r-small); pointer-events: none; }
.bonemap-side h2 { font-size: var(--fs-title3); margin: 0 0 var(--s2); }
.bonemap-side h3 { font-size: var(--fs-sub); margin: var(--s4) 0 var(--s1); }
.bonemap-side h3:focus { outline: none; }
.bonemap-side h3:focus-visible { outline: 2px solid var(--on-film-accent); outline-offset: 2px; }
.bonemap-systems, .bonemap-list { list-style: none; padding: 0; margin: 0; }
.bonemap-systems li { border-top: 1px solid var(--hair); padding: var(--s2) 0; }
.bonemap-list li { padding: 2px 0; font-size: var(--fs-sub); }
.bonemap-list button[aria-pressed="true"] { font-weight: 600; }
@media (max-width: 900px) { .bonemap { grid-template-columns: 1fr; } .bonemap-view { height: 480px; } }
@media (max-width: 700px), (pointer: coarse) {
  .bonemap-pin { width: 40px; height: 40px; }
  .bonemap-pin .dot { width: 14px; height: 14px; }
  .bonemap-pin.cluster .dot { width: 22px; height: 22px; }
}
@media (prefers-reduced-motion: reduce) { .bonemap-pin .lab { transition: none; } }

.ct .ct-note { margin: var(--s2) 0 0; color: var(--on-film-review); }
.reveal-ct .ct-pane canvas { touch-action: pan-y; }
@media (max-width: 700px) { .xray-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

table.list td .memline { display: block; white-space: normal; }
.note-line { color: var(--text); }
.conf .conf-clear { font-size: var(--fs-caption); margin-left: var(--s2); }

.learn-top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); margin: var(--s1) 0 var(--s4); }
.learn-top-actions .note-line { margin: 0; flex: 1 1 22rem; }
.type-explorer .explorer-types button { min-height: var(--hit); }
@media (max-width: 700px) {
  .type-explorer .explorer-types { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: var(--s1); }
  .type-explorer .explorer-types button { flex: none; scroll-snap-align: start; border-radius: var(--r-control); margin-left: var(--s1); }
  .score .misses th:nth-child(1) { width: 56px; }
  .score .misses img { width: 48px; }
  .score .misses th:nth-child(3), .score .misses th:nth-child(4) { width: 5.5rem; }
}

/* review round 2 of the new features */
@media (max-width: 700px) {
  table.list.cols4 th { font-size: var(--fs-caption); overflow-wrap: anywhere; hyphens: auto; }
}
.question .conf .conf-clear { min-height: var(--hit); padding: 0 var(--s2); }
@media (min-width: 701px) { .question .conf .conf-clear { min-height: 0; } }
.bonemap-pin .lab.left { left: auto; right: calc(100% + 2px); }
.bonemap-view.busy .bonemap-pin { pointer-events: none; }
.bonemap-panel { min-height: 15rem; }
@media (max-width: 700px), (pointer: coarse) { .bonemap-list button { min-height: var(--hit); } }

/* enlarged CT view */
.ct-pane .pane-head .pane-right { display: inline-flex; align-items: center; gap: var(--s2); }
.ct-pane .ct-enlarge { display: inline-flex; align-items: center; justify-content: center; min-height: 0; height: 24px; width: 28px; padding: 0; background: none; color: var(--on-film); border: 1px solid var(--film-hair); border-radius: var(--r-control); }
.ct-pane .ct-enlarge:hover:not(:disabled) { color: var(--on-film-hi); border-color: var(--on-film); }
@media (pointer: coarse), (max-width: 700px) { .ct-pane .ct-enlarge { height: 36px; width: 40px; } }
.ct-expand .ct-x-body { flex: 1; display: flex; min-height: 0; padding: 0 var(--s4) var(--s4); }
.ct-expand .ct-pane { flex: 1; min-height: 0; }
.ct-expand .ct-pane .canvas-wrap { flex: 1; height: auto; min-height: 0; }
.ct-expand .ct-pane canvas { touch-action: none; }
.ct-expand .ct-pane .ct-enlarge { display: none; }
.ct-expand .ct-pane.focus::after { display: none; }
.ct-expand .lb-bar .seg { display: inline-flex; align-items: center; }
.ct-expand .lb-bar .seg button { border-radius: 0; margin-left: -1px; }
.ct-expand .lb-bar .seg button:first-child { border-radius: var(--r-control) 0 0 var(--r-control); margin-left: 0; }
.ct-expand .lb-bar .seg button:last-child { border-radius: 0 var(--r-control) var(--r-control) 0; }
.ct-expand .lb-bar button.on { background: var(--film-sel); border-color: var(--on-film-accent); color: var(--on-film-hi); }
@media (max-width: 700px) { .ct-expand .ct-x-body { padding: 0 var(--s2) var(--s2); } }
.ct-expand .lb-bar { flex-wrap: wrap; row-gap: var(--s2); }
.ct-expand .lb-bar .hint { flex: 1 1 16rem; min-width: 0; }
html.ct-x-open { overflow: hidden; }
.ct-expand { overscroll-behavior: contain; touch-action: none; }
.ct-expand .ct-pane .canvas-wrap { overflow: hidden; }
.ct-expand .ct-pane .pane-head > span:first-child { white-space: normal; overflow: visible; text-overflow: clip; }
.ct-expand .ct-x-note { margin: 0 var(--s4) var(--s2); }
.ct-expand .ct-x-note[hidden] { display: none; }
@media (pointer: coarse), (max-width: 700px) { .ct-pane .ct-enlarge { height: 40px; width: 44px; } }
.ct-expand .ct-x-close .short { display: none; }
@media (max-width: 700px) {
  .ct-expand .ct-x-close .long { display: none; }
  .ct-expand .ct-x-close .short { display: inline; font-size: var(--fs-title3); line-height: 1; }
}
@media (pointer: coarse), (max-width: 700px) { .ct-expand .lb-bar button { min-width: 44px; min-height: var(--hit); } }

/* landing page (2026-10-20): a short header with three actions, the case list as the main column
   and a compact bone map beside it */
.tag { display: inline-block; font: var(--t-footnote); padding: 0 var(--s2); border-radius: var(--r-control); vertical-align: .15em; margin-left: var(--s2); white-space: nowrap; background: var(--surface-2); color: var(--text); border: 1px solid var(--hair); }
.tag.review { color: var(--review); }

/* the compact bone map */
.bonemap { display: block; margin: 0; }
.bonemap-pin .lab { opacity: 1; font-size: var(--fs-caption1); padding: 0 var(--s1); }
.bonemap-pin.far:not(.on) .lab { opacity: .75; }
.bonemap-pin.cluster .lab { font-weight: 600; }
.bonemap-leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.bonemap-leaders line { stroke: var(--on-film-accent); stroke-width: 1.5; }
.bonemap-leaders circle { fill: var(--on-film-accent); }
.bonemap-views { position: absolute; top: 8px; right: 8px; display: inline-flex; }
.bonemap-views button { font-size: var(--fs-caption); min-height: 30px; padding: var(--s1) var(--s2); background: var(--veil); color: var(--on-film); border-color: var(--film-hair); border-radius: 0; margin-left: -1px; }
.bonemap-views button:first-child { border-radius: var(--r-control) 0 0 var(--r-control); margin-left: 0; }
.bonemap-views button:last-child { border-radius: 0 var(--r-control) var(--r-control) 0; }
.bonemap-views button[aria-pressed="true"] { background: var(--film-sel); border-color: var(--on-film-accent); color: var(--on-film-hi); }
@media (max-width: 700px), (pointer: coarse) { .bonemap-views button { min-height: var(--hit); min-width: 44px; } }
.bonemap-pin.cluster .lab { white-space: normal; width: max-content; max-width: 74px; line-height: 1.15; padding: 2px var(--s1); }
.bonemap-pin .lab.left { text-align: right; }

/* all three CT planes enlarged side by side */
.ct-expand.all .ct-x-body { gap: var(--s2); }
.ct-expand.all .ct-pane { flex: 1 1 0; min-width: 0; }
.ct-expand.all .ct-pane.focus::after { display: block; }
.ct-toolbar .ct-enlarge-all { display: inline-flex; align-items: center; gap: var(--s1); margin-left: auto; }
@media (max-width: 700px) { .ct-toolbar .ct-enlarge-all, .ct-expand .ct-x-all { display: none; } }

/* Learn pages: scannable first (2026-10-20) */
.page-glance { background: var(--surface-2); border: 1px solid var(--hair); border-left: 4px solid var(--accent); border-radius: var(--r-card); padding: var(--s3) var(--s4) var(--s4); margin: var(--s4) 0 var(--s2); max-width: 52rem; }
.page-glance h2 { font-size: var(--fs-body); margin: 0 0 var(--s2); }
.page-glance ul { margin: 0; padding-left: var(--s4); }
.page-glance li { font: var(--t-sub); margin: var(--s1) 0; }
details.more { margin: var(--s4) 0 0; }
details.more > summary { cursor: pointer; color: var(--accent); font: 500 var(--fs-sub)/var(--lh-sub) var(--font); padding: var(--s1) 0; }
details.more.about { margin: var(--s1) 0 var(--s4); }
.learn-sub .key-line { font: var(--t-head); margin: 0 0 var(--s3); color: var(--text); }
.glance { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s2) var(--s3); margin: 0; align-items: baseline; }
.glance dt.chip { font: var(--t-footnote); padding: var(--s1) var(--s2); border-radius: var(--r-control); text-align: center; min-width: 6.4rem; background: var(--surface-2); color: var(--text); border: 1px solid var(--hair); }
.glance dd { margin: 0; font: var(--t-sub); }
.glance dd strong { font-weight: 600; color: var(--text); }
.vs-block h3 { font: 600 var(--fs-sub)/var(--lh-sub) var(--font); margin: var(--s4) 0 var(--s1); }
.vs-list { list-style: none; padding: 0; margin: 0; }
.vs-list li { font: var(--t-sub); margin: var(--s1) 0; }
.vs-list .vs { display: inline-block; min-width: 4.6rem; font-weight: 600; color: var(--text-2); margin-right: var(--s1); }
.feedback .takeaway { font: 500 var(--fs-body)/var(--lh-body) var(--font); background: var(--surface-2); border-left: 4px solid var(--accent); padding: var(--s2) var(--s3); margin: var(--s2) 0 var(--s2); }
/* case reveal and treatment: the short lines lead, the long account is folded */
.option details.opt-tech .glance { margin: var(--s1) 0 var(--s1); }
.side .takeaway { font: 500 var(--fs-sub)/var(--lh-sub) var(--font); background: var(--surface-2); border-left: 4px solid var(--accent); padding: var(--s2) var(--s3); margin: var(--s1) 0 var(--s3); }
.side .takeaway strong { font-weight: 650; }
.side .glance { gap: var(--s2) var(--s2); }
.side .glance dt.chip { min-width: 4.9rem; }
.side .glance dd { font-size: var(--fs-sub); }
.side details.more { margin: var(--s3) 0 var(--s1); }
.option .opt-line { font-size: var(--fs-sub); margin: 2px 0; }
.option .opt-line strong { font-size: inherit; color: var(--text); }
.option details.opt-more { margin: var(--s1) 0 0; }
.option details.opt-more > summary { font-size: var(--fs-caption); }
.option .opt-full-name { font-weight: 600; font-size: var(--fs-caption); color: var(--text); }
@media (max-width: 700px) { .glance { grid-template-columns: 1fr; gap: 2px; } .glance dt.chip { justify-self: start; margin-top: var(--s2); } }
.feedback .why-pick { font: var(--t-sub); color: var(--text); border-left: 4px solid var(--bad); padding: var(--s1) var(--s3); margin: 0 0 var(--s2); background: var(--surface-2); }
.feedback .mgmt-line { font: var(--t-sub); }
.learn-figs figure.diagram img { background: var(--diagram); }
.learn-key .key-cell img { background: var(--diagram); }

/* chips and segmented controls take the footnote style (section 2.5); on film they stay film-toned */
.ct-toolbar button, .tools3d button, .reveal .reveal-tools button, .reveal .reveal-tools select, .lightbox .lb-bar button,
.bonemap-views button, .type-explorer .explorer-types button, .reveal .drawer-toggle { font: var(--t-footnote); }

/* search, bone map and note lines on the new pages */
.search-form { max-width: 640px; margin: var(--s2) 0 var(--s4); }
.search-field { width: 100%; height: 44px; padding: 0 var(--s3); font: var(--t-body); color: var(--text); background: var(--surface-2); border: 1px solid var(--hair-strong); border-radius: var(--r-control); }
.map-page .bonemap-view { height: clamp(360px, 60vh, 640px); }
.map-list { margin-top: var(--s4); }
.page-note { max-width: 72rem; margin: var(--s2) 0 var(--s4); }
@media (max-width: 767px) {
  main { padding-top: max(var(--gap), env(safe-area-inset-top)); padding-left: max(var(--gap), env(safe-area-inset-left)); padding-right: max(var(--gap), env(safe-area-inset-right)); }
}

/* search results (DESIGN_PLAN 2.5): plain rows under small group labels, on the page and in the top bar's dropdown */
.search-results { max-width: 720px; }
.search-group { margin: var(--s4) 0 0; }
.search-group h2 { margin: 0 0 var(--s1); font: var(--t-footnote); color: var(--text-2); }
.search-group ul { list-style: none; margin: 0; padding: 0; }
.search-group li { display: flex; align-items: stretch; border-top: 1px solid var(--hair); }
.search-group li:last-child { border-bottom: 1px solid var(--hair); }
.result { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 52px; padding: var(--s2) var(--s3);
  color: var(--text); background: none; border: 0; border-radius: var(--r-control); text-align: left; font: inherit; }
.result:hover:not(:disabled), .result-alt:hover { background: var(--surface-2); border: 0; text-decoration: none; }
.result .r-title { font: var(--t-head); }
.result .r-detail { font: var(--t-caption); color: var(--text-2); }
.result-alt { flex: none; display: flex; align-items: center; min-height: var(--hit); padding: 0 var(--s3); border-radius: var(--r-control); font: 500 var(--fs-sub)/var(--lh-sub) var(--font); white-space: nowrap; }
.result:focus-visible, .result-alt:focus-visible { outline-offset: -2px; }
.search-empty { margin: var(--s4) 0 0; color: var(--text-2); }
.recent-head { display: flex; align-items: baseline; justify-content: space-between; }
.recent-head .linkish { font: var(--t-footnote); }
.search-pop { position: absolute; top: calc(100% + var(--s1)); right: 0; z-index: 32; width: 420px; max-height: min(70vh, 560px); overflow: auto;
  padding: 0 var(--s2) var(--s2); background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-card); }
.search-pop[hidden] { display: none; }
.search-pop .search-group { margin-top: var(--s2); }
.search-pop .result { min-height: 44px; padding: var(--s1) var(--s2); }
.search-pop .result .r-title { font: 600 var(--fs-sub)/var(--lh-sub) var(--font); }
.search-pop .result-alt { font-size: var(--fs-caption); padding: 0 var(--s2); }
.search-pop .search-empty { margin: var(--s3) var(--s2) var(--s1); }
.search-pop .all-results { display: flex; align-items: center; min-height: var(--hit); padding: 0 var(--s2); margin-top: var(--s1); font: var(--t-footnote); }

/* home, Cases and module pages (DESIGN_PLAN 3.1 to 3.3): plain rows, region chips, one card */
.phone-only { display: none; }
@media (max-width: 767px) { .phone-only { display: revert; } }
.home { max-width: 1120px; margin: 0 auto; }
.home-brand { margin: 0 0 var(--s4); font: var(--t-title2); }
@media (min-width: 768px) { .home-brand { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }
.search-launch { align-items: center; gap: var(--s2); min-height: 44px; margin: 0 0 var(--s4); padding: 0 var(--s3);
  font: var(--t-body); color: var(--text-2); background: var(--surface-2); border: 1px solid var(--hair-strong); border-radius: var(--r-control); }
@media (max-width: 767px) { .search-launch.phone-only { display: flex; } }
.search-launch:hover { text-decoration: none; color: var(--text); }
.search-launch .icon { width: 20px; height: 20px; }
.home-card { display: flex; align-items: center; gap: var(--s3); padding: var(--s3); margin: 0 0 var(--s4); color: var(--text); background: var(--surface); border-radius: var(--r-card); }
.home-card:hover { text-decoration: none; background: var(--surface-2); }
.card-film { flex: none; width: 56px; aspect-ratio: 4 / 5; overflow: hidden; background: var(--film); border-radius: var(--r-control); }
.card-film img, .row-film img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.card-head { font: var(--t-head); }
.card-sub { font: var(--t-sub); color: var(--text-2); }
.icon.chevron { width: 20px; height: 20px; color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin: 0 0 var(--s4); }
@media (max-width: 767px) {
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: calc(-1 * var(--gap)); margin-right: calc(-1 * var(--gap)); padding: var(--s1) var(--gap); }
  .chips::-webkit-scrollbar { display: none; }
}
/* a chip is drawn 32 px tall; its hit area reaches 44 px */
.chip-link { position: relative; flex: none; display: inline-flex; align-items: center; min-height: 32px; padding: 0 var(--s3); font: var(--t-footnote);
  color: var(--text); background: var(--surface-2); border: 1px solid var(--hair-strong); border-radius: var(--r-control); white-space: nowrap; }
.chip-link::after { content: ""; position: absolute; inset: -6px 0; }
.chip-link:hover { text-decoration: none; border-color: var(--text-2); }
.chip-link[aria-current="true"] { color: var(--accent); background: var(--accent-wash); border-color: var(--accent); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { border-top: 1px solid var(--hair); }
.rows > li:last-child { border-bottom: 1px solid var(--hair); }
.row { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 52px; padding: var(--s2) var(--s1); color: var(--text); background: none; border: 0; border-radius: 0; text-align: left; font: inherit; }
.row:hover:not(:disabled) { text-decoration: none; background: var(--surface-2); border: 0; }
.row:focus-visible { outline-offset: -2px; }
.row-film { flex: none; width: 52px; aspect-ratio: 4 / 5; overflow: hidden; background: var(--film); border-radius: var(--r-control); }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font: var(--t-head); }
.row-title .tag { vertical-align: .1em; }
.row-detail { font: var(--t-caption); color: var(--text-2); }
.review-note { color: var(--review); }
.home-rows { margin: 0 0 var(--s5); }
.home-recent h2, .case-group h2 { font: var(--t-title3); margin: 0 0 var(--s2); }
.home-recent { margin: var(--s5) 0 0; }
.case-group { margin: var(--s4) 0 var(--s5); }
.case-group h2 { position: sticky; top: var(--bar); z-index: 2; padding: var(--s2) 0; margin: 0; background: var(--bg); }
@media (min-width: 1000px) {
  .case-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--s6); }
  .case-rows > li { border-bottom: 1px solid var(--hair); border-top: 0; }
}
.status-line { margin: 0 0 var(--s2); font: var(--t-sub); color: var(--text-2); }
.actions-row { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s5); margin: 0 0 var(--s3); font: 500 var(--fs-sub)/var(--lh-sub) var(--font); }
.film-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); max-width: 1160px; }
@media (max-width: 767px) { .film-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); } }

/* case pages on phones (DESIGN_PLAN 2.5, 3.4): a 48 px step bar on top, the step's action fixed at the bottom */
.stepbar { display: none; }
@media (max-width: 767px) {
  .case-view { display: flex; flex-direction: column; }
  .case-view > .notice.warn { order: 1; margin-top: var(--s4); }      /* the flag waits under the case, so the first film stays near the top */
  .case-view > .crumbs, .case-view > .stepper { display: none; }
  .case-view > .case-head { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .case-view > .case-head > :not(h1) { display: none; }
  .stepbar { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; position: sticky; top: 0; z-index: 20;
    height: calc(48px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) var(--s1) 0;
    margin: calc(-1 * max(var(--gap), env(safe-area-inset-top))) calc(-1 * var(--gap)) var(--s3);
    background: var(--surface); border-bottom: 1px solid var(--hair); }
  .sb-back { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; color: var(--accent); border-radius: var(--r-control); }
  .sb-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; font: var(--t-head); }
  .sb-dots { display: flex; }
  .sb-dot { display: grid; place-items: center; width: 36px; height: 44px; min-height: 0; padding: 0; background: none; border: 0; border-radius: var(--r-control); }
  .sb-dot::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--text-2); }
  .sb-dot.done::before { background: var(--text-2); }
  .sb-dot.active::before { background: var(--accent); border-color: var(--accent); }
  .sb-dot:hover:not(:disabled) { background: var(--surface-2); border: 0; }
  .sb-dot:disabled { cursor: default; }
  .sb-dot:focus-visible { outline-offset: -4px; }
  body[data-route="case"] .tabbar { display: none; }
  body[data-route="case"] { padding-bottom: calc(var(--actionbar) + var(--s5)); }
  .case-actions, .side .side-foot.case-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; flex-direction: column-reverse; gap: var(--s1);
    margin: 0; padding: var(--s2) max(var(--gap), env(safe-area-inset-right)) calc(var(--s2) + env(safe-area-inset-bottom)) max(var(--gap), env(safe-area-inset-left));
    background: var(--surface); border-top: 1px solid var(--hair); }
  .case-actions.stack { flex-direction: column; }
  .case-actions .primary { width: 100%; justify-content: center; }
  .case-actions .small { margin: 0; text-align: center; }
  .case-actions .small:empty { display: none; }
  .case-actions .back-link { align-self: center; min-height: var(--hit); background: none; border: 0; color: var(--accent); font: 500 var(--fs-sub)/var(--lh-sub) var(--font); }
  .question label.opt, .opt { min-height: 48px; align-items: center; }
  .opt:has(input:checked) { box-shadow: inset 3px 0 0 var(--accent); }
}

/* CT on phones (DESIGN_PLAN 2.5, 3.5): one plane at a time under a plane switcher, the window and key-slice
   chips in one scrolling row above it, a square pane, the slider with the counter at its right */
.ct-planes { display: none; }
.ct.one-plane .ct-toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--s3)) var(--s2); padding: 0 var(--s3) var(--s1); }
.ct.one-plane .ct-toolbar::-webkit-scrollbar { display: none; }
.ct.one-plane .ct-toolbar .seg { flex: none; }
.ct.one-plane .ct-planes { display: flex; margin: 0 0 var(--s2); }
.ct.one-plane .ct-planes button { flex: 1; justify-content: center; min-height: 36px; font: var(--t-footnote); color: var(--on-film); background: transparent; border-color: var(--film-hair); }
.ct.one-plane .ct-planes button.on { color: var(--on-film-hi); background: var(--film-sel); border-color: var(--on-film-accent); }
.ct.one-plane .ct-panes { grid-template-columns: 1fr; }
.ct.one-plane .ct-pane:not(.shown) { display: none; }
.ct.one-plane .ct-pane { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label tools" "wrap wrap" "slider pos"; align-items: center; }
.ct.one-plane .ct-pane .pane-head, .ct.one-plane .ct-pane .pane-right { display: contents; }
.ct.one-plane .ct-pane .pane-head > span:first-child { grid-area: label; padding: var(--s1) var(--s2); font-size: var(--fs-caption); }
.ct.one-plane .ct-pane .pane-right > span:first-child { grid-area: pos; padding: 0 var(--s2) 0 0; font-size: var(--fs-caption); }
.ct.one-plane .ct-pane .ct-enlarge { grid-area: tools; margin: var(--s1); }
.ct.one-plane .ct-pane .canvas-wrap { grid-area: wrap; height: auto; aspect-ratio: 1 / 1; overflow: hidden; }
.ct.one-plane .ct-pane canvas, .reveal-ct .ct.one-plane .ct-pane canvas { touch-action: none; transform-origin: 0 0; }
.ct.one-plane .ct-pane input[type=range] { grid-area: slider; width: auto; margin: var(--s1) var(--s2); }
.ct.one-plane .ct-pane.focus::after { display: none; }

/* image wells and the full-screen film viewer (DESIGN_PLAN 2.5, D07) */
.well-label { display: block; padding: var(--s1) var(--s2) 0; font: var(--t-caption); color: var(--on-film-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xray-fig figcaption { border-top: 0; padding: var(--s1) var(--s2) var(--s2); }
.ct-pane .pane-title .sim { color: var(--on-film-dim); }
.lightbox.film-viewer { background: var(--viewer); }
.film-viewer .lb-bar { min-height: 52px; padding: max(var(--s1), env(safe-area-inset-top)) max(var(--s2), env(safe-area-inset-right)) var(--s1) max(var(--s4), env(safe-area-inset-left)); }
.film-viewer .lb-bar #lb-title { order: 0; flex: 1; min-width: 0; font: var(--t-head); color: var(--on-film-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.film-viewer .lb-close, .film-viewer .lb-nav { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-height: 44px; padding: 0;
  color: var(--on-film-hi); background: var(--veil); border: 1px solid var(--film-hair); border-radius: 50%; }
.film-viewer .lb-close:hover:not(:disabled), .film-viewer .lb-nav:hover:not(:disabled) { border-color: var(--on-film); }
.film-viewer .lb-nav { position: absolute; top: 50%; z-index: 2; transform: translateY(-50%); }
.film-viewer .lb-nav.prev { left: max(var(--s3), env(safe-area-inset-left)); }
.film-viewer .lb-nav.next { right: max(var(--s3), env(safe-area-inset-right)); }
.film-viewer .lb-view { cursor: grab; }

/* the 3D toolbar (DESIGN_PLAN 2.5, D08): one row of chips on the film at the top of the stage, at every
   width; it scrolls sideways when the row is longer than the stage */
.tools3d, .stage > .tools3d, .reveal .reveal-tools { position: absolute; top: var(--s3); left: var(--s3); right: var(--s3); z-index: 5; display: flex; flex-wrap: nowrap;
  gap: var(--s2); align-items: center; overflow-x: auto; scrollbar-width: none; max-width: none; margin: 0; }
.tools3d::-webkit-scrollbar { display: none; }
.tools3d > * { flex: none; }
.reveal .reveal-tools { left: var(--gap); right: auto; max-width: calc(100% - 2 * var(--gap)); }
.reveal.drawer-open .reveal-tools { max-width: calc(100% - var(--panel-w) - 3 * var(--gap)); }
@media (max-width: 900px) { .reveal .reveal-tools, .reveal.drawer-open .reveal-tools { left: var(--s3); max-width: calc(100% - 2 * var(--s3)); } }
.tools3d button, .tools3d select { min-height: 36px; padding: 0 var(--s3); font: var(--t-footnote); color: var(--on-film); background: var(--veil-soft); border: 1px solid var(--film-hair); }
.tools3d button:hover:not(:disabled) { color: var(--on-film-hi); border-color: var(--on-film); }
.tools3d button.on { color: var(--on-film-hi); background: var(--film-sel); border-color: var(--on-film-accent); }
.tools3d select[hidden] { display: none; }
.tools3d .note:not(:empty) { color: var(--on-film); font-size: var(--fs-caption); background: var(--veil); padding: var(--s1) var(--s2); border-radius: var(--r-small); white-space: normal; max-width: 22rem; }
.tools3d :focus-visible, .reveal .reveal-tools :focus-visible { outline-color: var(--on-film-accent); outline-offset: -2px; }
@media (pointer: coarse) { .tools3d button, .tools3d select { min-height: var(--hit); } }
.type-explorer .stage { min-height: 440px; background: var(--film); border-radius: var(--r-card); }
/* the loading state: a bar and the size on the film until the model is ready */
.viewer3d .load3d { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s2);
  font: var(--t-caption); color: var(--on-film-dim); pointer-events: none; }
.load3d .load-bar { width: min(240px, 60%); height: 4px; overflow: hidden; background: var(--film-hair); border-radius: 2px; }
.load3d .load-bar > span { display: block; width: 0; height: 100%; background: var(--on-film-accent); }
.viewer3d .hint { left: var(--s3); right: var(--s3); bottom: var(--s2); max-width: max-content; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* implant lists under a treatment option (task T06): the category name, at most five products, a fold for the rest */
.cat-name { margin: var(--s3) 0 var(--s1); font: var(--t-head); }
.pcard .link-note { margin-top: 2px; font: var(--t-caption); color: var(--review); }
.neutrality p { margin: 0 0 var(--s2); }

/* the first visit's notice (task T04, DESIGN_PLAN 3.13): a centred dialog, a bottom sheet on phones */
.firstrun { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: var(--s4); background: var(--scrim); }
.firstrun-sheet { width: 100%; max-width: 480px; padding: var(--s5); background: var(--surface); border-radius: var(--r-card); }
.firstrun-sheet h2 { font: var(--t-title2); margin: 0 0 var(--s3); }
.firstrun-sheet p { margin: 0 0 var(--s3); }
.firstrun-steps { display: flex; flex-direction: column; gap: var(--s2); }
.firstrun-steps .lead { font: var(--t-head); }
.firstrun-steps .glyphs { display: flex; gap: var(--s4); flex-wrap: wrap; }
.firstrun-steps .glyph { display: inline-flex; align-items: center; gap: var(--s1); font: var(--t-footnote); color: var(--text-2); }
.firstrun-steps .glyph .icon { width: 20px; height: 20px; color: var(--accent); }
.firstrun-sheet .primary { width: 100%; justify-content: center; margin-top: var(--s2); }
@media (max-width: 767px) {
  .firstrun { align-items: flex-end; padding: 0; }
  .firstrun-sheet { max-width: none; padding: var(--s5) max(var(--s4), env(safe-area-inset-right)) calc(var(--s5) + env(safe-area-inset-bottom)) max(var(--s4), env(safe-area-inset-left));
    border-radius: var(--r-sheet) var(--r-sheet) 0 0; box-shadow: var(--shadow-sheet); }
}
.study-note { margin-top: var(--s4); }
.citation { margin: 0 0 var(--s3); max-width: var(--measure); }

/* the reveal report: a restyled drawer on wide screens, a bottom sheet on phones (DESIGN_PLAN 2.5, 3.6, D09) */
.reveal .side.drawer { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-card); }
.sheet-handle, .sheet-films { display: none; }
@media (max-width: 767px) {
  .reveal .viewer3d { height: calc(100svh - 48px - var(--actionbar)); min-height: 360px; border-radius: 0; }
  .reveal { margin: 0 calc(-1 * var(--gap)); }
  .reveal .side.drawer { position: fixed; top: auto; left: 0; right: 0; bottom: var(--actionbar); z-index: 35; width: auto; height: 40vh; max-height: none;
    margin: 0; padding: 0 var(--gap) var(--s4); overflow: auto; overscroll-behavior: contain; border: 0; border-radius: var(--r-sheet) var(--r-sheet) 0 0;
    box-shadow: var(--shadow-sheet); transition: height .25s ease-out; }
  .reveal .side.drawer[data-sheet="peek"] { height: 72px; overflow: hidden; }
  .reveal .side.drawer[data-sheet="full"] { height: calc(90svh - var(--actionbar)); }
  .reveal .side.drawer.dragging { transition: none; }
  .sheet-handle { display: flex; align-items: center; justify-content: center; position: sticky; top: 0; z-index: 3; width: calc(100% + 2 * var(--gap));
    height: 32px; min-height: 32px; margin: 0 calc(-1 * var(--gap)) var(--s2); padding: 0; background: var(--surface); border: 0; border-radius: 0; cursor: grab; touch-action: none; }
  .sheet-handle::after { content: ""; position: absolute; inset: -6px 0; }          /* a 44 px tall target */
  .sheet-handle:hover:not(:disabled) { border: 0; }
  .sheet-handle .grip { width: 36px; height: 5px; border-radius: 3px; background: var(--hair-strong); }
  .sheet-films { display: block; margin: var(--s4) 0 0; }
  .reveal-below { padding-bottom: calc(72px + var(--s5)); }      /* room above the lowered sheet */
}

/* treatment option cards and their Manufacturer links box (DESIGN_PLAN 2.5, 3.7, D09) */
.option, .option:hover:not(:disabled) { display: block; margin: 0 0 var(--s3); padding: var(--s4); background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-card); box-shadow: none; text-align: left; }
.side .option { background: var(--surface-2); }
.option.sel, .option.sel:hover:not(:disabled) { border-color: var(--accent); box-shadow: none; background: var(--surface-2); }
.option:not(.sel) { cursor: pointer; }
.option:not(.sel):hover { border-color: var(--hair-strong); }
.option h3 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); margin: 0 0 var(--s1); }
.option .pick { display: inline; width: auto; min-height: 0; text-align: left; }
.option .pick::after { content: ""; display: inline-block; width: .45rem; height: .45rem; margin-left: var(--s2); vertical-align: .15em; border-right: 2px solid var(--text-2); border-bottom: 2px solid var(--text-2); transform: rotate(45deg); }
.option .pick[aria-expanded="true"]::after { transform: rotate(-135deg); vertical-align: -.05em; }
.chip-tag { display: inline-flex; align-items: center; min-height: 22px; padding: 0 var(--s2); font: var(--t-footnote); color: var(--text); background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-control); }
.option .opt-line { font: var(--t-body); margin: var(--s1) 0; }
.option .opt-body { margin-top: var(--s2); }
.mlinks { margin: var(--s4) 0 0; padding: var(--s3); background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-control); cursor: auto; }
.mlinks h4 { margin: 0 0 var(--s1); font: var(--t-head); }
.mlinks-cat { margin: var(--s2) 0 var(--s1); font: var(--t-footnote); color: var(--text-2); }
.prows { list-style: none; margin: 0; padding: 0; }
.prows > li { border-top: 1px solid var(--hair); }
.prows > li:last-child { border-bottom: 1px solid var(--hair); }
.prow { display: flex; align-items: center; gap: var(--s2); min-height: 48px; padding: var(--s1) var(--s1); color: var(--text); }
.prow:hover { text-decoration: none; background: var(--surface-2); }
.prow-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.prow-name { font: var(--t-sub); font-weight: 500; color: var(--accent); }
.prow-co { font: var(--t-caption); color: var(--text-2); }
.prow .icon.ext { width: 18px; height: 18px; color: var(--text-2); }
.prow .link-note { color: var(--review); }
.mlinks-all { display: inline-flex; align-items: center; min-height: var(--hit); font: 500 var(--fs-sub)/var(--lh-sub) var(--font); }
.mlinks-note { margin: var(--s1) 0 0; font: var(--t-caption); color: var(--text-2); }
.catalog-rows { max-width: 72rem; columns: 2 22rem; column-gap: var(--s6); }
.catalog-rows > li { break-inside: avoid; }

/* Learn index and Learn page (DESIGN_PLAN 3.8, 3.9, D10) */
.mixed-row { margin: 0 0 var(--s4); }
@media (min-width: 1000px) { .mixed-row { max-width: calc(50% - var(--s6) / 2); } }
.row-minis { flex: none; display: flex; gap: var(--s1); }
.row-minis img { width: 52px; aspect-ratio: 4 / 3; object-fit: contain; background: var(--diagram); border-radius: var(--r-small); display: block; }
.row-chev { flex: none; width: .5rem; height: .5rem; margin: 0 var(--s2) 0 var(--s1); border-right: 2px solid var(--text-2); border-bottom: 2px solid var(--text-2); transform: rotate(-45deg); }
.row-title .badge { margin-left: var(--s2); vertical-align: .1em; }
.chip-row { align-items: center; margin: var(--s2) 0 var(--s5); }
.chip-row .tag { margin-left: 0; vertical-align: baseline; min-height: 32px; display: inline-flex; align-items: center; }
.chip-link.primary-chip { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.chip-link.primary-chip:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.page-glance { background: none; border: 0; border-radius: 0; padding: 0; margin: var(--s5) 0 var(--s2); max-width: var(--measure); }
.page-glance h2 { font: var(--t-title3); margin: 0 0 var(--s2); }
.page-glance ul { padding-left: var(--s5); }
.page-glance li { font: var(--t-body); margin: var(--s1) 0; }
/* the at-a-glance lines as a plain definition list: the label in small secondary type, the line beside it
   (stacked on phones) */
.glance dt.chip, .side .glance dt.chip { min-width: 0; padding: 0; text-align: left; font: var(--t-footnote); color: var(--text-2); background: none; border: 0; border-radius: 0; }
.glance { column-gap: var(--s4); }
.learn-end { margin: var(--s5) 0; }
.key-cell { gap: var(--s1); }

/* the quiz (DESIGN_PLAN 3.10, D11): progress bar, the slip as a card, letter-first 48 px rows, marks after answering */
.qprogress { height: 3px; margin: 0 0 var(--s4); overflow: hidden; background: var(--hair); border-radius: 2px; }
.qprogress > span { display: block; height: 100%; width: 0; background: var(--accent); }
.qprogress[hidden] { display: none; }
.quiz-start { max-width: var(--measure); }
.quiz-start p { font: var(--t-body); }
.count-step { display: inline-flex; align-items: center; gap: var(--s2); margin: var(--s2) 0 var(--s4); }
.count-step button { width: 44px; min-height: 44px; justify-content: center; padding: 0; font: var(--t-title3); }
.count-step output { min-width: 10rem; text-align: center; font: var(--t-head); }
.vignette, .side .vignette { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-card); padding: var(--s3) var(--s4); }
.side .vignette { background: var(--surface-2); }
.qopt { position: relative; min-height: 48px; align-items: center; }
.qopt input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.qopt kbd, .opt.qopt kbd { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin: 0; padding: 0;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--hair-strong); border-radius: var(--r-small); }
.qopt:has(input:checked) { box-shadow: inset 3px 0 0 var(--accent); }
.qopt:has(input:checked) kbd { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.qopt.is-right, .qopt.is-right:has(input:checked) { border-color: var(--ok); box-shadow: inset 4px 0 0 var(--ok); }
.qopt.is-wrong, .qopt.is-wrong:has(input:checked) { border-color: var(--bad); box-shadow: inset 4px 0 0 var(--bad); }
.opt-why { margin: 0 0 var(--s2); padding: var(--s2) var(--s3); font: var(--t-sub); background: var(--surface-2); border-left: 3px solid var(--bad); border-radius: 0 0 var(--r-small) var(--r-small); }
.score-big { display: flex; align-items: baseline; gap: var(--s3); margin: var(--s2) 0; }
.score-big .num { font: 700 calc(var(--fs-title1) * 1.6)/1.1 var(--font); }
.score-big .lab { font: var(--t-head); color: var(--text-2); }
.score-line { margin: var(--s1) 0; font: var(--t-body); }
.score-actions { margin: var(--s4) 0 var(--s5); }
.score-more { margin-top: var(--s4); }
@media (max-width: 767px) {
  body[data-route="quiz"] .tabbar, body[data-route="apply"] .tabbar, body[data-route="try"] .tabbar { display: none; }
  body[data-route="quiz"], body[data-route="apply"], body[data-route="try"] { padding-bottom: calc(var(--actionbar) + var(--s5)); }
}

/* Progress (DESIGN_PLAN 3.11, D12): a summary line, one piece of advice, two bars per classification */
.progress-summary { margin: 0 0 var(--s3); font: var(--t-head); max-width: 860px; }
.advice { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4); max-width: 860px; margin: 0 0 var(--s5); padding: var(--s3) var(--s4);
  background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-card); }
.advice p { flex: 1 1 18rem; margin: 0; font: var(--t-body); }
.progress-rows { max-width: 860px; }
.progress-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 340px); gap: var(--s2) var(--s5); align-items: center; padding: var(--s3) var(--s1); }
.progress-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.progress-name a { font: var(--t-head); color: var(--text); }
.progress-bars { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) 2.8rem; gap: var(--s1) var(--s2); align-items: center; font: var(--t-caption); color: var(--text-2); }
.progress-bars .bar { display: block; border-radius: 4px; }
.progress-bars .bar-pct { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.progress-more { grid-column: 1 / -1; margin: 0; }
.progress-more > summary { font-size: var(--fs-caption); min-height: 32px; padding: var(--s1) 0; }
.mixed-title { margin-top: var(--s5); }
.reset-line { margin: var(--s5) 0; }
@media (max-width: 767px) { .progress-row { grid-template-columns: 1fr; } }

/* About and Privacy (DESIGN_PLAN 3.12, D13): a reading column; the study-tool notice as a box with an
   amber bar, not a warning fill; the appearance choice as a segmented control */
.study-box { max-width: var(--measure); padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--hair); border-left: 4px solid var(--review); border-radius: var(--r-control); }
.prose h2 { font: var(--t-title3); margin: var(--s5) 0 var(--s2); }
.theme-seg { display: inline-flex; margin: var(--s1) 0 var(--s3); }
.theme-seg button { border-radius: 0; margin-left: -1px; min-width: 5.5rem; justify-content: center; font: var(--t-footnote); }
.theme-seg button:first-child { border-radius: var(--r-control) 0 0 var(--r-control); margin-left: 0; }
.theme-seg button:last-child { border-radius: 0 var(--r-control) var(--r-control) 0; }

/* touch targets (D14): every control at least 44 px on touch screens */
.skip { min-height: var(--hit); display: inline-flex; align-items: center; }
.site-foot a, .actions-row a, .crumbs a { min-width: var(--hit); justify-content: center; }
.sb-dot { width: 44px; }
@media (pointer: coarse) {
  .cat-jump a { display: inline-flex; align-items: center; min-height: var(--hit); }
  .tools3d .seg button, .theme-seg button { min-width: 44px; }
  .bonemap-pin { width: 44px; height: 44px; }
}

/* three steps per classification (owner request, 2026-11-16): home by region with the skeleton on the
   page, Practice, the film drill (Try it) and View in 3D. Existing rows, chips, wells and tokens only. */
/* home: the skeleton in a block above the region list on phones (about 45 percent of the screen, with
   a Hide or Show control); from 768 px it stays in view beside the list while the list scrolls */
.home-skel { margin: 0 0 var(--s3); }
/* the block keeps its height while the model loads, so the list under it does not jump */
.home-skel .bonemap-holder { min-height: max(260px, 45vh); min-height: max(260px, 45svh); background: var(--film); border-radius: var(--r-card); }
.home-skel .bonemap-holder[hidden] { display: none; }
.home-skel .bonemap-holder.failed { min-height: 0; background: none; }
.home-skel .bonemap-view { height: 45vh; height: 45svh; min-height: 260px; }
button.skel-toggle { min-height: var(--hit); }
.skel-hint { font: var(--t-caption); color: var(--text-2); }
.skel-hint[hidden] { display: none; }
@media (max-width: 767px) {
  .skel-bar.phone-only { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
  /* the short block keeps its top clear for the head and neck markers: the view buttons sit at the foot,
     and the hint is beside the Hide control instead of over the feet */
  .home-skel .bonemap-views { top: auto; bottom: 8px; }
  .home-skel .bonemap-hint { display: none; }
}
.home-list > .region-group:first-child { margin-top: 0; }
.region-group h2:focus { outline: none; }
.region-group h2.flash { background: var(--accent-wash); box-shadow: calc(-1 * var(--s2)) 0 0 var(--accent-wash), var(--s2) 0 0 var(--accent-wash); }
@media (min-width: 768px) {
  .home { display: grid; grid-template-columns: minmax(320px, min(40%, 400px)) minmax(0, 1fr); column-gap: var(--s6); align-items: start; }
  .home > .home-card { grid-column: 2; grid-row: 1; }
  .home > .home-list { grid-column: 2; grid-row: 2; }
  .home > .home-skel { grid-column: 1; grid-row: 1 / span 2; position: sticky; top: calc(var(--bar) + var(--s4)); margin: 0; }
  .home-skel .bonemap-holder, .home-skel .bonemap-view { height: calc(100vh - var(--bar) - 2 * var(--s4)); min-height: 420px; max-height: 680px; }
  .home-skel .bonemap-holder.failed { height: auto; }
}
/* a row with small trailing links: the row itself opens Learn, the links go to the later steps */
.split-row { display: flex; align-items: stretch; }
.split-row > .row { flex: 1; width: auto; min-width: 0; }
.row-link { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 3.25rem; min-height: var(--hit); padding: 0 var(--s2); font: var(--t-footnote); white-space: nowrap; }
.row-link:hover { text-decoration: none; background: var(--surface-2); }
.row-link:focus-visible { outline-offset: -2px; }
/* Practice: two lists of rows under region names */
.practice-part { margin: var(--s5) 0 0; }
.practice-part h2 { font: var(--t-title3); margin: 0 0 var(--s1); }
.practice-part h3 { font: var(--t-footnote); color: var(--text-2); margin: var(--s4) 0 var(--s1); }
/* Learn: the View in 3D button under a type's heading; the film drill's missed types */
.sub-actions { margin: 0 0 var(--s4); }
.missed-rows { max-width: 860px; }
/* View in 3D: the model or the films, chosen with a two-part control */
.view-tabs { display: inline-flex; margin: var(--s1) 0 var(--s3); }
.view-tabs button { border-radius: 0; margin-left: -1px; min-width: 7rem; justify-content: center; font: var(--t-footnote); }
.view-tabs button:first-child { border-radius: var(--r-control) 0 0 var(--r-control); margin-left: 0; }
.view-tabs button:last-child { border-radius: 0 var(--r-control) var(--r-control) 0; }
.free-view .case-grid[hidden], .view-films[hidden], .view-ct[hidden] { display: none; }
.free-view .side .key-line { font: var(--t-head); margin: 0 0 var(--s3); }
.free-view .side .row-actions { margin: var(--s4) 0 0; }
@media (min-width: 901px) { .free-view .viewer3d { height: calc(100vh - var(--bar) - 190px); min-height: 440px; max-height: 760px; } }
@media (max-width: 767px) { .free-view .viewer3d { height: 60vh; height: 60svh; min-height: 360px; } }
/* three parts (3D model, Radiographs, CT) share the width on a phone */
@media (max-width: 767px) { .view-tabs { display: flex; } .view-tabs button { flex: 1 1 0; min-width: 0; padding-left: var(--s2); padding-right: var(--s2); } }

/* About me (owner request, 2026-11-21): the reading column with photos. A photo not yet supplied is a
   dashed box that says what goes there; a gap in the draft text is marked with a dashed underline */
.about-me .me-photo { margin: var(--s4) 0; max-width: 100%; border-radius: var(--r-card); overflow: hidden; }
.about-me .me-photo.portrait { width: 220px; aspect-ratio: 4 / 5; }
.about-me .me-photo.wide { aspect-ratio: 3 / 2; }
.about-me .me-photo.wide.empty { aspect-ratio: 5 / 2; min-height: 160px; }
.about-me .me-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.about-me .me-photo.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s1); padding: var(--s4); text-align: center; background: var(--surface); border: 1px dashed var(--hair-strong); color: var(--text-2); font: var(--t-sub); }
.about-me .me-photo.empty strong { font: var(--t-head); color: var(--text); }
.about-me .gap { border-bottom: 1px dashed var(--hair-strong); color: var(--text-2); }
.about-me .gap::before { content: '['; }
.about-me .gap::after { content: ']'; }
.about-me .draft-line { margin: 0 0 var(--s3); }
.donate-box { margin: var(--s4) 0; }
.donate-box p { margin: var(--s2) 0 0; font: var(--t-caption); }
