/* ===== Atlas (js/f-atlas.js): the knowledge graph. Everything here is prefixed .atl- and built from tokens. ===== */
.atl { --atl-h: max(420px, 72vh); display: grid; gap: 14px; container-type: inline-size; container-name: atl; min-width: 0 }

/* header counts */
.atl-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font: 500 .72rem/1.3 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted) }
.atl-stats span { display: inline-flex; align-items: baseline; gap: 6px }
.atl-stats b { font: 720 1.15rem/1 var(--f-display); letter-spacing: -.02em; text-transform: none; color: var(--ink); font-variant-numeric: tabular-nums }

/* toolbar */
.atl-bar { display: grid; gap: 12px; min-width: 0 }
.atl-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center }
.atl-acts { gap: 8px }
.atl-find { position: relative; flex: 1 1 300px; max-width: 560px; min-width: 0 }
.atl-find .search-in { max-width: none; width: 100% }
.atl-find .search-in input, .atl-find .search-in input:focus { border: 0; border-radius: 0; padding: 0; background: none; box-shadow: none; width: auto; height: 100% }
.atl-sug { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 15; display: grid; gap: 2px; padding: 6px; max-height: min(360px, 60vh); overflow-y: auto; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); overscroll-behavior: contain }
.atl-opt { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); text-align: left }
.atl-opt:hover, .atl-opt:focus-visible { background: var(--accent-soft); color: var(--accent-ink); outline-offset: -2px }
.atl-on { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .92rem }
.atl-opt small { flex: none; font: 500 .64rem/1.2 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.atl-none { padding: 10px 12px; font-size: .88rem; color: var(--muted) }
.atl-acts .chip { min-height: 42px; padding-inline: 14px }
.atl-seen .ic { color: var(--v0) }
.atl-types .chip small { margin-left: 0 }

/* swatches: one shape per type, color from --kc (molecules use the .c-<category> classes from app.css) */
.atl-sw { --kc: var(--muted); display: inline-block; width: 11px; height: 11px; flex: none; background: var(--kc) }
.atl-s-dot { border-radius: 50% }
.atl-s-sq { border-radius: 3px }
.atl-s-dia { transform: rotate(45deg) scale(.86); border-radius: 2px }
.atl-s-hex { clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); width: 12px }
.atl-s-ring { border-radius: 50%; background: radial-gradient(circle closest-side, var(--kc) 0 34%, var(--surface) 36% 58%, var(--kc) 60%) }
.atl-s-multi { border-radius: 50%; background: conic-gradient(var(--k-signal) 0 25%, var(--k-receptor) 0 50%, var(--k-enzyme) 0 75%, var(--k-gene) 0) }
.atl-t-pw { --kc: var(--k-receptor) } .atl-t-comp { --kc: var(--k-drug) } .atl-t-goal { --kc: var(--accent) } .atl-t-int { --kc: var(--k-out) } .atl-t-mol { --kc: var(--ink2) }

/* legend */
.atl-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; list-style: none; margin: 0; padding: 0; font-size: .78rem; color: var(--ink2) }
.atl-legend li { display: inline-flex; align-items: center; gap: 6px }
.atl-legend .atl-sw { width: 9px; height: 9px }
.atl-lg-h { font: 600 .62rem/1.2 var(--f-mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted) }
.atl-legend .atl-lg-h:not(:first-child) { margin-left: 8px; padding-left: 14px; border-left: 1px solid var(--line2) }
.atl-ln { display: inline-block; width: 18px; height: 3px; border-radius: 2px; background: var(--kc) }
.atl-v0 { --kc: var(--v0) } .atl-v1 { --kc: var(--v1) } .atl-v2 { --kc: var(--v2) } .atl-v3 { --kc: var(--v3) }

/* layout: map and panel side by side when the module is wide, stacked on phones */
.atl-grid { display: grid; gap: 14px; align-items: start; min-width: 0 }
@container atl (min-width: 860px) {
  .atl-grid { grid-template-columns: minmax(0, 1fr) minmax(300px, 340px) }
  .atl-panel { height: var(--atl-h); overflow-y: auto; overscroll-behavior: contain }
  .atl-pick { display: none !important }
}

/* the map */
.atl-stage.card { position: relative; display: block; height: var(--atl-h); padding: 0; gap: 0; overflow: hidden; border-radius: var(--r-lg); background-color: var(--surface); background-image: radial-gradient(circle at 1.5px 1.5px, var(--line2) 1.1px, transparent 1.6px); background-size: 26px 26px; outline: none; isolation: isolate }
.atl-stage.card:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: var(--r-lg) }
.atl-stage::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse 75% 70% at 50% 50%, transparent 62%, color-mix(in srgb, var(--surface) 72%, transparent) 100%) }
.atl-cv { position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent }
.atl-blank { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 24px; margin: 0; text-align: center; font-size: .92rem; line-height: 1.5; color: var(--muted); pointer-events: none }
.atl-cv.pt { cursor: pointer }
.atl-cv.grab { cursor: grabbing }
.atl-ctl { position: absolute; top: 12px; right: 12px; z-index: 3; display: grid; gap: 6px }
.atl-ctl .iconbtn { background: var(--glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: var(--shadow) }
.atl-status { position: absolute; left: 12px; bottom: 12px; z-index: 2; max-width: calc(100% - 24px); padding: 6px 12px; border-radius: 999px; background: var(--glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid var(--line); font: 500 .7rem/1.3 var(--f-mono); letter-spacing: .03em; color: var(--muted); pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.atl-status:empty { display: none }
.atl-banner { position: absolute; top: 12px; left: 12px; right: 62px; z-index: 3; display: grid; gap: 6px; justify-items: start; pointer-events: none }
.atl-bn { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; max-width: 100%; padding: 4px 6px 4px 12px; border-radius: 12px; background: var(--glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: .82rem; color: var(--ink2); pointer-events: auto }
.atl-bn b { color: var(--ink); font-weight: 650 }
.atl-bn .btn { min-height: 30px }
.atl-tip { position: absolute; left: 0; top: 0; z-index: 4; display: grid; gap: 2px; max-width: 280px; padding: 8px 11px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line); box-shadow: var(--shadow-lg); pointer-events: none; will-change: transform }
.atl-tip strong { font: 650 .9rem/1.3 var(--f-text); color: var(--ink) }
.atl-tip span { font: 500 .66rem/1.4 var(--f-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted) }
.atl-pick { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 14px; background: var(--raised); border: 1px solid var(--line); box-shadow: var(--shadow-lg) }
.atl-pick-n { display: flex; align-items: center; gap: 9px; min-width: 0; font-weight: 650; font-size: .92rem }
.atl-pick-n > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.atl-stage.has-pick .atl-status { display: none }
@container atl (min-width: 860px) { .atl-stage.has-pick .atl-status:not(:empty) { display: block } }

/* the panel */
.atl-panel.card { border-radius: var(--r-lg); gap: 14px; align-content: start; min-width: 0 }
.atl-ph { display: grid; gap: 6px; min-width: 0; position: relative }
.atl-ph.has-x { padding-right: 42px }
.atl-x { position: absolute; top: -4px; right: -4px }
.atl-ph .card-h { overflow-wrap: anywhere }
.atl-ph .card-h:focus { outline: none }
.atl-ph .card-h:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px }
.atl-desc { font-size: .94rem; line-height: 1.6; color: var(--ink2) }
.atl-desc.muted { color: var(--muted); font-size: .9rem }
.atl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font: 500 .7rem/1.5 var(--f-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--muted) }
.atl-seen-tag { display: inline-flex; align-items: center; gap: 3px; color: var(--v0) }
.atl-seen-tag .ic { width: 13px; height: 13px; stroke-width: 2.6 }
.atl-grp { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); min-width: 0 }
.atl-grp .chips { gap: 6px }
.atl-n { margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--sunk); color: var(--ink2); letter-spacing: 0 }
.atl-nb { min-height: 32px; padding: 4px 11px; font-size: .82rem; max-width: 100% }
.atl-nb > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0 }
.atl-nb .atl-sw { width: 9px; height: 9px }
.atl-nb .vmeter { gap: 2px; margin-left: 2px }
.atl-nb .vmeter i { width: 7px; height: 5px }
.atl-help { display: grid; gap: 5px; padding-left: 1.1em; font-size: .86rem; color: var(--ink2); line-height: 1.5 }
.atl-help kbd { font-size: .66rem; padding: 2px 5px }
.atl-prog { display: grid; gap: 7px }
.atl-prog > div { display: grid; grid-template-columns: 96px minmax(40px, 1fr) auto; align-items: center; gap: 10px; font-size: .84rem; color: var(--ink2) }
.atl-prog .bar > span { background: var(--v0) }
.atl-prog .mono { color: var(--muted) }
.atl-rfind { max-width: none; flex: none }
.atl-rfind .search-in { height: 40px }
.atl-rfind .atl-sug { position: static; margin-top: 6px; box-shadow: var(--shadow) }
.atl-route { display: grid; gap: 8px }
.atl-route .eyebrow:focus { outline: none }
.atl-route .eyebrow:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px }
.atl-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: atl }
.atl-steps li { display: grid; gap: 2px; position: relative; padding-left: 18px }
.atl-steps li::before { content: ""; position: absolute; left: 5px; top: 0; bottom: 0; width: 2px; background: var(--accent); opacity: .35 }
.atl-steps li:first-child::before { top: 18px }
.atl-steps li:last-child::before { bottom: calc(100% - 18px) }
.atl-via { font: 500 .66rem/1.4 var(--f-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--accent-ink); padding: 4px 0 0 4px }
.atl-step { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 38px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); text-align: left; flex-wrap: wrap; position: relative }
.atl-step::before { content: ""; position: absolute; left: -17px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent) }
.atl-step:hover { border-color: var(--accent); color: var(--accent-ink) }
.atl-step > span { font-weight: 600; font-size: .88rem; min-width: 0; overflow-wrap: anywhere }
.atl-step small { margin-left: auto; font: 500 .62rem/1.3 var(--f-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted) }
.atl-note { display: flex; gap: 8px; align-items: flex-start; padding-top: 12px; border-top: 1px solid var(--line); font-size: .8rem; line-height: 1.5; color: var(--muted) }
.atl-note .ic { width: 16px; height: 16px; flex: none; margin-top: 1px }

@media (max-width: 559px) {
  .atl-acts { width: 100% }
  .atl-acts .btn, .atl-acts .chip { flex: 1 1 auto; justify-content: center }
  .atl-legend .atl-lg-h:not(:first-child) { margin-left: 0; padding-left: 0; border-left: 0; flex-basis: 100% }
  .atl-legend .atl-lg-h:first-child { flex-basis: 100% }
  .atl-ctl { top: 10px; right: 10px }
  .atl-banner { top: 10px; left: 10px; right: 56px }
}
@media (prefers-reduced-motion: reduce) { .atl-opt, .atl-step { transition: none } }

/* ===== Body explorer (js/f-body.js). Everything is scoped under .bdx (SVG classes bx-*, fx-*, hs-*) and built from tokens.
   Tissue colors follow the slide metaphor: in light theme they read like an H&E section (purple epidermis, pink dermis,
   pale fat, red-violet muscle, ivory bone); in dark theme the same mixes glow like fluorescence. ===== */
.bdx {
  container: bdx / inline-size; display: grid; gap: 16px; min-width: 0;
  --bd-air: color-mix(in srgb, var(--c5) 9%, var(--surface));
  --bd-skin: color-mix(in srgb, var(--c3) 19%, var(--surface));
  --bd-skin-hi: color-mix(in srgb, var(--c3) 9%, var(--surface));
  --bd-skin-line: color-mix(in srgb, var(--c8) 28%, var(--ink2));
  --bd-hair: color-mix(in srgb, var(--ink2) 52%, var(--surface));
  --bd-lip: color-mix(in srgb, var(--c1) 34%, var(--surface));
  --bd-sclera: color-mix(in srgb, var(--c5) 4%, var(--surface));
  --bd-pupil: var(--ink);
  --bd-sc: color-mix(in srgb, var(--c1) 8%, var(--surface));
  --bd-sc1: color-mix(in srgb, var(--c1) 22%, var(--surface));
  --bd-sc2: color-mix(in srgb, var(--c1) 32%, var(--surface));
  --bd-epi: color-mix(in srgb, var(--c7) 13%, var(--surface));
  --bd-epc: color-mix(in srgb, var(--c7) 21%, var(--surface));
  --bd-nuc: color-mix(in srgb, var(--c2) 52%, var(--surface));
  --bd-nuc2: color-mix(in srgb, var(--c2) 70%, var(--ink));
  --bd-mel: color-mix(in srgb, var(--c8) 55%, var(--ink2));
  --bd-pd: color-mix(in srgb, var(--c1) 9%, var(--surface));
  --bd-rd: color-mix(in srgb, var(--c1) 16%, var(--surface));
  --bd-col: color-mix(in srgb, var(--c1) 34%, var(--surface));
  --bd-col2: color-mix(in srgb, var(--c1) 25%, var(--surface));
  --bd-fat: color-mix(in srgb, var(--c3) 15%, var(--surface));
  --bd-fatc: color-mix(in srgb, var(--c3) 5%, var(--surface));
  --bd-fatl: color-mix(in srgb, var(--c3) 46%, var(--surface));
  --bd-ct: color-mix(in srgb, var(--c1) 7%, var(--sunk));
  --bd-ctl: color-mix(in srgb, var(--c1) 30%, var(--surface));
  --bd-musk: color-mix(in srgb, var(--c1) 55%, var(--c7));
  --bd-mus: color-mix(in srgb, var(--bd-musk) 17%, var(--surface));
  --bd-mf1: color-mix(in srgb, var(--bd-musk) 33%, var(--surface));
  --bd-mf2: color-mix(in srgb, var(--bd-musk) 26%, var(--surface));
  --bd-car: color-mix(in srgb, var(--c5) 13%, var(--surface));
  --bd-bone: color-mix(in srgb, var(--c3) 12%, var(--sunk));
  --bd-bonel: color-mix(in srgb, var(--c3) 36%, var(--surface));
  --bd-trab: color-mix(in srgb, var(--c3) 26%, var(--sunk));
  --bd-msp: color-mix(in srgb, var(--c1) 11%, color-mix(in srgb, var(--c3) 8%, var(--surface)));
  --bd-mar: color-mix(in srgb, var(--c1) 20%, var(--surface));
  --bd-st: color-mix(in srgb, var(--c3) 30%, var(--surface));
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bdx { --bd-pupil: var(--bg); --bd-sclera: color-mix(in srgb, var(--ink) 20%, var(--surface)) } }
:root[data-theme="dark"] .bdx { --bd-pupil: var(--bg); --bd-sclera: color-mix(in srgb, var(--ink) 20%, var(--surface)) }

/* ---------- layout: one column on phones, drawing + column at 720, drawing + column + panel at 1040 ---------- */
.bdx-grid { display: grid; gap: 16px; align-items: start; min-width: 0; grid-template-columns: minmax(0, 1fr); grid-template-areas: "side" "col" "panel" }
.bdx-side { grid-area: side; display: grid; gap: 16px; min-width: 0; align-content: start }
.bdx-colcard { grid-area: col }
.bdx-panel { grid-area: panel }
@container bdx (min-width: 720px) {
  .bdx-grid { grid-template-columns: 280px minmax(0, 1fr); grid-template-areas: "side col" "side panel" }
}
@container bdx (min-width: 1040px) {
  .bdx-grid { grid-template-columns: 280px minmax(0, 1fr) minmax(320px, 360px); grid-template-areas: "side col panel" }
  .bdx-panel { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; overscroll-behavior: contain }
}
@media (max-width: 560px) { .bdx .card { padding: 16px 14px } }

/* ---------- drawing card ---------- */
.bdx-draw { gap: 12px }
.bdx-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--sunk); border: 1px solid var(--line) }
.bdx-seg button { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 11px; border: 0; border-radius: 8px; background: none; color: var(--ink2); font-size: .85rem; font-weight: 600 }
.bdx-seg button .ic { width: 16px; height: 16px }
.bdx-seg button small { font: 500 .68rem var(--f-mono); color: var(--muted) }
.bdx-seg button[aria-pressed="true"] { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 10%, transparent) }
.bdx-seg button:hover:not(:disabled):not([aria-pressed="true"]) { color: var(--accent-ink) }
.bdx-fig { display: grid; place-items: center; border-radius: var(--r); padding: 6px 0; background: radial-gradient(ellipse 70% 60% at 50% 42%, var(--accent-soft), transparent 72%) }
.bdx-figsvg { display: block; width: 100%; height: auto; max-width: 290px; overflow: visible }
.bdx-fig.body .bdx-figsvg { max-width: 210px }
.bdx-regs { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; padding: 3px 3px 6px; margin: -3px -3px 0; contain: paint; max-width: calc(100% + 6px) }
.bdx-regs .chip { flex: none }
@container bdx (min-width: 720px) { .bdx-regs { flex-wrap: wrap; overflow: visible; padding-bottom: 2px } .bdx-regs .chip { flex: 0 1 auto; max-width: 100%; line-height: 1.3 } }
.bdx-seen { display: flex; align-items: center; gap: 6px }
.bdx-seen .ic { width: 16px; height: 16px; color: var(--v0) }

/* face and body drawing */
.bdx-fig .fx-skin { fill: var(--bd-skin); stroke: var(--bd-skin-line); stroke-width: 1.1; stroke-opacity: .5; stroke-linejoin: round }
.bdx-fig .fx-shade { fill: var(--bd-skin-line); opacity: .13 }
.bdx-fig .fx-ln { fill: none; stroke: var(--bd-skin-line); stroke-width: 1; stroke-linecap: round; opacity: .55 }
.bdx-fig .fx-faint { fill: none; stroke: var(--bd-skin-line); stroke-width: .9; stroke-linecap: round; opacity: .28 }
.bdx-fig .fx-hair { fill: var(--bd-hair) }
.bdx-fig .fx-strand { fill: none; stroke: color-mix(in srgb, var(--ink2) 60%, var(--surface)); stroke-width: .8; stroke-linecap: round; opacity: .45 }
.bdx-fig .fx-brow { fill: none; stroke: var(--bd-hair); stroke-width: 4; stroke-linecap: round }
.bdx-fig .fx-eye { fill: var(--bd-sclera); stroke: color-mix(in srgb, var(--ink2) 60%, transparent); stroke-width: .8 }
.bdx-fig .fx-iris { fill: color-mix(in srgb, var(--c5) 48%, var(--surface)); stroke: color-mix(in srgb, var(--c5) 60%, var(--ink2)); stroke-width: .6 }
.bdx-fig .fx-pupil { fill: var(--bd-pupil) }
.bdx-fig .fx-glint { fill: var(--bd-sclera) }
.bdx-fig .fx-lid { fill: none; stroke: color-mix(in srgb, var(--ink2) 85%, transparent); stroke-width: 1.5; stroke-linecap: round }
.bdx-fig .fx-nose { fill: none; stroke: var(--bd-skin-line); stroke-width: 1.2; stroke-linecap: round; opacity: .75 }
.bdx-fig .fx-nos { fill: var(--bd-skin-line); opacity: .42 }
.bdx-fig .fx-lip { fill: var(--bd-lip); stroke: color-mix(in srgb, var(--c1) 45%, var(--ink2)); stroke-width: .7; stroke-opacity: .6 }
.bdx-fig .fx-mouth { fill: none; stroke: color-mix(in srgb, var(--c1) 40%, var(--ink2)); stroke-width: 1.2; stroke-linecap: round }
.bdx-fig .fx-frame { fill: color-mix(in srgb, var(--surface) 70%, transparent); stroke: var(--line2); stroke-width: .8; stroke-dasharray: 2 2.5 }
.bdx-fig .fx-spine { fill: none; stroke: var(--bd-skin-line); stroke-width: 1; stroke-dasharray: 1.2 2; opacity: .6 }
.bdx-fig .fx-cap { font: 600 6px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; fill: var(--muted) }

