/* Riji Health · Clinician Portal
   A clinical story told chapter by chapter over a cinematic backdrop.

   Proportional Viewport Architecture:
   Every dimension (typography, spacing, radii, icons, sidebars, grids, and
   visualizations) is expressed in `rem` calibrated to a 1440px (90rem) desktop
   reference canvas by fit.js (with pure-CSS vw fallback). Every laptop, HD,
   QHD, and 4K monitor renders the exact same proportional composition, while
   tablets (< 960px) and phones (< 640px) switch cleanly to touch-adapted grids.

   Zero external requests; strict CSP compatible (no inline styles in markup). */

/* ── Fonts ───────────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Jost'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/fonts/Jost-Variable.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Jost'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/fonts/Jost-Variable-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Instrument Serif'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/InstrumentSerif-Regular.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Serif'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/InstrumentSerif-Regular-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; font-display: swap;
  src: url('/fonts/InstrumentSerif-Italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; font-display: swap;
  src: url('/fonts/InstrumentSerif-Italic-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-SemiBold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

/* ── Tokens ──────────────────────────────────────────────────────────────── */

:root {
  --ember-50: #FFF0EC;
  --ember-100: #FFD1C3;
  --ember-300: #FF9B7D;
  --ember-400: #FF8864;
  --ember-500: #FF6A3D;
  --ember: #E86038;
  --ember-700: #B54B2B;

  --deep: #380802;
  --mid: #AA2700;
  --warm-black: #280900;

  --gold: #E1A878;
  --gold-deep: #B58455;
  --gold-wash: #FBF3EC;

  --ok: #008A10;
  --ok-300: #54B15F;
  --ok-50: #E6F3E7;
  --ok-ink: #00660C;
  --crit: #DA0000;
  --crit-50: #FEE6E8;
  --crit-ink: #B00000;

  --paper: #FFFFFF;
  --ivory: #FAFAF8;
  --ink: #1A1C23;
  --text: #3A3F4B;
  --slate: #64748B;
  --slate-400: #94A3B8;
  --line: #ECE8E1;
  --line-strong: #D9D3C8;

  --display: 'Jost', 'Futura', 'Avenir Next', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --serif: 'Instrument Serif', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --body: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;

  --vw: 1vw;
  --vh: 1vh;

  --ease: cubic-bezier(.2, .7, .3, 1);
  /* Pure rem shell tokens: scale in exact lockstep on every screen size */
  --bar-h: 4.125rem;
  --rail-w: 15.75rem;
  --gutter: 2.25rem;
  --sheet-max: 72rem;

  --grad-brand: linear-gradient(120deg, #E86038, #FF6A3D);
  --grad-deep: linear-gradient(160deg, #380802, #AA2700 140%);
  --glass-light: linear-gradient(150deg, rgba(255, 255, 255, .94), rgba(255, 255, 255, .82) 55%, rgba(255, 255, 255, .90));
  --glass-dark: linear-gradient(150deg, rgba(56, 8, 2, .56), rgba(40, 9, 0, .42));
  --lg-bg: rgba(255, 255, 255, .95);
  --lg-bg-warm: linear-gradient(180deg, rgba(255, 255, 255, .98) 0%, rgba(252, 250, 247, .95) 100%);
  --lg-bg-hover: #FFFFFF;
  --lg-border: rgba(26, 28, 35, .075);
  --lg-outline: rgba(232, 96, 56, .28);
  --lg-shadow: 0 0.5rem 1.75rem rgba(26, 28, 35, .045), 0 0.125rem 0.375rem rgba(26, 28, 35, .025);
  --lg-shadow-hover: 0 1rem 2.5rem rgba(232, 96, 56, .10), 0 0.1875rem 0.625rem rgba(26, 28, 35, .04);
}

.st-optimal, .st-normal { --st: var(--ok); --st-soft: var(--ok-50); --st-ink: var(--ok-ink); --val: var(--ink); }
.st-attention { --st: var(--ember); --st-soft: var(--ember-50); --st-ink: var(--ember-700); --val: var(--ember-700); }
.st-critical { --st: var(--crit); --st-soft: var(--crit-50); --st-ink: var(--crit-ink); --val: var(--crit-ink); }
.fs-critical { --fs: var(--crit); }
.fs-attention { --fs: var(--ember); }
.fs-watch { --fs: var(--gold-deep); }
.fs-steady { --fs: var(--ok); }
.band-ok { --band: var(--ok); --band-soft: var(--ok-50); --band-ink: var(--ok-ink); }
.band-gold { --band: var(--gold-deep); --band-soft: var(--gold-wash); --band-ink: #8A5A2E; }
.band-attention { --band: var(--ember); --band-soft: var(--ember-50); --band-ink: var(--ember-700); }
.band-critical { --band: var(--crit); --band-soft: var(--crit-50); --band-ink: var(--crit-ink); }
.band-neutral { --band: var(--slate-400); --band-soft: #F1EEE8; --band-ink: var(--slate); }

/* ── Base (Pure-CSS proportional root scale fallback before fit.js runs) ─── */

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  /* 16 / 1440 = 1.11111vw -> 90rem = 100vw on every desktop monitor */
  font-size: clamp(10.667px, 1.11111vw, 44px);
  overflow-x: clip;
}
@media (max-width: 959.98px) {
  html { font-size: clamp(13.5px, 11.5px + 0.42vw, 15.5px); }
}

body {
  margin: 0;
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.62;
  color: var(--text);
  background: var(--deep);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { font-family: var(--display); font-weight: 500; margin: 0; color: var(--ink); letter-spacing: -0.015em; }
p, ul, ol, dl, dd, blockquote, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: inherit; }
img { max-width: 100%; display: block; }
em { font-style: normal; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 0.1875rem; border-radius: 0.5rem; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0.625rem; z-index: 400; background: var(--ink); color: #fff; padding: 0.56rem 1rem; border-radius: 100px; font-size: 0.8125rem; text-decoration: none; }
.skip:focus { left: 0.875rem; }
.noscript, .loading { min-height: calc(100 * var(--vh)); display: grid; place-items: center; color: rgba(255, 255, 255, .82); font-size: 0.95rem; }
.print-thead { display: none; }
.ico { flex: none; display: inline-block; vertical-align: middle; }

/* ── Atoms (100% Proportional rem) ───────────────────────────────────────── */

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.625rem;
  font: 600 .76rem/1.2 var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--ember-700);
}
.eyebrow::before { content: ''; width: 1.625rem; height: 1.5px; background: currentColor; opacity: .7; }
.eyebrow b { font-weight: 600; }
.eyebrow.ok { color: var(--ok-ink); }
.eyebrow.small { font-size: .72rem; letter-spacing: .16em; color: var(--slate); }
.eyebrow.small::before { width: 0.875rem; }

.body-sm { font-size: .95rem; line-height: 1.64; color: var(--text); max-width: 78ch; }
.muted-sm { font-size: .88rem; line-height: 1.54; color: var(--slate); }
.muted-xs { font-size: .8rem; line-height: 1.48; color: var(--slate); }
.caveat { font-size: .82rem; color: var(--slate-400); max-width: 82ch; }
.calm { font: italic 400 1.45rem/1.4 var(--serif); color: var(--ok-ink); }
.empty { padding: 1.625rem; border-radius: 1.375rem; background: var(--ivory); color: var(--slate); font-size: .94rem; text-align: center; }
.tone-good, em.good { color: var(--ok-ink); }
.tone-warn, em.warn { color: var(--ember-700); }

.brand { display: inline-flex; align-items: center; gap: 0.625rem; text-decoration: none; }
.brand img { width: 1.875rem; height: 1.875rem; flex: none; }
.brand-words { display: grid; line-height: 1.05; text-align: left; }
.brand-words strong { font: 500 1.12rem var(--display); letter-spacing: .01em; color: var(--ink); }
.brand-words small { font: 600 .64rem var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--gold-deep); }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.56rem;
  border: 0; border-radius: 100px; padding: .76rem 1.4rem;
  font: 600 .92rem var(--body); color: #fff; text-decoration: none; max-width: 100%;
  background: var(--grad-brand);
  box-shadow: 0 0.625rem 1.625rem rgba(232, 96, 56, .35), inset 0 1px 0 rgba(255, 255, 255, .28);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-0.125rem); box-shadow: 0 1rem 2.125rem rgba(232, 96, 56, .42), inset 0 1px 0 rgba(255, 255, 255, .28); }
.btn-primary.full { width: 100%; padding: .9rem 1.4rem; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.44rem;
  border: 1px solid var(--line-strong); border-radius: 100px; padding: .56rem 1.02rem;
  font: 600 .86rem var(--body); color: var(--ink); background: rgba(255, 255, 255, .82);
  text-decoration: none; max-width: 100%;
  transition: background .2s, border-color .2s, transform .3s var(--ease);
}
.btn-ghost.sm { padding: .42rem .8rem; font-size: .8rem; }
.btn-ghost:hover:not(:disabled) { background: #fff; border-color: var(--ink); transform: translateY(-1px); }
.btn-glass {
  display: inline-flex; align-items: center; gap: 0.625rem;
  border-radius: 100px; padding: .7rem 1.15rem .7rem 1.3rem;
  font: 600 .92rem var(--body); max-width: 100%;
  backdrop-filter: blur(18px) saturate(160%);
  transition: transform .3s var(--ease), background .3s;
}
.btn-glass:hover { transform: translateY(-0.125rem); }
.pill-count { font-size: .76rem; font-weight: 700; padding: 0.18rem 0.56rem; border-radius: 100px; background: var(--gold); color: var(--warm-black); }
.link-btn {
  display: inline-flex; align-items: center; gap: 0.3125rem; border: 0; background: none; padding: 0.125rem 0;
  font: 600 .86rem var(--body); color: var(--ember-700); text-decoration: none; white-space: nowrap;
}
.link-btn:hover { text-decoration: underline; text-underline-offset: 0.25rem; }

.status-dot { width: 0.5625rem; height: 0.5625rem; border-radius: 50%; flex: none; display: inline-block; background: var(--st, var(--slate-400)); }
.status-dot.st-attention, .status-dot.st-critical { box-shadow: 0 0 0 0.25rem var(--st-soft); }

.tag {
  display: inline-flex; align-items: center; gap: 0.3125rem;
  font: 700 .76rem/1.25 var(--body); padding: 0.25rem 0.6875rem; border-radius: 100px; white-space: nowrap;
}
.tag.neutral { background: #F1EEE8; color: var(--text); }
.tag.ok { background: var(--ok-50); color: var(--ok-ink); }
.tag.attention, .tag.warn, .tag.accent { background: var(--ember-50); color: var(--ember-700); }
.tag.critical { background: var(--crit-50); color: var(--crit-ink); }
.tag.gold { background: var(--gold-wash); color: #8A5A2E; box-shadow: inset 0 0 0 1px rgba(225, 168, 120, .5); }

.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.chip, .chip-btn {
  display: inline-flex; align-items: baseline; gap: 0.44rem;
  font-size: .86rem; line-height: 1.32; padding: .44rem .86rem; border-radius: 100px;
  border: 0; background: #F4F1EB; color: var(--text);
}
.chip em, .chip-btn em { font-size: .76rem; font-weight: 600; opacity: .74; }
.chip-btn small { font-size: .74rem; opacity: .72; }
.chip.ok { background: var(--ok-50); color: var(--ok-ink); }
.chip.attention { background: var(--ember-50); color: var(--ember-700); }
.chip.critical { background: var(--crit-50); color: var(--crit-ink); font-weight: 600; }
.chip.reported { background: var(--gold-wash); color: var(--warm-black); }
.chip.dashed { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-strong); color: var(--slate); }
.chip-btn { background: var(--st-soft); color: var(--st-ink); font-weight: 600; font-variant-numeric: tabular-nums; transition: transform .25s var(--ease), box-shadow .25s; }
.chip-btn:hover { transform: translateY(-0.125rem); box-shadow: 0 0.5rem 1.125rem rgba(26, 28, 35, .1); }
.chip.removable button { border: 0; background: none; padding: 0 0 0 0.125rem; font-size: 1rem; line-height: 1; color: inherit; }
.fn-chip {
  display: inline-flex; align-items: center; gap: 0.375rem; border: 0; padding: 0.25rem 0.6875rem; border-radius: 100px;
  font: 600 .72rem var(--display); letter-spacing: .1em; text-transform: uppercase;
  background: var(--warm-black); color: var(--gold);
  transition: transform .25s var(--ease);
}
.fn-chip:hover { transform: translateY(-1px); }

.glyph { font-size: .9rem; font-weight: 700; margin-left: 0.25rem; }
.glyph.warn { color: var(--ember-700); }
.glyph.good { color: var(--ok-ink); }
.glyph.flat { color: var(--slate-400); }

/* Reference ranges, typeset */
.thr { display: inline-flex; align-items: baseline; gap: 0.44rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.thr-label { font-size: .7rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; opacity: .64; }
.thr-fig { display: inline-flex; align-items: baseline; gap: 0.25rem; font-size: .86rem; }
.thr-fig b { font-weight: 600; }
.thr-dash, .thr-op { opacity: .55; }
.thr-unit { opacity: .72; font-size: .92em; }

.facts { display: grid; grid-template-columns: minmax(6.8rem, auto) minmax(0, 1fr); gap: 0.56rem 1.375rem; font-size: .92rem; }
.facts dt { color: var(--slate); }
.facts dd { color: var(--ink); font-weight: 600; }

.field { display: grid; gap: 0.375rem; }
.field > span { font-size: .82rem; font-weight: 600; color: var(--ink); }
.field input, .field textarea, .inline-input, select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 0.875rem; padding: .7rem .9rem;
  background: #fff; color: var(--ink); font-size: .95rem;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus, .inline-input:focus, select:focus {
  border-color: var(--ember); box-shadow: 0 0 0 0.25rem rgba(232, 96, 56, .14); outline: none;
}
.field textarea { resize: vertical; line-height: 1.55; }
.field input:disabled, .field textarea:disabled { background: var(--ivory); color: var(--slate); }

.seg { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; padding: 0.25rem; border-radius: 100px; background: #F4F1EB; }
.seg-btn { border: 0; background: transparent; padding: 0.375rem 0.8125rem; border-radius: 100px; font: 600 .78rem var(--body); color: var(--slate); transition: background .2s, color .2s; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.on { background: var(--ink); color: #fff; }

.drawer summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 0.5rem;
  font: 600 .8125rem var(--body); color: var(--slate); padding: 0.25rem 0;
}
.drawer summary::-webkit-details-marker { display: none; }
.drawer summary::before { content: '+'; width: 1.125rem; height: 1.125rem; border-radius: 50%; display: grid; place-items: center; background: #F1EEE8; color: var(--ink); font-size: .8125rem; line-height: 1; }
.drawer[open] > summary::before { content: '\2212'; }
.drawer summary:hover { color: var(--ink); }

/* PubMed evidence */
.evidence-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.evidence {
  display: inline-flex; align-items: center; gap: 0.75rem; padding: 0.56rem 1rem 0.56rem 0.625rem; border-radius: 1rem;
  background: var(--ivory); text-decoration: none; font-size: .8125rem; color: var(--text); max-width: 100%;
  transition: background .25s, transform .3s var(--ease), box-shadow .3s;
}
.evidence:hover { background: #fff; transform: translateY(-0.125rem); box-shadow: 0 0.75rem 1.75rem rgba(232, 96, 56, .12); }
.evidence-tag { flex: none; font: 700 .625rem var(--body); letter-spacing: .1em; text-transform: uppercase; padding: 0.3125rem 0.5rem; border-radius: 0.5rem; background: var(--warm-black); color: var(--gold); }
.evidence-body { display: grid; gap: 0.0625rem; min-width: 0; }
.evidence-title { font-weight: 600; color: var(--ink); line-height: 1.35; }
.evidence-meta { font-size: .75rem; color: var(--slate); }

/* ── Motion ──────────────────────────────────────────────────────────────── */

.rv { opacity: 0; transform: translateY(1.5rem); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: calc(var(--i, 0) * 90ms); }
.rv.in { opacity: 1; transform: none; }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { transform: scale(0); opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(1.5rem); } }
@keyframes bloom { from { opacity: 0; transform: scale(.94); } }
@keyframes kenburns {
  from { transform: scale3d(1.02, 1.02, 1) translate3d(0, 0, 0); }
  to { transform: scale3d(1.085, 1.085, 1) translate3d(-1.1%, -0.8%, 0); }
}
@keyframes floatOrbA {
  from { transform: translate3d(0, 0, 0) scale3d(1, 1, 1); }
  to { transform: translate3d(3.5rem, -2.25rem, 0) scale3d(1.1, 1.08, 1); }
}
@keyframes floatOrbB {
  from { transform: translate3d(0, 0, 0) scale3d(1, 1, 1); }
  to { transform: translate3d(-3.25rem, 2.5rem, 0) scale3d(1.12, 1.1, 1); }
}
@keyframes floatOrbC {
  from { transform: translate3d(0, 0, 0) scale3d(1, 1, 1); }
  to { transform: translate3d(2.5rem, 2rem, 0) scale3d(1.08, 1.12, 1); }
}
@keyframes auraBreathe {
  0%, 100% { opacity: .84; transform: scale3d(1, 1, 1); }
  50% { opacity: 1; transform: scale3d(1.045, 1.045, 1); }
}
@keyframes laneIn { from { left: var(--from); } }
@keyframes ringIn { from { stroke-dashoffset: var(--p); } }
@keyframes haloPulse { 0% { transform: scale(1); opacity: .7; } 70%, 100% { transform: scale(2.3); opacity: 0; } }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(84, 177, 95, .5); } 50% { box-shadow: 0 0 0 0.3125rem rgba(84, 177, 95, 0); } }

.anim .draw, .marker-stage .draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.5s var(--ease) .2s forwards; }
.anim .pop, .marker-stage .pop { transform-box: fill-box; transform-origin: center; animation: pop .6s var(--ease) both; }
.anim .ring-arc { animation: ringIn 1.3s var(--ease) .2s both; }
.anim .lane-dot { animation: laneIn 1.2s var(--ease) .25s both; }

/* ── Cinematic backdrop ──────────────────────────────────────────────────── */

.backdrop { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--deep); contain: layout paint style; pointer-events: none; }
.bd-img {
  position: absolute; inset: -4%; background-size: cover; background-position: center;
  opacity: 0; transition: opacity 1s ease;
  filter: saturate(1.03);
  will-change: transform, opacity; backface-visibility: hidden;
}
.bd-img.on { opacity: 1; animation: kenburns 38s ease-in-out infinite alternate; }
.bd-scrim { position: absolute; inset: 0; }
.bd-scrim::before, .bd-scrim::after { content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity .8s ease; }
.bd-scrim::before {
  background:
    linear-gradient(92deg, rgba(56, 8, 2, .82) 0%, rgba(56, 8, 2, .56) 44%, rgba(56, 8, 2, .16) 80%, rgba(56, 8, 2, .22) 100%),
    linear-gradient(180deg, rgba(56, 8, 2, .38) 0%, rgba(56, 8, 2, 0) 24%, rgba(56, 8, 2, .44) 100%);
}
.bd-scrim::after {
  background:
    linear-gradient(92deg, rgba(255, 253, 250, .86) 0%, rgba(255, 253, 250, .52) 42%, rgba(255, 253, 250, 0) 78%),
    linear-gradient(180deg, rgba(255, 253, 250, .36) 0%, rgba(255, 253, 250, 0) 20%);
}
body[data-tone="dusk"] .bd-scrim::before { opacity: 1; }
body[data-tone="ivory"] .bd-scrim::after { opacity: 1; }
.bd-aura {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle 28rem at 18% 24%, rgba(232, 96, 56, .12), transparent 70%),
    radial-gradient(circle 32rem at 82% 68%, rgba(225, 168, 120, .11), transparent 72%);
  animation: floatOrbA 32s ease-in-out infinite alternate;
  will-change: transform; backface-visibility: hidden;
}
body[data-tone="ivory"] .bd-aura { opacity: .52; }
.bd-embers { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }

