/* RD Risk Calculator. Visual language shared with Eyeball Atlas (drsimonchen.com.au/apps/eyeballatlas):
   warm paper, navy ink, Manrope, frosted header, one dark "stage" card for the answer.
   Light theme by design, like the Atlas. The font is served locally: no third-party requests (SCOPE.md section 11). */

@font-face { font-family: Inter; src: url(fonts/inter.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: Manrope; src: url(fonts/manrope.woff2) format('woff2'); font-weight: 200 800; font-display: swap; }

.measurement-panel { margin-top: 24px; }
.measurement-panel > summary { font-weight: 700; cursor: pointer; }
.measurement-panel p, .measurement-panel h3 { margin-top: 16px; }
.measurement-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-top: 20px; }
.measurement-inputs label { display: block; font-size: .9rem; font-weight: 600; }
.measurement-inputs input { width: 100%; min-width: 0; margin-top: 6px; }
.measurement-inputs input[type="date"] { min-height: 48px; padding: 10px 14px; border: 1px solid var(--hair-strong); border-radius: 16px; background: var(--card); }
.measurement-methods { margin-block: 16px; }
.measurement-methods select { width: 100%; }
.measurement-method-label { display: block; min-width: 130px; max-width: 180px; font-weight: normal; white-space: normal; }
.measurement-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.measurement-table { width: 100%; text-align: left; font-variant-numeric: tabular-nums; }
.measurement-table caption { text-align: left; margin-block: 14px; }
.measurement-table th, .measurement-table td { padding: 10px; white-space: nowrap; }
.measurement-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; }
.measurement-chart { margin: 20px 0 0; min-width: 0; }
.measurement-chart figcaption { font-weight: 700; }
.measurement-chart svg { width: 100%; height: auto; }
.measurement-chart svg text { font: 13px var(--num); fill: var(--ink-soft); }
.measurement-chart polyline { fill: none; stroke-width: 2; }
.measurement-eye-0 { stroke: var(--ink); fill: var(--ink); }
.measurement-eye-1 { stroke: var(--risk-ink); fill: var(--risk-ink); }
.measurement-eye-1 polyline { stroke-dasharray: 7 5; }
.measurement-axis { fill: none; stroke: var(--hair-strong); }
.measurement-legend { display: flex; flex-wrap: wrap; gap: 20px; font-size: .9rem; }
.measurement-legend span:first-child { color: var(--ink); }
.measurement-legend span:last-child { color: var(--risk-ink); }
.measurement-changes { padding-left: 20px; }
.measurement-changes li { margin-block: 8px; }
.measurement-references { margin-top: 22px; }
@media (max-width: 600px) { .measurement-chart svg text { font-size: 20px; } }
@media print { .measurement-panel { display: none !important; } }
/* Myopia measurement summary: printed with the clinician summary only, as intervals without dates. */
.measurement-print { display: none; }
@media print { body[data-view="clinician"][data-export-ready="true"] .measurement-print:not(:empty) { display: block; font-size: 9.5pt; } .measurement-print h3 { font-size: 10pt; margin: 0 0 4px; } .measurement-print ul { margin: 0; padding-left: 18px; } }

:root {
  --paper: #f6f5ef;
  --lift: #fcfbf7;
  --card: #ffffff;
  --ink: #183d69;
  --ink-soft: #40597a;
  --soft: #e1eaf4;
  --key: #edf2f8;
  --gold: #e4d4b7;
  --gold-soft: #f4ecdc;
  --gold-ink: #6b4e12;
  --hair: rgba(24, 61, 105, .14);
  --hair-strong: rgba(24, 61, 105, .26);

  --stage: #0a111c;
  --stage-2: #111b2b;
  --stage-3: #1a2639;
  --stage-ink: #e3eaf3;
  --stage-soft: #aebdd0;
  --stage-hair: rgba(190, 210, 235, .14);
  --pin: #7fd4ff;
  --pin-ink: #06223a;

  --risk: #c4472f;
  --risk-ink: #a93825;
  --risk-soft: #f8e3dd;
  --dot: #d5dde8;
  --bar-ref: #c3d1e3;
  --bar-alt: #7d9fc8;

  --body: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Numbers use Inter: conventional figures (Manrope's are too stylised for results). Self-hosted, SIL OFL (fonts/inter-OFL.txt). */
  --num: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --data: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --tap: 44px;
  --gut: max(16px, env(safe-area-inset-left, 0px));
  --gut-r: max(16px, env(safe-area-inset-right, 0px));
  --radius: 20px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 450 16px/1.6 var(--body);
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-weight: 650; letter-spacing: -.022em; line-height: 1.15; margin: 0; text-wrap: balance; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-underline-offset: 3px; }
/* In-text citations link to PubMed: same colour as the text, a thin quiet underline. */
a.cite { text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
a.cite:hover, a.cite:focus-visible { text-decoration-color: currentColor; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #8e650e; outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
h2[tabindex="-1"]:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: var(--lift); padding: 10px 14px; border-radius: 10px; z-index: 50; }
.skip:focus { top: 12px; }
.wrap { max-width: 1320px; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
@media (min-width: 700px) { .wrap { padding-left: max(32px, env(safe-area-inset-left, 0px)); padding-right: max(32px, env(safe-area-inset-right, 0px)); } }

/* ---------- Header ---------- */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 31; background: var(--lift); }
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px 24px;
  padding: 10px max(32px, env(safe-area-inset-right, 0px)) 10px max(32px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--lift) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--hair);
}
.lockup { display: flex; align-items: center; gap: 12px; min-height: var(--tap); flex-wrap: wrap; }
.lockup-icon { width: 48px; height: 48px; flex: none; }
.lockup-text { display: grid; line-height: 1.05; }
.lockup-name { font-size: 1.45rem; font-weight: 800; letter-spacing: -.03em; }
.lockup-sub { margin-top: 4px; font-size: .8rem; font-weight: 500; color: var(--ink-soft); }

.view-switch { justify-self: center; display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--card); border: 1px solid var(--hair-strong); box-shadow: 0 8px 20px -16px rgba(24, 61, 105, .5); }
.view-switch button { min-height: 38px; border: 0; background: transparent; padding: 0 16px; border-radius: 999px; cursor: pointer; font-weight: 650; color: var(--ink-soft); }
.view-switch button:hover { color: var(--ink); }
.view-switch button[aria-pressed="true"] { background: var(--ink); color: var(--lift); }

.top > .by { grid-column: -2; justify-self: end; }
.by { display: flex; align-items: center; gap: 10px; min-height: var(--tap); text-decoration: none; font-size: 1rem; font-weight: 650; line-height: 1.25; }
.by img { width: 36px; height: 36px; flex: none; }
.by small { display: block; font-size: .7rem; font-weight: 500; margin-top: 1px; color: var(--ink-soft); }
.by:hover span { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

@media (max-width: 900px) {
  .top { grid-template-columns: minmax(0, 1fr) auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .view-switch { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .view-switch button { flex: 1; }
  .by span { display: none; }
}
@media (max-width: 420px) { .lockup-sub { display: none; } .lockup-icon { width: 40px; height: 40px; } }

/* ---------- Intro: one slim notice, no hero ---------- */
.intro { padding-block: 14px 0; }
.page-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.review-note { font-size: .86rem; line-height: 1.5; color: var(--ink-soft); background: var(--gold-soft); border: 1px solid var(--gold); border-radius: 14px; padding: 8px 14px; }
.review-title { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 18px; font-size: .86rem; font-weight: 750; color: var(--gold-ink); list-style: none; cursor: pointer; }
.review-title::-webkit-details-marker { display: none; }
.rt-main { display: inline-flex; align-items: center; gap: 8px; }
.rt-main::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: #c58a1a; box-shadow: 0 0 0 3px rgba(197, 138, 26, .2); }
.rt-more { margin-left: auto; font-size: .8rem; font-weight: 700; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.rt-more::after { content: "About this calculator"; }
.review-note[open] .rt-more::after { content: "Hide"; }
.review-note > p { margin-top: 8px; max-width: 86ch; }
.review-note a { font-weight: 700; color: var(--ink); }
@media (max-width: 600px) { .intro { padding-block: 10px 0; } .rt-more::after { content: "About"; } }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: minmax(320px, 440px) minmax(0, 1fr); gap: 28px; align-items: start; padding-block: 18px 40px; }
body[data-view="patient"] .layout { grid-template-columns: minmax(0, 1fr); }
body[data-view="patient"] .inputs { display: none; }
body[data-view="patient"] .results { max-width: 780px; width: 100%; margin-inline: auto; }
@media (max-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr); } }

.panel { background: var(--card); border: 1px solid var(--hair); border-radius: var(--radius); padding: 20px; box-shadow: 0 20px 40px -34px rgba(24, 61, 105, .55); }

/* ---------- Step headings (as on the Atlas home) ---------- */
.step { display: inline-grid; place-items: center; width: 34px; height: 34px; margin-right: 12px; border-radius: 50%; background: var(--soft); color: var(--ink); font-size: .95rem; font-weight: 800; vertical-align: .05em; letter-spacing: 0; }

/* ---------- Input panel ---------- */
/* Step 1 grows to its natural height on every screen: an inner scroll hid fields
   below its fold on desktop. The result bar shows the answer while it is off screen. */
.inputs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; justify-content: space-between; min-height: 48px; margin-bottom: 4px; }
.panel-head h2 { display: flex; align-items: center; }
.form-actions { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.link-btn { border: 0; background: transparent; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 4px 10px; font-size: .88rem; font-weight: 700; min-height: 44px; }
/* Phones: no New patient button (owner, 2026-11-28). Reloading the page does the same
   job there, because nothing is saved and a restored link is cleared from the address. */
@media (max-width: 600px) { .panel-head .form-actions { display: none; } }
@media (max-width: 360px) { .panel-head .step { width: 28px; height: 28px; margin-right: 8px; } }

/* Step 1 is a short stack of blocks on the page, as the result cards are in step 2:
   the choice of estimate, then one tinted block for what every estimate needs (age,
   sex and refraction or axial length), then plain white blocks for the rest. Tint and
   position carry the grouping; no block has an accent stripe or a badge. */
.card { background: var(--card); border: 1px solid var(--hair); border-radius: var(--radius); padding: 18px 20px 20px; box-shadow: 0 20px 40px -34px rgba(24, 61, 105, .55); min-width: 0; }
.card-key { background: var(--key); border-color: rgba(24, 61, 105, .17); }
.card-key > fieldset + fieldset { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--hair); }
@media (max-width: 480px) { .card { padding: 16px 16px 18px; } }