/* hotspots */
.bdx-hs { cursor: pointer }
.bdx-hs:focus { outline: none }
.bdx-hs .hs-hit { fill: transparent }
.bdx-hs .hs-ring { fill: color-mix(in srgb, var(--accent) 18%, transparent); stroke: var(--accent); stroke-width: 1.4; transition: fill .15s }
.bdx-hs .hs-dot { fill: var(--accent) }
.bdx-hs.new .hs-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 1 }
.bdx-hs:hover .hs-ring { fill: color-mix(in srgb, var(--accent) 34%, transparent) }
.bdx-hs:focus-visible .hs-ring { stroke-width: 2.8; fill: color-mix(in srgb, var(--accent) 34%, transparent) }
/* a separate outer ring, so focus also shows on the selected (already filled) spot */
.bdx-hs:focus-visible .hs-hit { stroke: var(--ink); stroke-width: 1.4; stroke-dasharray: 2.6 1.8 }
.bdx-hs.on .hs-ring { fill: var(--accent) }
.bdx-hs.on .hs-dot { fill: var(--on-accent); stroke: none }
.bdx-hs .hs-pulse { fill: none; stroke: var(--accent); stroke-width: 1.2; transform-box: fill-box; transform-origin: center; animation: bdx-pulse 2.6s ease-out infinite; pointer-events: none }
@keyframes bdx-pulse { from { transform: scale(1); opacity: .75 } to { transform: scale(2.2); opacity: 0 } }
.bdx-fig .hs-lab { pointer-events: none }
.bdx-fig .hs-lab rect { fill: var(--ink) }
.bdx-fig .hs-lab text { font: 600 8.4px var(--f-text); fill: var(--surface) }

/* ---------- apply card ---------- */
.bdx-apply { gap: 12px }
.bdx-q { max-width: none; flex: none; width: 100% }
.bdx-cats .chip { min-height: 32px; padding: 4px 11px; font-size: .82rem }
.bdx-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--kc, var(--accent)); flex: none }
.bdx-aglist { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)) }
.bdx-aglist > p { grid-column: 1 / -1 }
.bdx-ag { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 42px; padding: 8px 11px; border: 1px solid var(--line2); border-radius: 10px; background: var(--surface); color: var(--ink2); text-align: left; font-size: .88rem; font-weight: 560; line-height: 1.3; transition: border-color .15s, background .15s }
.bdx-ag:hover { border-color: var(--kc, var(--accent)); color: var(--ink) }
.bdx-ag[aria-pressed="true"] { border-color: var(--kc, var(--accent)); background: color-mix(in srgb, var(--kc, var(--accent)) 12%, var(--surface)); color: var(--ink); font-weight: 650 }
.bdx-agn { flex: 1; min-width: 0; display: grid }
.bdx-agn small { font: 500 .66rem/1.3 var(--f-mono); letter-spacing: .04em; color: var(--muted) }
.bdx-vd { width: 7px; height: 7px; border-radius: 50%; flex: none; opacity: .85 }
.bdx-vd.v0 { background: var(--v0) } .bdx-vd.v1 { background: var(--v1) } .bdx-vd.v2 { background: var(--v2) } .bdx-vd.v3 { background: var(--v3) }
.bdx-ab { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; flex: none; background: var(--kc, var(--accent)); color: var(--on-solid); font: 700 .7rem var(--f-mono); margin-right: 6px; vertical-align: 1px }
.bdx-ag .bdx-ab { margin-right: 0 }
.bdx-pick { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 9px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); font-size: .88rem; outline: none }
.bdx-pick > span { display: inline-flex; align-items: center; gap: 8px }
.bdx-pick .ic { width: 17px; height: 17px }
.bdx-pick:focus-visible { box-shadow: 0 0 0 2.5px var(--accent) }

/* ---------- column card ---------- */
.bdx-colcard { gap: 12px }
.bdx-colhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px 16px }
.bdx-colhead > div:first-child { display: grid; gap: 4px; min-width: 0; flex: 1 1 220px }
.bdx-blurb { color: var(--ink2); font-size: .94rem; line-height: 1.5 }
.bdx-scale .chip { min-height: 32px; padding: 4px 11px; font-size: .82rem }
.bdx-colbox { position: relative; min-width: 0; border-radius: 12px; overflow: hidden; background: var(--surface) }
.bdx-col { display: block; width: 100%; max-width: 100%; height: auto; overflow: hidden }
.bdx-colempty { display: grid; justify-items: center; gap: 8px; padding: 40px 16px; color: var(--muted); text-align: center; border: 1px dashed var(--line2); border-radius: 12px }
.bdx-colempty .ic { width: 30px; height: 30px }
.bdx-caprow { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px }
.bdx-cap { font-size: .84rem; color: var(--muted); line-height: 1.5; max-width: 70ch }

/* band bases by tissue */
.bdx .t-sc.bx-b { fill: var(--bd-sc) } .bdx .t-epi.bx-b { fill: var(--bd-epi) } .bdx .t-muc.bx-b { fill: color-mix(in srgb, var(--c1) 12%, var(--bd-epi)) }
.bdx .t-dej.bx-b { fill: var(--bd-pd) } .bdx .t-pd.bx-b { fill: var(--bd-pd) } .bdx .t-rd.bx-b { fill: var(--bd-rd) }
.bdx .t-fat.bx-b, .bdx .t-fatb.bx-b { fill: var(--bd-fatc) } .bdx .t-fas.bx-b, .bdx .t-gal.bx-b, .bdx .t-per.bx-b { fill: var(--bd-ct) } .bdx .t-smas.bx-b { fill: color-mix(in srgb, var(--c3) 8%, var(--bd-ct)) }
.bdx .t-mus.bx-b { fill: var(--bd-mus) } .bdx .t-car.bx-b { fill: var(--bd-car) } .bdx .t-bone.bx-b { fill: var(--bd-bone) } .bdx .t-mar.bx-b { fill: var(--bd-mar) } .bdx .t-gen.bx-b { fill: var(--sunk) }
.bdx .bx-thin.t-sc { fill: var(--bd-sc2) } .bdx .bx-thin.t-epi, .bdx .bx-thin.t-muc { fill: color-mix(in srgb, var(--c7) 42%, var(--surface)) } .bdx .bx-thin.t-dej { fill: color-mix(in srgb, var(--c2) 50%, var(--surface)) }
.bdx .bx-thin.t-pd { fill: color-mix(in srgb, var(--c1) 26%, var(--surface)) } .bdx .bx-thin.t-per, .bdx .bx-thin.t-fas, .bdx .bx-thin.t-gal { fill: var(--bd-ctl) }
/* swatches in lists */
.bdx-sw { display: inline-block; width: 12px; height: 12px; border-radius: 4px; flex: none; border: 1px solid color-mix(in srgb, var(--ink2) 18%, transparent); background: var(--sunk) }
.bdx-sw.t-sc { background: var(--bd-sc1) } .bdx-sw.t-epi { background: var(--bd-epc) } .bdx-sw.t-muc { background: color-mix(in srgb, var(--c1) 20%, var(--bd-epc)) } .bdx-sw.t-dej { background: color-mix(in srgb, var(--c2) 30%, var(--surface)) }
.bdx-sw.t-pd { background: color-mix(in srgb, var(--c1) 14%, var(--surface)) } .bdx-sw.t-rd { background: var(--bd-col2) } .bdx-sw.t-fat, .bdx-sw.t-fatb { background: var(--bd-fat) }
.bdx-sw.t-fas, .bdx-sw.t-gal, .bdx-sw.t-per, .bdx-sw.t-smas { background: var(--bd-ctl) } .bdx-sw.t-mus { background: var(--bd-mf1) } .bdx-sw.t-car { background: color-mix(in srgb, var(--c5) 24%, var(--surface)) }
.bdx-sw.t-bone { background: var(--bd-trab) } .bdx-sw.t-mar { background: var(--bd-mar) } .bdx-sw.t-st { background: var(--bd-st); border-radius: 50% }

/* textures (SVG classes, never interactive) */
.bdx-col .bx-tex, .bdx-col .bx-st, .bdx-col .bx-sep, .bdx-col .bx-cut { pointer-events: none }
/* shapes drawn as round-capped strokes (dots, nuclei, corneocytes, fibers): the path sets the width inline */
.bdx-col .bx-sc1, .bdx-col .bx-sc2, .bdx-col .bx-en, .bdx-col .bx-eg, .bdx-col .bx-ebn, .bdx-col .bx-fb, .bdx-col .bx-fn, .bdx-col .bx-la1, .bdx-col .bx-la2, .bdx-col .bx-cc,
.bdx-col .bx-tbn, .bdx-col .bx-oc, .bdx-col .bx-m1, .bdx-col .bx-m2, .bdx-col .bx-mn { fill: none; stroke-linecap: round }
.bdx-col .bx-sc1 { stroke: var(--bd-sc1) } .bdx-col .bx-sc2 { stroke: var(--bd-sc2) }
.bdx-col .bx-flk { fill: var(--bd-sc2); opacity: .8 }
.bdx-col .bx-ec { fill: var(--bd-epc); stroke: color-mix(in srgb, var(--c7) 32%, var(--surface)); stroke-width: .6 }
.bdx-col .t-muc .bx-ec { fill: color-mix(in srgb, var(--c1) 16%, var(--bd-epc)) }
.bdx-col .bx-en { stroke: var(--bd-nuc) } .bdx-col .bx-eg { stroke: var(--bd-nuc2) }
.bdx-col .bx-eb { fill: color-mix(in srgb, var(--c7) 28%, var(--surface)); stroke: color-mix(in srgb, var(--c7) 36%, var(--surface)); stroke-width: .5 }
.bdx-col .bx-ebn { stroke: var(--bd-nuc2) }
.bdx-col .bx-mel { fill: var(--bd-mel) } .bdx-col .bx-md { fill: none; stroke: var(--bd-mel); stroke-width: 1.1; stroke-linecap: round; opacity: .85 }
.bdx-col .bx-lc { fill: none; stroke: color-mix(in srgb, var(--c5) 70%, var(--surface)); stroke-width: .9; stroke-linecap: round }
.bdx-col .bx-peg { fill: var(--bd-epi) }
.bdx-col .bx-bm { fill: none; stroke: color-mix(in srgb, var(--c2) 48%, var(--surface)); stroke-width: 1.2 }
.bdx-col .bx-afb { fill: none; stroke: color-mix(in srgb, var(--c2) 30%, var(--surface)); stroke-width: .7 }
.bdx-col .bx-cap { fill: none; stroke: color-mix(in srgb, var(--c1) 75%, var(--surface)); stroke-width: 1.4; stroke-linecap: round }
.bdx-col .bx-pf { fill: none; stroke: color-mix(in srgb, var(--c1) 30%, var(--surface)); stroke-width: .8; stroke-linecap: round }
.bdx-col .bx-fb { stroke: var(--bd-nuc) }
.bdx-col .bx-c1, .bdx-col .bx-c2, .bdx-col .bx-c3 { fill: none; stroke-linecap: round }
.bdx-col .bx-c1 { stroke: var(--bd-col); stroke-width: 5 } .bdx-col .bx-c2 { stroke: var(--bd-col2); stroke-width: 3.4 } .bdx-col .bx-c3 { stroke: var(--bd-col); stroke-width: 2 }
.bdx-col .bx-el { fill: none; stroke: color-mix(in srgb, var(--c7) 42%, var(--surface)); stroke-width: .7 }
.bdx-col .bx-fc { fill: var(--bd-fatc); stroke: var(--bd-fatl); stroke-width: .8 }
.bdx-col .bx-fn { stroke: var(--bd-nuc2) }
.bdx-col .bx-fm { fill: none; stroke: var(--bd-fatl); stroke-width: .9; stroke-linejoin: round }
.bdx-col .bx-sp { fill: none; stroke: color-mix(in srgb, var(--c1) 30%, var(--surface)); stroke-width: 2.2; stroke-linecap: round }
.bdx-col .bx-ves { fill: none; stroke: color-mix(in srgb, var(--c1) 70%, var(--surface)); stroke-width: 1.2 }
.bdx-col .bx-fl { fill: none; stroke: var(--bd-ctl); stroke-width: .8 }
.bdx-col .t-gal .bx-fl { stroke: color-mix(in srgb, var(--c1) 22%, var(--surface)); stroke-width: 1.1 }
.bdx-col .bx-fnu { fill: none; stroke: var(--bd-nuc); stroke-width: 1.3; stroke-linecap: round }
.bdx-col .bx-ob { fill: color-mix(in srgb, var(--c2) 42%, var(--surface)) }
.bdx-col .bx-shp { fill: none; stroke: var(--bd-ctl); stroke-width: 1 }
.bdx-col .bx-m1 { stroke: var(--bd-mf1) } .bdx-col .bx-m2 { stroke: var(--bd-mf2) }
.bdx-col .bx-ms { fill: none; stroke: color-mix(in srgb, var(--c7) 42%, var(--surface)); stroke-dasharray: .9 1.9; opacity: .55 }
.bdx-col .bx-mn { stroke: var(--bd-nuc2) }
.bdx-col .bx-pc { fill: none; stroke: color-mix(in srgb, var(--c5) 40%, var(--surface)); stroke-width: .8 }
.bdx-col .bx-la1 { stroke: color-mix(in srgb, var(--c5) 38%, var(--surface)) } .bdx-col .bx-la2 { stroke: color-mix(in srgb, var(--c5) 4%, var(--surface)) }
.bdx-col .bx-cc { stroke: color-mix(in srgb, var(--c7) 50%, var(--surface)) }
.bdx-col .bx-tz { fill: var(--bd-msp) }
.bdx-col .bx-tb { fill: none; stroke: var(--bd-trab); stroke-width: 3.4; stroke-linecap: round }
.bdx-col .bx-tbn { stroke: var(--bd-trab) }
.bdx-col .bx-or { fill: none; stroke: var(--bd-bonel); stroke-width: .8 }
.bdx-col .bx-oc { stroke: color-mix(in srgb, var(--c1) 40%, var(--surface)) }
.bdx-col .bx-d1, .bdx-col .bx-d2, .bdx-col .bx-gd { fill: none; stroke-linecap: round }
.bdx-col .bx-d1 { stroke: color-mix(in srgb, var(--c2) 50%, var(--surface)); stroke-width: 2.4 } .bdx-col .bx-d2 { stroke: color-mix(in srgb, var(--c1) 50%, var(--surface)); stroke-width: 1.9 }
.bdx-col .bx-fv { fill: var(--bd-fatc); stroke: var(--bd-fatl); stroke-width: .6 }
.bdx-col .bx-mg { fill: color-mix(in srgb, var(--c7) 45%, var(--surface)) }
.bdx-col .bx-gd { stroke: var(--line2); stroke-width: 1.6 }
.bdx-col .bx-sep { fill: none; stroke: color-mix(in srgb, var(--ink2) 22%, transparent); stroke-width: .8 }
/* structures that cross layers */
.bdx-col .bx-fo { fill: color-mix(in srgb, var(--c7) 17%, var(--surface)); stroke: color-mix(in srgb, var(--c7) 42%, var(--surface)); stroke-width: 1 }
.bdx-col .bx-hs { fill: color-mix(in srgb, var(--ink2) 78%, var(--c8)) }
.bdx-col .bx-hair { fill: none; stroke: color-mix(in srgb, var(--ink2) 80%, var(--c8)); stroke-width: 2; stroke-linecap: round }
.bdx-col .bx-hair.v { stroke-width: 1.1; opacity: .7 }
.bdx-col .bx-dp { fill: color-mix(in srgb, var(--c1) 45%, var(--surface)) }
.bdx-col .bx-sg { fill: color-mix(in srgb, var(--c3) 28%, var(--surface)); stroke: color-mix(in srgb, var(--c3) 58%, var(--surface)); stroke-width: .9 }
.bdx-col .bx-sgd { fill: color-mix(in srgb, var(--c3) 8%, var(--surface)) }
.bdx-col .bx-ap { fill: none; stroke: var(--bd-mf1); stroke-width: 3; stroke-linecap: round }
.bdx-col .bx-sw { fill: none; stroke: color-mix(in srgb, var(--c4) 72%, var(--surface)); stroke-width: 1.3; stroke-linecap: round }
.bdx-col .bx-art { fill: none; stroke: color-mix(in srgb, var(--c1) 80%, var(--surface)); stroke-width: 1.8 }
.bdx-col .bx-lum { fill: color-mix(in srgb, var(--c1) 22%, var(--surface)) }
.bdx-col .bx-vein { fill: none; stroke: color-mix(in srgb, var(--c5) 75%, var(--surface)); stroke-width: 1.3 }
.bdx-col .bx-nv { fill: none; stroke: color-mix(in srgb, var(--c3) 80%, var(--surface)); stroke-width: 1.5; stroke-linecap: round }
.bdx-col .bx-cor { fill: color-mix(in srgb, var(--c3) 12%, var(--surface)); stroke: color-mix(in srgb, var(--c3) 62%, var(--surface)); stroke-width: .8 }
/* air, surface, cut edge, ruler */
.bdx-col .bx-surf { fill: none; stroke: color-mix(in srgb, var(--c1) 45%, var(--ink2)); stroke-width: 1.2; opacity: .7 }
.bdx-col .bx-flake { opacity: .8 }
.bdx-col .bx-cut { fill: none; stroke: var(--line2); stroke-width: 1 }
.bdx-col .bx-airt { font: 650 10.5px var(--f-mono); letter-spacing: .05em; text-transform: uppercase; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round }
.bdx-col .bx-airs { font: 500 10px var(--f-mono); letter-spacing: .04em; fill: var(--muted); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round }
.bdx-col .bx-tick { fill: none; stroke: var(--line2); stroke-width: 1 }
.bdx-col .bx-rt { font: 500 9.5px var(--f-mono); fill: var(--muted) }

/* hits and labels */
.bdx-band { cursor: pointer }
.bdx-band:focus, .bdx-fol:focus { outline: none }
.bdx-col .bx-hr { fill: transparent; stroke: none; transition: fill .15s }
.bdx-band:hover .bx-hr { fill: color-mix(in srgb, var(--accent) 7%, transparent) }
.bdx-band.sel .bx-hr { fill: color-mix(in srgb, var(--accent) 10%, transparent); stroke: var(--accent); stroke-width: 2 }
.bdx-band:focus-visible .bx-hr { stroke: var(--accent); stroke-width: 3 }
.bdx-band.sel:focus-visible .bx-hr { stroke: var(--ink); stroke-dasharray: 6 3 }
.bdx-col .bx-pill { fill: color-mix(in srgb, var(--surface) 88%, transparent); stroke: color-mix(in srgb, var(--line2) 80%, transparent); stroke-width: .8 }
.bdx-band.sel .bx-pill { fill: var(--accent-soft); stroke: var(--accent) }
.bdx-band:focus-visible .bx-pill { stroke: var(--accent); stroke-width: 2 }
.bdx-col .bx-ln { font: 600 12px var(--f-text); fill: var(--ink) }
.bdx-col .bx-lm { font: 500 10.5px var(--f-mono); fill: var(--muted) }
.bdx-col .bx-lhit { fill: transparent; transition: fill .15s }
.bdx-lbl:hover .bx-lhit { fill: color-mix(in srgb, var(--accent) 7%, transparent) }
.bdx-lbl.sel .bx-lhit { fill: var(--accent-soft) }
.bdx-lbl:focus-visible .bx-lhit { stroke: var(--accent); stroke-width: 2 }
.bdx-col .bx-lead { fill: none; stroke: var(--line2); stroke-width: 1 }
.bdx-lbl.sel .bx-lead { stroke: var(--accent) }
.bdx-fol { cursor: pointer }
.bdx-col .bx-fhit { fill: transparent; stroke: none }
.bdx-fol:hover .bx-fhit { fill: color-mix(in srgb, var(--accent) 9%, transparent) }
.bdx-fol.sel .bx-fhit, .bdx-fol:focus-visible .bx-fhit { stroke: var(--accent); stroke-width: 2; fill: color-mix(in srgb, var(--accent) 9%, transparent) }
.bdx-fol:focus-visible .bx-fhit { stroke-width: 3; stroke-dasharray: 5 3 }
/* effect markers */
.bdx-col .bx-mk { pointer-events: none }
.bdx-col .bx-mk circle { stroke: var(--surface); stroke-width: 1.6 }
.bdx-col .bx-mk text { font: 700 9.5px var(--f-mono); fill: var(--on-solid) }
.bdx-col .bx-mk.v0 circle { fill: var(--v0) } .bdx-col .bx-mk.v1 circle { fill: var(--v1) } .bdx-col .bx-mk.v2 circle { fill: var(--v2) } .bdx-col .bx-mk.v3 circle { fill: var(--v3) } .bdx-col .bx-mk.vn circle { fill: var(--accent) }