/* ── Shell: top bar, chapter rail, stage ─────────────────────────────────── */

.app { position: relative; min-height: calc(100 * var(--vh)); max-width: 100%; }

.topbar {
  position: sticky; top: 0; z-index: 60; min-height: var(--bar-h);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: nowrap; gap: 1rem;
  padding: 0.375rem max(1.375rem, env(safe-area-inset-right)) 0.375rem max(1.375rem, env(safe-area-inset-left));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-bottom: 1px solid rgba(26, 28, 35, .07);
  box-shadow: 0 2px 1.25rem rgba(26, 28, 35, .04);
  transition: background .3s;
}
body.scrolled .topbar { background: rgba(255, 255, 255, .98); }
.top-left { display: flex; align-items: center; gap: 1.125rem; min-width: 0; flex: 0 1 auto; }
.brand-home { border: 0; background: none; padding: 0; display: inline-flex; align-items: center; flex: none; }
.patient-bar { display: grid; gap: 0.0625rem; padding-left: 1.125rem; border-left: 1px solid rgba(26, 28, 35, .12); min-width: 0; }
.pb-main { display: flex; align-items: center; gap: 0.625rem; min-width: 0; }
.pb-name { font: 500 1.08rem var(--display); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-meta { font-size: .78rem; color: var(--slate); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.allergy-badge {
  display: inline-flex; align-items: center; gap: 0.3125rem; font: 700 .72rem var(--body); padding: 0.1875rem 0.625rem;
  border-radius: 100px; background: var(--crit-50); color: var(--crit-ink); white-space: nowrap; flex: none;
}
.allergy-none { font-size: .76rem; color: var(--slate-400); white-space: nowrap; flex: none; }
.top-right { display: flex; align-items: center; justify-content: flex-end; flex-wrap: nowrap; gap: 0.625rem; flex: 1 1 auto; min-width: 0; }
.enc-short { display: none; }
.top-actions { display: flex; align-items: center; gap: 0.375rem; flex: none; }
.top-actions .btn-ghost { white-space: nowrap; }
.enc-pill {
  display: inline-flex; align-items: center; gap: 0.44rem; font: 600 .78rem var(--body); color: var(--ok-ink);
  background: var(--ok-50); padding: 0.3125rem 0.75rem; border-radius: 100px; white-space: nowrap; flex: none;
}
.enc-pill.mode { background: var(--gold-wash); color: #8A5A2E; }
.enc-dot { width: 0.44rem; height: 0.44rem; border-radius: 50%; background: var(--ok-300); animation: breathe 2.4s ease-in-out infinite; }
.enc-pill.mode .enc-dot { background: var(--gold-deep); animation: none; }
.lock-timer { font: 600 .78rem var(--body); color: var(--slate); font-variant-numeric: tabular-nums; flex: none; }

.global-search { position: relative; display: flex; align-items: center; flex: 0 1 15.5rem; width: 15.5rem; min-width: 9rem; }
.global-search > .ico { position: absolute; left: 0.75rem; color: var(--slate-400); pointer-events: none; }
.global-search input {
  width: 100%; border: 1px solid transparent; background: rgba(26, 28, 35, .06); border-radius: 100px;
  padding: .46rem .875rem .46rem 2.15rem; font-size: .86rem; color: var(--ink); transition: background .2s, border-color .2s, box-shadow .2s;
}
.global-search input:focus { background: #fff; border-color: var(--ember); box-shadow: 0 0 0 0.25rem rgba(232, 96, 56, .14); outline: none; }
.search-pop {
  position: absolute; top: calc(100% + 0.625rem); right: 0; width: 22.5rem; padding: 0.375rem; z-index: 200;
  border-radius: 1.25rem; background: rgba(255, 255, 255, .96); backdrop-filter: blur(20px);
  box-shadow: 0 1.5rem 3.75rem rgba(56, 8, 2, .2), inset 0 1px 0 #fff;
}
.search-hit {
  width: 100%; display: flex; align-items: center; gap: 0.625rem; border: 0; background: transparent;
  padding: 0.625rem 0.75rem; border-radius: 0.875rem; font-size: .88rem; text-align: left;
}
.search-hit:hover, .search-hit:focus-visible { background: var(--ember-50); }
.search-hit strong { flex: 1; font-weight: 600; color: var(--ink); }
.hit-val { font-size: .82rem; color: var(--slate); font-variant-numeric: tabular-nums; }
.search-empty { padding: 0.75rem; font-size: .86rem; color: var(--slate); text-align: center; }

/* Chapter rail — shared visual tokens + desktop vertical sidebar (>= 960px).
   Mobile/tablet (< 960px) uses a completely separate inline-block horizontal
   pill scroller so WebKit/iOS Safari can never inherit grid/flex width collapse. */
.rail {
  z-index: 40;
  border: 1px solid rgba(255, 255, 255, .8);
  background: var(--glass-light);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  box-shadow: 0 1.25rem 3.125rem rgba(26, 28, 35, .1), inset 0 1px 0 rgba(255, 255, 255, .95);
  color: var(--ink);
  transition: background .8s, border-color .8s, color .8s, box-shadow .8s;
}
.rail-scroll { scrollbar-width: none; }
.rail-scroll::-webkit-scrollbar { display: none; }
.rail-score {
  border: 1px solid rgba(26, 28, 35, .08); background: rgba(255, 255, 255, .62);
  color: inherit; transition: background .25s, transform .25s var(--ease);
}
.rail-score:hover { background: rgba(255, 255, 255, .92); transform: translateY(-1px); }
.rs-label { font: 600 .64rem var(--display); letter-spacing: .16em; text-transform: uppercase; opacity: .72; }
.rs-total { font: 500 1.4rem/1 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--band-ink, inherit); }
.rs-total small { font-size: .56em; font-weight: 500; opacity: .65; margin-left: 1px; }
.rs-cat {
  display: grid; justify-items: center; gap: 1px; padding: 0.25rem 0.125rem; border-radius: 0.625rem;
  background: var(--band-soft, rgba(26, 28, 35, .06)); color: var(--band-ink, inherit);
}
.rs-cat em { font: 600 .58rem var(--display); letter-spacing: .08em; text-transform: uppercase; opacity: .78; }
.rs-cat b { font: 700 .76rem var(--display); font-variant-numeric: tabular-nums; }
body[data-tone="dusk"] .rail-score { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .18); }
body[data-tone="dusk"] .rail-score:hover { background: rgba(255, 255, 255, .18); }
body[data-tone="dusk"] .rs-total { color: #fff; }
body[data-tone="dusk"] .rs-cat { background: rgba(255, 255, 255, .12); color: #fff; }
body[data-tone="dusk"] .rs-cat.band-ok b { color: #9BE0A4; }
body[data-tone="dusk"] .rs-cat.band-gold b { color: var(--gold); }
body[data-tone="dusk"] .rs-cat.band-attention b { color: var(--ember-300); }
body[data-tone="dusk"] .rs-cat.band-critical b { color: #FF7A70; }

.rail-head { font: 600 .66rem var(--display); letter-spacing: .18em; text-transform: uppercase; opacity: .55; padding: 0 0.75rem 0.3rem; }
.rail-item {
  border: 0; background: transparent;
  font: 500 .86rem/1.26 var(--body); color: inherit;
  transition: background .25s, color .25s, transform .3s var(--ease);
}
.rail-item:hover { background: rgba(26, 28, 35, .06); transform: translateX(0.125rem); }
.rail-item.on { background: var(--ink); color: #fff; box-shadow: 0 0.625rem 1.5rem rgba(26, 28, 35, .22); }
.rail-dot { width: 0.5625rem; height: 0.5625rem; border-radius: 50%; background: var(--fs); box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--fs) 18%, transparent); }
.rail-ico { opacity: .7; }
.rail-item.on .rail-ico { opacity: 1; color: var(--gold); }
.rail-count { font: 700 .72rem var(--body); min-width: 1.375rem; text-align: center; padding: 0.125rem 0.44rem; border-radius: 100px; background: color-mix(in srgb, var(--fs) 14%, transparent); color: var(--fs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rail-item.on .rail-count { background: rgba(255, 255, 255, .16); color: #fff; }
.rail-count.accent, .rail-item.on .rail-count.accent { background: var(--grad-brand); color: #fff; padding: 0.18rem 0.5rem; }
.rail-foot { display: grid; gap: 0.25rem; padding: 0.65rem 0.75rem 0.1rem; border-top: 1px solid rgba(26, 28, 35, .1); font-size: .72rem; line-height: 1.42; opacity: .78; flex: none; }
.rail-keys { display: flex; align-items: center; gap: 0.3125rem; margin-top: 0.2rem; }
kbd { font: 600 .7rem var(--mono); padding: 0.125rem 0.375rem; border-radius: 0.375rem; background: rgba(26, 28, 35, .08); }
.rail-keys kbd:nth-of-type(3) { margin-left: 0.5rem; }

@media (min-width: 960px) {
  .rail {
    position: fixed; left: 1rem; top: calc(var(--bar-h) + 1rem); bottom: 1rem; width: var(--rail-w);
    display: flex; flex-direction: column; justify-content: space-between; gap: 0.75rem; padding: 0.95rem 0.75rem;
    border-radius: 1.625rem;
  }
  .rail-scroll { display: grid; gap: 0.75rem; overflow-y: auto; min-height: 0; }
  .rail-score { width: 100%; display: grid; gap: 0.45rem; padding: 0.7rem 0.8rem; border-radius: 1.125rem; text-align: left; }
  .rs-top { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
  .rs-cats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.3125rem; }
  .rail-group { display: grid; gap: 0.125rem; }
  .rail-item {
    width: 100%; display: grid; grid-template-columns: 1.125rem minmax(0, 1fr) auto; align-items: center; gap: 0.6rem;
    padding: .5rem .72rem; border-radius: 0.875rem; text-align: left;
  }
  .rail-dot { justify-self: center; }
  .rail-ico { display: grid; place-items: center; }
  .rail-label { min-width: 0; overflow-wrap: break-word; }
}

body[data-tone="dusk"] .rail {
  background: var(--glass-dark); border-color: rgba(255, 255, 255, .2); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .26), 0 1.125rem 2.75rem rgba(0, 0, 0, .24);
}
body[data-tone="dusk"] .rail-item:hover { background: rgba(255, 255, 255, .1); }
body[data-tone="dusk"] .rail-item.on { background: #fff; color: var(--mid); box-shadow: 0 0.625rem 1.75rem rgba(0, 0, 0, .28); }
body[data-tone="dusk"] .rail-item.on .rail-ico { color: var(--ember); }
body[data-tone="dusk"] .rail-item.on .rail-count { background: var(--ember-50); color: var(--ember-700); }
body[data-tone="dusk"] .rail-foot { border-top-color: rgba(255, 255, 255, .16); }
body[data-tone="dusk"] .rail kbd { background: rgba(255, 255, 255, .16); }
body[data-tone="dusk"] .rail .fs-critical { --fs: #FF5A4A; }
body[data-tone="dusk"] .rail .fs-attention { --fs: var(--ember-400); }
body[data-tone="dusk"] .rail .fs-watch { --fs: var(--gold); }
body[data-tone="dusk"] .rail .fs-steady { --fs: #7BD389; }

.stage {
  position: relative; z-index: 1; margin-left: calc(var(--rail-w) + 2rem);
  min-width: 0; max-width: 100%;
}
.scene, .hero, .hero-grid, .hero-aside, .sheet, .sec { min-width: 0; max-width: 100%; }
.scene { display: none; }
.scene.active { display: block; }

/* ── Hero ────────────────────────────────────────────────────────────────── */

.hero {
  position: relative; display: flex; flex-direction: column; justify-content: center; gap: 2rem;
  min-height: 28rem;
  padding: 2.75rem var(--gutter) 7.5rem;
  color: var(--warm-black);
}
.hero-story { min-height: min(calc(calc(100 * var(--vh)) - var(--bar-h)), 52rem); padding-top: 2.25rem; }
.hero-grid {
  width: 100%; max-width: var(--sheet-max); margin-inline: auto;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 3rem; align-items: center;
}
.hero-story .hero-grid { grid-template-columns: minmax(0, .96fr) minmax(0, 1.04fr); gap: 2.5rem; }
.hero-copy { display: grid; gap: 1.15rem; justify-items: start; min-width: 0; }
.hero-title { font: 500 3.75rem/1.02 var(--display); letter-spacing: -0.03em; color: inherit; }
.hero-story .hero-title { font-size: 3.55rem; }
.hero-family .hero-title, .hero-longevity .hero-title, .hero-plan .hero-title { font-size: 3.15rem; }
.hero-title em { font: italic 400 1.04em/1 var(--serif); letter-spacing: -0.01em; color: var(--ember-700); }
.hero-verdict { font: italic 400 1.85rem/1.22 var(--serif); max-width: 30ch; }
.hero-lead { font-size: 1.08rem; line-height: 1.64; max-width: 60ch; color: rgba(40, 9, 0, .78); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.25rem; }

/* Hero Riji Health Score Strip */
.hero-scores {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.625rem 0.875rem;
  padding: 0.625rem 0.875rem; border-radius: 1.375rem; width: 100%; max-width: 40rem;
  background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .24);
  backdrop-filter: blur(22px) saturate(165%); -webkit-backdrop-filter: blur(22px) saturate(165%);
}
.hero-score-total {
  display: inline-flex; align-items: center; gap: 0.625rem; border: 0; background: rgba(40, 9, 0, .42);
  color: #fff; padding: 0.5rem 0.875rem; border-radius: 1rem; transition: background .25s, transform .25s var(--ease);
}
.hero-score-total:hover { background: rgba(40, 9, 0, .62); transform: translateY(-1px); }
.hst-label { font: 600 .64rem var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.hst-fig { display: inline-flex; align-items: baseline; gap: 0.125rem; font-variant-numeric: tabular-nums; }
.hst-fig strong { font: 500 1.7rem/1 var(--display); letter-spacing: -0.03em; color: #fff; }
.hst-fig small { font-size: .76rem; opacity: .72; }
.hero-score-cats { display: flex; flex-wrap: wrap; gap: 0.375rem; flex: 1 1 13rem; }
.hero-cat-pill {
  display: inline-flex; align-items: baseline; gap: 0.375rem; border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .1); color: #fff; padding: 0.375rem 0.6875rem; border-radius: 100px;
  font-size: .76rem; transition: background .25s, transform .25s var(--ease);
}
.hero-cat-pill:hover { background: rgba(255, 255, 255, .22); transform: translateY(-1px); }
.hero-cat-pill span { opacity: .86; }
.hero-cat-pill strong { font: 600 .88rem var(--display); font-variant-numeric: tabular-nums; }
.hero-cat-pill.band-ok strong { color: #9BE0A4; }
.hero-cat-pill.band-gold strong { color: var(--gold); }
.hero-cat-pill.band-attention strong { color: var(--ember-300); }
.hero-cat-pill.band-critical strong { color: #FF7A70; }

.voice { display: grid; gap: 0.7rem; padding-left: 1.25rem; border-left: 2px solid var(--gold); max-width: 56ch; }
.voice blockquote { font: italic 400 1.42rem/1.36 var(--serif); }
.voice figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font: 600 .7rem var(--display); letter-spacing: .16em; text-transform: uppercase; opacity: .9; }
.voice figcaption > span:first-child { margin-right: 0.375rem; opacity: .72; }
.chip.on-hero { font: 600 .78rem var(--body); letter-spacing: 0; text-transform: none; padding: 0.3125rem 0.75rem; }

.float-chips { display: flex; flex-wrap: wrap; gap: 0.625rem; }
.float-chip {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: .52rem .92rem; border-radius: 100px; font-size: .84rem; font-weight: 600;
  border: 0; backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}
.float-chip.score-chip { transition: transform .25s var(--ease), box-shadow .25s; }
.float-chip.score-chip:hover { transform: translateY(-0.125rem); box-shadow: 0 0.875rem 2rem rgba(56, 8, 2, .18); }

/* Captured telemetry dock */
.captured {
  display: grid; gap: 1rem; padding: 1.375rem 1.75rem;
  border-radius: 1.375rem; border: 1px solid var(--lg-border);
  background: var(--lg-bg-warm);
  box-shadow: var(--lg-shadow);
  margin-bottom: 2rem;
}
.captured + .sec { border-top: 0; padding-top: 0; }
.capture { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11.5rem), 1fr)); gap: 1.125rem 1.75rem; }
.capture li { display: flex; align-items: flex-start; gap: 0.75rem; font-size: .82rem; line-height: 1.44; color: var(--slate); }
.capture .ico { margin-top: 0.1875rem; color: var(--ember); }
.capture strong { display: block; font: 500 1.04rem var(--display); letter-spacing: .005em; color: var(--ink); }
.capture strong span { font-variant-numeric: tabular-nums; }

/* Glass over the photograph */
.signal-glass {
  display: grid; gap: 0.75rem; padding: 1.625rem 1.75rem; border-radius: 1.75rem;
  backdrop-filter: blur(28px) saturate(175%);
  -webkit-backdrop-filter: blur(28px) saturate(175%);
}
.sg-top { display: flex; align-items: center; justify-content: space-between; gap: 0.625rem; }
.sg-name { font: 600 .72rem var(--display); letter-spacing: .2em; text-transform: uppercase; opacity: .8; }
.sg-value { display: flex; align-items: baseline; gap: 0.625rem; }
.sg-value strong { font: 500 4.35rem/.95 var(--display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.sg-value span { font: 500 1.125rem var(--display); opacity: .7; }
.sg-dev { font: italic 400 1.25rem/1.25 var(--serif); }
.sg-trend { display: flex; align-items: center; gap: 0.875rem; padding-top: 0.75rem; border-top: 1px solid currentColor; border-top-color: color-mix(in srgb, currentColor 16%, transparent); font: 500 .875rem var(--display); font-variant-numeric: tabular-nums; }
.spark { flex: none; overflow: visible; }
.spark-limit { stroke: currentColor; opacity: .4; stroke-dasharray: 3 3; }
.kin-list { display: grid; gap: 0.75rem; }
.kin-list li { display: grid; gap: 0.0625rem; padding-top: 0.75rem; border-top: 1px solid color-mix(in srgb, currentColor 16%, transparent); }
.kin-list strong { font: 500 1.18rem var(--display); }
.kin-list span { font-size: .84rem; opacity: .8; }
.age-glass { grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr)); gap: 1.125rem; }
.plan-glass { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 1.5rem; }
.plan-ring { position: relative; width: 8.25rem; height: 8.25rem; display: grid; place-content: center; text-align: center; }
.plan-ring .ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.plan-ring strong { font: 500 2.5rem/1 var(--display); font-variant-numeric: tabular-nums; }
.plan-ring span { font-size: .72rem; opacity: .75; }
.plan-tally { display: grid; gap: 0.5rem; font-size: .84rem; }
.plan-tally b { display: inline-block; min-width: 1.625rem; margin-right: 0.5rem; font: 500 1.25rem var(--display); font-variant-numeric: tabular-nums; }

.ring { display: block; }
.ring-track { stroke: color-mix(in srgb, currentColor 16%, transparent); }
.ring-arc.tone-ok { stroke: var(--ok); }
.ring-arc.tone-attention { stroke: var(--ember); }
.ring-arc.tone-critical { stroke: var(--crit); }
.ring-arc.tone-gold { stroke: var(--gold); }

.age-fig { display: grid; gap: 0.125rem; }
.age-label { font: 600 .66rem var(--display); letter-spacing: .18em; text-transform: uppercase; opacity: .7; }
.age-fig strong { font: 400 3.4rem/1 var(--display); letter-spacing: -0.035em; font-variant-numeric: tabular-nums; color: inherit; }
.age-fig em { font-size: .78rem; font-weight: 600; }

/* Tone: ivory */
body[data-tone="ivory"] .signal-glass {
  background: var(--glass-light); border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: 0 1.5rem 3.75rem rgba(56, 8, 2, .12), inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(255, 255, 255, .3);
}
body[data-tone="ivory"] .sg-dev { color: var(--ember-700); }
body[data-tone="ivory"] .sg-dev.calm { color: var(--ok-ink); }
body[data-tone="ivory"] .float-chip { background: rgba(255, 255, 255, .78); box-shadow: 0 0.75rem 1.875rem rgba(56, 8, 2, .1), inset 0 1px 0 #fff; color: var(--ink); }
body[data-tone="ivory"] .float-chip .ico { color: var(--ember); }
body[data-tone="ivory"] .btn-glass { background: rgba(255, 255, 255, .8); border: 1px solid rgba(255, 255, 255, .9); color: var(--ink); box-shadow: 0 0.5rem 1.375rem rgba(26, 28, 35, .08); }

/* Tone: dusk */
body[data-tone="dusk"] .hero { color: #fff; }
body[data-tone="dusk"] .hero .eyebrow { color: var(--gold); }
body[data-tone="dusk"] .hero-title em { color: var(--gold); }
body[data-tone="dusk"] .hero-lead { color: rgba(255, 255, 255, .84); }
body[data-tone="dusk"] .signal-glass {
  background: var(--glass-dark); border: 1px solid rgba(255, 255, 255, .22); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 1.125rem 2.75rem rgba(0, 0, 0, .22);
}
body[data-tone="dusk"] .sg-dev { color: var(--ember-300); }
body[data-tone="dusk"] .sg-dev.calm { color: #9BE0A4; }
body[data-tone="dusk"] .signal-glass em.good { color: #9BE0A4; }
body[data-tone="dusk"] .signal-glass em.warn { color: var(--ember-300); }
body[data-tone="dusk"] .signal-glass .thr { color: rgba(255, 255, 255, .86); }
body[data-tone="dusk"] .float-chip { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .2); color: #fff; }
body[data-tone="dusk"] .float-chip .ico { color: var(--gold); }
body[data-tone="dusk"] .chip.on-hero { background: rgba(255, 255, 255, .14); color: #fff; }
body[data-tone="dusk"] .btn-glass { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .26); color: #fff; }
body[data-tone="dusk"] .btn-glass:hover { background: rgba(255, 255, 255, .2); }

.scene.anim .hero-copy > * { animation: rise .9s var(--ease) both; }
.scene.anim .hero-copy > :nth-child(2) { animation-delay: .08s; }
.scene.anim .hero-copy > :nth-child(3) { animation-delay: .16s; }
.scene.anim .hero-copy > :nth-child(4) { animation-delay: .24s; }
.scene.anim .hero-copy > :nth-child(5) { animation-delay: .32s; }
.scene.anim .hero-copy > :nth-child(6) { animation-delay: .4s; }
.scene.anim .hero-aside { animation: bloom 1.1s var(--ease) .2s both; }

/* ── Range halo ──────────────────────────────────────────────────────────── */

.halo { display: grid; gap: 0.375rem; width: 100%; min-width: 0; }
.halo-stage { position: relative; width: 100%; max-width: 46rem; margin-inline: auto; aspect-ratio: 900 / 680; }
.halo-stage::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 76%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%;
  background: radial-gradient(circle, rgba(40, 9, 0, .74) 0%, rgba(40, 9, 0, .58) 52%, rgba(40, 9, 0, 0) 72%);
  animation: auraBreathe 7s ease-in-out infinite;
  backface-visibility: hidden;
}
.halo-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.halo .st-optimal, .halo .st-normal { --st: #7BD389; }
.halo .st-attention { --st: var(--ember-400); }
.halo .st-critical { --st: #FF4B3A; }
.halo .fs-critical { --fs: #FF5A4A; }
.halo .fs-attention { --fs: var(--ember-400); }
.halo .fs-watch { --fs: var(--gold); }
.halo .fs-steady { --fs: #7BD389; }
.halo-band { stroke: rgba(123, 211, 137, .2); }
.halo-edge { stroke: rgba(255, 255, 255, .22); stroke-width: 1; }
.halo-arc { stroke: var(--fs); stroke-width: 3.5; stroke-linecap: round; transition: stroke-width .3s; }
.halo-hit { stroke: transparent; pointer-events: stroke; cursor: pointer; }
.halo-sector:hover .halo-arc { stroke-width: 7; }
.halo-sector:hover .halo-band { stroke: rgba(123, 211, 137, .32); }
.halo-dot { cursor: pointer; outline: none; }
.halo-stem { stroke: var(--st); stroke-width: 1.5; stroke-dasharray: 2 4; opacity: .8; }
.halo-core { fill: var(--st); stroke: rgba(40, 9, 0, .7); stroke-width: 1.5; transition: stroke .2s, stroke-width .2s; }
.halo-dot:hover .halo-core, .halo-dot:focus-visible .halo-core { stroke: #fff; stroke-width: 3; }
.halo-pulse { fill: none; stroke: var(--st); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; animation: haloPulse 2.4s ease-out infinite; }
.halo-center {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 28%;
  display: grid; justify-items: center; gap: 0.1875rem; text-align: center; color: #fff; pointer-events: none;
}
.halo-big { font: 400 3.6rem/.9 var(--display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.halo-of { font-size: .76rem; line-height: 1.3; opacity: .84; }
.halo-hint { font: 600 .66rem var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-top: 0.25rem; }
.halo-name { font: 600 .7rem/1.25 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.halo-val { font: 500 1.9rem/1 var(--display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.halo-val small { font-size: .45em; font-weight: 500; opacity: .75; letter-spacing: 0; }
.halo-center .thr { font-size: .74rem; opacity: .85; }
.halo-center .thr-fig { font-size: .78rem; }
.halo-st { font: 700 .68rem var(--body); padding: 0.1875rem 0.5625rem; border-radius: 100px; background: color-mix(in srgb, var(--st, var(--fs)) 22%, transparent); color: var(--st, var(--fs)); margin-top: 0.1875rem; white-space: nowrap; }
.halo-label {
  position: absolute; display: grid; gap: 0.0625rem; padding: 0.3125rem 0.5625rem; border: 0; background: none; color: #fff;
  border-radius: 0.75rem; max-width: min(10.5rem, calc(100% - 0.75rem));
  white-space: normal; line-height: 1.15; overflow-wrap: break-word;
  transition: background .25s;
}
.halo-label:hover, .halo-label:focus-visible { background: rgba(255, 255, 255, .12); }
.halo-label.al-start { translate: 0 -50%; text-align: left; }
.halo-label.al-end { translate: -100% -50%; text-align: right; }
.halo-label.al-top { translate: -50% -100%; text-align: center; }
.halo-label.al-bottom { translate: -50% 0; text-align: center; }
.hl-name { font: 600 .76rem var(--display); letter-spacing: .12em; text-transform: uppercase; }
.hl-sub { font-size: .72rem; font-weight: 600; color: var(--fs); }
.halo-key { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.375rem 1.25rem; margin-top: 1.125rem; font-size: .76rem; color: rgba(255, 255, 255, .78); }
.halo-key span { display: inline-flex; align-items: center; gap: 0.44rem; }
.key-band { width: 1.375rem; height: 0.5rem; border-radius: 100px; background: rgba(123, 211, 137, .34); }
.key-dot { width: 0.5625rem; height: 0.5625rem; border-radius: 50%; }
.key-dot.in { background: #7BD389; }
.key-dot.attn { background: var(--ember-400); }

/* ── The sheet and its sections ──────────────────────────────────────────── */

.sheet {
  position: relative; z-index: 2; isolation: isolate; margin-top: -4rem; min-height: calc(60 * var(--vh));
  padding: 3rem max(var(--gutter), env(safe-area-inset-right)) calc(3.25rem + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  border-radius: 2.25rem 2.25rem 0 0;
  border-top: 1px solid rgba(255, 255, 255, .96);
  background: linear-gradient(180deg, #FFFFFF 0%, #FCFBF9 18rem, #F9F8F6 100%);
  box-shadow: 0 -1rem 3rem rgba(40, 9, 0, .16);
}
.sheet > :not(.ambient-fx) { max-width: var(--sheet-max); margin-inline: auto; }
.ambient-fx {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  overflow: hidden; border-radius: inherit; contain: layout paint style;
}
.fx-orb {
  position: absolute; border-radius: 50%; pointer-events: none;
  will-change: transform; backface-visibility: hidden;
}
.fx-orb.orb-a {
  width: 34rem; height: 34rem; top: 2%; left: -6rem;
  background: radial-gradient(circle, rgba(232, 96, 56, .065) 0%, rgba(255, 155, 125, .025) 44%, transparent 72%);
  animation: floatOrbA 34s ease-in-out infinite alternate;
}
.fx-orb.orb-b {
  width: 38rem; height: 38rem; top: 35%; right: -8rem;
  background: radial-gradient(circle, rgba(225, 168, 120, .085) 0%, rgba(225, 168, 120, .03) 44%, transparent 72%);
  animation: floatOrbB 40s ease-in-out infinite alternate;
}
.fx-orb.orb-c {
  width: 32rem; height: 32rem; bottom: 4%; left: 24%;
  background: radial-gradient(circle, rgba(84, 177, 95, .04) 0%, rgba(225, 168, 120, .02) 45%, transparent 72%);
  animation: floatOrbC 44s ease-in-out infinite alternate;
}
.fx-constellation {
  position: absolute; left: 0; top: 0; width: 100%; height: calc(100 * var(--vh));
  display: block; pointer-events: none; will-change: transform; backface-visibility: hidden;
}
.sec {
  padding: 0 0 3.25rem;
  border-top: 0;
  scroll-margin-top: calc(var(--bar-h) + 1rem);
}
.sec:first-child { padding-top: 0.25rem; }
.sec-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; margin-bottom: 1.625rem; }
.sec-head h2 { font-size: 2rem; line-height: 1.1; letter-spacing: -0.025em; margin-top: 0.625rem; }
.sec-lead { margin-top: 0.5rem; max-width: 68ch; font-size: .96rem; color: var(--slate); }
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.125rem; font-size: .8rem; color: var(--slate); }

/* Section break banners: compact, single-container 4K editorial photo band */
.sec-banner {
  position: relative; isolation: isolate; overflow: hidden; width: 100%;
  min-height: 8.75rem;
  margin-bottom: 1.75rem;
  border-radius: 1.375rem;
  border: 1px solid rgba(56, 8, 2, .08);
  display: flex; align-items: center;
  padding: 1.4rem 2rem;
  background: var(--deep);
  box-shadow: 0 0.75rem 2.125rem rgba(56, 8, 2, .11);
}
.sb-media {
  position: absolute; inset: -3%; z-index: 0; background-size: cover; background-position: center;
  filter: saturate(1.02) contrast(1.02);
  will-change: transform; backface-visibility: hidden;
  animation: kenburns 42s ease-in-out infinite alternate;
}
.sb-scrim {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    linear-gradient(96deg, rgba(56, 8, 2, .88) 0%, rgba(56, 8, 2, .70) 44%, rgba(56, 8, 2, .26) 76%, rgba(56, 8, 2, .14) 100%),
    linear-gradient(180deg, rgba(56, 8, 2, .14) 0%, rgba(56, 8, 2, 0) 35%, rgba(56, 8, 2, .24) 100%);
}
.sb-inner { width: 100%; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.75rem; position: relative; z-index: 1; }
.sb-copy {
  display: grid; gap: 0.3125rem; max-width: min(100%, 56ch); min-width: 0;
  padding: 0; border: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none;
  color: #fff;
}
.eyebrow.on-banner { color: var(--gold); }
.sec-banner h2 { font-size: 1.75rem; line-height: 1.12; letter-spacing: -0.02em; color: #fff; }
.sb-lead { font-size: .88rem; line-height: 1.5; color: rgba(255, 250, 246, .84); max-width: 58ch; }
.sb-aside { display: flex; flex-wrap: wrap; align-items: center; gap: 0.56rem; flex: none; }
.sec-banner .tag.gold { background: rgba(56, 8, 2, .56); color: var(--gold); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: inset 0 0 0 1px rgba(225, 168, 120, .42); }
.sec-banner .tag.ok { background: rgba(56, 8, 2, .56); color: #9BE0A4; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: inset 0 0 0 1px rgba(155, 224, 164, .36); }
.sec-banner .tag.attention { background: rgba(56, 8, 2, .56); color: var(--ember-300); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: inset 0 0 0 1px rgba(255, 155, 125, .4); }
.sec-banner .btn-glass.on-banner { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .32); color: #fff; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 0.5rem 1.25rem rgba(24, 6, 2, .2); }
.sec-banner .btn-glass.on-banner:hover { background: rgba(255, 255, 255, .24); }
.sec-banner .legend.on-banner { padding: 0.44rem 0.875rem; border-radius: 100px; background: rgba(56, 8, 2, .56); border: 1px solid rgba(255, 255, 255, .22); color: rgba(255, 255, 255, .92); backdrop-filter: blur(12px); }
.sec-banner .evidence { background: rgba(56, 8, 2, .6); color: rgba(255, 255, 255, .92); border: 1px solid rgba(255, 255, 255, .24); backdrop-filter: blur(12px); box-shadow: 0 0.5rem 1.25rem rgba(24, 6, 2, .18); }
.sec-banner .evidence:hover { background: rgba(56, 8, 2, .78); }
.sec-banner .evidence-title { color: #fff; }
.sec-banner .evidence-meta { color: rgba(255, 240, 230, .74); }

/* ── Riji Health Intelligence Precision Dial ─────────────────────────────── */

.hs-grid {
  display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.16fr);
  gap: 2.25rem; align-items: stretch;
}
.hs-compass-col {
  display: grid; gap: 1rem; justify-items: center; align-content: center;
  padding: 1.75rem 1.5rem 1.5rem; border-radius: 1.75rem;
  border: 1px solid var(--lg-border); background: var(--lg-bg);
  box-shadow: var(--lg-shadow);
}
.hs-stage { position: relative; width: 100%; max-width: 34rem; margin-inline: auto; aspect-ratio: 1 / 1; }
.hs-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.hs-guide { stroke: rgba(26, 28, 35, .06); stroke-width: 1; }
.hs-guide.outer { stroke: rgba(56, 8, 2, .08); }
.hs-axis { stroke: rgba(56, 8, 2, .06); stroke-width: 1; }
.hs-target { stroke: rgba(0, 138, 16, .46); stroke-width: 1.3; stroke-dasharray: 4 5; }
.hs-target-pill rect { fill: #FFFFFF; stroke: rgba(0, 138, 16, .34); stroke-width: 1; }
.hs-target-lbl { font: 700 7.6px var(--display); letter-spacing: .09em; text-transform: uppercase; fill: var(--ok-ink); }

.hs-med-bg { fill: #FFFFFF; }
.hs-med-rim { stroke: rgba(56, 8, 2, .07); stroke-width: 1; }
.hs-med-gold { stroke: rgba(225, 168, 120, .32); stroke-width: 1; }

.hs-weight-arc { stroke: var(--band); stroke-width: 3.2; stroke-linecap: round; opacity: .62; transition: opacity .3s var(--ease), stroke-width .25s var(--ease); }
.hs-sector:hover .hs-weight-arc, .hs-sector.hot .hs-weight-arc, .hs-sector.pinned .hs-weight-arc { opacity: 1; stroke-width: 4.8; }

.hs-sector { cursor: pointer; outline: none; transition: opacity .3s var(--ease); }
.hs-sector.dim { opacity: .38; }
.hs-track { fill: #F8F5F0; stroke: rgba(56, 8, 2, .045); stroke-width: 1; transition: fill .3s; }
.hs-sector:hover .hs-track, .hs-sector.hot .hs-track, .hs-sector.pinned .hs-track { fill: #F4EFE7; }
.hs-fill { opacity: .88; transition: opacity .3s var(--ease); }
.hs-sector:hover .hs-fill, .hs-sector.hot .hs-fill, .hs-sector.pinned .hs-fill { opacity: 1; }
.hs-rim { stroke: var(--band); stroke-width: 4.6; stroke-linecap: round; transition: stroke-width .25s var(--ease); }
.hs-sector:hover .hs-rim, .hs-sector.hot .hs-rim, .hs-sector.pinned .hs-rim { stroke-width: 6.4; }

.hs-sat-rail { stroke: rgba(56, 8, 2, .09); stroke-width: 1; stroke-linecap: round; transition: stroke .25s, stroke-width .25s; }
.hs-sector:hover .hs-sat-rail, .hs-sector.hot .hs-sat-rail, .hs-sector.pinned .hs-sat-rail { stroke: color-mix(in srgb, var(--band) 48%, transparent); stroke-width: 1.5; }
.hs-sat { cursor: pointer; outline: none; }
.hs-sat-stem { stroke: transparent; stroke-width: 1.4; stroke-dasharray: 2 3; transition: stroke .2s; }
.hs-sat:hover .hs-sat-stem, .hs-sat:focus-visible .hs-sat-stem { stroke: var(--st); }
.hs-sat-dot { fill: var(--st); stroke: #FFFFFF; stroke-width: 2; transition: stroke .2s, stroke-width .2s; }
.hs-sat:hover .hs-sat-dot, .hs-sat:focus-visible .hs-sat-dot { stroke: var(--deep); stroke-width: 2.8; }
.hs-sat-pulse { fill: none; stroke: var(--st); stroke-width: 1.3; transform-box: fill-box; transform-origin: center; animation: haloPulse 2.6s ease-out infinite; }

/* Curved architectural outer-bezel quadrant labels (pure SVG — zero collisions, zero line wraps) */
.hs-arc-label {
  font: 600 12px var(--display); letter-spacing: .11em; fill: var(--slate);
  transition: fill .25s var(--ease);
  user-select: none;
}
.hs-al-sep { fill: var(--line-strong); font-weight: 400; }
.hs-al-score { font-weight: 700; font-size: 13px; letter-spacing: .03em; fill: var(--band-ink); }
.hs-sector:hover .hs-arc-label, .hs-sector.hot .hs-arc-label, .hs-sector.pinned .hs-arc-label { fill: var(--ink); }
.hs-sector:hover .hs-al-score, .hs-sector.hot .hs-al-score, .hs-sector.pinned .hs-al-score { fill: var(--band); }

.hs-center {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  width: 27.5%; max-width: 27.5%;
  display: grid; justify-items: center; gap: 0.2rem; text-align: center; pointer-events: none;
}
.hs-c-kicker {
  font: 600 .58rem/1.15 var(--display); letter-spacing: .14em; text-transform: uppercase;
  color: var(--slate); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hs-c-num { font: 500 2.35rem/.94 var(--display); letter-spacing: -0.04em; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hs-c-num small { font-size: .38em; font-weight: 500; color: var(--slate); letter-spacing: 0; margin-left: 2px; }
.hs-c-val { font: 500 1.4rem/1 var(--display); letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hs-c-val small { font-size: .5em; color: var(--slate); }
.hs-c-sub { font-size: .64rem; line-height: 1.22; color: var(--slate); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hs-center .tag { font-size: .64rem; padding: 0.125rem 0.5rem; }
.hs-center .thr { font-size: .62rem; }
.hs-center .thr-fig { font-size: .64rem; }

.hs-key {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem 1.25rem;
  padding-top: 0.625rem; border-top: 1px solid var(--line); width: 100%;
  font-size: .76rem; color: var(--slate);
}
.hs-key span { display: inline-flex; align-items: center; gap: 0.4rem; }
.hs-key-ring { width: 1.125rem; height: 2px; border-top: 2px dashed var(--ok); }

.hs-panel-col { display: grid; gap: 1.125rem; min-width: 0; }
.hs-panel-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.625rem; }
.hs-reset {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.44rem 0.875rem; border-radius: 100px;
  border: 1px solid var(--line-strong); background: #fff; font: 600 .82rem var(--body); color: var(--ink);
  transition: background .2s, color .2s, border-color .2s;
}
.hs-reset.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.hs-reset.on .ico { color: var(--gold); }

.hs-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.875rem; }
.hs-card {
  display: grid; grid-template-columns: 4rem minmax(0, 1fr); gap: 0.875rem; align-items: center;
  padding: 1rem 1.125rem; border-radius: 1.5rem; border: 1px solid var(--lg-border);
  background: var(--lg-bg); box-shadow: var(--lg-shadow);
  text-align: left; color: var(--ink);
  transition: transform .3s var(--ease), box-shadow .3s, border-color .25s, background .25s;
}
.hs-card:hover { transform: translateY(-0.125rem); background: var(--lg-bg-hover); border-color: var(--lg-outline); box-shadow: var(--lg-shadow-hover); }
.hs-card.on { background: var(--lg-bg-hover); border-color: var(--band); box-shadow: 0 1.25rem 3rem color-mix(in srgb, var(--band) 18%, transparent), inset 0 1px 0 #fff; }
.hs-card-ring { position: relative; width: 4rem; height: 4rem; display: grid; place-items: center; color: var(--ink); }
.hs-card-ring .ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.hs-card-ring strong { font: 600 1.22rem var(--display); font-variant-numeric: tabular-nums; color: var(--band-ink); }
.hs-card-body { display: grid; gap: 0.1875rem; min-width: 0; }
.hs-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.375rem; }
.hs-card-head strong { font: 500 1.02rem/1.2 var(--display); color: var(--ink); overflow-wrap: anywhere; }
.hs-weight { font: 700 .68rem var(--body); padding: 0.125rem 0.44rem; border-radius: 100px; background: #EFECE5; color: var(--slate); font-variant-numeric: tabular-nums; flex: none; }
.hs-card-status { font-size: .76rem; font-weight: 600; color: var(--band-ink); }
.hs-card-meta { font-size: .74rem; color: var(--slate); }
.hs-card-bar { display: block; height: 0.25rem; border-radius: 100px; background: #EAE5DC; overflow: hidden; margin-top: 0.25rem; }
.hs-card-bar b { display: block; height: 100%; border-radius: 100px; background: var(--band); transition: width .5s var(--ease); }

.hs-bridge {
  display: grid; gap: 1rem; padding: 1.5rem 1.625rem; border-radius: 1.75rem;
  background: var(--lg-bg-warm); border: 1px solid var(--lg-border); box-shadow: var(--lg-shadow);
}
.hs-bridge-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.625rem 1rem; }
.hs-bridge-top h3 { font-size: 1.38rem; margin-top: 0.375rem; letter-spacing: -0.02em; }
.hs-bridge-badges { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.hs-stack-wrap { display: grid; gap: 0.625rem; }
.hs-stack { display: flex; gap: 0.25rem; height: 2.125rem; border-radius: 0.75rem; overflow: hidden; }
.hs-seg {
  display: flex; align-items: center; justify-content: center; border: 0; padding: 0 0.375rem; min-width: 0;
  background: var(--band); color: #fff; font: 600 .74rem var(--display); white-space: nowrap; overflow: hidden;
  transition: filter .2s;
}
.hs-seg:hover { filter: brightness(1.08); }
.hs-seg.band-gold { color: var(--warm-black); background: var(--gold); }
.hs-stack-meta { display: flex; flex-wrap: wrap; gap: 0.375rem 1.125rem; font-size: .78rem; color: var(--slate); font-variant-numeric: tabular-nums; }
.hs-stack-meta span { display: inline-flex; align-items: center; gap: 0.375rem; }
.hs-stack-meta b { color: var(--ink); font-weight: 600; }
.hs-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--band); display: inline-block; }
.hs-subblock { display: grid; gap: 0.625rem; }
.hs-subhead { font: 600 .7rem var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--slate); }
.hs-fn-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13.5rem), 1fr)); gap: 0.625rem; }
.hs-fn-btn {
  display: grid; gap: 0.5rem; padding: 0.875rem 1rem; border-radius: 1.125rem; border: 1px solid var(--line);
  background: #fff; text-align: left; color: var(--ink);
  transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
}
.hs-fn-btn:hover { transform: translateY(-0.125rem); border-color: var(--fs); box-shadow: 0 0.75rem 1.625rem rgba(56, 8, 2, .08); }
.hs-fn-top { display: flex; align-items: center; gap: 0.5rem; }
.hs-fn-top strong { flex: 1; font: 500 .98rem var(--display); color: var(--ink); }
.hs-fn-count { font-size: .72rem; font-weight: 700; color: var(--fs); white-space: nowrap; }
.hs-fn-go { display: inline-flex; align-items: center; justify-content: space-between; font-size: .78rem; font-weight: 600; color: var(--ember-700); }
.legend span { display: inline-flex; align-items: center; gap: 0.44rem; }
.lg { display: inline-block; }
.lg.band { width: 1.375rem; height: 0.5rem; border-radius: 100px; background: rgba(0, 138, 16, .24); }
.lg.ghost { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--slate-400); opacity: .6; }
.lg.now { width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--ember); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(26, 28, 35, .3); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 2.25rem; border-top: 1px solid var(--line); }
.pager-btn {
  display: inline-flex; align-items: center; gap: 1rem; padding: 0.8125rem 1.5rem; border-radius: 100px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink); text-align: left;
  transition: transform .35s var(--ease), box-shadow .35s, border-color .2s;
}
.pager-btn span { display: grid; font: 500 1.06rem/1.2 var(--display); }
.pager-btn small { font: 600 .625rem var(--display); letter-spacing: .2em; text-transform: uppercase; opacity: .6; }
.pager-btn:hover { transform: translateY(-0.1875rem); box-shadow: 0 1rem 2.125rem rgba(26, 28, 35, .12); border-color: var(--ink); }
.pager-btn.next { margin-left: auto; background: var(--ink); border-color: var(--ink); color: #fff; }
.pager-btn.next .ico { color: var(--gold); }

/* ── Story: takeaways ────────────────────────────────────────────────────── */

.beats { position: relative; display: grid; gap: 0.875rem; }
.beats::before { content: ''; position: absolute; left: 2.9375rem; top: 2.75rem; bottom: 2.75rem; width: 1.5px; background: linear-gradient(180deg, var(--ember), var(--gold)); opacity: .5; z-index: 0; }
.beat-btn {
  width: 100%; display: grid; grid-template-columns: 3.625rem minmax(0, 1fr) 2.75rem; gap: 1.375rem; align-items: start;
  padding: 1.375rem 1.5rem 1.375rem 1.125rem; border: 1px solid var(--lg-border); border-radius: 1.75rem;
  background: var(--lg-bg); box-shadow: var(--lg-shadow);
  text-align: left; transition: background .3s, transform .3s var(--ease), box-shadow .3s, border-color .3s;
}
.beat-btn:hover { background: var(--lg-bg-hover); border-color: rgba(232, 96, 56, .34); transform: translateY(-0.125rem); box-shadow: var(--lg-shadow-hover); }
.beat-node {
  position: relative; z-index: 1; width: 3.625rem; height: 3.625rem; border-radius: 50%; display: grid; place-items: center;
  font: 500 1.125rem var(--display); font-variant-numeric: tabular-nums;
  background: #fff; color: var(--tone); box-shadow: inset 0 0 0 1.5px var(--tone), 0 0 0 0.44rem #fff;
}
.beat-node.tone-critical { --tone: var(--crit); }
.beat-node.tone-attention { --tone: var(--ember); }
.beat-node.tone-optimal { --tone: var(--ok); }
.beat-body { display: grid; gap: 0.375rem; padding-top: 0.125rem; min-width: 0; }
.beat-domain { font: 600 .7rem var(--display); letter-spacing: .18em; text-transform: uppercase; color: var(--slate); }
.beat-title { font: 500 1.52rem/1.18 var(--display); letter-spacing: -0.015em; color: var(--ink); }
.beat-summary { font-size: .98rem; line-height: 1.62; color: var(--text); max-width: 74ch; }
.beat-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-top: 0.5rem; }
.sig { display: inline-flex; align-items: baseline; gap: 0.5rem; padding: 0.44rem 0.875rem; border-radius: 100px; background: var(--st-soft); color: var(--st-ink); font-size: .86rem; }
.sig em { font-weight: 600; }
.sig b { font-weight: 700; font-variant-numeric: tabular-nums; }
.sig .thr-fig { font-size: .76rem; opacity: .82; }
.ctx { display: inline-flex; align-items: center; gap: 0.375rem; font-size: .82rem; color: var(--slate); }
.beat-go { width: 2.75rem; height: 2.75rem; border-radius: 50%; display: grid; place-items: center; background: #F4F1EB; color: var(--ink); transition: background .3s, color .3s, transform .35s var(--ease); margin-top: 0.375rem; }
.beat-btn:hover .beat-go { background: var(--ink); color: var(--gold); transform: translateX(0.25rem); }
.steady {
  display: flex; align-items: flex-start; gap: 1.25rem; margin-top: 1.375rem; padding: 1.375rem 1.625rem; border-radius: 1.75rem;
  border: 1px solid rgba(0, 138, 16, .18);
  background: linear-gradient(135deg, rgba(230, 243, 231, .84), rgba(255, 255, 255, .72));
  box-shadow: var(--lg-shadow);
}
.steady > div { display: grid; gap: 0.75rem; }
.steady-mark { flex: none; width: 2.125rem; height: 2.125rem; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; }
.steady .chip.ok { background: #fff; }

/* ── Story: thread map ───────────────────────────────────────────────────── */

.tm-wrap { display: grid; gap: 1.375rem; }
.tm { position: relative; }
.tm-links { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; z-index: 0; }
.tm-grid { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.22fr) minmax(0, 1fr); gap: 5rem; align-items: center; }
.tm-col { display: grid; gap: 0.56rem; align-content: center; min-width: 0; }
.tm-head { font: 600 .7rem var(--display); letter-spacing: .18em; text-transform: uppercase; color: var(--slate); }
.tm-head:not(:first-child) { margin-top: 1.125rem; }
.tm-node {
  display: grid; gap: 0.125rem; width: 100%; padding: 0.8125rem 1.125rem; border: 1px solid var(--lg-border); border-radius: 1.25rem; text-align: left;
  background: var(--lg-bg); color: var(--ink);
  box-shadow: 0 0.625rem 1.75rem rgba(56, 8, 2, .06), inset 0 1px 0 rgba(255, 255, 255, .94);
  transition: opacity .3s, background .3s, box-shadow .3s, transform .35s var(--ease);
}
.tm-node strong { font-size: .92rem; font-weight: 600; line-height: 1.32; }
.tm-kind { font: 600 .64rem var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--slate); }
.tm-sub { font-size: .8rem; color: var(--slate); }
.tm-family, .tm-history, .tm-lifestyle { background: linear-gradient(148deg, rgba(251, 243, 236, .88), rgba(255, 250, 245, .72)); border-color: rgba(225, 168, 120, .42); }
.tm-panel, .tm-rec { background: linear-gradient(150deg, rgba(56, 8, 2, .92), rgba(40, 9, 0, .86)); border-color: rgba(225, 168, 120, .35); color: #fff; box-shadow: 0 1rem 2.375rem rgba(40, 9, 0, .2), inset 0 1px 0 rgba(255, 255, 255, .2); }
.tm-panel .tm-kind, .tm-rec .tm-kind { color: var(--gold); }
.tm-panel .tm-sub { color: rgba(255, 255, 255, .74); }
.tm-fn { gap: 0.56rem; padding: 1rem 1.125rem; border-radius: 1.375rem; background: var(--lg-bg-warm); border: 1px solid var(--lg-border); box-shadow: var(--lg-shadow), inset 0.25rem 0 0 var(--fs); }
.tm-fn-head { display: flex; align-items: center; gap: 0.56rem; }
.tm-fn-head strong { flex: 1; font: 500 1.08rem var(--display); }
.state-dot { width: 0.5625rem; height: 0.5625rem; border-radius: 50%; background: var(--fs); flex: none; }
.tm-state { font-size: .72rem; font-weight: 700; color: var(--fs); white-space: nowrap; }
.tm-signals { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.tm-signal { display: inline-flex; align-items: baseline; gap: 0.375rem; padding: 0.25rem 0.6875rem; border-radius: 100px; font-size: .78rem; font-weight: 700; background: var(--st-soft, #F4F1EB); color: var(--st-ink, var(--slate)); font-variant-numeric: tabular-nums; }
.tm-signal em { font-weight: 600; opacity: .8; }
.tm-signal.drift { background: var(--gold-wash); color: #8A5A2E; box-shadow: inset 0 0 0 1px rgba(225, 168, 120, .5); }
.tm-quiet { font-size: .82rem; color: var(--slate); }
.tm-node.hot { transform: scale(1.02); box-shadow: 0 1rem 2.25rem rgba(232, 96, 56, .18); }
.tm-fn.hot { box-shadow: 0 1.125rem 2.75rem rgba(232, 96, 56, .2), inset 0.2rem 0 0 var(--fs); }
.tm-node.dim { opacity: .3; }
.tm-link { stroke: var(--fs); stroke-width: 1.6; opacity: .34; transition: opacity .3s, stroke-width .3s; }
.tm-link.hot { opacity: 1; stroke-width: 2.8; }
.tm-link.dim { opacity: .07; }
.tm-caption { min-height: 2.875rem; max-width: 96ch; font-size: .92rem; line-height: 1.62; color: var(--text); padding-left: 1.125rem; border-left: 2px solid var(--gold); }
.tm-steady { display: flex; align-items: center; gap: 0.5rem; margin-top: 1.125rem; font-size: .88rem; color: var(--ok-ink); }

/* ── Story: chapter posters (Deterministic 3x2 grid on every desktop!) ───── */

.posters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.125rem; }
.poster {
  position: relative; isolation: isolate; overflow: hidden; min-height: 20.5rem; padding: 1.125rem 1.25rem 1.25rem;
  display: flex; flex-direction: column; justify-content: space-between; gap: 1.125rem;
  border: 0; border-radius: 1.875rem; text-align: left; color: #fff;
  background-color: var(--deep); background-size: cover; background-position: center;
  box-shadow: 0 1.125rem 2.75rem rgba(56, 8, 2, .16);
}
.poster::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(56, 8, 2, .42) 0%, rgba(56, 8, 2, .08) 26%, rgba(56, 8, 2, .28) 46%, rgba(56, 8, 2, .92) 100%); }
.poster.in { transition: transform .5s var(--ease), box-shadow .5s var(--ease), opacity .8s var(--ease); }
.poster.in:hover { transform: translateY(-0.44rem); box-shadow: 0 1.875rem 4rem rgba(232, 96, 56, .26); }
.poster-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.poster-num { font: italic 400 1.95rem/1 var(--serif); color: #fff; text-shadow: 0 2px 14px rgba(56, 8, 2, .5); }
.poster-body { display: grid; gap: 0.56rem; }
.poster-body strong { font: 500 1.42rem/1.14 var(--display); letter-spacing: -0.015em; }
.poster-line { font-size: .86rem; line-height: 1.48; color: rgba(255, 255, 255, .88); }
.poster-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: .8rem; font-weight: 600; color: var(--gold); }
.balance { display: flex; gap: 0.1875rem; height: 0.3125rem; border-radius: 100px; overflow: hidden; background: rgba(255, 255, 255, .2); margin-top: 0.25rem; }
.balance i { flex: 1 1 0; border-radius: 100px; }
.bal-ok { background: #7BD389; }
.bal-attention { background: var(--ember-400); }
.bal-critical { background: #FF4B3A; }

/* ── Story: age and indices ──────────────────────────────────────────────── */

.age-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.125rem; }
.age-trio .age-fig {
  padding: 1.5rem 1.625rem; border-radius: 1.75rem; border: 1px solid var(--lg-border);
  background: var(--lg-bg-warm); box-shadow: var(--lg-shadow);
}
.age-trio .age-fig strong { font-size: 3.9rem; color: var(--ink); }
.age-trio .age-fig em { font-size: .88rem; }
.age-trio .age-label { color: var(--slate); opacity: 1; }

/* ── Function chapter: lanes and marker stage ────────────────────────────── */

.explorer { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: 2rem; align-items: start; min-width: 0; }
.lanes {
  display: grid; padding: 0.625rem 0.75rem; border-radius: 1.875rem; min-width: 0;
  border: 1px solid var(--lg-border); background: var(--lg-bg);
  box-shadow: var(--lg-shadow);
}
.lane-row {
  position: relative; width: 100%; display: grid; grid-template-columns: minmax(7.4rem, .92fr) minmax(7.5rem, 1.12fr) auto;
  align-items: center; gap: 1rem; padding: 0.94rem 0.875rem 0.875rem 1.125rem; border: 0; border-bottom: 1px solid var(--line); border-radius: 1.125rem;
  background: none; text-align: left; transition: background .3s;
}
.lanes li:last-child .lane-row { border-bottom: 0; }
.lane-row::before { content: ''; position: absolute; left: 0; top: 0.875rem; bottom: 0.875rem; width: 0.1875rem; border-radius: 0.1875rem; background: var(--grad-brand); transform: scaleY(0); transition: transform .4s var(--ease); }
.lane-row:hover { background: linear-gradient(90deg, rgba(26, 28, 35, .03), rgba(26, 28, 35, 0) 80%); }
.lane-row.on { background: linear-gradient(90deg, rgba(232, 96, 56, .09), rgba(232, 96, 56, 0) 82%); }
.lane-row.on::before { transform: scaleY(1); }
.lr-name { display: flex; align-items: flex-start; gap: 0.6875rem; min-width: 0; }
.lr-name .status-dot { margin-top: 0.44rem; }
.lr-name > span { display: grid; gap: 0.0625rem; min-width: 0; }
.lr-name strong { font: 500 1.04rem/1.25 var(--display); color: var(--ink); overflow-wrap: anywhere; }
.lr-name small { font-size: .78rem; line-height: 1.38; color: var(--slate); font-variant-numeric: tabular-nums; }
.lr-name .drift { justify-self: start; margin-top: 0.1875rem; font-size: .7rem; font-weight: 700; padding: 0.125rem 0.5rem; border-radius: 100px; background: var(--gold-wash); color: #8A5A2E; box-shadow: inset 0 0 0 1px rgba(225, 168, 120, .5); white-space: nowrap; }
.lr-val { display: flex; align-items: baseline; justify-content: flex-end; gap: 0.3125rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lr-val strong { font: 500 1.32rem var(--display); color: var(--val, var(--ink)); }
.lr-val small { font-size: .78rem; color: var(--slate); }

.lane { display: grid; gap: 0.375rem; padding-top: 0.5rem; }
.lane-track { position: relative; height: 0.625rem; border-radius: 100px; background: #F3F0EA; }
.lane-band { position: absolute; top: 0; bottom: 0; border-radius: 100px; background: linear-gradient(90deg, rgba(0, 138, 16, .14), rgba(0, 138, 16, .28) 50%, rgba(0, 138, 16, .14)); }
.lane-trail { position: absolute; top: 50%; height: 2px; margin-top: -1px; border-radius: 2px; }
.lane-trail.ltr { background: linear-gradient(90deg, rgba(100, 116, 139, .12), rgba(100, 116, 139, .7)); }
.lane-trail.rtl { background: linear-gradient(270deg, rgba(100, 116, 139, .12), rgba(100, 116, 139, .7)); }
.lane-ghost { position: absolute; top: 50%; width: 0.5rem; height: 0.5rem; margin: -0.25rem 0 0 -0.25rem; border-radius: 50%; background: var(--slate); border: 1.5px solid #fff; }
.lane-spread { position: absolute; top: 2px; bottom: 2px; border-radius: 100px; background: rgba(26, 28, 35, .2); }
.lane-mean { position: absolute; top: -0.1875rem; bottom: -0.1875rem; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--ink); opacity: .55; }
.lane-dot {
  position: absolute; top: 50%; width: 1.0625rem; height: 1.0625rem; margin: -0.53125rem 0 0 -0.53125rem; border-radius: 50%;
  background: var(--st); border: 2.5px solid #fff; box-shadow: 0 2px 8px rgba(26, 28, 35, .28);
}
.lane-dot.st-attention, .lane-dot.st-critical { box-shadow: 0 2px 8px rgba(26, 28, 35, .28), 0 0 0 0.3125rem color-mix(in srgb, var(--st) 18%, transparent); }
.lane-scale { position: relative; height: 0.8125rem; font-size: .66rem; line-height: .8125rem; color: var(--slate-400); font-variant-numeric: tabular-nums; }
.lane-scale span { position: absolute; translate: -50% 0; white-space: nowrap; }
.lane-none { font-size: .75rem; color: var(--slate-400); }

.stage-col { position: sticky; top: calc(var(--bar-h) + 1.125rem); min-width: 0; }
.marker-stage {
  display: grid; gap: 1.25rem; padding: 1.75rem 1.75rem 1.625rem; border-radius: 2rem;
  border: 1px solid var(--lg-border); background: var(--lg-bg-warm); box-shadow: var(--lg-shadow);
}
.ms-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.125rem; }
.ms-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.625rem; }
.ms-title h3 { font-size: 1.62rem; letter-spacing: -0.02em; }
.ms-meta { margin-top: 0.25rem; font-size: .82rem; color: var(--slate); }
.ms-value { flex: none; display: grid; grid-template-columns: auto auto; align-items: baseline; justify-content: end; gap: 0 0.5rem; text-align: right; }
.ms-value strong { font: 500 3.1rem/.95 var(--display); letter-spacing: -0.04em; color: var(--val, var(--ink)); font-variant-numeric: tabular-nums; }
.ms-value > span { font: 500 .98rem var(--display); color: var(--slate); }
.ms-value .thr { grid-column: 1 / -1; justify-content: flex-end; margin-top: 0.375rem; color: var(--text); }
.ms-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.625rem; }
.compare select { width: auto; max-width: 15rem; padding: 0.48rem 0.875rem; font-size: .82rem; font-weight: 600; border-radius: 100px; background: #fff; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.4rem), 1fr)); gap: 1rem 1.375rem; padding-top: 1.125rem; border-top: 1px solid var(--line); }
.stat { display: grid; gap: 0.125rem; }
.stat span { font: 600 .66rem var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--slate); }
.stat strong { font: 500 1.16rem/1.3 var(--display); color: var(--ink); font-variant-numeric: tabular-nums; }
.stat em { font-size: .78rem; color: var(--slate); }
.ms-evidence { display: grid; gap: 0.625rem; }
.marker-stage .evidence { background: #fff; }
.readings { display: grid; gap: 0.375rem; margin-top: 0.625rem; max-width: 20rem; }
.readings li { display: flex; justify-content: space-between; gap: 0.75rem; font-size: .8125rem; font-variant-numeric: tabular-nums; padding-bottom: 0.375rem; border-bottom: 1px dashed var(--line); }

/* ── Function chapter: the reasoning chain ───────────────────────────────── */

.chain { position: relative; display: grid; gap: 1rem; width: 100%; min-width: 0; max-width: 100%; }
.chain::before { content: ''; position: absolute; left: 1.40625rem; top: 1.875rem; bottom: 1.875rem; width: 1.5px; background: linear-gradient(180deg, var(--ember) 0%, var(--gold) 100%); opacity: .55; }
.chain-step { display: grid; grid-template-columns: 2.875rem minmax(0, 1fr); gap: 1.375rem; padding: 0; align-items: start; min-width: 0; }
.chain-node {
  position: relative; z-index: 1; width: 2.875rem; height: 2.875rem; margin-top: 0.875rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--grad-deep); color: var(--gold); box-shadow: 0 0 0 0.375rem rgba(255, 253, 250, .92), 0 0.75rem 1.625rem rgba(56, 8, 2, .24);
}
.chain-step.quiet .chain-node { background: rgba(255, 255, 255, .9); color: var(--slate-400); box-shadow: 0 0 0 0.375rem rgba(255, 253, 250, .92), inset 0 0 0 1.5px var(--line-strong); }
.chain-body {
  display: grid; gap: 0.875rem; padding: 1.25rem 1.5rem; min-width: 0; border-radius: 1.625rem;
  border: 1px solid var(--lg-border); background: var(--lg-bg); box-shadow: var(--lg-shadow);
}
.chain-step.quiet .chain-body { background: rgba(255, 255, 255, .56); box-shadow: 0 0.625rem 1.625rem rgba(56, 8, 2, .04), inset 0 1px 0 rgba(255, 255, 255, .85); }
.chain-label { font: 600 .76rem var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--ember-700); }
.chain-step.quiet .chain-label { color: var(--slate-400); }
.chain-quiet { font-size: .94rem; color: var(--slate); }

.moves { display: grid; }
.move {
  width: 100%; display: grid; grid-template-columns: 0.75rem minmax(8rem, .7fr) minmax(0, 1.2fr) minmax(0, 1fr); align-items: baseline; gap: 1rem;
  padding: 0.8125rem 0.625rem 0.8125rem 0.25rem; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; border-radius: 0;
  transition: background .25s;
}
.move:hover { background: linear-gradient(90deg, rgba(232, 96, 56, .06), rgba(232, 96, 56, 0)); }
.move .status-dot { align-self: center; }
.move strong { font: 500 1.15rem var(--display); color: var(--ink); }
.move-seq { font: 500 1.18rem var(--display); letter-spacing: .005em; color: var(--ink); font-variant-numeric: tabular-nums; }
.move-zone { font: italic 400 1.15rem/1.25 var(--serif); color: var(--st-ink, var(--slate)); }
.move .st-optimal ~ .move-zone, .move .st-normal ~ .move-zone { color: #8A5A2E; }
.pattern { display: grid; gap: 0.5rem; padding-top: 0.5rem; max-width: 86ch; }
.pattern-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.625rem; }
.pattern-head strong { font: 500 1.15rem/1.25 var(--display); color: var(--ink); }
.pattern p { font-size: .94rem; color: var(--text); }
.pattern-proof { display: flex; flex-wrap: wrap; gap: 0.25rem 1.375rem; font-size: .84rem; color: var(--slate); font-variant-numeric: tabular-nums; }
.pattern-proof li::before { content: '\2192\00a0'; color: var(--gold-deep); }
.guests { display: grid; gap: 0.625rem; padding-top: 0.5rem; }
.guests p { font-size: .875rem; color: var(--slate); }
.kin { display: grid; gap: 0.75rem; }
.kin + .kin { padding-top: 0.875rem; border-top: 1px solid var(--line); }
.kin-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.875rem; }
.kin-line strong { font: 500 1.25rem var(--display); color: var(--ink); }
.kin-line > span { font-size: .94rem; color: var(--text); }
.kin-line .kin-gap { font: italic 400 1.18rem var(--serif); color: var(--ember-700); }
.ev-groups { display: grid; gap: 1rem; }
.ev-group { display: grid; grid-template-columns: minmax(9.5rem, 13.75rem) minmax(0, 1fr); gap: 0.5rem 1.375rem; align-items: start; }
.ev-for { padding-top: 0.625rem; font-size: .84rem; font-weight: 600; color: var(--ink); }
.ev-group > .evidence { grid-column: 2; justify-self: start; }
.suggest-rec { display: grid; gap: 0.25rem; max-width: 86ch; }
.suggest-rec strong { font: 500 1.25rem/1.25 var(--display); color: var(--ink); }
.suggest-rec p { font-size: .9rem; }
.suggest-tests { display: grid; max-width: 96ch; }
.suggest-tests li { display: grid; gap: 0.25rem; padding: 0.8125rem 0; border-bottom: 1px solid var(--line); }
.suggest-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.625rem; }
.suggest-top strong { font: 500 1.06rem var(--display); color: var(--ink); }
.suggest-tests p { font-size: .84rem; color: var(--slate); }
.chain-body > .btn-primary, .chain-body > .btn-ghost { justify-self: start; max-width: 100%; white-space: normal; text-align: left; }

/* ── Function chapter: between-visit signals and coverage ───────────────── */

.comps { display: grid; gap: 1.625rem; }
.comp {
  display: grid; gap: 1rem; padding: 1.625rem 1.75rem; border-radius: 1.75rem;
  border: 1px solid var(--lg-border); background: var(--lg-bg); box-shadow: var(--lg-shadow);
}
.comp-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.625rem 1.125rem; }
.comp-head h3 { font-size: 1.35rem; letter-spacing: -0.015em; }
.comp-lead { font: italic 400 1.38rem/1.3 var(--serif); color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 1.375rem; }
.tile {
  display: grid; gap: 0.75rem; min-width: 0; padding: 1.375rem 1.5rem; border-radius: 1.75rem;
  border: 1px solid var(--lg-border); background: var(--lg-bg-warm); box-shadow: var(--lg-shadow);
}
.tile-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.875rem; }
.tile-head h3 { font-size: 1.25rem; }
.tile-val { display: grid; grid-template-columns: auto auto; justify-content: end; align-items: baseline; gap: 0 0.375rem; text-align: right; }
.tile-val strong { font: 500 2.125rem/1 var(--display); letter-spacing: -0.03em; color: var(--val, var(--ink)); font-variant-numeric: tabular-nums; }
.tile-val small { font-size: .8125rem; color: var(--slate); }
.tile-val .thr { grid-column: 1 / -1; justify-content: flex-end; font-size: .75rem; color: var(--slate); margin-top: 0.1875rem; }
.tile-foot { min-height: 1.125rem; }
.scan-row { display: flex; flex-wrap: wrap; gap: 1.25rem 3.25rem; }
.scan-stat { display: grid; gap: 0.125rem; min-width: 6.875rem; }
.scan-stat > span:first-child { font: 600 .66rem var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--slate); }
.scan-stat strong { font: 500 2rem/1.1 var(--display); letter-spacing: -0.025em; color: var(--ink); font-variant-numeric: tabular-nums; }
.scan-stat strong small { font-size: .875rem; font-weight: 500; letter-spacing: 0; color: var(--slate); }
.scan-stat.out strong { color: var(--ember-700); }
.scan-stat .thr { font-size: .75rem; color: var(--slate); }
.scan-stat .delta { font-size: .78rem; font-weight: 600; color: var(--slate); }
.imaging { display: grid; gap: 0.25rem; }
.imaging strong { font: 500 1.06rem var(--display); color: var(--ink); }
.imaging-items { display: grid; gap: 0.125rem; font-size: .84rem; color: var(--slate); padding-left: 1rem; list-style: disc; }

.coverage { display: flex; flex-wrap: wrap; gap: 0.625rem; }
.cov { display: inline-flex; align-items: center; gap: 0.56rem; padding: 0.625rem 1rem; border-radius: 100px; font-size: .84rem; border: 0; }
.cov em { font-weight: 700; font-variant-numeric: tabular-nums; }
.cov.on { background: var(--st-soft); color: var(--st-ink); transition: transform .3s var(--ease), box-shadow .3s; }
.cov.on:hover { transform: translateY(-0.125rem); box-shadow: 0 0.625rem 1.375rem rgba(26, 28, 35, .1); }
.cov.off { box-shadow: inset 0 0 0 1.5px var(--line-strong); color: var(--slate); background: transparent; }
.cov.off em { font-weight: 500; opacity: .8; }

/* ── Charts (SVG user-space typography inside viewBox, rem outside) ──────── */

.trend-wrap { display: grid; gap: 0.625rem; min-width: 0; }
.chart-stage { position: relative; min-width: 0; }
.trend { width: 100%; height: auto; max-width: 100%; display: block; overflow: visible; outline: none; }
.trend:focus-visible { outline: 2px solid var(--ember); outline-offset: 0.375rem; border-radius: 0.875rem; }
.chart-tick { font: 400 11.5px var(--body); fill: var(--slate); font-variant-numeric: tabular-nums; }
.chart-tick.cap { font: 600 11px var(--display); letter-spacing: .14em; text-transform: uppercase; }
.grid-line { stroke: rgba(26, 28, 35, .07); stroke-width: 1; }
.zone-in { fill: rgba(0, 138, 16, .07); }
.zone-out { fill: rgba(232, 96, 56, .04); }
.limit-line { stroke: rgba(0, 138, 16, .6); stroke-width: 1.2; stroke-dasharray: 5 5; }
.limit-lbl { font: 600 11.5px var(--body); fill: var(--ok-ink); paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; }
.limit-lbl.neutral { fill: var(--slate); }
.trend-line { stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.trend-line.thin { stroke-width: 2.2; }
.trend-compare { stroke-width: 2; stroke-dasharray: 6 5; stroke-linecap: round; }
.trend-dot { stroke: #fff; stroke-width: 2.4; }
.point-lbl { font: 600 13px var(--display); fill: var(--slate); font-variant-numeric: tabular-nums; }
.point-lbl.latest { font-size: 16px; fill: var(--ink); }
.chart-cursor { stroke: rgba(26, 28, 35, .32); stroke-dasharray: 3 4; }
.chart-focus { fill: #fff; stroke-width: 3; }
.mean-line { stroke: rgba(26, 28, 35, .3); stroke-width: 1.2; stroke-dasharray: 3 4; }
.mean-line.good { stroke: var(--ok); }
.split-line { stroke: var(--ember); stroke-width: 1.4; stroke-dasharray: 4 4; }
.cycle-bar { cursor: pointer; transition: opacity .2s; }
.cycle-bar:hover { opacity: .72; }
.voice-stem { stroke-width: 2; opacity: .45; }
.voice-dot { stroke: #fff; stroke-width: 2; cursor: pointer; }
.dose-name { font: 500 12px var(--body); fill: var(--text); }
.dose-cell { cursor: pointer; }
.dose-cell.taken { fill: var(--ok); opacity: .8; }
.dose-cell.missed { fill: var(--ember-100); stroke: var(--ember); stroke-width: 1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 0.375rem 1.25rem; font-size: .78rem; color: var(--slate); }
.chart-legend span { display: inline-flex; align-items: center; gap: 0.44rem; }
.tt-dot { width: 0.5625rem; height: 0.5625rem; border-radius: 50%; display: inline-block; flex: none; }
.chart-readout { font-size: .78rem; color: var(--slate); font-variant-numeric: tabular-nums; }
.chart-empty { padding: 2.125rem 1.25rem; border-radius: 1.375rem; background: rgba(255, 255, 255, .7); text-align: center; font-size: .84rem; color: var(--slate); }
.chart-tooltip {
  position: absolute; z-index: 20; translate: 0.875rem -50%; pointer-events: none; min-width: 10.5rem;
  padding: 0.6875rem 0.875rem; border-radius: 1rem; font-size: .78rem; color: #fff;
  background: rgba(40, 9, 0, .92); backdrop-filter: blur(10px); box-shadow: 0 1rem 2.5rem rgba(56, 8, 2, .34);
}
.chart-tooltip.flip-left { translate: calc(-100% - 0.875rem) -50%; }
.tt-date { font: 600 .625rem var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-bottom: 0.25rem; }
.tt-row { display: flex; align-items: center; gap: 0.44rem; font-variant-numeric: tabular-nums; }
.tt-row strong { font-size: .875rem; }
.tt-sub { font-size: .72rem; color: rgba(255, 255, 255, .72); margin: 1px 0 3px; }

/* ── Family & history ────────────────────────────────────────────────────── */

.lineage { display: grid; gap: 0.875rem; }
.lin-row {
  display: grid; grid-template-columns: minmax(9.5rem, .7fr) minmax(13.5rem, 1.25fr) minmax(0, 1.25fr); gap: 0.875rem 2.25rem; align-items: center;
  padding: 1.375rem 1.5rem; border-radius: 1.625rem; border: 1px solid var(--lg-border);
  background: var(--lg-bg); box-shadow: var(--lg-shadow);
}
.lin-row.lin-head { padding: 0.25rem 1.5rem 0.375rem; border: 0; background: none; box-shadow: none; }
.lin-who { display: grid; gap: 0.25rem; justify-items: start; }
.lin-who strong { font: 500 1.42rem/1.15 var(--display); letter-spacing: -0.015em; color: var(--ink); }
.lin-who > span { font-size: .9rem; color: var(--text); }
.lin-who .fn-chip { margin-top: 0.375rem; }
.lin-mid { display: grid; gap: 0.75rem; }
.lin-axis { position: relative; height: 2.125rem; border-bottom: 1px solid var(--line-strong); }
.lin-tick { position: absolute; bottom: 0.3125rem; translate: -50% 0; font-size: .68rem; color: var(--slate-400); font-variant-numeric: tabular-nums; }
.lin-now { position: absolute; top: 0; translate: -50% 0; font: 600 .66rem var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--ember-700); white-space: nowrap; }
.lin-track { position: relative; height: 2.125rem; }
.lin-track::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; border-radius: 2px; background: #F1EEE8; }
.lin-gap { position: absolute; top: 50%; height: 0.5rem; margin-top: -0.25rem; border-radius: 100px; }
.lin-gap.ahead { background: linear-gradient(90deg, var(--ember), var(--gold)); opacity: .65; }
.lin-gap.past { background: linear-gradient(90deg, var(--crit), var(--ember)); opacity: .6; }
.lin-age { position: absolute; top: 2px; bottom: 2px; width: 2.5px; margin-left: -1.25px; border-radius: 2px; background: var(--ember); }
.lin-onset { position: absolute; top: 50%; translate: -50% -50%; }
.lin-onset b { display: grid; place-items: center; min-width: 2.125rem; height: 2.125rem; padding: 0 0.5rem; border-radius: 100px; background: var(--warm-black); color: var(--gold); font: 500 .94rem var(--display); font-variant-numeric: tabular-nums; box-shadow: 0 0 0 0.25rem #fff; }
.lin-unknown { position: absolute; left: 0; top: 50%; translate: 0 -50%; padding: 2px 0.625rem 2px 0; background: #fff; font-size: .78rem; color: var(--slate-400); }
.lin-text { font: italic 400 1.12rem/1.3 var(--serif); color: var(--ink); }
.lin-detail { display: grid; gap: 0.75rem; }
.lin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.625rem 1.125rem; }

.pass-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.pass-group {
  display: grid; gap: 0.75rem; align-content: start; padding: 1.375rem 1.5rem; border-radius: 1.625rem;
  border: 1px solid var(--lg-border); background: var(--lg-bg); box-shadow: var(--lg-shadow);
}
.pass-group h3 { font: 600 .72rem var(--display); letter-spacing: .18em; text-transform: uppercase; color: var(--slate); padding-bottom: 0.625rem; border-bottom: 1px solid var(--line); }

.meds { display: grid; gap: 0.875rem; margin-bottom: 1.5rem; }
.med {
  display: grid; grid-template-columns: 4.75rem minmax(0, 1fr); gap: 1.375rem; align-items: center;
  padding: 1.25rem 1.5rem; border-radius: 1.625rem; border: 1px solid var(--lg-border);
  background: var(--lg-bg-warm); box-shadow: var(--lg-shadow);
}
.med-ring { position: relative; width: 4.75rem; height: 4.75rem; display: grid; place-items: center; color: var(--ink); }
.med-ring .ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.med-ring strong { font: 500 1.125rem var(--display); font-variant-numeric: tabular-nums; color: var(--ink); }
.med-info { display: grid; gap: 0.1875rem; }
.med-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.625rem; }
.med-title strong { font: 500 1.25rem var(--display); color: var(--ink); }

.pgx { display: grid; gap: 0.625rem; margin: 1rem 0; width: 100%; }
.pgx-row {
  display: grid; grid-template-columns: 6.875rem auto minmax(0, 1fr); gap: 1rem; align-items: center;
  padding: 1rem 1.375rem; border-radius: 1.375rem; border: 1px solid var(--lg-border);
  background: var(--lg-bg); box-shadow: var(--lg-shadow);
}
.pgx-row strong { font: 500 1.125rem var(--display); color: var(--ink); }
.pgx-row .tag { justify-self: start; }

/* ── Longevity: Phenotypic Age model ─────────────────────────────────────── */

.sim { display: grid; gap: 1.375rem; }
.sim-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.sim-grid-layout { display: grid; grid-template-columns: minmax(17rem, .72fr) minmax(0, 1.28fr); gap: 2.5rem; align-items: start; }
.sim-score-box {
  position: sticky; top: calc(var(--bar-h) + 1.125rem); display: grid; gap: 0.75rem; padding: 1.875rem 1.75rem; border-radius: 2rem; color: #fff;
  background: var(--grad-deep); box-shadow: 0 1.875rem 4.375rem rgba(56, 8, 2, .28), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.sim-score-box .muted-xs { color: var(--gold); font: 600 .66rem var(--display); letter-spacing: .18em; text-transform: uppercase; }
.sim-figure { display: flex; align-items: baseline; gap: 0.5rem; }
.sim-number { font: 400 4.75rem/.95 var(--display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.sim-figure .unit { font: 500 1.06rem var(--display); opacity: .7; }
.sim-delta { font: italic 400 1.18rem/1.3 var(--serif); color: rgba(255, 255, 255, .92); }
.sim-break-wrap { display: grid; gap: 0.5rem; padding-top: 0.875rem; border-top: 1px solid rgba(255, 255, 255, .18); }
.sim-breakdown { display: grid; gap: 0.375rem; font-size: .8125rem; }
.sim-breakdown li { display: flex; justify-content: space-between; gap: 0.625rem; }
.sim-breakdown li.muted { color: rgba(255, 255, 255, .7); }
.sim-breakdown .tone-good { color: #9BE0A4; }
.sim-breakdown .tone-warn { color: var(--ember-300); }
.sim-score-box .btn-ghost { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .28); color: #fff; justify-self: start; }
.sim-score-box .btn-ghost:hover { background: rgba(255, 255, 255, .22); border-color: #fff; }

.agescale { padding: 2.125rem 0 1.875rem; }
.agescale-track { position: relative; height: 0.375rem; border-radius: 100px; background: rgba(255, 255, 255, .2); }
.agescale-span { position: absolute; top: 0; bottom: 0; border-radius: 100px; }
.agescale-span.younger { background: #7BD389; }
.agescale-span.older { background: var(--ember-400); }
.agescale-pin { position: absolute; top: 50%; translate: -50% -50%; text-align: center; }
.agescale-pin span { display: inline-block; font: 700 .72rem var(--body); padding: 0.1875rem 0.5rem; border-radius: 100px; background: #fff; color: var(--warm-black); font-variant-numeric: tabular-nums; }
.agescale-pin.bio.younger span { background: #7BD389; }
.agescale-pin.bio.older span { background: var(--ember-400); color: #fff; }
.agescale-pin em { position: absolute; left: 50%; translate: -50% 0; font-size: .625rem; white-space: nowrap; color: rgba(255, 255, 255, .76); }
.agescale-pin.chrono em { top: -1.25rem; }
.agescale-pin.bio em { bottom: -1.25rem; }

.seg-tabs { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; padding: 0.25rem; border-radius: 100px; background: #F4F1EB; margin-bottom: 1.375rem; }
.seg-tab { border: 0; background: transparent; padding: 0.5rem 1rem; border-radius: 100px; font: 600 .8125rem var(--body); color: var(--slate); transition: background .2s, color .2s; }
.seg-tab:hover { color: var(--ink); }
.seg-tab.on { background: var(--ink); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.sim-sliders { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.375rem 1.75rem; }
.sim-row { display: grid; gap: 0.375rem; padding: 0.875rem 0; border-bottom: 1px solid var(--line); }
.sim-row.assumed label::after { content: ' \00b7 assumed'; font-weight: 500; color: var(--slate-400); }
.sim-row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; font-size: .84rem; }
.sim-row-head label { font-weight: 600; color: var(--ink); }
.sim-val { font: 500 1rem var(--display); font-variant-numeric: tabular-nums; }
.sim-val.ok { color: var(--ok-ink); }
.sim-val.warn { color: var(--ember-700); }
.sim-row-foot { display: flex; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.sim-effect { font-size: .72rem; font-weight: 700; color: var(--ember-700); }
input[type="range"] { width: 100%; accent-color: var(--ember); }
.lever-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem 2rem; }
.lever-box { display: grid; gap: 0.56rem; align-content: start; padding: 1.125rem 0; border-bottom: 1px solid var(--line); transition: opacity .3s; }
.lever-box.off { opacity: .5; }
.lever-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.625rem; }
.lever-head h4 { font-size: 1.18rem; margin-top: 0.375rem; }
.switch { width: 1.25rem; height: 1.25rem; accent-color: var(--ember); }
.sim-na { font-size: .75rem; color: var(--slate); font-style: italic; }
.method-copy { display: grid; gap: 0.875rem; }

/* ── Plan & sign-off ─────────────────────────────────────────────────────── */

.plan-grid { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(21.5rem, .82fr); gap: 2.25rem; align-items: start; min-width: 0; }
.plan-main { display: grid; gap: 2.5rem; min-width: 0; }
.plan-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.875rem; }
.plan-progress { display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; }
.pp { display: inline-flex; align-items: baseline; gap: 0.5rem; font-size: .8125rem; color: var(--slate); }
.pp b { font: 500 2rem/1 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--ink); }
.pp.ok b { color: var(--ok-ink); }
.pp.wait b { color: var(--ember-700); }
.plan-block { display: grid; gap: 1.125rem; }
.block-head { display: grid; gap: 0.625rem; }
.block-head h2 { font-size: 1.7rem; letter-spacing: -0.02em; }

.ask {
  display: grid; gap: 0.875rem; padding: 1.5rem 1.625rem 0.875rem; border-radius: 1.75rem;
  border: 1px solid var(--lg-border); border-top: 3px solid var(--ink);
  background: var(--lg-bg); box-shadow: var(--lg-shadow);
}
.ask.approved { border-top-color: var(--ok); }
.ask-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.ask-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.56rem; }
.ask-title h3 { font-size: 1.5rem; letter-spacing: -0.02em; }
.ask-title strong { font: 500 1.14rem/1.25 var(--display); color: var(--ink); }
.ask-meta { margin-top: 0.125rem; font-size: .84rem; color: var(--slate); }
.ask-basis { display: grid; gap: 0.25rem; padding: 0.875rem 1.125rem; border-radius: 1.125rem; background: var(--gold-wash); font-size: .92rem; color: var(--warm-black); }
.ask-basis-label { font: 600 .66rem var(--display); letter-spacing: .18em; text-transform: uppercase; color: #8A5A2E; }
.ask-list { display: grid; }
.ask-item {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.75rem 1.125rem; padding: 1rem 0.875rem 1rem 1rem;
  border-bottom: 1px solid var(--line); border-left: 3px solid transparent; transition: background .3s, border-color .3s, opacity .3s;
}
.ask-item.approved { background: linear-gradient(90deg, rgba(0, 138, 16, .07), rgba(0, 138, 16, 0) 75%); border-left-color: var(--ok); }
.ask-item.declined { opacity: .58; border-left-color: var(--slate-400); }
.ask-body { flex: 1 1 17rem; min-width: 0; display: grid; gap: 0.44rem; justify-items: start; }
.ask-why { font-size: .9rem; line-height: 1.56; color: var(--slate); max-width: 78ch; }
.ask-body .evidence { padding: 0.3125rem 0.75rem 0.3125rem 0.375rem; border-radius: 0.75rem; font-size: .8rem; }
.decide-group { display: inline-flex; gap: 0.375rem; flex: none; }
.decide {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 100px; padding: .46rem .92rem;
  font: 600 .82rem var(--body); color: var(--ink); transition: background .2s, color .2s, border-color .2s, transform .25s var(--ease);
}
.decide:hover:not(:disabled) { transform: translateY(-1px); }
.decide.approved:hover:not(:disabled), .decide.approved.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.decide.declined:hover:not(:disabled), .decide.declined.on { background: var(--ink); border-color: var(--ink); color: #fff; }

.plan-desk { position: sticky; top: calc(var(--bar-h) + 1.125rem); display: grid; gap: 1.125rem; }
.desk {
  display: grid; gap: 1rem; padding: 1.875rem 1.75rem; border-radius: 2rem;
  border: 1px solid var(--lg-border); background: var(--lg-bg-warm);
  box-shadow: var(--lg-shadow), inset 0 3px 0 var(--ember);
}
.desk-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.desk-head h2 { font-size: 1.625rem; letter-spacing: -0.02em; margin-top: 0.625rem; }
.readonly-callout { padding: 0.75rem 1rem; border-radius: 1rem; background: var(--gold-wash); font-size: .8125rem; color: #6B4423; }
.notes-primary textarea { min-height: 9.375rem; }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.signoff-foot { display: grid; gap: 0.625rem; padding-top: 0.25rem; }
.signoff-status { min-height: 1.125rem; font-size: .8125rem; font-weight: 600; }
.signoff-status.ok { color: var(--ok-ink); }
.signoff-status.warn { color: var(--ember-700); }
.desk-note { display: grid; gap: 0.625rem; padding: 0.25rem 0.375rem; }
.prior-list, .audit-list { display: grid; gap: 0.625rem; margin-top: 0.625rem; }
.prior-list li, .audit-list li { display: grid; gap: 0.125rem; padding-bottom: 0.625rem; border-bottom: 1px solid var(--line); font-size: .8125rem; }
.prior-list li:last-child, .audit-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.prior-top { display: flex; justify-content: space-between; gap: 0.625rem; }
.audit-list time { font-size: .72rem; color: var(--slate-400); }
.audit-list strong { color: var(--ink); }
.trail-tabs { margin: 0.75rem 0 0.25rem; }

/* ── Unlock ──────────────────────────────────────────────────────────────── */

.unlock { position: relative; min-height: calc(100 * var(--vh)); display: grid; align-items: center; padding: 3rem 4rem; overflow: hidden; }
.unlock-bg { position: absolute; inset: -4%; background: url('/img/story-sanctuary.jpg') center / cover no-repeat; will-change: transform; backface-visibility: hidden; animation: kenburns 40s ease-in-out infinite alternate; }
.unlock-fx { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; contain: layout paint style; }
.unlock::before {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(100deg, rgba(56, 8, 2, .86) 0%, rgba(56, 8, 2, .62) 46%, rgba(56, 8, 2, .16) 100%);
}
.unlock-grid { position: relative; z-index: 2; width: min(77.5rem, 100%); margin-inline: auto; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(22rem, 28.75rem); gap: 4.5rem; align-items: center; }
.unlock-copy { display: grid; gap: 1.5rem; justify-items: start; color: #fff; }
.unlock-copy > * { animation: rise 1s var(--ease) both; }
.unlock-copy > :nth-child(2) { animation-delay: .1s; }
.unlock-copy > :nth-child(3) { animation-delay: .2s; }
.unlock-copy > :nth-child(4) { animation-delay: .3s; }
.unlock-copy .brand-words strong { color: #fff; font-size: 1.3125rem; }
.unlock-copy .brand-words small { color: var(--gold); }
.unlock-title { font: 500 3.75rem/1.02 var(--display); letter-spacing: -0.03em; color: #fff; }
.unlock-title em { font: italic 400 1.04em/1 var(--serif); letter-spacing: -0.01em; color: var(--gold); }
.unlock-lead { font-size: 1.125rem; line-height: 1.68; max-width: 52ch; color: rgba(255, 255, 255, .88); }
.unlock-guarantees { display: grid; gap: 0.75rem; padding-top: 1.375rem; border-top: 1px solid rgba(255, 255, 255, .2); font-size: .9rem; color: rgba(255, 255, 255, .92); }
.unlock-guarantees li { display: flex; align-items: flex-start; gap: 0.6875rem; }
.unlock-guarantees .ico { color: var(--gold); margin-top: 0.1875rem; }
.unlock-form {
  display: grid; gap: 0.94rem; padding: 2.25rem 2.125rem; border-radius: 2rem;
  background: linear-gradient(150deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .82) 55%, rgba(255, 255, 255, .9));
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: 0 1.875rem 5rem rgba(56, 8, 2, .36), inset 0 1px 0 rgba(255, 255, 255, .95);
  animation: bloom 1.1s var(--ease) .25s both;
}
.unlock-form h2 { font-size: 1.85rem; line-height: 1.12; letter-spacing: -0.025em; }
.unlock-form input.code { font: 600 1.08rem var(--mono); letter-spacing: .1em; text-align: center; text-transform: uppercase; }
.unlock-status { min-height: 1.1875rem; font-size: .86rem; font-weight: 600; color: var(--ember-700); }
.unlock-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }

/* ── Tablet (< 960px / data-viewport="tablet" | "mobile") ────────────────── */

@media (max-width: 959.98px) {
  .topbar { flex-wrap: wrap; padding: 0.55rem 1rem; gap: 0.5rem 0.875rem; }
  .enc-label { display: none; }
  .enc-short { display: inline; }
  .brand-words small { display: none; }
  .global-search { flex: 1 1 11rem; width: auto; }

  /* Pure inline-block horizontal pill scroller on tablet/mobile:
     Zero nested flexboxes, zero grid/max-content on <button>, so iOS Safari
     can never crush, wrap, or overlap chapter pills. */
  .rail {
    position: sticky; top: var(--bar-h); left: 0; right: 0; bottom: auto; z-index: 50;
    display: block; width: 100%; max-width: 100%; margin: 0; padding: 0;
    border-radius: 0; border-width: 0 0 1px; overflow: hidden;
    box-shadow: 0 0.375rem 1.25rem rgba(26, 28, 35, .1);
  }
  body[data-tone="dusk"] .rail { background: rgba(56, 8, 2, .95); border-bottom-color: rgba(255, 255, 255, .14); }
  body[data-tone="ivory"] .rail { background: rgba(255, 255, 255, .97); border-bottom-color: var(--line); }
  .rail-scroll {
    position: relative;
    display: block; width: 100%; box-sizing: border-box;
    white-space: nowrap; overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
    padding: 0.55rem max(0.875rem, env(safe-area-inset-right)) 0.55rem max(0.875rem, env(safe-area-inset-left));
    font-size: 0; line-height: 0;
  }
  .rail-score .rs-cats, .rail-head, .rail-foot { display: none; }
  .rail-group { display: inline; margin: 0; padding: 0; }
  .rail-score, .rail-item {
    -webkit-appearance: none; appearance: none;
    display: inline-block; vertical-align: middle;
    width: auto; height: auto; min-width: 0; max-width: none;
    margin: 0 0.45rem 0 0; border-radius: 100px;
    font: 500 0.85rem/1.25 var(--body); white-space: nowrap;
    text-align: center;
  }
  .rail-score { padding: 0.46rem 0.88rem; }
  .rail-item {
    padding: 0.48rem 0.88rem;
    background: #F6F4F0; border: 1px solid rgba(26, 28, 35, .07); color: var(--ink);
  }
  .rail-item.on, .rail-item.on:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
  body[data-tone="dusk"] .rail-item {
    background: rgba(255, 255, 255, .10); border-color: rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .94);
  }
  body[data-tone="dusk"] .rail-item.on, body[data-tone="dusk"] .rail-item.on:hover {
    background: #FFFFFF; border-color: #FFFFFF; color: var(--mid);
  }
  .rail-group:last-of-type .rail-item:last-of-type { margin-right: 0; }
  .rail-item:hover { transform: none; }
  .rail-ico, .rail-label, .rail-count,
  .rs-top, .rs-label, .rs-total {
    display: inline-block; vertical-align: middle; white-space: nowrap;
    width: auto; max-width: none;
  }
  .rail-dot {
    display: inline-block; vertical-align: middle;
    width: 0.5rem; height: 0.5rem; margin-right: 0.45rem;
  }
  .rail-ico { margin-right: 0.4rem; line-height: 1; }
  .rail-ico svg { display: block; }
  .rail-label { overflow-wrap: normal; word-break: normal; }
  .rail-count { margin-left: 0.45rem; line-height: 1.25; }
  .rs-label { margin-right: 0.45rem; }
  .rs-total { font-size: 0.94rem; line-height: 1; }

  .stage { margin-left: 0; }
  .hero, .hero-story { min-height: 0; padding-bottom: 5.5rem; }
  .hero-grid, .hero-story .hero-grid, .explorer, .plan-grid, .sim-grid-layout, .hs-grid, .unlock-grid { grid-template-columns: 1fr; gap: 1.75rem; }
  .stage-col, .plan-desk, .sim-score-box { position: static; }
  .posters, .pass-grid, .sim-sliders { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tm-grid { grid-template-columns: 1fr; gap: 1.625rem; }
  .tm-links { display: none; }
  .lin-row { grid-template-columns: 1fr; }
  .lin-row.lin-head { display: none; }
  .ev-group { grid-template-columns: 1fr; }
  .ev-group > .evidence { grid-column: 1; }
  .move { grid-template-columns: 0.75rem 1fr; }
  .move-seq, .move-zone { grid-column: 2; }
  .unlock { padding: 2rem 1.5rem; }
}

/* ── Mobile (< 640px / data-viewport="mobile") ───────────────────────────── */

@media (max-width: 639.98px) {
  :root { --gutter: 1rem; }
  /* Prevent iOS Safari zoom-on-focus on touch devices */
  .field input, .field textarea, .inline-input, select { font-size: max(1rem, 16px); }

  .topbar { position: static; padding: 0.65rem 1rem; gap: 0.5rem; }
  .rail { top: 0; }
  .rail-scroll { padding: 0.52rem max(0.75rem, env(safe-area-inset-right)) 0.52rem max(0.75rem, env(safe-area-inset-left)); }
  .rail-score, .rail-item { font-size: 0.83rem; padding: 0.45rem 0.82rem; }
  .top-left, .top-right { flex: 1 1 100%; }
  .patient-bar { padding-left: 0.75rem; }
  .top-right { justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
  .global-search { flex: 1 1 100%; max-width: none; }
  .search-pop { left: 0; right: auto; width: min(22rem, 100%); }
  .top-actions .btn-label {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }

  .hero, .hero-story { padding: 1.5rem var(--gutter) 4.25rem; gap: 1.35rem; }
  .hero-title, .hero-story .hero-title, .hero-family .hero-title, .hero-longevity .hero-title, .hero-plan .hero-title, .unlock-title { font-size: 2.15rem; line-height: 1.06; }
  .hero-verdict { font-size: 1.32rem; }
  .hero-lead { font-size: 0.96rem; }
  .hero-scores { padding: 0.55rem 0.65rem; border-radius: 1.125rem; gap: 0.5rem; }
  .hero-score-total { width: 100%; justify-content: space-between; }
  .hero-score-cats { flex: 1 1 100%; }
  .signal-glass { padding: 1.25rem; border-radius: 1.375rem; }
  .sg-value strong { font-size: 3.1rem; }

  .sheet {
    border-radius: 1.5rem 1.5rem 0 0; margin-top: -2.5rem;
    padding: 1.75rem max(var(--gutter), env(safe-area-inset-right)) calc(2.75rem + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  }
  .sec { padding: 0 0 2.35rem; }
  .captured { padding: 1.125rem 1.15rem; border-radius: 1.125rem; margin-bottom: 1.5rem; }
  .sec-banner { min-height: 7.25rem; padding: 1.125rem 1.25rem; border-radius: 1.125rem; margin-bottom: 1.25rem; }
  .sb-scrim {
    background:
      linear-gradient(100deg, rgba(56, 8, 2, .90) 0%, rgba(56, 8, 2, .74) 55%, rgba(56, 8, 2, .42) 100%),
      linear-gradient(180deg, rgba(56, 8, 2, .16) 0%, rgba(56, 8, 2, .28) 100%);
  }
  .sec-banner h2, .sec-head h2 { font-size: 1.4rem; }
  .sb-lead { font-size: 0.84rem; }

  .hs-compass-col, .hs-bridge, .marker-stage, .desk, .comp, .tile, .lin-row, .pass-group, .med, .ask {
    border-radius: 1.25rem; padding: 1.125rem;
  }
  .lanes { padding: 0.375rem 0.5rem; border-radius: 1.25rem; }
  .posters, .pass-grid, .age-trio, .hs-cards, .sim-sliders, .lever-grid, .form-grid-2, .pgx-row { grid-template-columns: 1fr; }
  .poster { min-height: 15.5rem; border-radius: 1.375rem; }
  .lane-row { grid-template-columns: minmax(0, 1fr) auto; gap: 0.65rem; padding: 0.85rem 0.65rem; }
  .lane-row .lane { grid-column: 1 / -1; grid-row: 2; padding-top: 0.2rem; }
  .beat-btn { grid-template-columns: 2.75rem minmax(0, 1fr); gap: 0.875rem; padding: 1rem; border-radius: 1.25rem; }
  .beat-node { width: 2.75rem; height: 2.75rem; font-size: 0.96rem; }
  .beats::before { left: 2.375rem; }
  .beat-go { display: none; }
  .ms-head { flex-direction: column; }
  .ms-value { justify-content: start; text-align: left; }
  .ms-value .thr { justify-content: flex-start; }
  .ask-item, .ask-head { flex-direction: column; align-items: stretch; }
  .plan-glass { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .halo-label { padding: 0.2rem 0.42rem; }
  .halo-label .hl-name { font-size: 0.66rem; }
  .halo-label .hl-sub { display: none; }
  .hs-c-num { font-size: 1.75rem; }
  .hs-c-val { font-size: 1.15rem; }
  .hs-c-kicker { font-size: 0.5rem; }
  .hs-c-sub { font-size: 0.56rem; }
  .hs-center .tag { font-size: 0.56rem; padding: 0.08rem 0.4rem; }
  .pager { flex-wrap: wrap; padding-top: 1.5rem; }
  .pager-btn { flex: 1 1 10rem; justify-content: space-between; padding: 0.72rem 1.15rem; }
  .unlock { padding: 1.5rem 1rem; }
  .unlock-form { padding: 1.5rem 1.2rem; border-radius: 1.375rem; }
  .fx-orb { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .bd-img.on, .sb-media, .unlock-bg, .bd-aura, .fx-orb, .halo-stage::before { animation: none !important; }
  .rv { opacity: 1; transform: none; }
}

/* ── Print: every chapter, black on white ────────────────────────────────── */

@media print {
  html { font-size: 14px !important; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .backdrop, .ambient-fx, .unlock-fx, .topbar, .rail, .pager, .hero-actions, .ms-controls, .decide-group, .add-test-row, .plan-toolbar .btn-ghost,
  .btn-primary, .btn-ghost, .btn-glass, .link-btn, .legend, .halo-key, .tm-links, .tm-caption, .float-chips, .chart-readout, .beat-go { display: none !important; }
  .rv { opacity: 1 !important; transform: none !important; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .draw { stroke-dasharray: none !important; stroke-dashoffset: 0 !important; }
  .stage { margin: 0; }
  .scene { display: block !important; break-before: page; }
  .scene:first-child { break-before: auto; }
  .print-thead { display: block; margin-bottom: 12pt; padding-bottom: 8pt; border-bottom: 1.5pt solid #1A1C23; }
  .print-letterhead { display: flex; justify-content: space-between; align-items: center; font-size: 9.5pt; margin-bottom: 5pt; }
  .print-brand { display: inline-flex; align-items: center; gap: 6pt; }
  .print-patient-bar { display: flex; justify-content: space-between; gap: 12pt; font-size: 10pt; padding: 5pt 8pt; background: #F4F1EB; }
  .hero, body[data-tone="dusk"] .hero { min-height: 0; padding: 0 0 14pt; color: #000; }
  .hero-grid, .hero-story .hero-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 26pt; }
  .hero-title em, body[data-tone="dusk"] .hero-title em { color: var(--ember-700); }
  .hero-verdict { font-size: 15pt; }
  .hero-lead, body[data-tone="dusk"] .hero-lead { color: #333; }
  body[data-tone="dusk"] .hero .eyebrow { color: var(--ember-700); }
  .signal-glass, body[data-tone="dusk"] .signal-glass, body[data-tone="ivory"] .signal-glass { background: none; border: 1px solid #D9D3C8; box-shadow: none; color: #000; backdrop-filter: none; }
  .capture { border-top-color: #D9D3C8; }
  .capture .ico { color: var(--ember-700); }
  body[data-tone="dusk"] .chip.on-hero { background: #F4F1EB; color: #000; }
  .halo-stage { max-width: 420pt; }
  .halo-stage::before { display: none; }
  .halo-center, .halo-label { color: #000; }
  .halo-edge { stroke: #BBB; }
  .halo-core { stroke: #fff; }
  .halo-hint, .halo-name { color: var(--ember-700); }
  .sheet { margin: 0; padding: 0; border-radius: 0; background: #fff; box-shadow: none; backdrop-filter: none; min-height: 0; }
  .sec { padding: 14pt 0; break-inside: avoid-page; }
  .explorer, .plan-grid, .sim-grid-layout, .tm-grid, .hs-grid { grid-template-columns: 1fr; gap: 14pt; }
  .stage-col, .plan-desk, .sim-score-box { position: static; }
  .marker-stage, .desk, .hs-bridge, .hs-compass-col, .hs-card, .captured, .beat-btn, .steady, .lanes, .chain-body, .comp, .tile, .lin-row, .pass-group, .med, .pgx-row, .ask, .age-trio .age-fig { box-shadow: none; border: 1px solid #D9D3C8; background: #fff; backdrop-filter: none; }
  .sec-banner { min-height: 0; padding: 10pt 0; background: none; color: #000; border: 0; border-bottom: 1.5pt solid #1A1C23; border-radius: 0; box-shadow: none; margin-bottom: 10pt; }
  .sb-media, .sb-scrim { display: none !important; }
  .sec-banner h2, .sb-lead { color: #000; text-shadow: none; }
  .eyebrow.on-banner { color: var(--ember-700); }
  .hs-stage { max-width: 280pt; }
  .hero-scores { background: #F4F1EB; border: 1px solid #D9D3C8; backdrop-filter: none; }
  .hero-score-total, .hero-cat-pill { background: #fff; color: #000; border: 1px solid #D9D3C8; }
  .hst-fig strong { color: #000; }
  .poster { min-height: 0; color: #000; background-image: none !important; background-color: #fff; border: 1px solid #D9D3C8; box-shadow: none; }
  .poster::before { display: none; }
  .poster-num, .poster-line { color: #333; text-shadow: none; }
  .poster-foot { color: var(--ember-700); }
  .lane-row, .ask-item, .chain-step, .lin-row, .med, .beat { break-inside: avoid; }
  .tab-panel { display: block; margin-bottom: 12pt; }
  .seg-tabs { display: none; }
}