fieldset { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
/* Floated, a legend is an ordinary first row inside its block instead of sitting on the block's top edge. */
legend { float: left; width: 100%; font-size: 1rem; font-weight: 750; padding: 0; margin-bottom: -2px; letter-spacing: -.01em; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .row { grid-template-columns: 1fr; } }
/* Two fields side by side keep their boxes level when one label wraps to two lines. */
@supports (grid-template-rows: subgrid) {
  .row { grid-template-rows: auto auto auto; row-gap: 0; }
  .row > .field { grid-row: span 3; grid-template-rows: subgrid; row-gap: 6px; }
  .row > .field > label, .row > .field > .label { align-self: end; }
}
label, .field { display: grid; gap: 6px; font-size: .92rem; font-weight: 600; align-content: start; }
.label { font-size: .92rem; font-weight: 600; }
/* Two levels only: the block's heading in ink, then quieter field labels. */
.field > label, .field > .label, .label-line > label, .label-line > .label { font-size: .86rem; color: var(--ink-soft); }
.label-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.req { color: var(--ink-soft); font-size: .82rem; font-weight: 500; }
input[type="number"] {
  width: 100%; height: 48px; padding: 0 14px;
  background: #fff; border: 1px solid var(--hair-strong); border-radius: 14px;
  font-size: 1.02rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
input[type="number"]::placeholder { color: #5a6f8c; font-weight: 500; font-size: .92rem; }
input[type="number"]:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(40, 85, 129, .14); }
input[aria-invalid="true"] { border-color: var(--risk); box-shadow: 0 0 0 3px rgba(196, 71, 47, .15); }
.field-err { color: var(--risk-ink); font-size: .86rem; font-weight: 700; }
.echo { font-size: .86rem; font-weight: 650; color: var(--ink-soft); }
.field > .echo:empty { margin-top: -6px; }
.echo.echo-warn { color: var(--gold-ink); background: var(--gold-soft); border-radius: 8px; padding: 3px 8px; }
.hint { font-size: .88rem; font-weight: 500; color: var(--ink-soft); line-height: 1.5; }

/* Choices. A two-way choice is one outlined control with the chosen half filled, the
   same height and corner as a number field, so a row of inputs reads as one line of
   boxes. The two halves always stay side by side; long text wraps inside its half. */
.seg { display: flex; gap: 2px; padding: 2px; background: #fff; border: 1px solid var(--hair-strong); border-radius: 14px; }
.seg label { position: relative; display: block; flex: 1 1 0; min-width: 0; font-weight: 650; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; pointer-events: none; }
.seg span { display: grid; place-items: center; height: 100%; text-align: center; min-height: 44px; padding: 8px 12px; border: 1px solid transparent; border-radius: 11px; cursor: pointer; font-size: .92rem; line-height: 1.25; transition: border-color .15s, background .15s; }
.seg span:hover { background: var(--key); }
.seg input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--lift); }
.seg input:focus-visible + span { outline: 3px solid #8e650e; outline-offset: 2px; }
/* Until one half is chosen, a hairline shows that there are two things to press. */
.seg label + label::before { content: ""; position: absolute; left: -2px; top: 10px; bottom: 10px; width: 1px; background: var(--hair-strong); }
.seg:has(input:checked) label + label::before, .seg-stack label + label::before, .purpose-grid label + label::before { content: none; }
/* Three or more choices, and the choice of estimate, are separate rows or tiles. */
.seg-stack, .purpose-grid { padding: 0; background: none; border: 0; border-radius: 0; gap: 8px; }
.seg-stack { flex-direction: column; }
.seg-stack label { flex: none; }
.seg-stack span, .purpose-grid span { display: block; place-items: normal; background: #fff; border-color: var(--hair-strong); border-radius: 14px; }
.seg-stack span:hover, .purpose-grid span:hover { background: #fff; border-color: var(--ink); }
.seg-stack span { text-align: left; padding: 10px 16px; }
.purpose-grid { display: grid; grid-template-columns: 1fr 1fr; }
.purpose-group { gap: 12px; }
#module-switch span { height: 100%; padding: 10px 12px; text-align: left; font-size: .98rem; font-weight: 750; line-height: 1.25; }
#module-switch span small { display: block; margin-top: 3px; font-size: .76rem; font-weight: 500; line-height: 1.3; color: var(--ink-soft); }
.seg-stack span small { margin-left: 8px; font-size: .78rem; font-weight: 500; color: var(--ink-soft); }
.seg input:checked + span small, #module-switch input:checked + span small { color: #cbd8e8; }

.checks { display: grid; gap: 2px; }
.checks label { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; min-height: 40px; padding: 6px 10px; margin-inline: -10px; border-radius: 10px; font-size: .92rem; font-weight: 600; cursor: pointer; transition: background .15s; }
.checks label:hover { background: var(--paper); }
.checks label:has(input:checked) { background: var(--soft); }
@media (pointer: coarse) { .checks label { min-height: var(--tap); } }
/* Factors that are recorded but not counted sit in one folded row that names them. */
.recorded-fold { margin-top: 10px; border-top: 1px solid var(--hair); }
.recorded-fold > summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 14px 0 2px; list-style: none; }
.recorded-fold > summary::-webkit-details-marker { display: none; }
.recorded-fold > summary::before { content: "+"; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--soft); font-weight: 800; }
.recorded-fold[open] > summary::before { content: "\2212"; }
.rf-title { font-size: .92rem; font-weight: 700; }
.rf-count { font-size: .82rem; font-weight: 650; color: var(--ink-soft); }
.rf-sub { grid-column: 2 / -1; font-size: .82rem; font-weight: 500; line-height: 1.45; color: var(--ink-soft); }
.recorded-fold[open] .rf-sub { display: none; }
.recorded-fold > .checks { margin-top: 8px; }
.checks label:has(input:focus-visible) { outline: 3px solid #8e650e; outline-offset: 2px; }
.checks input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); cursor: pointer; }
.checks input:focus-visible { outline: none; }

details summary { cursor: pointer; font-weight: 700; font-size: .95rem; }
details.projection { border-top: 1px dashed var(--hair-strong); padding-top: 14px; }
details.projection > * + * { margin-top: 12px; }
.opt { display: inline-block; text-decoration: none; font-weight: 500; color: var(--ink-soft); font-size: .82rem; margin-left: 4px; }
.opt[hidden] { display: none; }
details.settings { border: 1px solid var(--hair); border-radius: 16px; padding: 12px 20px; }
details.settings > summary { font-size: .9rem; font-weight: 650; color: var(--ink-soft); }
details.settings[open] { background: var(--card); }
details.settings[open] > * + * { margin-top: 14px; }
/* Two quiet help links share a line; the one that is open takes the full width. */
.help-row { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.help-row > details[open] { flex: 1 1 100%; }
.se-presurg strong { font-weight: 600; }
details.more-help > summary { display: inline-block; font-size: .86rem; font-weight: 650; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; list-style: none; }
details.more-help > summary::-webkit-details-marker { display: none; }
details.more-help > summary:hover { color: var(--ink); }
details.more-help[open] > * + * { margin-top: 8px; }

/* ---------- Results ---------- */
.results { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; min-width: 0; }
.results-head { position: relative; display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; min-height: 48px; }
.results-head h2 { display: flex; align-items: center; margin-right: auto; }
/* Share and export: one quiet control; the four actions sit in its menu. */
/* The menu hangs from the heading row, not the button, so it stays on screen when the button wraps to the left on a phone. */
.share-toggle { display: inline-flex; align-items: center; gap: 9px; min-height: 36px; padding: 0 14px; border: 1px solid var(--hair-strong); border-radius: 999px; background: transparent; font-size: .88rem; font-weight: 650; color: var(--ink-soft); cursor: pointer; }
.share-toggle::after { content: ""; width: 6px; height: 6px; margin-top: -3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.share-toggle:hover, .share-toggle[aria-expanded="true"] { border-color: var(--ink); color: var(--ink); background: var(--card); }
.share-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; display: grid; gap: 2px; width: min(330px, 100%); padding: 6px; background: var(--card); border: 1px solid var(--hair-strong); border-radius: 16px; box-shadow: 0 24px 50px -24px rgba(10, 17, 28, .5); }
.menu-item { display: grid; gap: 1px; padding: 9px 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; }
.menu-item strong { font-size: .92rem; font-weight: 700; }
.menu-item small { font-size: .8rem; font-weight: 500; line-height: 1.35; color: var(--ink-soft); }
.menu-item:hover:not(:disabled) { background: var(--soft); }
.menu-item:disabled { opacity: .45; cursor: not-allowed; }
.copy-status { font-size: .84rem; font-weight: 650; color: var(--ink); background: var(--soft); border-radius: 999px; padding: 4px 12px; }
.copy-status:empty { display: none; }
@media (max-width: 480px) { .share-menu { width: 100%; } }
.results.is-stale .clinician, .results.is-stale .patient { opacity: .4; pointer-events: none; filter: grayscale(.4); }
.stale { font-size: .86rem; font-weight: 700; color: var(--gold-ink); background: var(--gold-soft); border-radius: 999px; padding: 4px 12px; }
.empty { color: var(--ink-soft); padding: 36px 24px; text-align: center; font-weight: 600; }
.clinician, .patient { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; min-width: 0; }
.clinician > *, .patient > * { min-width: 0; }
.clinician .panel > h3 { margin-bottom: 16px; }

/* The answer: the one dark stage on the page */
.headline { display: grid; gap: 10px; padding: 26px 28px; background: var(--stage); color: var(--stage-ink); border: 0; box-shadow: 0 30px 60px -36px rgba(10, 17, 28, .8); }
.headline .kicker { font-size: 1rem; font-weight: 650; color: var(--stage-ink); display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.headline { position: relative; overflow: hidden; isolation: isolate; }
.headline::before { content: ""; position: absolute; z-index: -1; right: -120px; top: -160px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(127, 212, 255, .16), transparent 65%); pointer-events: none; }
.headline .big .more-than { display: block; font-size: .3em; font-weight: 600; letter-spacing: 0; line-height: 1.2; color: var(--stage-ink); margin-bottom: 4px; }
.headline .big.is-range { font-size: clamp(2.6rem, 6.5vw, 4rem); }
.big-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin-block: 2px 4px; }
.headline .big { font-family: var(--num); font-size: clamp(3.2rem, 8vw, 5rem); font-weight: 700; letter-spacing: -.035em; line-height: .95; color: #fff; }
.big-side { display: grid; gap: 4px; padding-left: 18px; border-left: 1px solid var(--stage-hair); }
.big-side .ui, .big-side .freq { font-family: var(--num); }
.big-side .freq { color: #fff; font-size: clamp(1.35rem, 3.2vw, 1.6rem); font-weight: 700; letter-spacing: -.01em; }
.big-side .ui { color: var(--stage-ink); font-size: .92rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.big-side .ui span { color: var(--stage-soft); font-size: .82rem; margin-right: 4px; }
/* The comparison, as a sentence. */
.headline .plain { font-size: 1.08rem; line-height: 1.5; color: var(--stage-ink); max-width: 64ch; text-wrap: pretty; }
.headline .plain strong { color: #fff; font-weight: 750; }
@media (max-width: 480px) { .big-side { padding-left: 0; border-left: 0; } .big-side .ui { white-space: normal; } .big-side .ui span { display: block; } }
/* Nothing in the result card may set its width beyond the card on a phone. */
.headline > * { min-width: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; margin: 6px 0 4px; }
.tile { margin: 0; padding: 9px 14px 10px; border-radius: 14px; background: var(--stage-2); border: 1px solid var(--stage-hair); }
/* In the answer card each tile is a button: the pressed one is the headline. */
button.tile { display: grid; gap: 2px; font: inherit; color: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
button.tile:hover { border-color: rgba(127, 212, 255, .5); }
.tile dt, .t-label { font-size: .76rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--stage-soft); }
.tile dd { margin: 4px 0 0; display: grid; gap: 1px; }
.t-val { font-family: var(--num); font-size: 1.3rem; font-weight: 650; letter-spacing: -.015em; color: #fff; font-variant-numeric: tabular-nums; }
.t-ci { font-family: var(--num); font-size: .76rem; font-weight: 600; color: var(--stage-soft); font-variant-numeric: tabular-nums; }
.tile.is-main { background: var(--stage-3); border-color: var(--pin); }
.tile.is-main dt, .tile.is-main .t-label { color: var(--pin); }
/* Narrow phones: two even columns, and a third tile on its own row spans the width
   (deep review 2026-11-26: at 320 px the odd tile widened one column and the other
   wrapped its figures). */
@media (max-width: 420px) {
  .tiles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
.headline .sub { color: var(--stage-soft); font-size: .95rem; }
.headline .spread { font-size: 1rem; color: var(--stage-ink); }
.headline .spread strong { color: var(--pin); }
.headline .pill.unverified { color: var(--gold); border-color: rgba(228, 212, 183, .6); }
.headline :focus-visible { outline-color: var(--pin); }

.hbars { display: grid; gap: 12px; margin-bottom: 18px; }
.hbar { display: grid; grid-template-columns: minmax(0, 17rem) minmax(0, 1fr) 4.5rem; gap: 12px; align-items: center; font-size: .92rem; font-weight: 600; }
.hb-track { position: relative; height: 22px; background: var(--paper); border-radius: 999px; overflow: visible; box-shadow: inset 0 0 0 1px var(--hair); }
.hb-fill { position: absolute; inset: 0 auto 0 0; background: var(--ink); border-radius: 999px; }
.hbar.ref .hb-fill { background: var(--bar-ref); }
.hbar.alt .hb-fill { background: var(--bar-alt); }
.hb-ci { position: absolute; top: 50%; height: 2px; margin-top: -1px; background: var(--risk); }
.hb-ci::before, .hb-ci::after { content: ""; position: absolute; top: -5px; width: 2px; height: 12px; background: var(--risk); }
.hb-ci::before { left: 0; } .hb-ci::after { right: 0; }
.hb-val { font-family: var(--num); font-variant-numeric: tabular-nums; text-align: right; font-weight: 650; }
@media (max-width: 560px) { .hbar { grid-template-columns: minmax(0, 1fr) 4.5rem; } .hb-label { grid-column: 1 / -1; } }
@media (prefers-reduced-motion: no-preference) { .hb-fill { transition: width .35s var(--ease); } }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--hair); vertical-align: top; }
thead th { font-weight: 700; font-size: .76rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }
tbody th { font-weight: 600; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover > * { background: var(--lift); }
@media (max-width: 600px) {
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.stack, table.stack tbody, table.stack tr { display: block; }
  table.stack tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; padding: 12px 0; border-bottom: 1px solid var(--hair); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack tr > * { display: block; padding: 0; border: 0; background: none !important; }
  table.stack tbody th { grid-column: 1 / -1; font-weight: 750; }
  table.stack td::before { content: attr(data-label); display: block; font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }
  table.stack td.num { white-space: normal; }
}
td.num { font-family: var(--num); font-variant-numeric: tabular-nums; white-space: nowrap; }
td.num strong { font-weight: 800; }

details.disclosure > summary { display: flex; gap: 12px; align-items: center; list-style: none; min-height: 28px; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "+"; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--soft); font-weight: 800; flex: none; }
details.disclosure[open] > summary::before { content: "\2212"; }
details.disclosure > summary h3 { margin: 0; }
details.disclosure[open] > summary { margin-bottom: 14px; }
details.disclosure > * + * { margin-top: 12px; }
.count { font-size: .85rem; color: var(--ink-soft); font-weight: 550; }
/* One panel under the answer holds every folded section, as rows. */
.more { padding: 6px 20px; }
.more-title { padding: 12px 0 10px; font-size: .76rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.more > details.disclosure { border-top: 1px solid var(--hair); padding: 12px 0; }
.more > details.disclosure > summary h3 { font-size: 1rem; font-weight: 650; }
.more > details.disclosure[open] { padding-bottom: 18px; }
@media (max-width: 480px) { .more > details.disclosure > summary .count { display: none; } }
.fold-sub { margin: 20px 0 12px; font-size: .95rem; font-weight: 700; }

.sense-check { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--soft); font-size: .88rem; font-weight: 500; line-height: 1.5; color: var(--ink-soft); }
.sc-tag { display: inline-block; margin-right: 6px; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); background: var(--card); border: 1px solid var(--hair-strong); border-radius: 999px; padding: 1px 9px; vertical-align: .1em; }
@media print { .sense-check { background: #fff; border: 1px solid #000; } }
.flags { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }
.flags li { padding: 2px 0; font-size: .92rem; font-weight: 500; }
.flags li.high { font-weight: 650; }
.evidence td { font-size: .86rem; }
.pill { display: inline-block; font-size: .72rem; font-weight: 750; padding: 1px 9px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; letter-spacing: .01em; }
.pill.unverified { color: var(--risk); }
.grade { text-transform: capitalize; }
code { font-family: var(--data); font-size: .76rem; color: var(--ink-soft); word-break: break-all; }
.suppressed { padding: 24px; display: grid; gap: 10px; }

/* Phone: result bar while the form is on screen */
.result-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: flex; flex-wrap: nowrap; gap: 12px; align-items: center; white-space: nowrap;
  background: var(--stage); color: var(--stage-ink); text-decoration: none; font-weight: 700;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px)); border-radius: 18px 18px 0 0; border-top: 2px solid var(--pin); box-shadow: 0 -12px 30px -18px rgba(10, 17, 28, .7);
}
@media (max-width: 860px) {
  body.is-typing .result-bar { display: none; }
  .footer { padding-bottom: 88px; }
}
.result-bar .tag { font-size: .7rem; font-weight: 750; color: var(--gold); border: 1px solid rgba(228, 212, 183, .6); border-radius: 999px; padding: 1px 8px; }
.result-bar .rb-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.result-bar .go { margin-left: auto; flex: none; color: var(--pin); }
.result-bar .go::after { content: " \2191"; }
.result-bar:focus-visible { outline: 3px solid var(--pin); outline-offset: 3px; }
@media (min-width: 861px) { .result-bar { left: auto; right: 24px; bottom: 24px; max-width: 460px; border-radius: 999px; border-top: 0; padding: 12px 22px; box-shadow: 0 20px 40px -16px rgba(10, 17, 28, .7); } }
@media (prefers-reduced-motion: no-preference) { .result-bar { animation: bar-in .3s var(--ease); } @keyframes bar-in { from { transform: translateY(16px); opacity: 0; } } }

/* ---------- Patient explanation ---------- */
.patient-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; font-size: .92rem; color: var(--ink-soft); padding-top: 8px; }
.patient-bar strong { color: var(--ink); }
.patient .letter { padding: clamp(22px, 4vw, 40px); display: grid; gap: 18px; background: var(--lift); }
.patient .eyebrow { font-size: .78rem; font-weight: 750; color: var(--gold-ink); background: var(--gold-soft); justify-self: start; padding: 3px 12px; border-radius: 999px; }
.patient .letter h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 720; letter-spacing: -.03em; }
.patient .letter > p { font-size: 1.02rem; max-width: 64ch; }
.patient .lead { font-size: 1.35rem !important; font-weight: 600; line-height: 1.4; letter-spacing: -.01em; }
.patient .lead strong { font-family: var(--num); color: var(--risk); font-weight: 700; font-size: 1.25em; font-variant-numeric: tabular-nums; }
.icon-array { display: grid; gap: 10px; break-inside: avoid; background: var(--card); border: 1px solid var(--hair); border-radius: 16px; padding: 16px; }
.icon-array svg { width: 100%; max-width: 600px; height: auto; }
.icon-array .on { fill: var(--risk); }
.icon-array .off { fill: var(--dot); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .9rem; font-weight: 600; color: var(--ink-soft); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.legend .k-on { background: var(--risk); } .legend .k-off { background: var(--dot); }
.symptoms { background: var(--stage); color: var(--stage-ink); border-radius: 18px; padding: 20px 22px; display: grid; gap: 8px; break-inside: avoid; }
.symptoms h2 { color: #fff; font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }
.symptoms ul { margin: 0; padding-left: 1.2em; }
.symptoms .hint { color: var(--stage-soft); }
.sign { display: flex; flex-wrap: wrap; gap: 14px 28px; font-size: .95rem; font-weight: 600; }
.sign p { display: flex; gap: 10px; align-items: end; flex: 1 1 14rem; }
.sign .line { flex: 1; border-bottom: 1.5px solid var(--ink); min-width: 6rem; height: 1.3em; }
.sign .line.short { flex: 0 0 9rem; }
.print-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.secondary { min-height: 44px; padding: 0 20px; background: var(--ink); color: var(--lift); border: 0; border-radius: 999px; cursor: pointer; font-weight: 700; }
.secondary:hover { background: #22507f; }
.patient .facts { font-size: .86rem; color: var(--ink-soft); }

/* ---------- Footer ---------- */
.footer { padding-block: 28px 96px; color: var(--ink-soft); font-size: .86rem; display: grid; gap: 10px; border-top: 1px solid var(--hair); }
.footer p { max-width: 90ch; }
.footer strong { color: var(--ink); }
.version { font-family: var(--data); font-size: .74rem; }
.copyright { font-size: .74rem; }

@media print {
  :root { --paper: #fff; --lift: #fff; --card: #fff; --stage: #fff; --stage-ink: #000; --stage-soft: #333; --pin: #183d69; --ink: #000; --ink-soft: #333; }
  body::before, .top .view-switch, .by, .skip, .inputs, .print-row, .patient-bar, .copy-status, .rt-more, .result-bar, .settings { display: none !important; }
  .top { position: static; backdrop-filter: none; background: #fff; }
  .layout { display: block; padding: 0; }
  .panel { border: 0; padding: 0; box-shadow: none; margin-bottom: 14px; }
  .headline { border: 2px solid #000 !important; padding: 14px !important; }
  .headline .big { color: #000; }
  .headline::before { display: none; }
  .tile { background: #fff; border: 1px solid #000; }
  .t-val { color: #000; }
  .t-ci, .tile dt { color: #333; }
  .big-side { border-left-color: #000; }
  .review-note { background: #fff; border: 1px solid #000; }
  .headline .plain strong, .big-side .freq, .on-stage .ia-title strong { color: #000; }
  .t-label { color: #333; }
  details.range-box > summary::after { content: none; }
  .more { padding: 0; }
  .more > details.disclosure { border-top-color: #000; }
  .symptoms { border: 2px solid #000; }
  details.disclosure > summary::before { display: none; }
  body { font-size: 11pt; }
}

@media (max-width: 520px) { .wide-only { display: none; } }

/* Phone header: compact and not sticky, so it never covers the page heading. */
@media (max-width: 900px) {
  html { scroll-padding-top: 16px; }
  .top { position: relative; top: auto; padding-block: 10px; gap: 10px; }
  body::before { display: none; }
  .lockup { flex-wrap: nowrap; gap: 10px; min-width: 0; }
  .lockup-text { min-width: 0; }
  .lockup-icon { width: 40px; height: 40px; }
  .lockup-name { font-size: 1.25rem; }
  .lockup-sub { display: none; }
  .by img { width: 32px; height: 32px; }
  .view-switch button { min-height: 36px; }
}

/* ---------- Print: shared ---------- */
.print-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.print-only { display: none; }
.print-blocked { display: none; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; font-weight: 650; }

@media print {
  @page { size: A4; margin: 12mm 14mm 12mm; }
  /* Native Print / Save as PDF must also withhold stale or failed results. */
  body:not([data-export-ready="true"]) #clinician,
  body:not([data-export-ready="true"]) #patient,
  #notes-dialog { display: none !important; }
  body:not([data-export-ready="true"]) #print-blocked { display: block !important; }
  .print-only { display: block; }
  .print-btns { display: none !important; }
  a[href]::after { content: none; }

  /* Paper width must not depend on the browser's screen-width breakpoints. */
  .wrap { padding-inline: 0; }
  .top { padding-block: 6px; min-height: 0; }
  .lockup-icon { width: 32px; height: 32px; }
  .lockup-name { font-size: 16pt; }
  .lockup-sub { display: none; }
  .intro { padding-block: 10px; }
  .page-title { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; font-size: 18pt; }
  .review-note { margin-top: 8px; padding: 6px 10px; font-size: 9pt; line-height: 1.35; }
  /* Normal flow honours page breaks in Safari as well as Chromium. */
  .results, .clinician { display: block; }
  .results > * + *, .clinician > * + * { margin-top: 10px; }
  .results-head { min-height: 32px; }
  .headline { display: block; padding: 10px !important; overflow: visible; break-inside: avoid; page-break-inside: avoid; }
  .headline > * + * { margin-top: 8px; }
  .headline .big { font-size: 40pt; }
  .headline .kicker, .headline .sub { font-size: 10pt; }
  .headline .tile { padding: 6px 10px; }
  .headline .range-box { font-size: 9pt; padding: 8px 10px; }
  .headline .plain { font-size: 11pt; }
  .headline .icon-array { padding: 8px; }
  .headline .icon-array svg { max-width: 65mm; }
  .headline .legend { font-size: 8pt; }
  h3, h4, details > summary { break-after: avoid; page-break-after: avoid; }
  .entered dl > div, tr { break-inside: avoid; page-break-inside: avoid; }

  /* Chart marks carry information even with background printing switched off. */
  .hbars, .icon-array { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .hbars, .range-box { break-inside: avoid; page-break-inside: avoid; }
  .hb-fill { background: #000; transition: none; }
  .hbar.ref .hb-fill { background: #bbb; }
  .hbar.alt .hb-fill { background: #777; }
  .hb-ci, .hb-ci::before, .hb-ci::after { background: #000; }

  /* Clinician summary: what was entered, since the form is not printed. */
  .tile.is-main { background: #fff; border: 2px solid #000; }
  .tile.is-main dt { color: #000; }
  .entered { border: 1px solid #000; border-radius: 10px; padding: 10px 12px; break-inside: avoid; }
  .entered h3 { margin-bottom: 6px; }
  .entered dl { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 18px; margin: 0; font-size: 9.5pt; }
  .entered dl > div { display: flex; gap: 8px; }
  .entered dt { font-weight: 700; min-width: 9.5em; }
  .entered dd { margin: 0; }

  /* Patient handout: one A4 page, no clinician chrome, footer replaced by the sheet's own small print. */
  body[data-view="patient"] .intro,
  body[data-view="patient"] .review-note,
  body[data-view="patient"] .footer,
  body[data-view="patient"] .top { padding: 0 0 6px; border-bottom: 2px solid #000; margin-bottom: 8px; }
  body[data-view="patient"] { font-size: 10pt; line-height: 1.45; }
  .patient .letter { gap: 7px; padding: 0 !important; }
  .patient .letter h1 { font-size: 16pt; }
  .patient .letter > p { max-width: none; font-size: 10pt; }
  .patient .lead { font-size: 12pt !important; }
  .patient .eyebrow { border: 1px solid #000; background: #fff; color: #000; }
  .handout-head { display: flex !important; justify-content: space-between; align-items: end; gap: 18px; }
  .handout-head .hh-title { font-weight: 750; font-size: 11pt; }
  .handout-head p:last-child { display: flex; gap: 8px; align-items: end; flex: 0 1 45%; }
  .handout-head .line { flex: 1; border-bottom: 1.5px solid #000; height: 1.3em; }
  .icon-array { padding: 8px; border-color: #000; }
  .icon-array svg { max-width: 85mm; }
  .icon-array .on { fill: #000; }
  .icon-array .off { fill: #c8c8c8; }
  .legend .k-on { background: #000; } .legend .k-off { background: #c8c8c8; }
  .used-print { font-size: 9.5pt; }
  .patient .letter > .facts { font-size: 8pt; line-height: 1.35; color: #333; border-top: 1px solid #000; padding-top: 5px; }
  .symptoms { padding: 8px 14px; gap: 4px; }
  .symptoms h2 { color: #000; }
}

/* ---------- Show the working ---------- */
/* The single column may shrink below its content, so the year-by-year table scrolls
   inside its own box instead of widening the whole page on a phone. */
.working .w-steps { margin: 14px 0 0; padding-left: 1.4em; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.working .w-steps > li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }
.working, .working .w-steps { min-width: 0; }
.working .w-steps > li::marker { font-weight: 800; color: var(--ink); }
.working h4 { margin: 0; font-size: .98rem; font-weight: 700; }
.w-eq { font-family: var(--num); font-variant-numeric: tabular-nums; font-size: .95rem; }
.w-eq strong { font-weight: 750; }
.w-src { font-size: .8rem; color: var(--ink-soft); }
.w-src code { font-size: .74rem; }
.w-table { font-size: .84rem; }
.w-table td.num, .w-table th { white-space: nowrap; }
.w-table tr.w-mark td { background: var(--gold-soft); }
.w-years summary { font-size: .88rem; }
.w-years > .table-wrap { max-height: 22rem; overflow: auto; margin-top: 8px; }
.w-result { margin-top: 14px; font-weight: 700; padding: 10px 14px; border-radius: 12px; background: var(--soft); }
@media print {
  .no-print { display: none !important; }
  .w-result { background: #fff; border: 1px solid #000; }
  /* Let long working tables fragment in normal flow without overlapping notes. */
  .working .w-steps { display: block; }
  .working .w-steps > li { display: list-item; margin-top: 16px; }
  .working .w-steps > li > * + * { margin-top: 6px; }
  .working li > h4 + .table-wrap { break-before: avoid; page-break-before: avoid; }
  .table-wrap, .w-years .table-wrap { overflow: visible; max-height: none; }
}

/* ---------- Absolute and relative risk with the icon array ---------- */
.icon-array .base { fill: var(--ink-soft); }
.icon-array .extra { fill: var(--risk); }
.icon-array .fewer { fill: none; stroke: var(--ink-soft); stroke-width: 1.2; }
.legend .k-base { background: var(--ink-soft); }
.legend .k-extra { background: var(--risk); }
.legend .k-fewer { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-soft); }

.icon-array.on-stage { background: var(--stage-2); border-color: var(--stage-hair); padding: 12px; gap: 8px; }
.on-stage .off { fill: #2c3b52; }
.on-stage .on, .on-stage .extra { fill: #ff8f73; }
.on-stage .base { fill: var(--pin); }
.on-stage .fewer { fill: none; stroke: var(--pin); }
.on-stage .legend { color: var(--stage-soft); font-size: .82rem; }
.on-stage .legend .k-on, .on-stage .legend .k-extra { background: #ff8f73; }
.on-stage .legend .k-base { background: var(--pin); }
.on-stage .legend .k-off { background: #2c3b52; }
.on-stage .legend .k-fewer { box-shadow: inset 0 0 0 1.5px var(--pin); }
/* The dot picture: folded in the clinician card, with a caption that says what a dot is. */
.ia-title { font-size: .92rem; font-weight: 500; line-height: 1.45; color: var(--ink-soft); max-width: 62ch; }
.ia-title strong { color: var(--ink); }
.on-stage .ia-title { color: var(--stage-soft); }
.on-stage .ia-title strong { color: #fff; }
.picture, .numbers-key { border-top: 1px solid var(--stage-hair); padding-top: 10px; }
.picture > summary, .numbers-key > summary { cursor: pointer; color: var(--pin); font-weight: 650; font-size: .92rem; min-height: 24px; }
.picture[open] > summary { margin-bottom: 10px; }
.picture .icon-array svg { max-width: 520px; }
.picture + .numbers-key { border-top: 0; padding-top: 0; }

/* ---------- Inputs outside the source cohorts ---------- */
.range-box { display: grid; gap: 4px; padding: 12px 14px; border-radius: 14px; background: var(--gold-soft); color: var(--gold-ink); font-size: .9rem; font-weight: 550; line-height: 1.45; }
.range-box .rb-title { font-weight: 800; display: flex; align-items: center; gap: 8px; }
.range-box .rb-title::before { content: "!" / ""; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #8a5d0b; color: #fff; font-size: .75rem; font-weight: 800; }
.range-box ul { margin: 0; padding-left: 1.2em; }
.range-box .rb-foot { font-size: .84rem; }
details.range-box { display: block; }
details.range-box > summary { cursor: pointer; list-style: none; }
details.range-box > summary::-webkit-details-marker { display: none; }
details.range-box > summary::after { content: "Why"; margin-left: auto; padding-left: 12px; font-size: .8rem; text-decoration: underline; text-underline-offset: 3px; }
details.range-box[open] > summary::after { content: "Hide"; }
details.range-box[open] > summary { margin-bottom: 6px; }
.range-note { margin-top: 6px; font-size: .84rem; font-weight: 600; line-height: 1.4; color: var(--gold-ink); background: var(--gold-soft); border: 1px solid rgba(197, 138, 26, .35); border-radius: 6px; padding: 6px 10px; }

/* ---------- Copy for notes ---------- */
.notes-dialog { width: min(640px, calc(100vw - 32px)); border: 0; border-radius: var(--radius); padding: 22px; background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -30px rgba(10, 17, 28, .6); }
.notes-dialog::backdrop { background: rgba(10, 17, 28, .45); }
.notes-dialog h2 { font-size: 1.15rem; margin-bottom: 6px; }
.notes-dialog textarea { width: 100%; margin: 12px 0; font: 500 .86rem/1.5 var(--data); color: var(--ink); background: var(--lift); border: 1px solid var(--hair-strong); border-radius: 12px; padding: 12px; resize: vertical; }
.dialog-row { display: flex; justify-content: flex-end; }

@media print {
  .notes-dialog { display: none !important; }
  .icon-array.on-stage { background: #fff; border: 1px solid #000; }
  .icon-array svg { max-width: 85mm; }
  .icon-array .base, .on-stage .base { fill: #777; }
  .icon-array .on, .icon-array .extra, .on-stage .on, .on-stage .extra { fill: #000; }
  .icon-array .off, .on-stage .off { fill: #d8d8d8; }
  .icon-array .fewer, .on-stage .fewer { fill: none; stroke: #000; }
  .legend .k-base, .on-stage .legend .k-base { background: #777; }
  .legend .k-extra, .legend .k-on, .on-stage .legend .k-extra, .on-stage .legend .k-on { background: #000; }
  .legend .k-off, .on-stage .legend .k-off { background: #d8d8d8; }
  .legend .k-fewer, .on-stage .legend .k-fewer { box-shadow: inset 0 0 0 1.5px #000; }
  .range-box, .range-note { background: #fff; border: 1px solid #000; color: #000; }
}

/* ---- Improvement plan, phase A ---- */

/* A6: myopia/hyperopia toggle beside a magnitude field */
.signed { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: center; }
.seg-sign label { flex: 1 0 auto; }
.seg-sign span { padding: 8px 10px; font-size: .84rem; white-space: nowrap; }
@media (max-width: 420px) { .signed { grid-template-columns: 1fr; } }

/* A7: inputs the fellow-eye pathway does not use */
.is-unused { opacity: .85; }
.unused-tag { display: inline-block; margin-left: 6px; font-style: normal; font-size: .72rem; font-weight: 700; color: var(--ink-soft); background: var(--soft); border-radius: 999px; padding: 0 8px; white-space: nowrap; letter-spacing: 0; text-transform: none; }

/* A3/B6: extrapolated horizons */
.x-tag { display: inline-block; font-size: .66rem; font-weight: 750; letter-spacing: .02em; text-transform: none; color: var(--gold); border: 1px dashed rgba(228, 212, 183, .7); border-radius: 999px; padding: 0 7px; vertical-align: middle; }
.tile.is-extrapolated { border-style: dashed; }
.x-note { color: var(--gold); font-size: .9rem; font-weight: 600; }
.x-note p { margin: 0; }
.x-note p + p, .x-note ul + p { margin-top: 4px; }
.x-note strong { font-weight: 800; }
.x-paths { margin: 4px 0 0; padding-left: 1.1rem; }
.x-paths li { margin: 2px 0; }
.t-alt { font-size: .72rem; font-weight: 600; color: var(--gold); }
.hbar.extrapolated .hb-fill { background: repeating-linear-gradient(135deg, var(--ink) 0 6px, var(--bar-alt) 6px 10px); }

/* A2: neighbouring source group near a band edge */
.headline .range-box + .range-box { margin-top: 6px; }
/* Lens surgery: one quiet list of cautions in the answer card. A thin full border, no fill colour or icon. */
.caution { margin-top: 6px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--stage-hair); color: var(--stage-soft); font-size: .9rem; line-height: 1.45; }
.caution-title { margin: 0 0 4px; font-weight: 750; color: var(--stage-ink); }
.caution ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.caution strong { color: var(--stage-ink); }
.caution a { color: inherit; }

/* A8: scenarios beside a child's headline */
.scen-row { display: grid; gap: 4px; }
.scen-title { font-size: .8rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; color: var(--stage-soft); }
.headline .scen-row .hint { color: var(--stage-soft); }

/* A9: interval wording and evidence-range whisker */
.big-side .ui.ev { color: var(--stage-ink); }
.hb-ev { position: absolute; top: 50%; height: 8px; margin-top: -4px; background: rgba(125, 159, 200, .35); border: 1px dashed var(--bar-alt); border-radius: 4px; pointer-events: auto; }
.hb-key { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8rem; color: var(--ink-soft); margin: -8px 0 14px; }
.hb-key i { display: inline-block; vertical-align: middle; margin-right: 6px; }
.hb-key .k-ci { width: 16px; height: 2px; background: var(--risk); }
.hb-key .k-ev { width: 16px; height: 8px; background: rgba(125, 159, 200, .35); border: 1px dashed var(--bar-alt); border-radius: 3px; }

.result-bar[data-dir="down"] .go::after { content: " \2193"; }
@media print {
  .hb-key { display: none !important; }
  .caution { background: #fff; border: 1px solid #000; color: #000; }
  .caution-title, .caution strong { color: #000; }
  .x-note, .x-tag, .scen-title { color: #000; }
}

/* Phase B: risk curve (B4) and 10,000-person array (P3) */
.curve-fig { margin: 0 0 8px; break-inside: avoid; }
.curve { width: 100%; max-width: 640px; height: auto; display: block; }
.curve .c-grid { stroke: var(--hair); stroke-width: 1; }
.curve .c-tick, .curve .c-axis { fill: var(--ink-soft); font: 11px var(--num); }
.curve .c-axis { font-weight: 600; }
.curve .c-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.curve .c-line.main { stroke: var(--risk); }
.curve .c-line.ref { stroke: var(--ink-soft); stroke-width: 2; }
.curve .c-line.alt { stroke: var(--bar-alt); stroke-width: 2; }
.curve .c-line.alt2 { stroke: var(--gold-ink); stroke-width: 2; }
.curve .c-dash { stroke-dasharray: 6 5; }
.curve .c-line.assume { stroke: var(--bar-alt); stroke-width: 2.25; }
.legend .c-key.assume { background: var(--bar-alt); }
.pvd-assume { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--hair); display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.pvd-assume label { font-size: .88rem; font-weight: 650; color: var(--ink); }
.pvd-assume select { width: 100%; max-width: 34rem; min-width: 0; justify-self: start; text-overflow: ellipsis; font: inherit; font-size: .9rem; padding: 7px 10px; border: 1px solid var(--line, #c9d2df); border-radius: 8px; background: #fff; color: var(--ink); }
.curve .c-zone { fill: var(--gold-ink); opacity: .07; }
.curve .c-zone-edge { stroke: var(--gold-ink); stroke-width: 1; stroke-dasharray: 2 3; opacity: .6; }
.curve .c-zone-label { fill: var(--gold-ink); font: 700 11px var(--num); }
/* 0.23.0: the same eye if the yearly risk did not fall after year 5 (thinner, same
   colour), and the estimates by PVD status (dotted, quiet grey). No new colours. */
.curve .c-line.upper { stroke: var(--risk); stroke-width: 1.5; opacity: .75; }
.curve .c-line.upper.c-dash { stroke-dasharray: 3 4; }
.curve .c-line.est { stroke: var(--ink-soft); stroke-width: 1.75; stroke-dasharray: 0.1 4.5; }
.legend .c-key { width: 18px; height: 3px; border-radius: 2px; vertical-align: 3px; }
.legend .c-key.main { background: var(--risk); }
.legend .c-key.ref { background: var(--ink-soft); }
.legend .c-key.alt { background: var(--bar-alt); }
.legend .c-key.alt2 { background: var(--gold-ink); }
.legend .c-key.upper { height: 2px; background: repeating-linear-gradient(90deg, var(--risk) 0 4px, transparent 4px 7px); opacity: .75; }
.legend .c-key.est { height: 2px; background: repeating-linear-gradient(90deg, var(--ink-soft) 0 2px, transparent 2px 5px); }
@media print { .curve-fig { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.evidence .src-loc { color: var(--ink-soft); font-size: .9em; }
.evidence .src-id { font-size: .78em; color: var(--ink-soft); }

/* Phase C: evidence cards for recorded factors (C7) */
.not-counted .ev-cards { margin: 8px 0 2px; padding-left: 18px; display: grid; gap: 6px; font-weight: 500; }
.not-counted .ev-cards li { line-height: 1.45; }

/* P5: accessibility. The extrapolated tag on light panels uses the dark gold ink
   (the pale gold is for the dark answer card), and links and disclosure summaries
   are at least 24 px tall on touch screens (WCAG 2.2, 2.5.8). */
.panel table .x-tag { color: var(--gold-ink); border-color: rgba(107, 78, 18, .45); }
@media (pointer: coarse) {
  .footer a, .evidence td a, .inline-tap, details > summary { min-height: 24px; }
  .footer a, .evidence td a, .inline-tap { display: inline-block; padding-block: 3px; }
  details > summary { padding-block: 2px; }
}

/* Simon's testing (2026-11-16): a plain-words key to the answer card, and the working in plain words. */
.numbers-key dl { display: grid; gap: 10px; margin: 10px 0 2px; }
.numbers-key dt { color: var(--stage-ink); font-weight: 700; font-size: .9rem; }
.numbers-key dd { margin: 2px 0 0; color: var(--stage-soft); font-size: .9rem; line-height: 1.45; }
.working .w-plain { margin-top: 12px; padding: 14px 16px; border-radius: 14px; background: var(--paper); border: 1px solid var(--hair); }
.working .w-plain ol { margin: 8px 0 0; padding-left: 1.3em; display: grid; gap: 10px; line-height: 1.5; }
.working .w-plain h4, .working .w-formal { margin: 0; }
.working .w-formal { margin-top: 18px; }
.working .w-challenge { margin: 12px 0 0; font-size: .92rem; line-height: 1.5; color: var(--ink-soft); }
.se-presurg { color: var(--ink-soft); }
@media print { .numbers-key, .picture > summary { display: none; } }

/* Myopia control comparison (docs/MODEL-SPEC.md section 8) */
.mc-group select { width: 100%; min-height: var(--tap); padding: 8px 12px; border-radius: 12px; border: 1px solid var(--hair-strong); background: var(--card); color: var(--ink); font: inherit; }
.mc-group .signed[hidden] { display: none; }
/* The age treatment runs to: a label and a short list on one line under the trial. */
.mc-stop { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.mc-stop[hidden] { display: none; }
.mc-stop label { font-size: .92rem; font-weight: 650; color: var(--ink); }
.mc-group .mc-stop select { width: auto; min-width: 5.5rem; }
/* How a picked trial is applied: a quiet fold under the trial, one labelled list per choice. */
.mc-assume { margin-top: 10px; }
.mc-assume[hidden] { display: none; }
.mc-assume > summary small { font-weight: 500; }
.mc-assume .mc-opt { display: grid; gap: 4px; margin-top: 12px; }
.mc-assume .mc-opt label { font-size: .92rem; font-weight: 650; color: var(--ink); }
.mc-assume .mc-opt .hint { margin: 0; font-size: .84rem; }
.mc-assume .link-btn { padding-inline: 0; }
.mc-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* The two arms stay side by side on a phone, so the comparison reads in one glance. */
@media (max-width: 480px) { .mc-pair { gap: 8px; } .mc-arm { padding: 12px; } .mc-val { font-size: 2rem; } }
@media (max-width: 420px) { .mc-pair { grid-template-columns: 1fr; } }
.mc-arm { margin: 0; padding: 14px 16px; border-radius: 16px; background: var(--stage-2); border: 1px solid var(--stage-hair); display: grid; gap: 2px; align-content: start; }
.mc-arm.mc-treated { border-color: rgba(127, 212, 255, .45); }
.mc-arm-label { font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--stage-soft); }
.mc-treated .mc-arm-label { color: var(--pin); }
.mc-se { font-family: var(--num); font-size: .92rem; font-weight: 650; color: var(--stage-ink); margin-top: 6px; }
.mc-se small { font-family: var(--body); font-weight: 500; color: var(--stage-soft); }
.mc-val { font-family: var(--num); font-size: clamp(2.2rem, 6vw, 3.2rem); font-weight: 700; letter-spacing: -.03em; line-height: 1.05; color: #fff; font-variant-numeric: tabular-nums; }
.mc-ci, .mc-one { font-family: var(--num); font-size: .82rem; font-weight: 600; color: var(--stage-soft); }
.mc-honest { border: 1px solid rgba(228, 212, 183, .55); background: rgba(228, 212, 183, .08); border-radius: 14px; padding: 12px 16px; color: var(--stage-ink); font-size: .92rem; }
.mc-stages { margin: 10px 0 0; padding: 0 0 0 1.4em; display: grid; gap: 3px; font-size: .9rem; color: var(--stage-ink); }
.mc-stages li span { font-weight: 700; color: var(--stage-soft); margin-right: .35em; }
.mc-stages li span::after { content: ":"; }
.mc-honest summary { margin-top: 6px; cursor: pointer; color: var(--gold); font-weight: 650; font-size: .9rem; min-height: 24px; }
.mc-honest ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.mc-honest strong { color: #fff; }
table.mc-options tr.is-chosen { background: var(--soft); }
table.mc-options td:nth-child(2) { font-size: .85rem; color: var(--ink-soft); }
.plain-list { padding-left: 20px; display: grid; gap: 6px; }
@media print {
  .mc-arm, .mc-honest { border-color: #000; background: #fff; }
  .mc-val, .mc-honest strong, .mc-treated .mc-arm-label, .on-stage .ia-title strong { color: #000; }
  .mc-honest summary { display: none; }
}

/* Counselling: source scope stays beside the result, with one shared treatment caveat. */
.applicability { font-size: .88rem; line-height: 1.5; }
.headline > .applicability { color: var(--stage-soft); }
.mc-honest .applicability { margin-bottom: 8px; }
.parent-applicability { border: 1px solid var(--hair-strong); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; }
.parent-applicability p { margin: 0; font-size: .95rem; }
.trajectory-panel { border: 1px solid var(--hair); border-radius: 16px; padding: 18px; background: var(--lift); display: grid; gap: 10px; }
.trajectory-panel h2, .take-home h2 { font-size: 1.15rem; }
.trajectory-panel figure { margin: 0; }
.trajectory { display: block; width: 100%; height: auto; max-width: 760px; margin-inline: auto; }
.trajectory text { font-family: var(--num); font-size: 13px; fill: var(--ink-soft); }
.tr-grid { stroke: var(--hair); stroke-width: 1; }
.tr-projection { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-dasharray: 7 4; }
.tr-current { fill: var(--ink); }
.tr-endpoint { fill: var(--card); stroke: var(--ink); stroke-width: 2.5; }
.trajectory-panel figcaption { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .85rem; }
.trajectory-panel figcaption b { font-family: var(--num); font-weight: 700; }
.take-home { display: grid; gap: 8px; }
.clinician > .take-home { padding: 18px; border: 1px solid var(--hair); border-radius: 16px; background: var(--lift); }
.take-home > p { font-size: .9rem; }
.take-home ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.take-home li { display: flex; gap: 14px; align-items: center; min-width: 0; break-inside: avoid; }
.take-home img { flex: 0 0 88px; width: 88px; height: 88px; background: #fff; }
.take-home a { display: inline-block; min-height: 44px; align-content: center; text-decoration: underline; text-underline-offset: 3px; }
.reading-url { font-size: .75rem; overflow-wrap: anywhere; line-height: 1.4; color: var(--ink-soft); }
@media (max-width: 480px) {
  .patient .letter { padding: 18px; gap: 14px; }
  .patient .letter h1 { font-size: 1.65rem; }
  .patient .lead { font-size: 1.1rem !important; }
  .trajectory-panel { padding: 12px; }
  .trajectory text { font-size: 24px; }
  .take-home li { gap: 10px; }
}
@media print {
  .applicability, .parent-applicability p { font-size: 9pt; color: #000; }
  .parent-applicability { padding: 7px; gap: 5px; border-color: #000; break-inside: avoid; }
  .trajectory-panel { padding: 8px; background: #fff; border-color: #000; break-inside: avoid; }
  .trajectory { max-width: 120mm; }
  .trajectory text { fill: #000; font-size: 13px; }
  .tr-grid { stroke: #ccc; }
  .tr-projection, .tr-endpoint { stroke: #000; }
  .tr-current { fill: #000; }
  .tr-endpoint { fill: #fff; }
  .trajectory-panel h2, .take-home h2 { font-size: 11pt; }
  .trajectory-panel figcaption, .trajectory-panel .hint, .take-home > p { font-size: 9pt; }
  .take-home { break-inside: avoid; }
  .take-home ul { grid-template-columns: 1fr 1fr; gap: 10px; }
  .take-home li { align-items: start; gap: 6px; }
  .take-home img { flex-basis: 22mm; width: 22mm; height: 22mm; }
  .take-home a { min-height: 0; font-size: 9pt; }
  .reading-url { font-size: 7pt; color: #000; }
}

/* Previous-RRD detail (model 0.6.1): sits under its checkbox, indented. */
.checks .rrd-detail { margin: 2px 0 8px 32px; display: grid; gap: 6px; }
.checks .rrd-detail label { display: block; min-height: 0; padding: 0; margin: 0; font-size: .88rem; cursor: default; background: none; }
.checks .rrd-detail label:hover { background: none; }
.rrd-detail select { width: 100%; min-height: var(--tap); padding: 8px 12px; border-radius: 12px; border: 1px solid var(--hair-strong); background: var(--card); color: var(--ink); font: inherit; }
.rrd-detail .hint { margin: 0; }
/* Years since the repair (0.11.0): a number field inside the checkbox group, so
   the checkbox sizing above is undone for it. */
.rrd-detail .since-repair { display: grid; gap: 6px; margin-top: 6px; }
.rrd-detail .since-repair[hidden] { display: none; }
.checks .since-repair input[type="number"] { width: 100%; height: auto; min-height: var(--tap); cursor: text; accent-color: auto; }
.checks .since-repair .opt { font-weight: 500; }

/* PVD status (model 0.19.0): one list in the risk-factor group, above the fold. */
.checks .pvd-field { margin: 6px 0 8px; display: grid; gap: 6px; }
.checks .pvd-field[hidden] { display: none; }
.checks .pvd-field label { display: flex; align-items: center; gap: 6px; min-height: 0; padding: 0; margin: 0; cursor: default; background: none; }
.checks .pvd-field label:hover { background: none; }
.pvd-field select { width: 100%; min-height: var(--tap); padding: 8px 12px; border-radius: 12px; border: 1px solid var(--hair-strong); background: var(--card); color: var(--ink); font: inherit; }
.pvd-field .hint { margin: 0; }
/* The line under the number that says what the PVD status did to it. */
p.pvd-line { font-weight: 500; }
p.pvd-line strong { font-weight: 650; }
/* The estimate for the PVD status entered sits under the published figure, in the
   same card: a quiet outlined box with its own number, range and one link. */
.pvd-est { display: grid; gap: 6px; padding: 14px 16px; border: 1px solid var(--stage-hair); border-radius: 14px; background: var(--stage-2); }
.pvd-est-label { margin: 0; font-size: .95rem; font-weight: 650; color: var(--stage-ink); }
.pvd-est-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; }
.pvd-est-num { margin: 0; font-family: var(--num); font-size: clamp(1.7rem, 4.4vw, 2.2rem); font-weight: 700; letter-spacing: -.01em; color: #fff; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pvd-est-side { display: grid; gap: 2px; padding-left: 16px; border-left: 1px solid var(--stage-hair); }
.pvd-est-side p { margin: 0; font-family: var(--num); }
.pvd-est-side .freq { color: var(--stage-ink); font-size: 1rem; font-weight: 650; }
.pvd-est-side .ui { color: var(--stage-ink); font-size: .92rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.pvd-est-side .ui span { color: var(--stage-soft); font-size: .82rem; margin-right: 4px; }
.pvd-est-text { margin: 0; font-size: .9rem; line-height: 1.45; color: var(--stage-soft); }
.fh-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fh-rows li { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; align-items: baseline; }
.fh-what { color: var(--stage-ink); font-size: .92rem; font-weight: 600; }
.fh-num { font-family: var(--num); font-size: 1.15rem; color: #fff; font-variant-numeric: tabular-nums; text-align: right; }
.fh-note { grid-column: 1 / -1; font-size: .84rem; line-height: 1.4; color: var(--stage-soft); }
.fh-rows + .pvd-est-text { margin-top: 6px; }
.pvd-est-more { margin: 0; }
.pvd-est-btn { border: 0; background: transparent; padding: 0; min-height: 32px; font: inherit; font-size: .9rem; font-weight: 700; color: var(--sky, #7fd4ff); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.pvd-est-btn:hover { color: #fff; }
@media (max-width: 480px) { .pvd-est-side { padding-left: 0; border-left: 0; } }
@media print { .pvd-est { background: #fff; border: 1px solid #000; } .pvd-est-label, .pvd-est-num, .pvd-est-text, .pvd-est-side .freq, .pvd-est-side .ui, .pvd-est-side .ui span { color: #000; } .pvd-est-more { display: none; } }

/* Thumb-sized − and + steppers beside number fields (app/ui/stepper.js). Native
   spinners are hidden where these replace them; typing still works. */
/* One box: minus, the number, plus. Three separate boxes per field made the form busy. */
.stepper { display: grid; grid-template-columns: var(--step) minmax(0, 1fr) var(--step); align-items: stretch; --step: 48px; background: #fff; border: 1px solid var(--hair-strong); border-radius: 14px; overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.stepper:focus-within { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(40, 85, 129, .14); }
.stepper:has(input[aria-invalid="true"]) { border-color: var(--risk); box-shadow: 0 0 0 3px rgba(196, 71, 47, .15); }
.stepper input[type="number"] { text-align: center; padding: 0 8px; appearance: textfield; -moz-appearance: textfield; border: 0; border-radius: 0; background: transparent; }
.stepper input[type="number"]:focus, .stepper input[aria-invalid="true"] { box-shadow: none; }
.stepper input[type="number"]::-webkit-inner-spin-button,
.stepper input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.step-btn {
  min-width: var(--tap); min-height: 48px; padding: 0;
  display: grid; place-items: center;
  background: transparent; color: var(--ink-soft); border: 0; border-radius: 0;
  font: inherit; font-size: 1.35rem; font-weight: 600; line-height: 1;
  cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent; transition: background .15s, border-color .15s;
}
.step-down { border-right: 1px solid var(--hair); }
.step-up { border-left: 1px solid var(--hair); }
.step-btn:hover:not(:disabled) { background: var(--key); color: var(--ink); }
.step-btn:active:not(:disabled) { background: var(--soft); }
.step-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; border-radius: 12px; }
.step-btn:disabled { opacity: .38; cursor: default; }
@media print { .step-btn { display: none; } .stepper { display: block; border: 0; } }

/* Clinician charts (2026-11-18): in place of the dot picture, a folded card with
   the risk curve (horizon markers, 95% whiskers) and the factor multipliers. */
.chart-card { display: grid; gap: 8px; background: var(--card); color: var(--ink); border: 1px solid var(--hair); border-radius: 16px; padding: 16px; break-inside: avoid; }
.chart-card .chart-h { margin: 4px 0 0; font-size: .95rem; font-weight: 700; color: var(--ink); }
.chart-card .chart-h + .curve-fig, .chart-card .chart-h + .hbars, .chart-card .chart-h + .fbars { margin-top: 2px; }
.chart-card .hint { color: var(--ink-soft); font-size: .85rem; margin: 0 0 6px; }
.chart-card .legend { color: var(--ink-soft); }
.curve .c-mark circle { fill: var(--risk); stroke: var(--card); stroke-width: 2; }
.curve .c-mark:not(.is-on) circle { fill: var(--card); stroke: var(--risk); stroke-width: 2; }
.curve .c-mark circle.c-hit { fill: transparent; stroke: none; }
.curve .c-whisk { stroke: var(--risk-ink); stroke-width: 1.5; opacity: .75; }
.curve .c-label { fill: var(--ink); font: 700 12px var(--num); paint-order: stroke; stroke: var(--card); stroke-width: 4px; stroke-linejoin: round; }
.legend .c-key.whisk { width: 2px; height: 12px; vertical-align: -1px; background: var(--risk-ink); border-radius: 0; }

.fbars { display: grid; gap: 6px; }
.fbar { display: grid; grid-template-columns: minmax(8rem, 13rem) minmax(0, 1fr) 5.5rem; gap: 10px; align-items: center; font-size: .9rem; }
.fb-label { color: var(--ink); }
.fbar.total .fb-label { font-weight: 700; }
.fb-track { position: relative; height: 18px; background: var(--paper); border-radius: 999px; box-shadow: inset 0 0 0 1px var(--hair); }
.fb-one { position: absolute; top: -3px; bottom: -3px; margin-left: -1px; background: var(--ink-soft); z-index: 1; }
.fb-fill { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; }
.fbar.up .fb-fill { background: var(--risk); }
.fbar.down .fb-fill { background: var(--ink); }
.fbar.flat .fb-fill { background: var(--ink-soft); }
.fbar.total .fb-fill { top: 1px; bottom: 1px; }
.fbar.up.total .fb-fill { background: var(--risk-ink); }
.fbar.none .fb-label, .fbar.none .fb-val { color: var(--ink-soft); }
.fb-val { font-family: var(--num); font-variant-numeric: tabular-nums; font-weight: 650; text-align: right; }
.fb-val small { display: block; font-family: var(--body); font-weight: 500; font-size: .75rem; color: var(--ink-soft); }
.fb-axis { display: flex; justify-content: space-between; gap: 8px; font-size: .75rem; color: var(--ink-soft); }
@media (max-width: 560px) {
  .fbar { grid-template-columns: minmax(0, 1fr) 4.5rem; }
  .fb-label { grid-column: 1 / -1; }
  .fb-axisrow > span:first-child { display: none; }
}
@media (forced-colors: active) {
  .fb-fill, .fb-one, .curve .c-mark circle { forced-color-adjust: none; background: CanvasText; fill: CanvasText; }
}

.curve-narrow { display: none; }
@media (max-width: 560px) {
  .curve-wide { display: none; }
  .curve-narrow { display: block; }
  .curve-narrow .c-tick, .curve-narrow .c-axis { font-size: 13px; }
  .curve-narrow .c-label { font-size: 14px; }
}
@media print { .curve-wide { display: block; } .curve-narrow { display: none; } }

/* ---- 2026-11-18 screenshot audit ---- */
/* What the headline counts: time span and per person or per eye. */
.tiles-label { margin: 8px 0 -2px; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--stage-soft); }
button.tile { box-shadow: inset 0 0 0 0 transparent; }
button.tile:not(.is-main) .t-label::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border: 1.5px solid currentColor; border-radius: 50%; vertical-align: .05em; }
button.tile.is-main .t-label::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: var(--pin); border: 1.5px solid var(--pin); border-radius: 50%; vertical-align: .05em; }
/* Recorded factors that the number leaves out, right under the number. */
.not-counted { margin: 4px 0 2px; font-size: .9rem; font-weight: 550; line-height: 1.45; color: var(--gold-ink); background: var(--gold-soft); border: 1px solid rgba(197, 138, 26, .35); border-radius: 10px; padding: 8px 12px; }
.not-counted strong { color: inherit; }
/* Myopia control: the treated arm carries its difference. */
.mc-honest { border-color: var(--stage-hair); background: transparent; }
.tr-reference { stroke: var(--ink-soft); stroke-width: 1.5; stroke-dasharray: 2 4; }
.se-helper .row { margin-top: 10px; grid-template-columns: 1fr 1fr; align-items: end; }
.se-helper button { margin-top: 10px; }
.dialog-row { gap: 10px; align-items: center; flex-wrap: wrap; }
@media print {
  .not-counted { background: #fff; border: 1px solid #000; color: #000; }
  .tr-reference { stroke: #000; }
  .tiles-label { display: none; }
}
/* One box: the line is the summary; what the evidence says unfolds inside it. */
details.not-counted > summary { cursor: pointer; list-style: none; font-size: inherit; font-weight: inherit; min-height: 24px; }
details.not-counted > summary::-webkit-details-marker { display: none; }
.not-counted .nc-more { white-space: nowrap; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.not-counted .nc-more::after { content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 2px 2px 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg); }
details.not-counted[open] .nc-more::after { transform: rotate(-135deg); margin-bottom: -1px; }
@media print { .not-counted .nc-more { display: none; } }

/* Evidence buttons: a quiet (i) beside an input, risk factor or headline opens one
   shared dialog with the evidence and PubMed links (app/ui/evidence-info.js).
   The visible circle is small; the tap area is 44 px. */
.info-btn {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 22px; height: 22px; margin: 0 0 0 6px; padding: 0; vertical-align: -4px;
  border: 1px solid var(--hair-strong); border-radius: 50%; background: transparent;
  color: var(--ink-soft); cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.info-btn::after { content: ""; position: absolute; inset: -11px; }
.info-btn:hover { color: var(--ink); border-color: var(--ink-soft); background: var(--card); }
.info-btn:focus-visible { outline: 3px solid #8e650e; outline-offset: 2px; }
.label-line { display: flex; align-items: flex-start; gap: 0; flex-wrap: nowrap; }
.label-line > .info-btn { margin-top: -1px; }
.label-line > label, .label-line > .label { display: inline-flex; flex: 0 1 auto; min-width: 0; }
.checks label > .info-btn { justify-self: end; margin: 0; }
.checks label { grid-template-columns: auto minmax(0, 1fr) auto; }
.headline .info-btn { color: var(--stage-soft); border-color: var(--stage-hair); margin-left: 0; }
.headline .info-btn:hover { color: var(--stage-ink); border-color: var(--stage-soft); background: transparent; }
.fb-label .info-btn { width: 18px; height: 18px; vertical-align: -3px; }
.fb-label .info-btn svg { width: 12px; height: 12px; }

.info-dialog { width: min(640px, calc(100vw - 32px)); max-height: min(80vh, 760px); border: 0; border-radius: var(--radius); padding: 0; background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -30px rgba(10, 17, 28, .6); }
.info-dialog[open] { display: flex; flex-direction: column; }
.info-dialog::backdrop { background: rgba(10, 17, 28, .45); }
.info-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 10px; border-bottom: 1px solid var(--hair); }
.info-head h2 { font-size: 1.15rem; margin: 0; }
.info-head button { min-height: 44px; }
.info-body { overflow-y: auto; padding: 14px 22px 4px; font-size: .94rem; line-height: 1.55; }
.info-body p, .info-body ul { margin: 0 0 10px; max-width: 64ch; }
.info-body ul { padding-left: 20px; }
.info-body li + li { margin-top: 6px; }
.info-body h3 { font-size: .96rem; margin: 16px 0 6px; }
.info-body h3:first-child { margin-top: 0; }
.info-src { font-size: .86rem; color: var(--ink-soft); }
.info-src a { color: var(--ink); text-underline-offset: 3px; }
.info-used { display: block; margin-top: 2px; }
/* Trials by method (myopia control): the figure leads, the trial detail is quieter. */
.trial-list li { margin-bottom: 8px; }
.trial-note { display: block; margin-top: 2px; font-size: .86rem; color: var(--ink-soft); line-height: 1.5; }
.info-foot { margin: 0; padding: 10px 22px 18px; font-size: .84rem; color: var(--ink-soft); border-top: 1px solid var(--hair); }
.info-foot a { color: var(--ink); }
@media (max-width: 560px) {
  .info-dialog { width: 100vw; max-width: 100vw; max-height: 85vh; margin: auto 0 0; border-radius: var(--radius) var(--radius) 0 0; }
}
@media print { .info-btn, .info-dialog { display: none !important; } }
.pill.checked, .pill.verified { color: var(--ink-soft); }
.pill.partial { color: var(--gold-ink); }
/* Myopia control: the optional trial picker sits under the entry it fills. */
/* Help text as short points, not one block (owner, 2026-11-19). */
.hint-list { margin: 0; padding-left: 1.1rem; display: grid; gap: 6px; }
.hint-list strong { font-weight: 650; color: var(--ink); }

/* Starting values (owner, 2026-11-20): age, sex and, for myopia control, refraction
   open filled in so they can be changed rather than typed. Until each is changed or
   accepted it is shown in grey, and no estimate is drawn. */
.stepper input.is-start { color: #5f6875; font-weight: 500; }
.seg.is-start input:checked + span { background: var(--key); border-color: #8a929d; color: #5f6875; }
.start-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin-top: 4px; }
.start-row .hint { margin: 0; flex: 1 1 220px; }
.start-row .link-btn { padding-inline: 0; }
@media print { .start-row { display: none; } }

/* What-if illustration (2026-11-22): quiet, folded, never printed. */
details.what-if { margin: 6px 0 2px; font-size: .9rem; line-height: 1.45; }
details.what-if > summary { cursor: pointer; min-height: 24px; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
details.what-if ul { margin: 8px 0 4px; padding-left: 18px; display: grid; gap: 6px; }
details.what-if .hint { margin: 4px 0 0; color: inherit; }
@media print { details.what-if { display: none !important; } }

/* Cross-mode review 2026-12-02: inside a white chart card the headline's light
   information glyph had 1.91:1 contrast. Use the card's ink there. */
.headline .chart-card .info-btn { color: #40597a; border-color: #40597a; }
.headline .chart-card .info-btn:hover { color: var(--ink); border-color: var(--ink); }