/* the agent arriving: shading by reach, a moving front, and a glyph above the surface */
.bdx-col .bx-ov { fill: var(--bdx-ta, var(--accent)); opacity: var(--o, .3); mix-blend-mode: multiply; animation: bdx-ov .6s ease calc(var(--dl, 0s) + .15s) both; pointer-events: none }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bdx-col .bx-ov { mix-blend-mode: screen } }
:root[data-theme="dark"] .bdx-col .bx-ov { mix-blend-mode: screen }
.bdx-col .bx-ov.b { fill: var(--bdx-tb, var(--accent)) }
.bdx-col .bx-og { fill: var(--bdx-ta, var(--accent)); opacity: var(--o, .5); animation: bdx-ov .6s ease calc(var(--dl, 0s) + .15s) both }
.bdx-col .bx-og.b { fill: var(--bdx-tb, var(--accent)) }
@keyframes bdx-ov { from { opacity: 0 } to { opacity: var(--o) } }
.bdx-col .bx-front { opacity: 0; animation: bdx-front var(--dur, 1.6s) cubic-bezier(.35, .1, .45, 1) .15s both; pointer-events: none }
@keyframes bdx-front { 0% { transform: translateY(0); opacity: 0 } 8% { opacity: 1 } 86% { opacity: 1 } 100% { transform: translateY(var(--d, 0px)); opacity: 0 } }
.bdx-col .bx-ndl { animation: bdx-press 1s cubic-bezier(.3, .1, .3, 1) .1s both }
@keyframes bdx-press { from { transform: translateY(var(--d, 0px)) } to { transform: none } }
.bdx-col .bx-hub { fill: color-mix(in srgb, var(--ink2) 30%, var(--surface)); stroke: var(--ink2); stroke-width: 1 }
.bdx-col .bx-nd { fill: none; stroke: var(--ink2); stroke-width: 1.6; stroke-linecap: round }
.bdx-col .bx-dep { fill: var(--bdx-ta, var(--accent)); opacity: .38; transform-box: fill-box; transform-origin: center; animation: bdx-bloom .7s ease-out 1s both }
.bdx-col .bx-dep.b { fill: var(--bdx-tb, var(--accent)) }
@keyframes bdx-bloom { from { transform: scale(0); opacity: 0 } to { transform: scale(1); opacity: .38 } }
.bdx-col .bx-ray { fill: none; stroke: var(--bdx-ta, var(--accent)); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 5 4; animation: bdx-flow 1s linear 3 }
.bdx-col .bx-ray.b, .bdx-col .bx-up.b { stroke: var(--bdx-tb, var(--accent)) }
@keyframes bdx-flow { to { stroke-dashoffset: -18 } }
.bdx-col .bx-drop { fill: var(--bdx-ta, var(--accent)); opacity: .8; animation: bdx-fall .8s ease-in .05s both }
.bdx-col .bx-drop.b, .bdx-col .bx-film.b { fill: var(--bdx-tb, var(--accent)) }
@keyframes bdx-fall { from { transform: translateY(-10px); opacity: 0 } to { transform: none; opacity: .8 } }
.bdx-col .bx-film { fill: var(--bdx-ta, var(--accent)); opacity: .55 }
.bdx-col .bx-up { fill: none; stroke: var(--bdx-ta, var(--accent)); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .8 }
.bdx-still .bx-ov, .bdx-still .bx-og, .bdx-still .bx-ndl, .bdx-still .bx-dep, .bdx-still .bx-ray, .bdx-still .bx-drop { animation: none }
.bdx-still .bx-front { display: none }
@media (prefers-reduced-motion: reduce) {
  .bdx-col .bx-ov, .bdx-col .bx-og, .bdx-col .bx-ndl, .bdx-col .bx-dep, .bdx-col .bx-ray, .bdx-col .bx-drop, .bdx-hs .hs-pulse { animation: none }
  .bdx-col .bx-front, .bdx-hs .hs-pulse { display: none }
}

/* ---------- panel ---------- */
.bdx-panel { gap: 14px }
.bdx-panel .back { margin-bottom: -4px }
.bdx-panel .eyebrow { display: flex; align-items: center; gap: 7px }
.bdx-panel .eyebrow .ic { width: 15px; height: 15px }
.bdx-prose { display: grid; gap: 8px; color: var(--ink2); line-height: 1.6 }
.bdx-llist { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px }
.bdx-lrow { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 7px 10px; border: 0; border-radius: 9px; background: none; color: var(--ink); text-align: left; font-size: .92rem; font-weight: 560 }
.bdx-lrow span { flex: 1; min-width: 0 }
.bdx-lrow small { font-size: .72rem; color: var(--muted); white-space: nowrap }
.bdx-lrow:hover { background: var(--sunk) }
.bdx-lhead { display: grid; gap: 6px }
.bdx-kc { --kc: var(--ink2) }
.bdx-kc .bdx-sw { width: 11px; height: 11px; border-radius: 3px }
.bdx-thk { font-size: .92rem }
.bdx-thk .mono:first-child { font-weight: 600; color: var(--ink) }
.bdx-note { padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; font-size: .94rem; line-height: 1.55 }
.bdx-here { display: grid; gap: 6px; padding: 12px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--kc) 45%, transparent); background: color-mix(in srgb, var(--kc) 9%, var(--surface)); font-size: .94rem; line-height: 1.55 }
.bdx-here .eyebrow { color: var(--ink2) }
.bdx-fact { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--sunk); font-size: .94rem; line-height: 1.55 }
.bdx-fact .ic { width: 20px; height: 20px; color: var(--c3); margin-top: 1px }
.bdx-verd { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px }
.bdx-reach { display: grid; gap: 8px }
.bdx-reach ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 5px }
.bdx-reach li { display: grid; grid-template-columns: minmax(0, 1fr) 72px 40px; gap: 10px; align-items: center; font-size: .86rem }
.bdx-reach li.none { color: var(--muted) }
/* structures that cross the layers (follicle, vessels, nerves) follow the bands, set apart by a hairline */
.bdx-reach li.st { font-style: italic }
.bdx-reach li:not(.st) + li.st { border-top: 1px dashed var(--line2); padding-top: 6px; margin-top: 2px }
.bdx-rn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.bdx-rp { text-align: right; font-size: .78rem; color: var(--ink2) }
.bdx-bar { display: block; height: 7px; border-radius: 999px; background: var(--sunk); overflow: hidden }
.bdx-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--kc, var(--accent)) }
.bdx-fx { display: grid; gap: 8px }
.bdx-fx ol, .bdx-fx ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px }
.bdx-fx-i { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: start }
.bdx-fx-n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 700 .72rem var(--f-mono); color: var(--on-solid); margin-top: 1px }
.bdx-fx-n.off { width: 10px; height: 10px; margin: 6px 0 0 6px }
.bdx-fx-n.v0 { background: var(--v0) } .bdx-fx-n.v1 { background: var(--v1) } .bdx-fx-n.v2 { background: var(--v2) } .bdx-fx-n.v3 { background: var(--v3) } .bdx-fx-n.vn { background: var(--accent) }
.bdx-fx-b { display: grid; gap: 4px; font-size: .93rem; line-height: 1.55; min-width: 0 }
.bdx-fx-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-weight: 650 }
.bdx-fx-t { display: flex; align-items: center; gap: 6px; font: 500 .76rem var(--f-mono); color: var(--muted) }
.bdx-fx-t .ic { width: 14px; height: 14px }
.bdx-sum, .bdx-risk { display: grid; gap: 6px; line-height: 1.6 }
.bdx-risk { padding: 12px 14px; border-radius: 12px; background: var(--v1-soft) }
.bdx-risk .eyebrow .ic { color: var(--v1) }
.bdx-links { display: grid; gap: 8px }
.bdx-src summary { cursor: pointer; font-size: .86rem; color: var(--muted); font-weight: 600 }
.bdx-src ul { margin-top: 8px; font-size: .86rem; color: var(--ink2); display: grid; gap: 4px }
.bdx-edu { display: flex; gap: 8px; align-items: flex-start; font-size: .82rem; color: var(--muted); line-height: 1.45 }
.bdx-edu .ic { width: 16px; height: 16px; margin-top: 1px }

/* ---------- compare ---------- */
.bdx-cmp { gap: 14px }
.bdx-ctbl { min-width: 560px }
.bdx-ctbl td { font-size: .88rem; min-width: 180px }
.bdx-ctbl td p { margin-top: 6px }
.bdx-ctbl th[scope="row"] { min-width: 120px }
.bdx-cr { display: grid; grid-template-columns: minmax(60px, 1fr) 40px; gap: 8px; align-items: center }
.bdx-cr .mono { font-size: .76rem; color: var(--ink2); text-align: right }
.bdx-ctot td, .bdx-ctot th { border-bottom: 0; padding-top: 14px }
.bdx-cmp .swipe { display: none }
@media (max-width: 640px) { .bdx-cmp .swipe { display: block } }

/* ---------- empty ---------- */
.bdx-empty > .ic { width: 34px; height: 34px; color: var(--accent) }

/* ===== f-exp: Self-experiments. A = baseline (slate), B = the change (teal), washout = hatched. All colors from tokens. ===== */
:root {
  --exp-a: color-mix(in srgb, var(--cB) 14%, var(--surface)); --exp-a-line: var(--cB);
  --exp-b: color-mix(in srgb, var(--c4) 19%, var(--surface)); --exp-b-line: var(--c4);
  --exp-hatch: repeating-linear-gradient(45deg, var(--line2) 0 1.5px, var(--surface) 1.5px 6px);
}
.exp-page { display: grid; gap: 18px; width: 100%; max-width: 1000px; min-width: 0 }
.exp-page > * { min-width: 0 }
.exp-head .tags { margin-top: 6px }
/* titles, notes and descriptions are typed by the learner: a long unbroken word must never widen the page on a phone */
.exp-head .title, .exp-head .sub, .exp-card-t button, .exp-today-b, .exp-rev dd, .exp-cvl li, .exp-idea-t, .exp-confirm p, .exp-msel-t, .exp-card-m, .exp-mc .chartnote, .exp-mc .card-h { overflow-wrap: anywhere }
.exp-foot { padding: 4px 2px 0 }

/* status pills and design letters */
.exp-st { display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px; border-radius: 999px; font: 600 .74rem/1.45 var(--f-mono); letter-spacing: .01em; background: var(--sunk); color: var(--ink2); white-space: nowrap }
.exp-st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none }
.exp-st.running { background: var(--accent-soft); color: var(--accent-ink) }
.exp-st.over { background: var(--v1-soft); color: var(--v1) }
.exp-st.done { background: var(--v0-soft); color: var(--v0) }
.exp-st.planned { color: var(--muted) }
.exp-dm { display: inline-flex; gap: 2px; flex: none }
.exp-dm i { width: 19px; height: 19px; display: grid; place-items: center; border-radius: 5px; font: 700 .64rem/1 var(--f-mono); font-style: normal }
.exp-dm i.a { background: var(--exp-a); color: var(--ink2); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--exp-a-line) 45%, transparent) }
.exp-dm i.b { background: var(--exp-b-line); color: var(--on-solid) }

/* timeline: segments are flex-grown by their number of days, so the bar is to scale */
.exp-tl { display: grid; gap: 6px; padding-top: 18px; min-width: 0 }
.exp-tl.mini { padding-top: 0 }
.exp-tl-bar { position: relative; display: flex; height: 42px; border-radius: 10px; background: var(--sunk) }
.exp-tl.mini .exp-tl-bar { height: 10px; border-radius: 5px }
.exp-sg { min-width: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1px; overflow: hidden; white-space: nowrap; box-shadow: inset 1px 0 0 var(--surface); color: var(--ink) }
.exp-sg:first-child { border-radius: 10px 0 0 10px; box-shadow: none }
.exp-sg:last-of-type { border-radius: 0 10px 10px 0 }
.exp-tl.mini .exp-sg:first-child { border-radius: 5px 0 0 5px } .exp-tl.mini .exp-sg:last-of-type { border-radius: 0 5px 5px 0 }
.exp-sg.a { background: var(--exp-a) }
.exp-sg.b { background: var(--exp-b) }
.exp-sg.w { background: var(--exp-hatch) }
.exp-sg b { font: 700 .74rem/1 var(--f-mono) }
.exp-sg small { font: 500 .62rem/1.2 var(--f-mono); color: var(--muted) }
.exp-sg.on { box-shadow: inset 0 0 0 2px var(--accent) }
.exp-now { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--accent); pointer-events: none; font-style: normal }
.exp-tl.mini .exp-now { top: -3px; bottom: -3px }
.exp-now em { position: absolute; bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%); font: 600 .62rem/1 var(--f-mono); font-style: normal; letter-spacing: .07em; text-transform: uppercase; color: var(--accent-ink); white-space: nowrap }
.exp-now.l em { left: -1px; transform: none } .exp-now.r em { left: auto; right: -1px; transform: none }
.exp-tl-d { display: flex; justify-content: space-between; gap: 8px; font: 500 .72rem var(--f-mono); color: var(--muted) }

/* legend (timeline and charts) */
.exp-lg { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .78rem; color: var(--ink2) }
.exp-lg li { display: inline-flex; align-items: center; gap: 7px; margin: 0 }
.exp-lg i { width: 18px; height: 12px; border-radius: 3px; flex: none }
.exp-lg i.a { background: var(--exp-a); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--exp-a-line) 40%, transparent) }
.exp-lg i.b { background: var(--exp-b); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--exp-b-line) 40%, transparent) }
.exp-lg i.w { background: var(--exp-hatch); box-shadow: inset 0 0 0 1px var(--line2) }
.exp-lg i.mn { height: 0; border-radius: 0; border-top: 2px dashed var(--ink2) }
.exp-lg i.f { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--v1) }

/* phase list */
.exp-ph { list-style: none; padding: 0; display: grid; gap: 4px; margin-top: 10px }
.exp-ph li { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 10px; margin: 0 }
.exp-ph li.on { background: var(--accent-soft) }
.exp-ph-m { display: grid; gap: 1px; flex: 1; min-width: 0 }
.exp-ph-m b { font-weight: 620; font-size: .92rem }
.exp-ph-m small { font-size: .8rem; color: var(--muted) }
.exp-ph-k { flex: none; min-width: 36px; height: 28px; padding: 0 7px; border-radius: 8px; display: inline-grid; place-items: center; font: 700 .74rem/1 var(--f-mono); color: var(--ink); background: var(--sunk) }
.exp-ph-k .ic { width: 18px; height: 18px; color: var(--accent-ink) }
.exp-ph-k.a { background: var(--exp-a); box-shadow: inset 0 0 0 1.5px var(--exp-a-line) }
.exp-ph-k.b { background: var(--exp-b); box-shadow: inset 0 0 0 1.5px var(--exp-b-line) }
.exp-ph-k.w { background: var(--exp-hatch); box-shadow: inset 0 0 0 1.5px var(--line2) }
.exp-det summary { cursor: pointer; font-size: .88rem; color: var(--muted); padding: 4px 0 }
.exp-det summary:hover { color: var(--accent-ink) }

/* list page */
.exp-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)) }
.exp-card { gap: 10px; transition: border-color .15s, box-shadow .15s }
.exp-card:hover { border-color: var(--line2); box-shadow: var(--shadow) }
.exp-card.done { background: color-mix(in srgb, var(--sunk) 45%, var(--surface)) }
.exp-card-t { margin: 0 }
.exp-card-t button { border: 0; background: none; padding: 0; font: 680 1.1rem/1.3 var(--f-display); letter-spacing: -.015em; text-align: left; color: var(--ink) }
.exp-card-t button:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px }
.exp-card-m { font: 500 .78rem var(--f-mono); color: var(--ink2) }
.exp-okline { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; font-weight: 600; color: var(--v0) }
.exp-okline .ic { width: 17px; height: 17px; stroke-width: 2.4 }
.exp-empty-ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink) }
.exp-empty-ic .ic { width: 28px; height: 28px }
.exp-how-g { display: grid; gap: 20px; align-items: start }
@media (min-width: 900px) { .exp-how-g { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) } }
.exp-fig { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); min-width: 0 }
.exp-learn { display: grid; gap: 6px; padding-top: 4px }
.exp-learn-g { display: grid; gap: 0 18px }
@media (min-width: 760px) { .exp-learn-g { grid-template-columns: repeat(2, minmax(0, 1fr)) } .exp-learn-g .mini:nth-of-type(2) { border-top: 0 } }
.exp-ideas { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)) }
.exp-idea { gap: 8px }
.exp-idea-t { font: 650 1rem/1.35 var(--f-text); margin: 0 }
.exp-idea .btnrow { margin-top: auto }

/* notes and callouts */
.exp-note { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 12px; padding: 12px 14px; border-radius: var(--r); background: var(--accent-soft); color: var(--ink) }
.exp-note > .ic { color: var(--accent-ink); margin-top: 1px }
.exp-note > p { flex: 1 1 220px; min-width: 0; line-height: 1.55 }
.exp-note.warn { background: var(--v1-soft) }
.exp-note.warn > .ic { color: var(--v1) }
.exp-iline { display: flex; gap: 8px; align-items: flex-start }
.exp-iline .ic { width: 17px; height: 17px; margin-top: 1px }
.exp-sugg { display: flex; gap: 8px; align-items: center; color: var(--accent-ink); font-weight: 550 }
.exp-sugg .ic { width: 17px; height: 17px }

/* the planner */
.exp-wiz { gap: 18px; padding: 22px; border-color: transparent; box-shadow: var(--shadow) }
@media (max-width: 560px) { .exp-wiz { padding: 18px 16px } }
.exp-wtop { display: grid; gap: 4px }
.exp-wtop h2:focus { outline: none }
.exp-wtop h2:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px }
.exp-wbody { display: grid; gap: 16px; min-width: 0 }
.exp-steps { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px }
.exp-steps li { margin: 0 }
.exp-steps button, .exp-stp { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 4px 12px 4px 5px; border-radius: 999px; border: 1px solid var(--line2); background: var(--surface); font-size: .82rem; font-weight: 600; color: var(--muted) }
.exp-steps button:hover { border-color: var(--accent); color: var(--accent-ink) }
.exp-steps b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--sunk); font: 600 .72rem/1 var(--f-mono); color: var(--ink2) }
.exp-steps b .ic { width: 14px; height: 14px; stroke-width: 2.6 }
.exp-steps li.done b { background: var(--v0-soft); color: var(--v0) }
.exp-steps li[aria-current="step"] .exp-stp { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink) }
.exp-steps li[aria-current="step"] b { background: var(--accent); color: var(--on-accent) }
@media (max-width: 640px) { .exp-steps li:not([aria-current="step"]) b + span { display: none } .exp-steps li:not([aria-current="step"]) button, .exp-steps li:not([aria-current="step"]) .exp-stp { padding: 4px } }
.exp-err { color: var(--v3); font-weight: 600; font-size: .92rem }
.exp-err:empty { display: none }
.exp-wfoot { border-top: 1px solid var(--line); padding-top: 16px }
.exp-picks { display: grid; gap: 12px; max-height: 320px; overflow: auto; padding: 2px 4px 2px 2px; overscroll-behavior: contain }
.exp-pg { display: grid; gap: 6px }
.exp-iv { display: grid; gap: 6px; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line); border-left: 3px solid var(--exp-b-line); background: var(--surface) }
.exp-ivo { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .84rem; color: var(--ink2) }
.exp-ivo li { display: inline-flex; align-items: center; gap: 6px; margin: 0 }
.exp-mgrid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 215px), 1fr)) }
.exp-mopt { display: flex; align-items: center; gap: 11px; padding: 11px 12px; text-align: left; border: 1.5px solid var(--line2); border-radius: 11px; background: var(--surface); color: var(--ink); transition: border-color .12s, background .12s }
.exp-mopt:hover { border-color: var(--accent) }
.exp-mopt .ic { color: var(--muted) }
.exp-mopt > span { display: grid; gap: 1px; min-width: 0 }
.exp-mopt b { font-weight: 620; font-size: .93rem }
.exp-mopt small { font-size: .76rem; color: var(--muted) }
.exp-mopt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft) }
.exp-mopt[aria-pressed="true"] .ic { color: var(--accent-ink) }
.exp-custom { border: 1px dashed var(--line2); border-radius: var(--r); padding: 10px 14px }
.exp-custom summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--accent-ink) }
.exp-cform { display: grid; gap: 12px; padding-top: 12px }
.exp-msel { list-style: none; padding: 0; display: grid; gap: 6px }
.exp-msel li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 8px 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); margin: 0 }
.exp-msel-t { display: grid; gap: 1px; flex: 1 1 160px; min-width: 0 }
.exp-msel-t small { font-size: .78rem; color: var(--muted) }
.exp-designs { display: grid; gap: 10px }
@media (min-width: 760px) { .exp-designs { grid-template-columns: repeat(3, minmax(0, 1fr)) } }
.exp-dopt { display: grid; gap: 6px; justify-items: start; align-content: start; padding: 14px; text-align: left; border: 1.5px solid var(--line2); border-radius: var(--r); background: var(--surface); color: var(--ink); transition: border-color .12s, background .12s }
.exp-dopt:hover { border-color: var(--accent) }
.exp-dopt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft) }
.exp-dopt b { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font: 700 1.08rem/1.2 var(--f-display); letter-spacing: -.01em }
.exp-dopt > .sm { font-weight: 600; color: var(--ink2) }
.exp-dopt small { font-size: .82rem; line-height: 1.45; color: var(--muted) }
.exp-prev { display: grid; gap: 6px; padding: 14px 16px 12px; border-radius: var(--r); background: var(--sunk); min-width: 0 }
.exp-prev .exp-tl-bar { background: var(--surface) }
.exp-cgrid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)) }
.exp-cgrid .tick small, .exp-wbody .tick small { font-size: .78rem; line-height: 1.4 }
.exp-rules { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--r); background: var(--sunk) }
.exp-rules li { margin: 3px 0 }
.exp-rev > div { grid-template-columns: 112px minmax(0, 1fr); gap: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line) }
.exp-rev > div:last-child { border-bottom: 0 }
.exp-rev dt { padding-top: 3px }
.exp-rev .link { margin-left: 6px }
@media (max-width: 520px) { .exp-rev > div { grid-template-columns: minmax(0, 1fr); gap: 2px } }

/* experiment page */
.exp-today { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--r); border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--surface) }
.exp-today.a { border-left-color: var(--exp-a-line) } .exp-today.b { border-left-color: var(--exp-b-line) } .exp-today.w { border-left-color: var(--line2) }
.exp-today > .exp-ph-k { height: 40px; min-width: 44px; font-size: .86rem; border-radius: 10px }
.exp-today-b { display: grid; gap: 4px; flex: 1; min-width: 0 }
.exp-today-t { font: 680 1.12rem/1.3 var(--f-display); letter-spacing: -.012em }
.exp-move { display: grid; gap: 8px; padding-top: 8px; max-width: 360px }
.exp-tiles .stat-n { font-size: clamp(1.3rem, 3.6vw, 1.75rem); flex-wrap: wrap; gap: 2px 4px }
.exp-of { font: 500 .78rem var(--f-mono); color: var(--muted); letter-spacing: 0; margin-right: 6px }
.exp-log { scroll-margin-top: 84px }
.exp-dfield { max-width: 240px }
.exp-logb { display: grid; gap: 14px }
.exp-dayph { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--sunk); font-size: .9rem }
.exp-dayph .exp-ph-k { height: 26px }
.exp-sf { gap: 8px }
.exp-sf legend .muted { font-weight: 450 }
.exp-scale { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; max-width: 540px }
.exp-scale button { min-height: 44px; padding: 0; border: 1.5px solid var(--line2); border-radius: 10px; background: var(--surface); font: 600 .95rem var(--f-mono); color: var(--ink2); transition: background .1s, border-color .1s }
.exp-scale button:hover { border-color: var(--accent); color: var(--accent-ink) }
.exp-scale button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent) }
@media (max-width: 440px) { .exp-scale { grid-template-columns: repeat(5, minmax(0, 1fr)) } }
.exp-num { max-width: 220px; font-family: var(--f-mono) }

/* results */
.exp-hl { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 999px; font: 650 .8rem/1.4 var(--f-text); white-space: nowrap; background: var(--sunk); color: var(--muted) }
.exp-hl.better { background: var(--v0-soft); color: var(--v0) }
.exp-hl.worse { background: var(--v3-soft); color: var(--v3) }
.exp-hl.flat { background: var(--v2-soft); color: var(--v2) }
.exp-hl.big { font: 700 clamp(1.15rem, 3.4vw, 1.4rem)/1.2 var(--f-display); letter-spacing: -.015em; padding: 7px 16px; white-space: normal }
.exp-sum { gap: 12px; border-color: transparent; box-shadow: var(--shadow) }
.exp-trust { display: grid; gap: 8px; padding: 12px 14px; border-radius: 10px; background: var(--sunk) }
.exp-trust-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px }
.exp-trust-h b { font-weight: 680 }
.exp-tm { display: inline-flex; gap: 3px }
.exp-tm i { width: 22px; height: 8px; border-radius: 3px; background: var(--line2) }
.exp-tm i.on { background: var(--accent) }
.exp-why { list-style: none; padding: 0; display: grid; gap: 4px; font-size: .86rem; color: var(--ink2) }
.exp-why li { display: flex; align-items: flex-start; gap: 8px; margin: 0 }
.exp-why .ic { width: 16px; height: 16px; margin-top: 2px; stroke-width: 2.4 }
.exp-why .plus .ic { color: var(--v0) } .exp-why .minus .ic { color: var(--muted) }
.exp-mc { gap: 10px }
.exp-mc-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px }
.exp-mc-h .card-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px }
.exp-chart { width: 100%; min-width: 0; min-height: 196px }
.exp-chart:empty { border-radius: 10px; background: var(--sunk) }
.exp-mc .chartnote .link { font-size: .85rem }
.exp-stats { display: grid; gap: 14px; align-items: start }
@media (min-width: 860px) { .exp-stats { grid-template-columns: minmax(0, 300px) minmax(0, 1fr) } }
.exp-tbl tr.exp-tot th, .exp-tbl tr.exp-tot td { font-weight: 700; background: var(--sunk) }
.exp-kv { gap: 10px }
.exp-kv dd { font-size: .94rem }
.exp-cvl { list-style: none; padding: 0; display: grid; gap: 8px }
.exp-cvl li { display: grid; gap: 3px; padding: 12px 14px; border-radius: 10px; border-left: 4px solid var(--line2); background: var(--sunk); margin: 0 }
.exp-cvl li.l2 { border-left-color: var(--v3); background: var(--v3-soft) }
.exp-cvl li.l1 { border-left-color: var(--v1); background: var(--v1-soft) }
.exp-cvl li p { color: var(--ink2); line-height: 1.55 }
.exp-cvt { font: 600 .64rem/1.4 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted) }
.exp-cvl li.l2 .exp-cvt { color: var(--v3) } .exp-cvl li.l1 .exp-cvt { color: var(--v1) }
.exp-fin.done { border-left: 3px solid var(--v0) }
.exp-csvbox { font: 500 .8rem/1.5 var(--f-mono) }
.exp-del { padding-top: 6px; border-top: 1px solid var(--line) }
.exp-danger { color: var(--v3) }
.exp-danger:hover:not(:disabled) { background: var(--v3-soft) }
.exp-confirm { display: grid; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--v3-soft) }
.btn.exp-dangerbtn { background: var(--v3); border-color: var(--v3); color: var(--on-solid) }
.btn.exp-dangerbtn:hover:not(:disabled) { background: color-mix(in srgb, var(--v3) 85%, var(--ink)); border-color: transparent }

/* chart SVG */
.exp-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: manipulation }
.exp-svg .bA { fill: var(--exp-a) }
.exp-svg .bB { fill: var(--exp-b) }
.exp-svg .pat-bg { fill: var(--surface) }
.exp-svg .pat-ln { stroke: var(--line2); stroke-width: 1.3 }
.exp-svg .grid { stroke: color-mix(in srgb, var(--ink) 9%, transparent); stroke-width: 1 }
.exp-svg .ax { font: 500 10.5px var(--f-mono); fill: var(--muted) }
.exp-svg .bl { font: 700 10px var(--f-mono); letter-spacing: .05em; fill: var(--ink2) }
.exp-svg .bl.tB { fill: color-mix(in srgb, var(--c4) 75%, var(--ink)) }
.exp-svg .ln { fill: none; stroke: var(--ink2); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; opacity: .55 }
.exp-svg .mn { stroke-width: 2; stroke-dasharray: 5 4; stroke-linecap: round }
.exp-svg .mA { stroke: var(--exp-a-line) } .exp-svg .mB { stroke: var(--exp-b-line) }
.exp-svg .pA { fill: var(--exp-a-line); stroke: var(--surface); stroke-width: 1.4 }
.exp-svg .pB { fill: var(--exp-b-line); stroke: var(--surface); stroke-width: 1.4 }
.exp-svg .pW { fill: var(--surface); stroke: var(--muted); stroke-width: 1.4 }
.exp-svg .pX { fill: var(--surface); stroke: var(--faint); stroke-width: 1.4; stroke-dasharray: 2 1.5 }
.exp-svg .pF { fill: none; stroke: var(--v1); stroke-width: 1.5 }
.exp-svg .now { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 3 3 }
.exp-svg .nowt { font: 600 10px var(--f-mono); letter-spacing: .05em; fill: var(--accent-ink) }
.exp-svg .sel { fill: color-mix(in srgb, var(--accent) 16%, transparent) }
.exp-svg .hit { fill: transparent; cursor: pointer }
.exp-svg .hit:hover { fill: color-mix(in srgb, var(--ink) 6%, transparent) }

/* ===== f-goals: Goals, the Evidence matrix and the Interventions library. Prefix .gol- =====
   Built from app.css tokens only. --gc is the goal's (or category's) stain, --kc a category stain,
   --vc / --vs a verdict color and its wash. */

/* ---------- shared atoms ---------- */
.gol-note { display: flex; align-items: flex-start; gap: 9px; margin: 0; padding: 10px 14px; border-radius: var(--r); background: var(--sunk); color: var(--ink2); font-size: .86rem; line-height: 1.45 }
.gol-note .ic { width: 17px; height: 17px; color: var(--muted); margin-top: 1px }

/* verdict squares: color plus shape, so the grade survives without color vision */
.gol-sq { display: inline-block; position: relative; flex: none; width: 14px; height: 14px; border-radius: 4px; vertical-align: middle; background: var(--sunk) }
.gol-sq.v0 { background: var(--v0) }
.gol-sq.v1 { background: linear-gradient(135deg, var(--v1) 0 50%, color-mix(in srgb, var(--v1) 40%, var(--surface)) 50% 100%) }
.gol-sq.v2 { background: var(--v2-soft); box-shadow: inset 0 0 0 2px var(--v2) }
.gol-sq.v3 { background: var(--v3) }
.gol-sq.v3::before, .gol-sq.v3::after { content: ""; position: absolute; left: 50%; top: 50%; width: 64%; height: 2px; border-radius: 1px; background: var(--on-solid); transform: translate(-50%, -50%) rotate(45deg) }
.gol-sq.v3::after { transform: translate(-50%, -50%) rotate(-45deg) }
/* "not graded" in the legend draws the same small dot that an empty matrix cell shows */
.gol-sq.nil { background: radial-gradient(circle, var(--line2) 0 2px, transparent 2.5px) }

.gol-type { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 5px; font: 600 .6rem/1.55 var(--f-mono); letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; vertical-align: middle; color: var(--tk); background: color-mix(in srgb, var(--tk) 12%, var(--surface)) }
.gol-type.t-intervention { --tk: var(--c4) }
.gol-type.t-compound { --tk: var(--c7) }
.gol-type.t-index { --tk: var(--c5) }

/* evidence spectrum: one bar split by how many items sit at each grade */
.gol-spec { display: flex; gap: 2px; width: 100%; height: 8px; border-radius: 999px; overflow: hidden; background: var(--sunk) }
.gol-spec i { display: block; min-width: 4px; flex-basis: 0 }
.gol-spec .v0 { background: var(--v0) } .gol-spec .v1 { background: var(--v1) } .gol-spec .v2 { background: var(--v2) } .gol-spec .v3 { background: var(--v3) }

/* effect-size meter: three rising bars, outlined when the size is unclear */
.gol-eff { display: inline-flex; align-items: center; gap: 7px; font-size: .78rem; color: var(--muted); white-space: nowrap }
.gol-eff-b { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px }
.gol-eff-b i { display: block; width: 5px; border-radius: 1.5px; background: var(--line2) }
.gol-eff-b i:nth-child(1) { height: 6px } .gol-eff-b i:nth-child(2) { height: 10px } .gol-eff-b i:nth-child(3) { height: 14px }
.gol-eff-b i.on { background: var(--ink2) }
.gol-eff.e-unclear .gol-eff-b i { background: transparent; box-shadow: inset 0 0 0 1px var(--faint) }

/* a second, different grade for the same pair (goal hub versus the intervention's own page) */
.gol-alt { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; font-size: .8rem; line-height: 1.4; color: var(--muted) }
.gol-alt .vchip { font-size: .68rem; padding: 1px 8px 1px 6px; gap: 5px }
.gol-alt .vchip i { width: 6px; height: 6px }
.gol-sh-alt { display: grid; gap: 6px; padding: 10px 12px; border: 1px dashed var(--line2); border-radius: 10px }
.gol-sh-alt > p:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: .9rem; font-weight: 600; color: var(--ink2) }

.gol-prose { display: grid; gap: 12px; line-height: 1.7 }
.gol-prose p, .gol-prose li { max-width: 70ch }
.gol-prose h3 { font: 650 1rem/1.35 var(--f-text); margin-top: 6px }
.gol-prose ul, .gol-prose ol { display: grid; gap: 6px }
.gol-prose strong { font-weight: 650; color: var(--ink) }
.card-h.gol-ch { display: flex; align-items: center; gap: 9px }
.card-h.gol-ch .ic { color: var(--muted) }
.gol-risk .card-h .ic { color: var(--v3) }
.gol-careful .card-h .ic { color: var(--v1) }
.gol-myths { display: grid; gap: 12px }
@media (min-width: 900px) { .gol-myths { grid-template-columns: repeat(2, minmax(0, 1fr)) } }
.gol-tools { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center }
/* app.css styles input[type=search] after .search-in input, which draws a second box inside the search field:
   undo it here (the wrapper already shows the focus ring through :focus-within) */
.gol-tools .search-in input, .gol-tools .search-in input:focus { width: auto; height: 100%; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none }
.gol-sel { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--muted); min-width: 0; max-width: 100% }
.gol-sel select { width: auto; min-width: 0; max-width: 100%; height: 44px; padding: 8px 12px }
@media (max-width: 560px) { .gol-sel { flex: 1 1 100% } .gol-sel select { flex: 1 } }
.gol-filters { display: grid; gap: 8px }

/* ---------- goals grid ---------- */
.gol-stats { margin-top: 0 }
.gol-stats .gol-sq { align-self: center }
.gol-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)) }
.gol-card { position: relative; display: grid; gap: 10px; align-content: start; padding: 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: radial-gradient(120% 90% at 100% 0, color-mix(in srgb, var(--gc, var(--accent)) 11%, transparent), transparent 62%), var(--surface); transition: border-color .15s, box-shadow .15s, transform .15s }
.gol-card:hover { border-color: var(--gc, var(--accent)); box-shadow: var(--shadow); transform: translateY(-2px) }
.gol-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px }
.gol-gic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--gc, var(--accent)) 15%, var(--surface)); color: var(--gc, var(--accent)) }
.gol-gic .ic { width: 26px; height: 26px }
.gol-pin { position: relative; z-index: 1 }
.gol-pin[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink) }
.gol-pin[aria-pressed="true"] .ic .tf { fill: currentColor }
.gol-card-t { font: 700 1.2rem/1.2 var(--f-display); letter-spacing: -.018em }
.gol-card-go { border: 0; background: none; padding: 0; font: inherit; color: var(--ink); text-align: left; letter-spacing: inherit }
.gol-card-go::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-lg) }
.gol-card-go:focus-visible { outline: none }
.gol-card-go:focus-visible::after { outline: 2.5px solid var(--accent); outline-offset: -2px }
.gol-card-b { font-size: .9rem; color: var(--ink2); line-height: 1.5 }
.gol-card-ev { display: grid; gap: 6px }
.gol-card-n { font: 500 .74rem var(--f-mono); color: var(--muted) }
.gol-top { display: grid; gap: 6px; padding-top: 2px }
.gol-tchips { display: flex; flex-wrap: wrap; gap: 6px }
.gol-tchip { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 7px; min-height: 30px; max-width: 100%; padding: 3px 11px 3px 9px; border: 1px solid var(--line2); border-radius: 999px; background: var(--surface); font-size: .8rem; font-weight: 550; color: var(--ink2); text-align: left }
.gol-tchip > span:not(.sr) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0 }
.gol-tchip .gol-sq { width: 10px; height: 10px; border-radius: 3px }
.gol-tchip .gol-sq.v3::before, .gol-tchip .gol-sq.v3::after { height: 1.5px }
.gol-tchip:hover { border-color: var(--accent); color: var(--accent-ink) }
.gol-lever { align-items: center }
/* the list card clips overflow, so draw the focus ring inside the row */
.gol-lever:focus-visible { outline-offset: -3px; border-radius: 0 }
.gol-lever-n { display: grid; justify-items: center; gap: 3px; width: 34px; flex: none }
.gol-lever-n b { font: 720 1.05rem/1 var(--f-display); font-variant-numeric: tabular-nums }
.gol-lever .ltitle { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px }
.gol-scale { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) }
@media (min-width: 720px) { .gol-scale { grid-template-columns: repeat(2, minmax(0, 1fr)) } }
@media (min-width: 1180px) { .gol-scale { grid-template-columns: repeat(4, minmax(0, 1fr)) } }
.gol-scale li { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px; border-radius: var(--r); background: var(--sunk) }
.gol-scale li .gol-sq { margin-top: 3px }
.gol-scale b { display: block; font-weight: 650; font-size: .92rem }
.gol-scale div span { display: block; font-size: .84rem; color: var(--ink2); line-height: 1.45 }

/* ---------- hero (goal hub and intervention page) ---------- */
.gol-hero { display: grid; gap: 18px; padding: 22px; border-radius: var(--r-lg); border: 1px solid color-mix(in srgb, var(--gc, var(--accent)) 26%, var(--line)); background: radial-gradient(130% 150% at 0 0, color-mix(in srgb, var(--gc, var(--accent)) 13%, var(--surface)), var(--surface) 62%) }
@media (min-width: 640px) { .gol-hero { grid-template-columns: auto minmax(0, 1fr); padding: 26px } .gol-hero-ev { grid-column: 1 / -1 } }
@media (min-width: 1000px) { .gol-hero { grid-template-columns: auto minmax(0, 1fr) minmax(250px, 300px); align-items: start } .gol-hero-ev { grid-column: auto } }
.gol-hero-ic { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: var(--gc, var(--accent)); color: var(--on-solid); box-shadow: 0 6px 20px color-mix(in srgb, var(--gc, var(--accent)) 30%, transparent) }
.gol-hero-ic .ic { width: 32px; height: 32px }
.gol-hero-ic .ic .tf { fill: color-mix(in srgb, currentColor 28%, transparent) }
.gol-hero-main { display: grid; gap: 6px; justify-items: start; min-width: 0 }
.gol-hero-main .sub { margin-top: 4px }
.gol-hero-main .btnrow { margin-top: 12px }
.gol-hero-ev { display: grid; gap: 10px; align-content: start; padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); min-width: 0 }
.gol-vstats { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px }
.gol-vstats li { margin: 0; min-width: 0 }
.gol-vbtn { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 38px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 9px; background: none; text-align: left; font-size: .78rem; color: var(--ink2) }
.gol-vbtn span { min-width: 0; line-height: 1.25 }
.gol-vbtn b { font: 700 1rem/1 var(--f-display); color: var(--ink); font-variant-numeric: tabular-nums }
button.gol-vbtn:hover:not(:disabled) { border-color: var(--accent) }
button.gol-vbtn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink) }
.gol-pinbtn .ic { width: 18px; height: 18px }

/* ---------- goal hub sections ---------- */
.gol-start { border-color: color-mix(in srgb, var(--v0) 32%, var(--line)); background: linear-gradient(180deg, var(--v0-soft), var(--surface) 75%) }
.gol-start-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)) }
.gol-start-it { display: grid; gap: 7px; align-content: start; justify-items: start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); text-align: left; color: var(--ink); transition: border-color .15s, transform .15s }
.gol-start-it:hover { border-color: var(--v0); transform: translateY(-1px) }
.gol-start-n { font: 680 1.04rem/1.3 var(--f-display); letter-spacing: -.012em }
.gol-start-w { font-size: .88rem; color: var(--ink2); line-height: 1.5 }
.gol-intro .gol-prose { font-size: 1.02rem }

.gol-mechs { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)) }
.gol-mech { display: grid; grid-template-rows: auto 1fr; padding: 0; overflow: hidden; text-align: left; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s }
.gol-mech:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px) }
.gol-mech-art { display: grid; place-items: center; height: 118px; padding: 10px 18px; background: var(--zone-shade); border-bottom: 1px solid var(--line); overflow: hidden }
.gol-mech-art .pw { width: auto; height: 100%; max-width: 100% }
.gol-mech-art.lesson { background: color-mix(in srgb, var(--nb, var(--accent)) 9%, var(--surface)) }
.gol-mech-ic .ic { width: 40px; height: 40px; color: var(--muted) }
.gol-mech-body { display: grid; gap: 4px; padding: 14px 16px 16px; align-content: start }
.gol-mech-t { font: 680 1.02rem/1.25 var(--f-display); letter-spacing: -.012em }
.gol-mech-w { font-size: .87rem; color: var(--ink2); line-height: 1.5 }

/* the evidence ladder: one rung per grade */
.gol-ladder { display: grid; gap: 16px }
.gol-rung { --vc: var(--v2); --vs: var(--v2-soft); position: relative; display: grid; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden }
.gol-rung::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--vc) }
.gol-rung.v0, .gol-sh.v0, .gol-sh-g.v0 { --vc: var(--v0); --vs: var(--v0-soft) }
.gol-rung.v1, .gol-sh.v1, .gol-sh-g.v1 { --vc: var(--v1); --vs: var(--v1-soft) }
.gol-rung.v2, .gol-sh.v2, .gol-sh-g.v2 { --vc: var(--v2); --vs: var(--v2-soft) }
.gol-rung.v3, .gol-sh.v3, .gol-sh-g.v3 { --vc: var(--v3); --vs: var(--v3-soft) }
.gol-rung-h { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 3px 10px; align-items: center; padding: 12px 16px 12px 20px; background: var(--vs) }
.gol-rung-h h3 { font: 680 1.02rem/1.3 var(--f-display); letter-spacing: -.01em }
.gol-rung-h p { grid-column: 2 / -1; font-size: .84rem; color: var(--ink2); line-height: 1.45 }
.gol-rung-n { font: 600 .8rem var(--f-mono); color: var(--muted) }
.gol-rows { list-style: none; padding: 0; margin: 0 }
.gol-row { display: grid; gap: 8px 18px; margin: 0; padding: 14px 16px 14px 20px; border-top: 1px solid var(--line) }
.gol-row:first-child { border-top: 0 }
.gol-row-main { min-width: 0 }
.gol-row-t { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px }
.gol-row-n { border: 0; background: none; padding: 0; font: 650 1rem/1.35 var(--f-text); color: var(--ink); text-align: left; text-decoration: underline; text-decoration-color: var(--line2); text-decoration-thickness: 1px; text-underline-offset: 3px }
.gol-row-n:hover { color: var(--accent-ink); text-decoration-color: currentColor }
.gol-row-note { font-size: .92rem; color: var(--ink2); line-height: 1.55; margin-top: 4px; max-width: 72ch }
.gol-row-x { border: 0; background: none; padding: 2px 0; margin-top: 6px; font: 500 .74rem var(--f-mono); color: var(--accent-ink); text-align: left }
.gol-row-x:hover { text-decoration: underline; text-underline-offset: 2px }
.gol-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px }
@media (min-width: 720px) {
  .gol-row { grid-template-columns: minmax(0, 1fr) auto; align-items: start }
  .gol-row-meta { flex-direction: column; align-items: flex-end; padding-top: 2px }
}
.gol-rel .goalchip .ic { color: var(--gc, var(--accent)) }
.gol-rel .goalchip small { font: 500 .7rem var(--f-mono); color: var(--muted); margin-left: 2px }

/* ---------- evidence matrix ---------- */
.gol-mx-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: .92rem; color: var(--ink2) }
.gol-mx-sum b { font: 700 1.05rem/1 var(--f-display); color: var(--ink); font-variant-numeric: tabular-nums }
.gol-sumv { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap }
.gol-legend-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px }
.gol-legend { display: flex; flex-wrap: wrap; gap: 6px }
.gol-lg { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 4px 12px 4px 9px; border: 1px solid var(--line2); border-radius: 999px; background: var(--surface); font-size: .82rem; font-weight: 550; color: var(--ink2) }
button.gol-lg:hover { border-color: var(--accent); color: var(--accent-ink) }
.gol-lg[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); font-weight: 650 }
.gol-lg.nil { border-style: dashed; color: var(--muted) }
.gol-mx-help { margin-top: -6px }
.gol-mx-count { margin-bottom: 8px }
#gol-mxhost { min-width: 0 }
.gol-mx-wrap { max-height: min(76vh, 900px); overflow: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overscroll-behavior-x: contain }
.gol-mx { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: .86rem; line-height: 1.3 }
.gol-mx th, .gol-mx td { padding: 0; border-bottom: 1px solid var(--line); vertical-align: middle }
.gol-mx thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 2px solid var(--line2); vertical-align: bottom }
.gol-mx thead th.gol-mx-corner { left: 0; z-index: 3; padding: 10px 12px; text-align: left; border-right: 1px solid var(--line); min-width: 200px }
.gol-mx-corner span { display: block; font: 600 .68rem var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted) }
.gol-mx-corner small { display: block; margin-top: 3px; font-size: .74rem; font-weight: 500; color: var(--faint) }
.gol-mx-rh { position: sticky; left: 0; z-index: 1; min-width: 200px; background: var(--surface); text-align: left; border-right: 1px solid var(--line) }
@media (max-width: 560px) { .gol-mx thead th.gol-mx-corner, .gol-mx-rh { min-width: 136px; max-width: 136px } }
.gol-mx-rn { display: grid; gap: 4px; justify-items: start; width: 100%; padding: 8px 12px; border: 0; background: none; text-align: left; font-weight: 600; font-size: .86rem; line-height: 1.3; color: var(--ink) }
.gol-mx-rn > span:first-child { overflow-wrap: anywhere }
.gol-mx-rn:hover > span:first-child { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px }
.gol-mx-rn:focus-visible { outline-offset: -3px }
.gol-mx col[data-g] { width: 44px }
.gol-mx col.hc { background: color-mix(in srgb, var(--accent) 8%, transparent) }
.gol-mx-gh { width: 44px; min-width: 44px; text-align: center }
.gol-mx-gh button { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; width: 100%; height: 118px; padding: 8px 0; border: 0; background: none; color: var(--ink2); font: 600 .78rem/1 var(--f-text) }
.gol-mx-gh button:focus-visible { outline-offset: -3px }
.gol-mx-gt { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; max-height: 82px; overflow: hidden; text-overflow: ellipsis }
.gol-mx-gh .ic { width: 18px; height: 18px; color: var(--gc, var(--accent)) }
.gol-mx-pin { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none }
.gol-mx-gh button:hover { color: var(--accent-ink) }
.gol-mx thead th.gol-mx-gh.hc { background: color-mix(in srgb, var(--accent) 8%, var(--surface)) }
.gol-mx thead th.gol-mx-gh.on { background: var(--accent-soft); border-bottom-color: var(--accent) }
.gol-mx thead th.gol-mx-gh.on button { color: var(--accent-ink) }
.gol-mx-td { height: 40px; text-align: center }
.gol-mx-td:empty::after { content: ""; display: block; width: 4px; height: 4px; margin: auto; border-radius: 50%; background: var(--line2) }
.gol-cell { display: grid; place-items: center; width: 100%; height: 100%; min-height: 40px; padding: 0; border: 0; border-radius: 0; background: none }
.gol-cell .gol-sq { width: 18px; height: 18px; border-radius: 5px; transition: transform .12s, opacity .15s }
.gol-cell:hover .gol-sq { transform: scale(1.25) }
.gol-cell:focus-visible { outline-offset: -4px }
.gol-cell.dim .gol-sq { opacity: .16 }
.gol-mx tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent) }
.gol-mx tbody tr:hover th { background: color-mix(in srgb, var(--accent) 6%, var(--surface)) }
.gol-mx tbody tr:last-child th, .gol-mx tbody tr:last-child td { border-bottom: 0 }
.gol-mx-wrap + .swipe { margin-top: 6px }

/* ---------- detail sheets ---------- */
.gol-sh { display: grid; gap: 14px }
.gol-sh-t { font: 700 1.5rem/1.2 var(--f-display); letter-spacing: -.02em }
.gol-sh-t span { color: var(--muted); font-weight: 500 }
.gol-sh-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px }
.gol-sh-note { margin: 0; padding: 12px 14px; border-left: 3px solid var(--vc, var(--line2)); border-radius: 0 10px 10px 0; background: var(--vs, var(--sunk)); font-size: 1rem; line-height: 1.6 }
.gol-sh-sum { display: grid; gap: 6px }
.gol-sh-list { display: grid; gap: 6px }
.gol-sh-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-align: left; font-size: .9rem; color: var(--ink) }
.gol-sh-row:hover { border-color: var(--accent) }
.gol-sh-row span { flex: 1; min-width: 0; font-weight: 600 }
.gol-sh-row small { color: var(--muted); font-size: .78rem; white-space: nowrap }
.gol-sh-gl { display: grid; gap: 8px }
.gol-sh-g { position: relative; display: grid; gap: 7px; padding: 12px 14px 12px 17px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden }
.gol-sh-g::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--vc) }
.gol-sh-g p { font-size: .9rem; color: var(--ink2); line-height: 1.55 }
.gol-sh-gh { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px }
.gol-sh-gn { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; font-weight: 650; color: var(--ink); text-align: left }
.gol-sh-gn .ic { width: 18px; height: 18px; color: var(--gc, var(--accent)) }
.gol-sh-gn:hover span { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px }

/* ---------- interventions library ---------- */
.gol-catchip .ic { color: var(--kc) }
.gol-catchip[aria-pressed="true"] .ic { color: var(--accent-ink) }
.gol-ivlist { display: grid; gap: 22px; align-content: start }
.gol-catsec { display: grid; gap: 12px }
.gol-cath { display: flex; align-items: center; gap: 12px }
.gol-cath-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--kc) 14%, var(--surface)); color: var(--kc) }
.gol-cath-ic .ic { width: 21px; height: 21px }
.gol-cath small { font: 500 .74rem var(--f-mono); color: var(--muted); letter-spacing: 0 }
.gol-ivgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)) }
.gol-ic { position: relative; display: grid; gap: 8px; align-content: start; justify-items: start; padding: 18px 18px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); text-align: left; color: var(--ink); overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s }
.gol-ic::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--kc, var(--accent)) }
.gol-ic:hover { border-color: var(--kc, var(--accent)); box-shadow: var(--shadow); transform: translateY(-2px) }
.gol-ic-k { display: inline-flex; align-items: center; gap: 7px; font: 600 .66rem/1.3 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--kc, var(--muted)) }
.gol-ic-k .ic { width: 16px; height: 16px }
.gol-ic-t { font: 700 1.14rem/1.25 var(--f-display); letter-spacing: -.016em }
.gol-ic-d { font-size: .9rem; color: var(--ink2); line-height: 1.5 }
.gol-ocs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; align-items: center }
.gol-oc { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 3px 2px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .76rem; font-weight: 600; color: var(--ink2); background: var(--surface) }
.gol-oc > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0 }
.gol-oc .vchip { font-size: .68rem; padding: 1px 8px 1px 6px; gap: 5px }
.gol-oc .vchip i { width: 6px; height: 6px }
.gol-ocm { font: 500 .7rem var(--f-mono); color: var(--muted) }

/* outcomes table on an intervention page: stacks into blocks on a phone */
.gol-otbl th[scope="row"] { min-width: 120px }
.gol-otbl td:nth-child(2) { white-space: nowrap }
.gol-otbl .tag { margin-left: 4px; vertical-align: middle }
@media (max-width: 600px) {
  .gol-otbl thead { display: none }
  .gol-otbl, .gol-otbl tbody, .gol-otbl tr, .gol-otbl th, .gol-otbl td { display: block; width: 100% }
  .gol-otbl tr { padding: 10px 0; border-bottom: 1px solid var(--line) }
  .gol-otbl tr:last-child { border-bottom: 0 }
  .gol-otbl th, .gol-otbl td { border: 0; padding: 3px 0 }
  .gol-otbl td:nth-child(2) { white-space: normal }
}

/* keep each control's own shape when the global focus ring (which sets a 6px radius) lands on it */
.gol-ic:focus-visible, .gol-mech:focus-visible { border-radius: var(--r-lg) }
.gol-start-it:focus-visible, .gol-sh-row:focus-visible { border-radius: var(--r) }
.gol-tchip:focus-visible, .gol-lg:focus-visible { border-radius: 999px }
.gol-vbtn:focus-visible { border-radius: 9px }
.gol-cell:focus-visible { border-radius: 4px }
.gol-sh-nb { margin-top: 2px }

@media (prefers-reduced-motion: reduce) {
  .gol-card:hover, .gol-mech:hover, .gol-ic:hover, .gol-start-it:hover { transform: none }
  .gol-cell:hover .gol-sq { transform: none }
}

/* ===== f-labs: Biomarkers library, test pages and My lab results =====
   Band colors follow the evidence scale: normal = --v0, borderline = --v1, low and high = --v3. */
:root {
  --bm-n: color-mix(in srgb, var(--v0) 34%, var(--surface));
  --bm-b: color-mix(in srgb, var(--v1) 40%, var(--surface));
  --bm-h: color-mix(in srgb, var(--v3) 32%, var(--surface));
  --bm-o: color-mix(in srgb, var(--v2) 26%, var(--surface));
}

/* ---------- shared pieces ---------- */
.bm-sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; flex: none; background: var(--bm-o) }
.bm-sw.normal { background: var(--bm-n) }
.bm-sw.borderline { background: var(--bm-b) }
.bm-sw.low, .bm-sw.high { background: var(--bm-h) }
.bm-arr { width: 14px; height: 14px; flex: none }
.bm-note { display: flex; gap: 10px; align-items: flex-start; font-size: .86rem; color: var(--muted); line-height: 1.55; max-width: 80ch }
.bm-note .ic { width: 17px; height: 17px; margin-top: 2px; color: var(--faint) }
.bm-privacy { display: flex; gap: 10px; align-items: center; font-size: .88rem; color: var(--ink2); padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); line-height: 1.45 }
.bm-privacy .ic { width: 18px; height: 18px; color: var(--accent-ink) }
.bm-privacy.sm { font-size: .8rem; padding: 7px 11px; max-width: 360px }
.bm-cnt { font: 600 .72rem/1 var(--f-mono); padding: 4px 7px; border-radius: 999px; background: color-mix(in srgb, var(--on-accent) 22%, transparent) }

/* compact strip used in list rows */
.bm-strip { position: relative; display: block; width: 100%; min-width: 110px; height: 10px }
.bm-strip-z { position: absolute; inset: 0; border-radius: 999px; overflow: hidden; background: var(--sunk) }
.bm-strip-z > span { position: absolute; top: 0; bottom: 0; background: var(--bm-o) }
.bm-strip-z > span + span { box-shadow: inset 2px 0 0 var(--surface) }
.bm-strip-z > .normal { background: var(--bm-n) }
.bm-strip-z > .borderline { background: var(--bm-b) }
.bm-strip-z > .low, .bm-strip-z > .high { background: var(--bm-h) }
.bm-strip.big { height: 14px }
.bm-pin, .bm-pin-k { position: absolute; top: 50%; width: 7px; height: 20px; border-radius: 4px; background: var(--ink); border: 2px solid var(--surface); transform: translate(-50%, -50%); box-shadow: 0 0 0 1px var(--line2) }
.bm-strip.big .bm-pin { height: 26px; width: 8px }
.bm-pin-k { position: relative; top: auto; transform: none; display: inline-block; width: 7px; height: 16px; box-shadow: none; border-width: 1.5px }
.bm-key { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8rem; color: var(--muted) }
.bm-key > span { display: inline-flex; align-items: center; gap: 7px }
.bm-key .bm-sw { width: 22px; height: 9px }

/* ---------- library ---------- */
.bm-top { display: grid; gap: 18px; align-items: end }
@media (min-width: 960px) { .bm-top { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr) } }
.bm-howto { gap: 12px; padding: 18px 20px; background: linear-gradient(160deg, var(--surface), color-mix(in srgb, var(--accent-soft) 55%, var(--surface))) }
.bm-howto-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px }
.bm-howto .bm-strip { margin: 8px 0 4px }
.bm-tools { display: grid; gap: 12px }
.bm-tools .toolbar { justify-content: space-between }
.bm-pchip .ic { color: var(--kc, var(--muted)) }
.bm-pchip[aria-pressed="true"] .ic { color: inherit }
.bm-list { display: grid; gap: 28px }
.bm-grp { display: grid; gap: 10px; min-width: 0 }
.bm-grp > .muted { margin-top: -4px }
.bm-grp-h { display: flex; align-items: center; gap: 10px; font: 680 1.1rem/1.2 var(--f-display); letter-spacing: -.015em }
.bm-grp-h .ic { width: 32px; height: 32px; padding: 6px; border-radius: 10px; color: var(--kc, var(--muted)); background: color-mix(in srgb, var(--kc, var(--muted)) 14%, var(--surface)) }
.bm-grp-h small { font: 500 .72rem var(--f-mono); color: var(--muted); padding: 2px 8px; border: 1px solid var(--line2); border-radius: 999px }

/* list rows: stacked on phones, four columns from tablet up */
.lrow.bm-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main val" "strip strip"; gap: 10px 14px; align-items: center; color: var(--ink) }
.lrow.bm-row:focus-visible { outline-offset: -3px }
.bm-row-main { grid-area: main; display: grid; gap: 2px; min-width: 0 }
.bm-row-main .mono { color: var(--ink2) }
.bm-row-strip { grid-area: strip; display: block; padding: 5px 0 }
.bm-row-val { grid-area: val; display: grid; justify-items: end; align-content: center; gap: 4px; text-align: right; min-width: 0 }
.bm-row-val:empty { display: none }
.bm-row-val .vchip { white-space: normal; text-align: left }
.bm-row .chev { display: none }
.bm-v { font: 500 .8rem var(--f-mono); color: var(--muted); white-space: nowrap }
.bm-v b { font: 700 1.02rem var(--f-mono); color: var(--ink); letter-spacing: -.02em }
.bm-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden }
@media (max-width: 559px) { .bm-row .bm-clamp { -webkit-line-clamp: 1 } }
@media (min-width: 760px) {
  .lrow.bm-row { grid-template-columns: minmax(0, 1.3fr) minmax(150px, 1fr) minmax(128px, max-content) 17px; grid-template-areas: "main strip val chev"; gap: 20px }
  .bm-row .chev { display: block; grid-area: chev }
  .bm-row-val:empty { display: block }
}
.lrow.bm-orow { display: flex; justify-content: space-between; flex-wrap: wrap }

/* ---------- test page ---------- */
.bm-page { display: grid; gap: 22px; max-width: 920px; width: 100%; min-width: 0 }
.bm-head .eyebrow { display: flex }
.bm-panel-l { display: inline-flex; align-items: center; gap: 7px; border: 0; background: none; padding: 2px 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--kc, var(--muted)) }
.bm-panel-l .ic { width: 16px; height: 16px }
.bm-panel-l:hover { text-decoration: underline; text-underline-offset: 3px }
.bm-rc { gap: 14px }
.bm-rc-top { display: flex; justify-content: space-between; align-items: center; gap: 10px 16px; flex-wrap: wrap }
.bm-latest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px }
.bm-latest b { font-size: 1.05rem; font-weight: 700; color: var(--ink) }
.bm-range { width: 100%; min-width: 0 }
.bm-rsvg, .bm-tsvg { display: block; width: 100%; height: auto; overflow: visible }
.bm-z { fill: var(--bm-o) }
.bm-z.normal { fill: var(--bm-n) }
.bm-z.borderline { fill: var(--bm-b) }
.bm-z.low, .bm-z.high { fill: var(--bm-h) }
.bm-zsep { stroke: var(--surface); stroke-width: 2 }
.bm-zl { font: 600 11.5px var(--f-text); fill: var(--ink) }
.bm-tk { font: 500 11px var(--f-mono); fill: var(--ink2); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round }
.bm-tkm { stroke: var(--ink2); stroke-width: 1.2; opacity: .55 }
.bm-ol { font: 600 11px var(--f-text); fill: var(--ink2); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round }
.bm-lead { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 2 2 }
.bm-mk-l { stroke: var(--ink); stroke-width: 2 }
.bm-mk-c { fill: var(--surface); stroke: var(--ink); stroke-width: 2.5 }
.bm-mk-p { fill: var(--ink) }
.bm-mk-t { font: 650 11.5px var(--f-text); fill: var(--surface) }
.bm-mk.ghost .bm-mk-l { opacity: .55 }
.bm-mk.ghost .bm-mk-c { stroke-width: 2 }
.bm-mk.pv .bm-mk-l { stroke: var(--accent); stroke-dasharray: 3 2 }
.bm-mk.pv .bm-mk-p { fill: var(--accent) }
.bm-mk.pv .bm-mk-t { fill: var(--on-accent) }
.bm-mk.pv .bm-mk-c { stroke: var(--accent) }
.bm-legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)) }
.bm-legend li { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; padding: 8px 12px; border-radius: 10px; background: var(--sunk); font-size: .88rem; border: 1px solid transparent }
.bm-legend li.on { border-color: var(--ink2); background: var(--surface) }
.bm-legend b { font-weight: 620 }
.bm-legend .mono { color: var(--muted); margin-left: auto }
.bm-here { display: inline-flex; align-items: center; gap: 4px; font: 600 .7rem var(--f-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--ink) }
.bm-here .ic { width: 13px; height: 13px }
.bm-ref { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; color: var(--ink2); line-height: 1.6; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line) }
.bm-ref .ic { width: 18px; height: 18px; margin-top: 2px; color: var(--accent-ink) }
.bm-learn .ls:first-child { padding-top: 22px }
.bm-prose { display: grid; gap: 10px; line-height: 1.65 }
.bm-prose p, .bm-prose li { max-width: 68ch }
.bm-dir { border-top: 4px solid var(--bm-h) }
.bm-dir.on { border-color: var(--v3); box-shadow: 0 0 0 1px var(--v3) }
.bm-dir-e { display: flex; align-items: center; gap: 6px; color: var(--v3) }
.bm-yours { display: inline-flex; align-items: center; gap: 6px; justify-self: start; padding: 3px 10px; border-radius: 999px; background: var(--v3-soft); color: var(--v3); font-size: .8rem; font-weight: 650 }
.bm-yours .ic { width: 14px; height: 14px }
.bm-mv .card-h, .bm-pit .card-h { display: flex; align-items: center; gap: 9px }
.bm-mv .card-h .ic { color: var(--accent-ink) }
.bm-moves { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)) }
.bm-moves li { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--sunk); line-height: 1.5; font-size: .94rem }
.bm-moves li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: .55em; flex: none }
.bm-pit { background: var(--v1-soft); border-color: transparent }
.bm-pit .card-h .ic { color: var(--v1) }

/* your results: form, trend, table */
.bm-you { gap: 18px }
.bm-you-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px 16px; flex-wrap: wrap }
.bm-form { display: grid; gap: 12px; padding: 16px; border-radius: var(--r); background: var(--sunk) }
.bm-fgrid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) }
@media (min-width: 640px) { .bm-fgrid { grid-template-columns: repeat(2, minmax(0, 1fr)) } .bm-f-n, .bm-f-bm { grid-column: 1 / -1 } }
@media (min-width: 1000px) { .bm-quick .bm-fgrid { grid-template-columns: repeat(3, minmax(0, 1fr)) } .bm-quick .bm-f-bm { grid-column: 1 / -1 } .bm-quick .bm-f-n { grid-column: auto } }
.bm-vin { display: flex; align-items: stretch; border: 1px solid var(--line2); border-radius: 10px; background: var(--surface); overflow: hidden }
.bm-vin:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent) }
.bm-vin.bad { border-color: var(--v3) }
.bm-vin.soft { border-color: var(--v1) }
.bm-vin input[type=number] { border: 0; border-radius: 0; background: transparent; flex: 1; min-width: 0; font: 600 1.05rem var(--f-mono) }
.bm-vin input[type=number]:focus { box-shadow: none }
.bm-vu { display: grid; place-items: center; padding: 0 12px; background: var(--sunk); color: var(--ink2); font: 600 .8rem var(--f-mono); border-left: 1px solid var(--line2); white-space: nowrap; max-width: 46% ; overflow: hidden; text-overflow: ellipsis }
.bm-form input[type=date][aria-invalid="true"] { border-color: var(--v3) }
.bm-ferr { font-size: .84rem; color: var(--v3); line-height: 1.45 }
.bm-ferr.warn { color: var(--ink2); padding: 8px 10px; border-radius: 8px; background: var(--v1-soft); border-left: 3px solid var(--v1) }
.bm-ferr:empty { display: none }
.bm-lpa { display: flex; gap: 8px; align-items: flex-start; line-height: 1.5 }
.bm-lpa .ic { width: 16px; height: 16px; margin-top: 2px; color: var(--v1) }
.bm-pv { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: .9rem; color: var(--ink2); min-height: 1.7em }
.bm-pv:empty { display: none }
.bm-pv b { color: var(--ink) }
.bm-hist { display: grid; gap: 12px; min-width: 0 }
.bm-hist-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap }
.bm-h3 { font: 650 1.02rem var(--f-text); outline: none }
#lb-h:focus, #bm-you-h:focus { outline: none } /* focus targets after a delete, not controls */
.bm-nohist { display: flex; gap: 12px; align-items: center; padding: 16px; border: 1px dashed var(--line2); border-radius: var(--r) }
.bm-nohist .ic { width: 26px; height: 26px; color: var(--faint) }
.bm-trend { width: 100%; min-width: 0 }
.bm-st { fill: var(--v2-soft) }
.bm-st.normal { fill: var(--v0-soft) }
.bm-st.borderline { fill: var(--v1-soft) }
.bm-st.low, .bm-st.high { fill: var(--v3-soft) }
.bm-stl { font: 600 10.5px var(--f-text); fill: var(--muted) }
.bm-grid { stroke: color-mix(in srgb, var(--ink) 12%, transparent); stroke-width: 1 }
.bm-ax { font: 500 11px var(--f-mono); fill: var(--muted) }
.bm-ax.u { font-weight: 600; fill: var(--ink2) }
.bm-axl { stroke: var(--line2); stroke-width: 1 }
.bm-tl { fill: none; stroke: var(--ink2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round }
.bm-pt { fill: var(--v2); stroke: var(--surface); stroke-width: 2 }
.bm-pt.normal { fill: var(--v0) }
.bm-pt.borderline { fill: var(--v1) }
.bm-pt.low, .bm-pt.high { fill: var(--v3) }
.bm-pt-ring { fill: none; stroke: var(--ink); stroke-width: 1.5 }
.bm-ptl { font: 700 12px var(--f-mono); fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round }
.bm-sum { font-size: .92rem; color: var(--ink2); line-height: 1.6 }
.bm-tbl { min-width: 540px }
.bm-tbl tbody th { white-space: nowrap; font-weight: 600 }
.bm-tbl td.n { white-space: nowrap }
.bm-tbl td.n b { font-weight: 700; color: var(--ink) }
.bm-tbl td, .bm-tbl th { vertical-align: middle }
.bm-tnote { color: var(--ink2); max-width: 260px }
.bm-act { text-align: right; white-space: nowrap }
.bm-tbl tr.bm-del td, .bm-tbl tr.bm-del th { background: var(--v3-soft) }
.bm-cf { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end }
.btn.bm-danger { background: var(--v3); border-color: var(--v3); color: var(--on-solid) }
.btn.bm-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--v3) 82%, var(--ink)); border-color: color-mix(in srgb, var(--v3) 82%, var(--ink)) }
.bm-delta { display: inline-flex; align-items: center; gap: 4px; font: 600 .8rem var(--f-mono); color: var(--ink2); white-space: nowrap }
.bm-delta.none, .bm-delta.flat { color: var(--muted); font: 500 .78rem var(--f-text) }
.bm-sum .bm-delta { font-size: .86rem; color: var(--ink) }
.bm-links { display: grid; gap: 12px }
@media (min-width: 760px) { .bm-xgrid { grid-template-columns: repeat(3, minmax(0, 1fr)) } }

/* ---------- my lab results ---------- */
.bm-tiles .stat-n { font-variant-numeric: tabular-nums }
.bm-t0 .stat-n { color: var(--v0) }
.bm-t3 .stat-n { color: var(--v3) }
.bm-labs-top { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap }
.bm-quick { gap: 14px }
.bm-csv { max-width: 640px; width: 100% }
.bm-csv textarea { font: 500 .8rem var(--f-mono) }
.bm-empty { gap: 12px }
.bm-empty-ic { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; background: color-mix(in srgb, var(--c4) 14%, var(--surface)); color: var(--c4) }
.bm-empty-ic .ic { width: 28px; height: 28px }
.bm-how { display: grid; gap: 6px; color: var(--ink2); line-height: 1.55; max-width: 66ch }

@media (prefers-reduced-motion: no-preference) {
  .bm-pin { transition: left .25s ease }
  .lrow.bm-row { transition: background .15s }
}

/* ===== Body explorer: what you would see (js/f-look.js). The face and skin use fixed, realistic skin colors so a change
   such as redness reads the same in both themes; frames, labels and the microscope use tokens. ===== */
.bdx-grid.has-look { grid-template-areas: "side" "look" "col" "panel" }
.bdx-look { grid-area: look; gap: 14px; container: lk / inline-size }
@container bdx (min-width: 720px) {
  .bdx-grid.has-look { grid-template-areas: "side look" "side col" "side panel" }
}
@container bdx (min-width: 1040px) {
  .bdx-grid.has-look { grid-template-areas: "side look panel" "side col panel" }
}

.lk-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px 16px }
.lk-head > div:first-child { display: grid; gap: 4px; min-width: 0; flex: 1 1 220px }
.lk-tone { display: flex; align-items: center; gap: 6px; flex-wrap: wrap }
.lk-tl { font-size: .78rem; color: var(--muted); margin-right: 2px }
.lk-sw { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--surface); background: var(--sw); box-shadow: 0 0 0 1px var(--line2); padding: 0; cursor: pointer }
.lk-sw[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent) }
.lk-sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px }

.lk-stages { display: flex; flex-wrap: wrap; align-items: center; gap: 6px }
.lk-st { gap: 7px }
.lk-stn { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--sunk); color: var(--ink2); font: 700 .68rem var(--f-mono) }
.lk-st[aria-pressed="true"] .lk-stn { background: var(--accent); color: var(--on-accent) }
.lk-play { margin-left: auto }
.lk-see { display: grid; gap: 4px; color: var(--ink); font-size: .98rem; line-height: 1.5; min-height: 3em }
.lk-see i { color: var(--muted); font-style: normal; font-weight: 600 }
.lk-flat { display: flex; gap: 9px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--sunk); color: var(--ink2); font-size: .9rem; line-height: 1.45 }
.lk-flat .ic { width: 17px; height: 17px; flex: none; margin-top: 1px; color: var(--accent) }
.lk-ab { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 6px; background: var(--accent); color: var(--on-accent); font: 700 .72rem var(--f-mono); margin-right: 6px; vertical-align: 1px }
/* B's teal is darkened in the light theme so white text on it passes 4.5:1; the dark theme keeps the bright teal */
.lk-ab.b { background: color-mix(in srgb, var(--c4) 78%, var(--ink)) }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lk-ab.b { background: var(--c4) } }
:root[data-theme="dark"] .lk-ab.b { background: var(--c4) }

.lk-main { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start }
@container lk (min-width: 600px) { .lk-main { grid-template-columns: minmax(0, 1fr) minmax(210px, 250px) } }

/* the figure: the wrap fits the drawing exactly, so the slider lines up with the wipe */
.lk-fig { margin: 0; display: grid; gap: 10px; justify-items: center; padding: 12px; border-radius: 14px; background: radial-gradient(120% 90% at 50% 30%, var(--surface), var(--sunk)); border: 1px solid var(--line) }
.lk-wrap { position: relative; width: 100%; max-width: 380px; line-height: 0 }
.lk-fig.body .lk-wrap { width: auto; max-width: none; padding-top: 30px }
.lk-fig.body .lk-lab { top: 2px; max-width: calc(50% - 8px) }
.lk-fig.body .lk-lab.l { left: auto; right: calc(50% + 4px) } .lk-fig.body .lk-lab.r { right: auto; left: calc(50% + 4px) }
.lk-svgbox { line-height: 0 }
.lk-svg { display: block; width: 100%; height: auto }
.lk-fig.body .lk-svg { width: auto; height: min(470px, 70vh); max-width: 100% }
.lk-svg .lk-ring { fill: none; stroke: #fff; stroke-opacity: .75; stroke-width: .7; stroke-dasharray: 2.2 2.2 }
.lk-svg .lk-wl { stroke: #fff; stroke-width: 1.1; stroke-opacity: .95 }
.lk-fade .lk-right { animation: lk-fade .5s ease both }
@keyframes lk-fade { from { opacity: .2 } }
.lk-labs { position: absolute; inset: 0; pointer-events: none; line-height: 1.2 }
.lk-lab { position: absolute; top: 8px; max-width: 46%; padding: 3px 9px; border-radius: 999px; background: rgb(17 22 34 / .66); color: #fff; font-size: .74rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.lk-lab.l { left: 8px } .lk-lab.r { right: 8px }
.lk-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; touch-action: pan-y; -webkit-appearance: none; appearance: none; background: none }
/* a 1px invisible thumb, so the value maps linearly to the pointer and the wipe line lands where you press */
.lk-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 1px; height: 100%; border: 0 }
.lk-range::-moz-range-thumb { width: 1px; height: 100%; border: 0 }
.lk-handle { position: absolute; top: 50%; width: 0; height: 0; pointer-events: none }
.lk-knob { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #222; font: 700 .8rem/1 var(--f-mono); letter-spacing: 1px; box-shadow: 0 2px 10px rgb(0 0 0 / .3) }
.lk-range:focus-visible ~ .lk-handle .lk-knob { outline: 3px solid var(--accent); outline-offset: 2px }
.lk-quick { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; line-height: 1.2 }
.lk-quick .chip { min-height: 32px }

.lk-side { display: grid; gap: 14px; min-width: 0 }
@container lk (min-width: 430px) and (max-width: 599px) { .lk-side { grid-template-columns: 1fr 1fr } }
.lk-block { display: grid; gap: 6px; min-width: 0 }
.lk-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px }
.lk-cell { margin: 0; display: grid; gap: 4px; min-width: 0 }
.lk-cell svg { display: block; width: 100%; height: auto }
/* captions such as "After · Months to years" wrap rather than lose their time label */
.lk-cell figcaption { font-size: .72rem; color: var(--muted); text-align: center; line-height: 1.25; overflow-wrap: anywhere }
.lk-micro { border-radius: 8px; border: 1px solid var(--line) }
.lk-cap { font-size: .74rem; color: var(--muted); line-height: 1.45 }
.lk-key { display: inline-block; width: 10px; height: 4px; border-radius: 2px; margin: 0 3px 1px 6px; vertical-align: middle }
.lk-key:first-child { margin-left: 0 }
.bdx { --lk-cap: #c8414a }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bdx { --lk-cap: #ff6d7a } }
:root[data-theme="dark"] .bdx { --lk-cap: #ff6d7a }
.lk-key.k-col { background: var(--bd-col) } .lk-key.k-ela { background: var(--bd-nuc2) } .lk-key.k-mel { background: var(--bd-mel) } .lk-key.k-cap { background: var(--lk-cap) }

/* microscope stains (the same family as the tissue column) */
.lk-micro .mk-air { fill: var(--bd-air) }
.lk-micro .mk-rd { fill: var(--bd-rd) }
.lk-micro .mk-pd { fill: var(--bd-pd) }
.lk-micro .mk-fatb { fill: var(--bd-fatl) }
.lk-micro .mk-fat { fill: var(--bd-fatc); stroke: var(--bd-fatl); stroke-width: .5 }
.lk-micro .mk-col { fill: none; stroke: var(--bd-col); stroke-linecap: round; opacity: .95 }
.lk-micro .mk-ela { fill: none; stroke: var(--bd-nuc2); stroke-width: .5; opacity: .75 }
.lk-micro .mk-elast { fill: color-mix(in srgb, var(--c5) 26%, var(--bd-rd)); stroke: color-mix(in srgb, var(--c5) 40%, var(--bd-rd)); stroke-width: .4 }
.lk-micro .mk-cap { fill: none; stroke: var(--lk-cap); stroke-linecap: round }
.lk-micro .mk-inf { fill: var(--bd-nuc2) }
.lk-micro .mk-epi { fill: var(--bd-epi) }
.lk-micro .mk-nuc { fill: var(--bd-nuc) }
.lk-micro .mk-mel { fill: var(--bd-mel) }
.lk-micro .mk-sc { fill: none; stroke: var(--bd-sc2); stroke-width: .9; stroke-linecap: round }
.lk-micro .mk-mar { fill: var(--bd-mar) }
.lk-micro .mk-trab { fill: none; stroke: var(--bd-bonel); stroke-linecap: round }
.lk-micro .mk-cort { fill: var(--bd-bonel) }
.lk-micro .mk-endo { fill: var(--bd-mus) }
.lk-micro .mk-fib { fill: var(--bd-mf1); stroke: var(--bd-mf2); stroke-width: .7 }

/* the list of changes: a meter per change, hollow dot before, solid dot after */
.lk-list { display: grid; gap: 8px }
.lk-two { display: grid; gap: 14px }
@container lk (min-width: 560px) { .lk-two { grid-template-columns: 1fr 1fr } }
.lk-two > div { display: grid; gap: 6px; align-content: start }
.lk-sub { display: flex; align-items: center; font-weight: 650; font-size: .9rem }
.lk-rows { list-style: none; padding: 0; margin: 0 0 4px; display: grid; gap: 2px }
.lk-row { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto 84px; gap: 10px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: .88rem }
.lk-row:last-child { border-bottom: 0 }
.lk-row.good { --lk: var(--v0) } .lk-row.bad { --lk: var(--v3) } .lk-row.neu { --lk: var(--accent) }
.lk-ar { color: var(--lk); font-size: .72rem; text-align: center }
.lk-rn { color: var(--ink); font-weight: 560; min-width: 0 }
.lk-rw { color: var(--lk); font-weight: 650; font-size: .82rem; text-align: right }
.lk-mt { position: relative; height: 8px; border-radius: 4px; background: var(--sunk) }
.lk-mt i { position: absolute; top: 50% }
.lk-span { top: 1px !important; bottom: 1px; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--lk) 35%, transparent) }
.lk-b, .lk-a { width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50% }
.lk-b { border: 2px solid var(--muted); background: var(--surface) }
.lk-a { background: var(--lk); box-shadow: 0 0 0 2px var(--surface) }
@media (max-width: 420px) { .lk-row { grid-template-columns: 14px minmax(0, 1fr) 64px } .lk-rw { grid-column: 2; grid-row: 2; text-align: left; margin-top: -4px } .lk-mt { grid-column: 3; grid-row: 1 / 3 } }
.lk-note { color: var(--ink2); font-size: .88rem; line-height: 1.5 }
.lk-disc { display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line) }
.lk-disc p:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: 6px }
@media (prefers-reduced-motion: reduce) { .lk-fade .lk-right { animation: none } }
/* with hundreds of options, the list scrolls inside the card */
.bdx-aglist { max-height: min(460px, 62vh); overflow-y: auto; overscroll-behavior: contain; padding: 2px 4px 2px 2px; margin: -2px -4px -2px -2px; scrollbar-width: thin; align-content: start }
/* the scroller clips anything outside it, so the focus ring is drawn inside the button */
.bdx-aglist .bdx-ag:focus-visible { outline-offset: -3px }
/* an option whose details are still loading */
.bdx-ag.busy { opacity: .6; cursor: progress }
.bdx-ag.busy .bdx-dot { animation: lk-pulse .8s ease-in-out infinite alternate }
@keyframes lk-pulse { to { transform: scale(1.5) } }
@media (prefers-reduced-motion: reduce) { .bdx-ag.busy .bdx-dot { animation: none } }

/* ===== Stack checker (route "stack"). Everything is prefixed .stk- and built from the app tokens.
   Severity is carried by two variables set on the severity classes at the end of this file:
   --sev (stripe, text) and --sev-soft (wash). major = --v3, moderate = --v1, minor = --v2. ===== */

/* ---------- banner and builder ---------- */
.stk-banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r); background: var(--v1-soft); border: 1px solid color-mix(in srgb, var(--v1) 32%, transparent); color: var(--ink); font-size: .93rem; line-height: 1.5 }
.stk-banner .ic { color: var(--v1); margin-top: 1px }
.stk-banner strong { font-weight: 680 }
.stk-build { gap: 14px; position: relative; z-index: 2 }
.stk-build-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px }
.stk-count { font: 500 .74rem var(--f-mono); color: var(--muted); letter-spacing: .02em }
.stk-combo { position: relative }
.stk-combo .search-in { max-width: none; height: 50px; border-radius: 13px }
.stk-combo .search-in input { font-size: 1rem }
.stk-sug { position: absolute; z-index: 18; left: 0; right: 0; top: calc(100% + 6px); display: grid; gap: 2px; padding: 6px; max-height: min(380px, 60vh); overflow: auto; overscroll-behavior: contain; background: var(--raised); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); animation: stk-pop .14s ease }
@keyframes stk-pop { from { opacity: .001; transform: translateY(-4px) } to { opacity: 1; transform: none } }
.stk-opt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "ic t k" "ic s k"; column-gap: 12px; row-gap: 1px; align-items: center; width: 100%; padding: 9px 12px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: left }
.stk-opt .ic { grid-area: ic; width: 18px; height: 18px; color: var(--muted) }
.stk-opt-t { grid-area: t; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.stk-opt-s { grid-area: s; font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.stk-opt-k { grid-area: k; font: 500 .62rem var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); white-space: nowrap }
.stk-opt mark { background: none; color: inherit; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px }
.stk-opt:hover, .stk-opt[aria-selected="true"] { background: var(--accent-soft) }
.stk-opt[aria-selected="true"] .stk-opt-t { color: var(--accent-ink) }
.stk-opt[aria-selected="true"] .ic { color: var(--accent-ink) }
.stk-opt[aria-disabled="true"] { opacity: .55 }
.stk-opt-none { padding: 14px 12px; color: var(--muted); font-size: .9rem }

/* chips for the items in the stack */
.stk-chips:focus { outline: none }
.stk-nothing { padding: 4px 0 }
.stk-chiplist { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px }
.stk-chip { position: relative; display: inline-flex; align-items: center; gap: 2px; max-width: 100%; min-height: 42px; padding: 3px 4px 3px 7px; border: 1px solid var(--line2); border-radius: 999px; background: var(--surface); margin: 0 }
.stk-chip.stk-major, .stk-chip.stk-moderate, .stk-chip.stk-minor { border-color: color-mix(in srgb, var(--sev) 50%, var(--line2)) }
.stk-dot { position: absolute; top: -3px; left: 20px; width: 10px; height: 10px; border-radius: 3px; transform: rotate(45deg); background: var(--sev); border: 2px solid var(--surface) }
.stk-num { flex: none; display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--sunk); color: var(--ink2); font: 600 .7rem/1 var(--f-mono); font-variant-numeric: tabular-nums }
.stk-chip .stk-num { background: var(--sev-soft, var(--sunk)); color: var(--sev, var(--ink2)) }
.stk-chip-n { display: inline-flex; align-items: baseline; gap: 7px; min-width: 0; padding: 5px 6px; border: 0; background: none; color: var(--ink); font-size: .92rem; font-weight: 620; text-align: left; border-radius: 8px }
.stk-chip-n > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0 }
.stk-chip-n small { flex: none; font: 500 .62rem var(--f-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted) }
button.stk-chip-n:hover > span:first-child { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px }
.stk-chip-x { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--muted); padding: 0 }
.stk-chip-x:hover { background: var(--v3-soft); color: var(--v3) }
.stk-chip-x .ic { width: 15px; height: 15px }
.stk-chip.stk-gone { border-style: dashed; opacity: .75 }

/* quick adds, tools, saved stacks */
.stk-quick { display: grid; gap: 10px }
.stk-quick:empty { display: none }
.stk-qrow { display: grid; gap: 6px }
.stk-qh { font-size: .8rem; color: var(--muted); font-weight: 550 }
.stk-qk .ic { width: 15px; height: 15px }
.stk-qk[aria-pressed="true"] .ic { stroke-width: 2.6 }
.stk-more { border-style: dashed }
.stk-tools { display: grid; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line) }
.stk-tools:not(:has(.stk-acts, .stk-saveform, .stk-saved, .stk-msg:not(:empty), .stk-copybox)) { padding-top: 0; border-top: 0 }
.stk-acts { gap: 6px }
.stk-msg:empty { display: none }
.stk-saveform { display: flex; flex-wrap: wrap; gap: 10px; align-items: end }
.stk-saveform .field { flex: 1 1 220px; max-width: 360px }
.stk-saved { display: grid; gap: 6px }
.stk-svlist { list-style: none; padding: 0; margin: 0 }
.stk-sv { display: inline-flex; align-items: center; gap: 2px; margin: 0 }
.stk-sv .iconbtn { border-color: transparent; background: none }
.stk-sv .iconbtn:hover { color: var(--v3) }
.stk-copybox { margin-top: 6px; font: 400 .82rem/1.5 var(--f-mono) }

/* links inside toasts: the toast stack ignores the pointer, these take it back */
.stk-tlink { pointer-events: auto; border: 0; background: none; padding: 0 0 0 4px; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer }
.stk-tlink:focus-visible { outline-color: var(--surface) }

/* ---------- results ---------- */
.stk-results { display: grid; gap: 22px; min-width: 0 }
.stk-results > *, .stk-sec > * { min-width: 0 }
.stk-sec { gap: 14px; scroll-margin-top: 84px; min-width: 0 }
/* long sources, brand names or links never push the page sideways on a phone */
.stk-ix-t, .stk-ix-dl dd, .stk-src, .stk-lrow-b, .stk-opt-none, .stk-cover, .stk-note p, .stk-same, .stk-ev-b, .stk-vb, .stk-banner p { overflow-wrap: anywhere }
.stk-sech { display: grid; gap: 4px }
.stk-sech h2:focus, .stk-verdict h2:focus { outline: none }

/* verdict: the one-line answer, colored by the worst listed severity */
.stk-verdict { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px 16px; align-items: start; padding: 20px; border-radius: var(--r-lg); background: var(--sev-soft, var(--surface)); border: 1px solid color-mix(in srgb, var(--sev, var(--line2)) 35%, transparent) }
.stk-vic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--sev, var(--accent)); color: var(--on-solid) }
.stk-vic .ic { width: 24px; height: 24px; stroke-width: 2 }
.stk-vic .ic .tf { fill: color-mix(in srgb, currentColor 25%, transparent) }
.stk-vb { display: grid; gap: 6px; min-width: 0 }
.stk-vb > p:not(.eyebrow) { max-width: 70ch; line-height: 1.55; color: var(--ink2) }
.stk-vb .btnrow { margin-top: 6px }
.stk-verdict.stk-one, .stk-verdict.stk-hid { background: var(--surface); border: 1px dashed var(--line2) }
.stk-verdict.stk-one .stk-vic, .stk-verdict.stk-hid .stk-vic { background: var(--accent-soft); color: var(--accent-ink) }
.stk-sevbar { display: flex; gap: 3px; height: 9px; margin-top: 6px; max-width: 420px; border-radius: 999px; overflow: hidden }
.stk-sevbar > span { display: block; min-width: 10px; background: var(--sev) }
.stk-sevkey { display: flex; flex-wrap: wrap; gap: 4px 14px; font: 600 .74rem var(--f-mono); color: var(--ink2) }
.stk-sevkey > span { display: inline-flex; align-items: center; gap: 6px }
.stk-sevkey i { width: 9px; height: 9px; border-radius: 2px; transform: rotate(45deg); background: var(--sev) }
.stk-tiles .stk-tile { text-align: left; color: var(--ink); font: inherit; cursor: pointer; transition: border-color .15s, transform .15s }
.stk-tiles .stk-tile:hover { border-color: var(--accent); transform: translateY(-2px) }

/* severity chip: a diamond, so it never reads as an evidence verdict dot */
.stk-sev { display: inline-flex; align-items: center; gap: 7px; padding: 2px 10px 2px 9px; border-radius: 999px; background: var(--sev-soft); color: var(--sev); font: 650 .74rem/1.5 var(--f-text); white-space: nowrap }
.stk-sev i { width: 8px; height: 8px; border-radius: 2px; background: currentColor; transform: rotate(45deg); flex: none }
.stk-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px }
.stk-bars i { display: block; width: 4px; border-radius: 1px; background: currentColor; opacity: .28 }
.stk-bars i:nth-child(1) { height: 5px } .stk-bars i:nth-child(2) { height: 9px } .stk-bars i:nth-child(3) { height: 13px }
.stk-bars.b1 i:nth-child(1), .stk-bars.b2 i:nth-child(-n+2), .stk-bars.b3 i { opacity: 1 }

/* the pair grid */
.stk-mxwrap { padding: 4px 0 }
.stk-mx { border-collapse: separate; border-spacing: 4px; font-size: .86rem }
.stk-mx thead th { font: 600 .7rem var(--f-mono); color: var(--muted); text-align: center; padding: 2px 0; min-width: 34px }
.stk-mx tbody th { position: sticky; left: 0; z-index: 1; background: var(--bg); text-align: left; font-weight: 600; padding: 0 10px 0 0; white-space: nowrap }
.stk-mx-n { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; margin-left: 7px }
.stk-mx td { width: 36px; height: 36px; padding: 0; text-align: center; vertical-align: middle }
.stk-mx-self { border-radius: 8px; background: repeating-linear-gradient(45deg, var(--line) 0 2px, transparent 2px 7px) }
.stk-mx-0 { border-radius: 8px; background: var(--sunk) }
.stk-cell { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: var(--sev); color: var(--on-solid); font: 650 .82rem var(--f-mono); transition: transform .12s }
button.stk-cell:hover { transform: scale(1.08) }
.stk-cell.stk-hid { background: var(--surface); color: var(--muted); border: 1.5px dashed var(--line2) }
.stk-cell.stk-none { background: var(--sunk) }
.stk-cell.sm { width: 22px; height: 22px; border-radius: 6px }
.stk-cell.sm .stk-bars { transform: scale(.75) }
@media (max-width: 480px) { .stk-mx-n { max-width: 96px } .stk-mx tbody th { padding-right: 6px } }
.stk-legend { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8rem; color: var(--ink2) }
.stk-legend li { display: inline-flex; align-items: center; gap: 7px; margin: 0 }

/* interaction cards */
.stk-group { display: grid; gap: 10px }
.stk-gh { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font: 650 .92rem/1.4 var(--f-text); margin-top: 4px }
.stk-gh > .muted { font-weight: 450 }
.stk-ix { position: relative; display: grid; gap: 10px; padding: 16px 18px 16px 22px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); scroll-margin-top: 90px; transition: box-shadow .3s }
.stk-ix::before { content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 6px; border-radius: var(--r) 0 0 var(--r); background: var(--sev, var(--line2)) }
.stk-ix.stk-hid::before { background: repeating-linear-gradient(180deg, var(--line2) 0 5px, transparent 5px 9px) }
.stk-ix:focus { outline: none }
.stk-ix:focus-visible, .stk-ix.stk-flash { box-shadow: 0 0 0 3px color-mix(in srgb, var(--sev, var(--accent)) 40%, transparent) }
.stk-ix-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px }
.stk-ix-t { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font: 680 1.08rem/1.3 var(--f-display); letter-spacing: -.012em; min-width: 0 }
.stk-plus { color: var(--faint); font-weight: 500 }
.stk-ix-tags { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center }
.stk-ix-dl { display: grid; gap: 10px; margin: 0 }
.stk-ix-dl > div { display: grid; gap: 3px }
.stk-ix-dl dt { font: 600 .66rem/1.4 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted) }
.stk-ix-dl dd { margin: 0; font-size: .95rem; line-height: 1.58; max-width: 68ch }
@media (min-width: 860px) { .stk-ix-dl { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px } }
.stk-src { display: flex; gap: 8px; align-items: flex-start; font-size: .82rem; line-height: 1.45; color: var(--muted) }
.stk-src .ic { width: 15px; height: 15px; margin-top: 2px }
/* nothing listed: neutral on purpose (no green), since a missing listing is not proof of safety */
.stk-clean { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--r); background: var(--surface); border: 1px dashed var(--line2) }
.stk-clean > .ic { width: 26px; height: 26px; color: var(--muted); margin-top: 2px }
.stk-clean > div { display: grid; gap: 4px }
.stk-cover { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--sunk); font-size: .9rem; line-height: 1.5 }
.stk-cover .ic { color: var(--muted); margin-top: 1px }

/* guess first */
.stk-guess { display: grid; gap: 8px; padding: 12px 14px; border-radius: 10px; background: var(--sunk) }
.stk-gb .stk-bars { margin-right: 2px }
.stk-gb.stk-major .stk-bars { color: var(--v3) } .stk-gb.stk-moderate .stk-bars { color: var(--v1) } .stk-gb.stk-minor .stk-bars { color: var(--v2) }
.stk-gbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 14px; padding: 10px 14px; border-radius: var(--r); border: 1px dashed var(--line2); background: var(--surface); font-size: .9rem }
.stk-gres { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 620 }
.stk-gres .ic { width: 17px; height: 17px; stroke-width: 2.4 }
.stk-gres.right { color: var(--v0) }
.stk-gres.off { color: var(--v1) }

/* also listed with your items */
.stk-wrow { gap: 12px; box-shadow: inset 4px 0 0 var(--sev, var(--line2)); padding-left: 18px }
.stk-wrow .lmain { min-width: 120px }
@media (max-width: 520px) { .stk-wrow { flex-wrap: wrap } .stk-wrow .lmain { flex-basis: 100% } }

/* shared pathways */
.stk-lead { display: grid; gap: 8px }
.stk-lead > p { font-weight: 620 }
.stk-note { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--accent-soft); font-size: .92rem; line-height: 1.55 }
.stk-note .ic { color: var(--accent-ink); margin-top: 1px }
.stk-note p { max-width: 75ch }
.stk-note.stk-dupe { background: var(--v1-soft) }
.stk-note.stk-dupe .ic { color: var(--v1) }
.stk-pwgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)) }
.stk-pw { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); align-items: start }
.stk-pw.nothumb { grid-template-columns: minmax(0, 1fr) }
.stk-pwthumb { display: grid; place-items: center; min-height: 124px; padding: 8px; border-radius: 10px; background: var(--zone-shade); overflow: hidden }
.stk-pwthumb .pw { width: 100%; height: auto; max-height: 160px }
.stk-pwthumb .pe { opacity: .3 }
.stk-pwthumb .pn rect { opacity: .32 }
.stk-pwthumb .pn.stk-hit rect { opacity: 1; fill: var(--kc); stroke: var(--kc) }
.stk-pw-b { display: grid; gap: 8px; min-width: 0 }
.stk-pw-b .card-h .link { text-decoration: none; color: var(--ink); font: inherit; text-align: left }
.stk-pw-b .card-h .link:hover { color: var(--accent-ink); text-decoration: underline }
.stk-pw-items { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; font-size: .9rem; line-height: 1.45 }
.stk-pw-items li { display: flex; gap: 8px; align-items: flex-start; margin: 0 }
.stk-same { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 9px; background: var(--v1-soft); font-size: .86rem; line-height: 1.45 }
.stk-same .ic { width: 16px; height: 16px; color: var(--v1); margin-top: 1px }
@media (max-width: 440px) { .stk-pw { grid-template-columns: 78px minmax(0, 1fr); gap: 10px } .stk-pwthumb { min-height: 96px; padding: 5px } }
.stk-foot { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface) }
.stk-foot > summary { display: flex; align-items: center; gap: 8px; padding: 12px 16px; cursor: pointer; list-style: none; font-weight: 600; font-size: .92rem; color: var(--ink2) }
.stk-foot > summary::-webkit-details-marker { display: none }
.stk-foot > summary .ic { width: 17px; height: 17px; transition: transform .2s }
.stk-foot[open] > summary .ic { transform: rotate(180deg) }
.stk-foot-b, .stk-foot-one { display: grid; gap: 14px }
.stk-foot-b { padding: 0 16px 16px }
.stk-fp { display: grid; gap: 7px }
.stk-fp-n { display: flex; align-items: center; gap: 8px }

/* evidence by goal */
.stk-goals { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)) }
.stk-goal { gap: 10px }
.stk-goal-h { display: flex; gap: 12px; align-items: center }
.stk-goal-ic { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-ink) }
.stk-goal-ic .ic { width: 22px; height: 22px }
.stk-goal-h .card-h .link { text-decoration: none; color: var(--ink); font: inherit }
.stk-goal-h .card-h .link:hover { color: var(--accent-ink); text-decoration: underline }
.stk-ev { list-style: none; padding: 0; margin: 0; display: grid }
.stk-ev li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); margin: 0 }
.stk-ev-b { display: grid; gap: 4px; min-width: 0 }
.stk-ev-t { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px }
.stk-ev-b > .sm { color: var(--ink2); line-height: 1.5 }
.stk-better { display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line) }

/* empty state */
.stk-empty { display: grid; gap: 14px; justify-items: start; padding: 28px; border: 1px dashed var(--line2); border-radius: var(--r-lg); background: var(--surface) }
.stk-empty-art { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-ink) }
.stk-empty-art .ic { width: 30px; height: 30px }
.stk-exs { display: grid; gap: 10px; width: 100%; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)) }
.stk-ex { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "t ic" "d ic"; gap: 3px 12px; align-items: center; padding: 14px 16px; border: 1px solid var(--line2); border-radius: var(--r); background: var(--surface); color: var(--ink); text-align: left; transition: border-color .15s, box-shadow .15s, transform .15s }
.stk-ex:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px) }
.stk-ex-t { grid-area: t; font: 680 1.02rem/1.3 var(--f-display); letter-spacing: -.01em }
.stk-ex-d { grid-area: d; font-size: .84rem; line-height: 1.4; color: var(--muted) }
.stk-ex > .ic { grid-area: ic; width: 18px; height: 18px; color: var(--accent-ink) }
.stk-how { display: grid; gap: 8px; margin: 0; padding-left: 1.3em; color: var(--ink2); font-size: .93rem; line-height: 1.5; max-width: 72ch }
.stk-how li { margin: 0 }

/* how to read, and the library */
.stk-scale { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px }
.stk-scale li { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 10px; align-items: start; font-size: .92rem; line-height: 1.5; margin: 0 }
.stk-scale .stk-sev { justify-self: start }
.stk-lib { display: block; padding: 0; overflow: hidden }
.stk-lib > summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px; cursor: pointer; list-style: none }
.stk-lib > summary::-webkit-details-marker { display: none }
.stk-lib > summary:hover .card-h { color: var(--accent-ink) }
.stk-lib > summary > .ic { color: var(--muted); transition: transform .2s }
.stk-lib[open] > summary > .ic { transform: rotate(180deg) }
.stk-lib-s { display: grid; gap: 2px }
.stk-lib-b { display: grid; gap: 12px; padding: 0 20px 20px }
.stk-liblist { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden }
.stk-lrow { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px 12px 20px; border-top: 1px solid var(--line); background: var(--surface) }
.stk-lrow:first-child { border-top: 0 }
.stk-lrow::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 0 3px 3px 0; background: var(--sev, var(--line2)) }
.stk-lrow-b { display: grid; gap: 4px; min-width: 0 }
.stk-lrow-t { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-weight: 650 }
.stk-lrow-b > .sm { color: var(--ink2); line-height: 1.5 }
.stk-lrow .btn { flex: none }
@media (max-width: 560px) { .stk-lrow { flex-direction: column; align-items: flex-start } }

/* ---------- severity variables (kept last so they win over component defaults) ---------- */
.stk-major { --sev: var(--v3); --sev-soft: var(--v3-soft) }
.stk-moderate { --sev: var(--v1); --sev-soft: var(--v1-soft) }
.stk-minor { --sev: var(--v2); --sev-soft: var(--v2-soft) }
.stk-other { --sev: var(--muted); --sev-soft: var(--sunk) }
.stk-hid { --sev: var(--line2); --sev-soft: var(--surface) }
.stk-clear { --sev: var(--ink2); --sev-soft: var(--surface) }

@media (prefers-reduced-motion: reduce) {
  .stk-sug { animation: none }
  .stk-ex:hover, .stk-tiles .stk-tile:hover, button.stk-cell:hover { transform: none }
}

/* ===== f-tutor: Claude tutor dock, lesson read-aloud, practice sheet and voice notes. Built only from app.css tokens. ===== */
:root { --tut-w: 420px }

/* availability: Claude-only controls disappear while Claude is unreachable (no-sample) or switched off in Settings (no-tutor) */
body.no-sample .tutor-only, body.no-tutor .tutor-only { display: none !important }
body.no-tutor .tut-dock { display: none !important }
.ask-btn[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent) }

/* ---------- the dock: a right-hand panel on wide screens, a bottom sheet above the tab bar on phones ---------- */
/* z-index 28: above the top bar (20) and tab bar (22), below the phone menu (30), the detail sheet (50) and search (60) */
.tut-dock { position: fixed; z-index: 28; top: 0; right: 0; bottom: var(--tut-kb, 0px); width: min(var(--tut-w), 100%); display: flex; flex-direction: column; background: var(--raised); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) 0; transform: translateX(104%); transition: transform .26s cubic-bezier(.2, .8, .2, 1); overscroll-behavior: contain }
.tut-dock.in { transform: none }
.tut-grab { display: none }
@media (min-width: 1200px) {
  .main { transition: margin-right .26s cubic-bezier(.2, .8, .2, 1) }
  body.tut-open:not(.no-tutor) .main { margin-right: var(--tut-w) }
  .tut-dock { box-shadow: none }
}
@media (max-width: 759px) {
  .tut-dock { top: auto; left: 0; width: 100%; height: min(78vh, 680px); height: min(78dvh, 680px); max-height: calc(var(--tut-vh, 100vh) - 12px); bottom: var(--tut-tabs, calc(54px + env(safe-area-inset-bottom, 0px))); border-left: 0; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; padding: 0 env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px); transform: translateY(calc(100% + 140px)) }
  .tut-dock.tut-notabs { padding-bottom: env(safe-area-inset-bottom, 0px) }
  .tut-grab { display: block; flex: none; width: 40px; height: 4px; margin: 8px auto 0; border-radius: 2px; background: var(--line2) }
}

/* header */
.tut-top { flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line) }
.tut-mark { flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: var(--on-accent); background: linear-gradient(140deg, var(--accent), var(--c7)) }
.tut-mark .ic { width: 20px; height: 20px }
.tut-mark .ic .tf, .tut-art .ic .tf { fill: color-mix(in srgb, currentColor 35%, transparent) }
.tut-ttl { flex: 1; min-width: 0; display: grid; gap: 2px }
.tut-h { font: 700 1.06rem/1.15 var(--f-display); letter-spacing: -.018em }
.tut-about { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: .8rem; line-height: 1.3; color: var(--muted) }
.tut-kind { flex: none; padding: 1px 6px; border-radius: 5px; background: var(--accent-soft); color: var(--accent-ink); font: 600 .6rem/1.5 var(--f-mono); letter-spacing: .08em; text-transform: uppercase }
.tut-abt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.tut-abt b { color: var(--ink2); font-weight: 600 }

/* conversation */
.tut-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 16px; padding: 18px 16px 12px; scrollbar-width: thin }
.tut-log:focus-visible { outline-offset: -3px }
.tut-msg { min-width: 0 }
.tut-msg.me { align-self: flex-end; max-width: 86% }
.tut-bub { padding: 9px 14px; border-radius: 16px 16px 5px 16px; background: var(--accent); color: var(--on-accent); font-size: .93rem; line-height: 1.5; overflow-wrap: anywhere }
.tut-msg.ai { display: flex; gap: 10px; align-items: flex-start }
.tut-av { flex: none; width: 28px; height: 28px; margin-top: 1px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink) }
.tut-av .ic { width: 16px; height: 16px }
.tut-col { flex: 1; min-width: 0; display: grid; gap: 6px; justify-items: start }
.tut-body { width: 100%; display: grid; gap: 9px; font-size: .95rem; line-height: 1.62; color: var(--ink); overflow-wrap: anywhere }
.tut-body ul, .tut-body ol { display: grid; gap: 4px; padding-left: 1.25em }
.tut-body li::marker { color: var(--accent) }
.tut-body strong { font-weight: 650 }
.tut-hd { font-weight: 650 }
.tut-msg.stream .tut-body > p:last-child::after, .tut-msg.stream .tut-body > ul:last-child > li:last-child::after, .tut-msg.stream .tut-body > ol:last-child > li:last-child::after { content: ""; display: inline-block; width: 7px; height: 1em; margin-left: 3px; vertical-align: -2px; border-radius: 2px; background: var(--accent); animation: tut-blink 1.05s step-end infinite }
@keyframes tut-blink { 50% { opacity: 0 } }
.tut-think { display: inline-flex; align-items: center; gap: 10px; min-height: 28px; color: var(--muted); font-size: .9rem }
.tut-dots { display: inline-flex; gap: 4px }
.tut-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .3; animation: tut-dot 1.2s ease-in-out infinite }
.tut-dots i:nth-child(2) { animation-delay: .15s }
.tut-dots i:nth-child(3) { animation-delay: .3s }
@keyframes tut-dot { 0%, 80%, 100% { opacity: .25; transform: none } 40% { opacity: 1; transform: translateY(-3px) } }
.tut-note { display: flex; align-items: flex-start; gap: 7px; font-size: .84rem; line-height: 1.45; color: var(--muted) }
.tut-note .ic { width: 16px; height: 16px; margin-top: 1px }
.tut-note.err .ic { color: var(--v3) }
.tut-note.err span { color: var(--ink2) }
.tut-acts { display: flex; flex-wrap: wrap; gap: 2px; margin-left: -7px }
.tut-act { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 4px 8px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: .78rem; font-weight: 550 }
.tut-act:hover:not(:disabled) { background: var(--sunk); color: var(--accent-ink) }
.tut-act .ic { width: 15px; height: 15px }
.tut-div { display: flex; align-items: center; gap: 10px; margin: 2px 0; color: var(--muted); font: 600 .62rem/1.4 var(--f-mono); letter-spacing: .08em; text-transform: uppercase }
.tut-div::before, .tut-div::after { content: ""; flex: 1; border-top: 1px solid var(--line) }
.tut-div span { max-width: 75%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }

/* empty state */
.tut-hello { display: grid; gap: 10px; align-content: start; padding: 4px 2px 0 }
.tut-art { width: 54px; height: 54px; margin-bottom: 4px; border-radius: 17px; display: grid; place-items: center; color: var(--on-accent); background: radial-gradient(circle at 30% 25%, var(--c7), var(--accent) 72%); box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 28%, transparent) }
.tut-art .ic { width: 28px; height: 28px }
.tut-hello-h { font: 700 1.3rem/1.2 var(--f-display); letter-spacing: -.022em }
.tut-hello .eyebrow { margin-top: 8px }
.tut-sugs { display: grid; gap: 8px }
.tut-sug { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink2); font-size: .9rem; line-height: 1.4; text-align: left; transition: border-color .15s, background .15s }
.tut-sug:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink) }
.tut-sug .ic { width: 16px; height: 16px; margin-top: 1px; color: var(--accent) }
.tut-keys { margin-top: 10px; font-size: .78rem; color: var(--muted) }
.tut-off { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px dashed var(--line2); border-radius: 12px; background: var(--sunk) }
.tut-off > .ic { width: 20px; height: 20px; margin-top: 2px; color: var(--muted) }
.tut-off-t { margin-bottom: 2px; font-weight: 650 }

/* composer */
.tut-foot { flex: none; display: grid; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--raised) }
.tut-chips { display: flex; gap: 6px; overflow-x: auto; margin: 0 -12px; padding: 1px 12px 2px; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 28px), transparent) }
.tut-chips::-webkit-scrollbar { display: none }
.tut-chips .chip { flex: none; min-height: 32px; padding: 4px 11px; font-size: .8rem; white-space: nowrap }
.tut-chips .chip:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-ink) }
/* with a mouse there is no swipe and the scrollbar is hidden, so every chip has to be in view: let them wrap */
@media (pointer: fine) { .tut-chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; -webkit-mask-image: none; mask-image: none } }
.tut-partial { padding: 0 4px; font-size: .85rem; font-style: italic; line-height: 1.4; color: var(--muted) }
.tut-box { display: flex; align-items: flex-end; gap: 4px; padding: 5px 5px 5px 12px; border: 1px solid var(--line2); border-radius: 14px; background: var(--surface); transition: border-color .15s, box-shadow .15s }
.tut-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent) }
.tut-box textarea, .tut-box textarea:focus { flex: 1; width: auto; min-width: 0; min-height: 38px; max-height: 168px; padding: 8px 0; border: 0; border-radius: 0; background: none; box-shadow: none; outline: none; resize: none; font-size: .95rem; line-height: 1.45 }
.tut-box textarea:disabled { cursor: not-allowed }
.tut-ib { flex: none; width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 11px; background: none; color: var(--muted) }
.tut-ib .ic { width: 19px; height: 19px }
.tut-mic:hover { background: var(--sunk); color: var(--accent-ink) }
.tut-send { background: var(--accent); color: var(--on-accent); transition: background .15s, transform .1s }
.tut-send:hover:not(:disabled) { background: var(--accent-ink) }
.tut-send:active:not(:disabled) { transform: scale(.94) }
.tut-send:disabled { background: var(--sunk); color: var(--faint); opacity: 1 }
.tut-stop { background: var(--ink); color: var(--surface) }
.tut-fine { font-size: .72rem; line-height: 1.35; text-align: center; color: var(--muted) }
@media (pointer: coarse) { .tut-keys { display: none } .tut-act { min-height: 38px } }

/* recording: the mic in the dock and in the notes bar */
.tut-rec { position: relative }
.tut-mic.tut-rec { background: var(--v3-soft); color: var(--v3) }
.btn.tut-dict.tut-rec { border-color: var(--v3); background: var(--v3-soft); color: var(--v3) }
.tut-rec::after { content: ""; position: absolute; inset: -3px; border: 2px solid var(--v3); border-radius: inherit; opacity: 0; pointer-events: none; animation: tut-ping 1.6s ease-out infinite }
@keyframes tut-ping { 0% { opacity: .55; transform: scale(.96) } 100% { opacity: 0; transform: scale(1.12) } }
.tut-np { flex: 1 1 100%; padding: 2px 2px 0; font-size: .88rem; font-style: italic; line-height: 1.45; color: var(--muted) }
.tut-np::before { content: "Hearing"; margin-right: 8px; font: normal 600 .62rem var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--v3) }

/* ---------- lesson tools and read-aloud ---------- */
.tut-tools { display: contents }
.btn.tut-listen.tut-live { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink) }
.tut-rate { min-width: 52px; font-family: var(--f-mono) }
.prose .tut-reading { border-radius: 3px; background: color-mix(in srgb, var(--accent) 10%, transparent); box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 10%, transparent); transition: background .3s, box-shadow .3s }

/* ---------- practice with Claude (in the side sheet) ---------- */
.tut-pq { display: grid; gap: 14px }
.tut-pq-h { display: grid; gap: 6px }
.tut-pq-h h2:focus { outline: none }
.tut-pq-e { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-ink) }
.tut-pq-e .ic { width: 15px; height: 15px }
.tut-load { display: grid; justify-items: center; gap: 12px; padding: 36px 8px; text-align: center; color: var(--muted) }
.tut-pips { display: flex; gap: 6px }
.tut-pips i { flex: 1; height: 6px; border-radius: 3px; background: var(--sunk); transition: background .2s }
.tut-pips i.on { background: var(--accent) }
.tut-pips i.ok { background: var(--v0) }
.tut-pips i.no { background: var(--v3) }
.tut-pq-q { font: 680 1.16rem/1.38 var(--f-display); letter-spacing: -.012em }
.tut-opts { display: grid; gap: 8px }
.tut-res { display: flex; flex-wrap: wrap; gap: 18px; align-items: center }
.tut-res .ring { width: 104px; height: 104px }
.tut-res-t { flex: 1; min-width: 200px; display: grid; gap: 6px }
.tut-miss { display: grid; gap: 10px }
.tut-miss > div { display: grid; gap: 5px; padding: 12px 14px; border-radius: 12px; background: var(--sunk); font-size: .94rem; line-height: 1.5 }
.tut-lbl { display: inline-block; margin-right: 8px; padding: 0 6px; border-radius: 4px; font: 600 .6rem/1.6 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; vertical-align: 1px }
.tut-lbl.no { background: var(--v3-soft); color: var(--v3) }
.tut-lbl.ok { background: var(--v0-soft); color: var(--v0) }
.tut-perr { display: grid; gap: 14px }

@media (prefers-reduced-motion: reduce) {
  .tut-dock, .main, .tut-sug, .tut-box, .tut-send, .prose .tut-reading { transition: none }
  .tut-dots i, .tut-rec::after, .tut-msg.stream .tut-body > p:last-child::after, .tut-msg.stream .tut-body > ul:last-child > li:last-child::after, .tut-msg.stream .tut-body > ol:last-child > li:last-child::after { animation: none }
  .tut-dots i { opacity: .7 }
}

/* f-xp: level card, XP log and badge grid on the Progress page, plus XP toasts. Built from app.css tokens only. */
.xp-wrap { display: grid; gap: 16px; min-width: 0 }

/* ---------- level card ---------- */
.xp-hero { gap: 20px; overflow: hidden; border-color: color-mix(in srgb, var(--nb) 24%, var(--line));
  background: radial-gradient(130% 120% at 0% 0%, color-mix(in srgb, var(--nb) 11%, var(--surface)) 0%, var(--surface) 58%) }
.xp-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px 20px; align-items: center }
.xp-top .ring { width: 104px; height: 104px }
.xp-id { display: grid; gap: 6px; min-width: 0 }
.xp-title { display: flex; align-items: center; gap: 10px; font: 720 clamp(1.55rem, 4.4vw, 2.25rem)/1.05 var(--f-display); letter-spacing: -.03em; overflow-wrap: anywhere }
.xp-title .ic { width: 30px; height: 30px; color: var(--nb) }
.xp-meta { display: flex; flex-wrap: wrap; gap: 2px 18px; color: var(--ink2); font-size: .92rem }
.xp-meta b { font: 650 .98rem var(--f-mono); color: var(--ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums }
.xp-week { grid-column: 1 / -1; display: grid; gap: 4px; padding: 12px 14px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface) }
.xp-wk-tot { font-size: .86rem; color: var(--muted) }
.xp-wk-tot b { font: 700 1.25rem/1.1 var(--f-display); color: var(--ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums }
.xp-wk { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; align-items: end }
.xp-wk li { display: grid; justify-items: center; align-content: end; gap: 5px; height: 84px }
.xp-wk-b { display: block; width: 100%; max-width: 24px; height: calc(var(--h, 0) * 62px + 3px); border-radius: 5px 5px 2px 2px; background: color-mix(in srgb, var(--nb) 55%, var(--surface)); transition: height .4s ease }
.xp-wk li.now .xp-wk-b { background: var(--nb) }
.xp-wk li.z .xp-wk-b { background: var(--sunk); height: 3px }
.xp-wk-l { font: 500 .62rem/1 var(--f-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .04em }
.xp-wk li.now .xp-wk-l { color: var(--ink); font-weight: 650 }
@media (min-width: 900px) {
  .xp-top { grid-template-columns: auto minmax(0, 1fr) minmax(230px, 300px) }
  .xp-week { grid-column: auto }
}

/* the eight titles, Molecule to Ecologist */
.xp-ladder { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 6px }
@media (min-width: 720px) { .xp-ladder { grid-template-columns: repeat(8, minmax(0, 1fr)) } }
.xp-ladder li { display: grid; justify-items: center; gap: 4px; text-align: center; min-width: 0 }
.xp-lad-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; border: 1.5px dashed var(--line2); color: var(--faint); background: var(--surface) }
.xp-lad-ic .ic { width: 19px; height: 19px }
.xp-ladder li.done .xp-lad-ic { border: 1.5px solid var(--tc); color: var(--tc); background: color-mix(in srgb, var(--tc) 14%, var(--surface)) }
.xp-ladder li.now .xp-lad-ic { border: 1.5px solid var(--tc); background: var(--tc); color: var(--on-solid); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tc) 22%, transparent) }
.xp-lad-n { font-size: .76rem; font-weight: 620; color: var(--muted); line-height: 1.2; overflow-wrap: anywhere }
.xp-ladder li.done .xp-lad-n, .xp-ladder li.now .xp-lad-n { color: var(--ink) }
.xp-ladder small { font: 500 .6rem/1 var(--f-mono); color: var(--faint); letter-spacing: .02em }

/* recent XP and closest badges */
.xp-cols { display: grid; gap: 20px; padding-top: 16px; border-top: 1px solid var(--line) }
@media (min-width: 900px) { .xp-cols { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 28px } }
.xp-col { display: grid; gap: 4px; align-content: start; min-width: 0 }
.xp-h3 { font: 600 .68rem/1.3 var(--f-mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px }
.xp-log { list-style: none; margin: 0; padding: 0; display: grid }
.xp-log li { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line) }
.xp-log li:first-child { border-top: 0 }
.xp-amt { font: 650 .84rem var(--f-mono); color: var(--ink); font-variant-numeric: tabular-nums }
.xp-why { font-size: .9rem; color: var(--ink2); overflow-wrap: anywhere }
.xp-when { font-size: .74rem; color: var(--muted); white-space: nowrap }
.xp-near { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 10px }
.xp-near li { display: flex; gap: 12px; align-items: flex-start; --nb: var(--bc) }
.xp-how { border-top: 1px solid var(--line); padding-top: 4px }
.xp-how summary { cursor: pointer; padding: 8px 0; font-size: .9rem; font-weight: 600; color: var(--ink2); border-radius: var(--r-sm) }
.xp-how summary:hover { color: var(--accent-ink) }
.xp-rules { display: grid; margin: 0 0 8px }
.xp-rules > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); font-size: .86rem }
.xp-rules > div:first-child { border-top: 0 }
.xp-rules dt { color: var(--ink2) }
.xp-rules dd { font: 500 .78rem var(--f-mono); color: var(--ink); text-align: right; white-space: nowrap }

/* ---------- badges ---------- */
.xp-bd { gap: 14px }
.xp-bd > .bar { height: 6px }
.xp-groups { display: grid; gap: 10px }
.xp-gh { font: 600 .68rem/1.3 var(--f-mono); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-top: 8px }
.xp-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)) }
.xp-badge { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); min-width: 0; --nb: var(--bc) }
.xp-badge.on { border-color: color-mix(in srgb, var(--bc) 38%, var(--line)); background: color-mix(in srgb, var(--bc) 7%, var(--surface)) }
.xp-badge.off { background: var(--zone-shade) }
.xp-bic { position: relative; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--bc);
  background: color-mix(in srgb, var(--bc) 16%, var(--surface)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--bc) 42%, transparent) }
.xp-bic .ic { width: 23px; height: 23px }
.xp-bic.sm { width: 36px; height: 36px }
.xp-bic.sm .ic { width: 18px; height: 18px }
.xp-badge.off .xp-bic { color: var(--faint); background: var(--sunk); box-shadow: inset 0 0 0 1.5px var(--line2) }
.xp-badge.off .xp-bic .ic { opacity: .75 }
.xp-lock { position: absolute; right: -4px; bottom: -4px; width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line2); color: var(--muted) }
.xp-lock .ic, .xp-badge.off .xp-lock .ic { width: 12px; height: 12px; opacity: 1 }
.xp-bt { display: grid; gap: 3px; min-width: 0; flex: 1 }
.xp-bn { font-weight: 650; font-size: .95rem; line-height: 1.3 }
.xp-badge.off .xp-bn { color: var(--ink2) }
.xp-bdesc { font-size: .84rem; color: var(--muted); line-height: 1.4 }
.xp-bwhen { display: inline-flex; align-items: center; gap: 5px; margin-top: 2px; font: 500 .72rem var(--f-mono); color: var(--v0) }
.xp-bwhen .ic { width: 13px; height: 13px; stroke-width: 2.6 }
.xp-bwhen.off { color: var(--faint) }
.xp-bprog { display: flex; align-items: center; gap: 8px; margin-top: 3px; min-width: 0 }
.xp-bprog .bar { height: 5px }
.xp-bprog .mono { font-size: .7rem; color: var(--muted); white-space: nowrap }
.xp-badge.fresh .xp-bic { animation: xp-glow 1.6s ease 2 }
@keyframes xp-glow { 0%, 100% { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--bc) 42%, transparent) } 50% { box-shadow: inset 0 0 0 2px var(--bc), 0 0 0 6px color-mix(in srgb, var(--bc) 18%, transparent) } }

/* ---------- toasts ---------- */
/* toasts sit on --ink (dark in light theme, light in dark theme); mixing the stain with --surface moves it away
   from the toast color in both themes, so the icon keeps its contrast */
.toast.xp strong { font-weight: 750; font-variant-numeric: tabular-nums }
.toast.xp .ic { color: color-mix(in srgb, var(--c3) 66%, var(--surface)) }
.toast.xp-lvl .ic { color: color-mix(in srgb, var(--c6) 66%, var(--surface)) }
.toast.xp-badge .ic { color: color-mix(in srgb, var(--c7) 70%, var(--surface)) }

@media (prefers-reduced-motion: reduce) {
  .xp-badge.fresh .xp-bic { animation: none }
  .xp-wk-b { transition: none }
}
@media (max-width: 420px) {
  .xp-top .ring { width: 88px; height: 88px }
  .xp-log li { grid-template-columns: 46px minmax(0, 1fr); }
  .xp-when { grid-column: 2 }
}
