/* Atkinson Hyperlegible slashes its zero; numbers come from a plain system font instead (Wen's preference). */
@font-face { font-family: "RG Digits"; font-weight: 400; unicode-range: U+0030-0039;
  src: local("Helvetica Neue"), local("HelveticaNeue"), local("Segoe UI"), local("Roboto"), local("Arial"), local("ArialMT"); }
@font-face { font-family: "RG Digits"; font-weight: 700; unicode-range: U+0030-0039;
  src: local("Helvetica Neue Bold"), local("HelveticaNeue-Bold"), local("Segoe UI Bold"), local("SegoeUI-Bold"), local("Roboto Bold"), local("Roboto-Bold"), local("Arial Bold"), local("Arial-BoldMT"); }

/* Retina Genetics — shared styles
   Low-vision first: large base text, strong contrast, big targets, visible focus. */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --card: #ffffff;
  --ink: #1d1d1f;
  --ink-2: #424245;
  --line: #d2d2d7;
  --accent: #0a4fb5;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0fd;
  --ok-bg: #e2f3e7;  --ok-ink: #0a5a27;
  --soon-bg: #fff1cc; --soon-ink: #6b4200;
  --muted-bg: #ececf0; --muted-ink: #3a3a3e;
  --reading: #fff3a3;
  --focus: #0a4fb5;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 28px rgba(0,0,0,.06);
  --radius: 18px;
  --max: 1120px;
  --font-body: "RG Digits", "Atkinson Hyperlegible", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-head: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-contrast="high"]) {
    --bg: #000000; --bg-alt: #161617; --card: #1c1c1e;
    --ink: #f5f5f7; --ink-2: #c7c7cc; --line: #3a3a3c;
    --accent: #7ab1ff; --accent-ink: #00122e; --accent-soft: #0e2445;
    --ok-bg: #0f3a1f; --ok-ink: #a6e8bb;
    --soon-bg: #3d2c00; --soon-ink: #ffd98a;
    --muted-bg: #2c2c2e; --muted-ink: #e5e5ea;
    --reading: #5a4b00; --focus: #7ab1ff;
    --shadow: none;
    color-scheme: dark;
  }
}

/* High contrast mode (toggle) */
:root[data-contrast="high"] {
  --bg: #000000; --bg-alt: #000000; --card: #000000;
  --ink: #ffffff; --ink-2: #ffffff; --line: #ffffff;
  --accent: #ffe14d; --accent-ink: #000000; --accent-soft: #000000;
  --ok-bg: #000000; --ok-ink: #7dffa0;
  --soon-bg: #000000; --soon-ink: #ffe14d;
  --muted-bg: #000000; --muted-ink: #ffffff;
  --reading: #1f3dff; --focus: #ffe14d;
  --shadow: none;
  color-scheme: dark;
}
:root[data-contrast="high"] .card,
:root[data-contrast="high"] .pill,
:root[data-contrast="high"] .trial { border: 2px solid var(--line); }
:root[data-contrast="high"] a { text-decoration-thickness: 3px; }

/* Text size steps (toggle) */
html { font-size: 100%; }
:root[data-size="2"] { font-size: 118.75%; }
:root[data-size="3"] { font-size: 137.5%; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.25rem;          /* 20px at default size */
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }

h1, h2, h3 { font-family: var(--font-head); color: var(--ink); line-height: 1.15; letter-spacing: -0.015em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.4rem, 5.5vw, 4rem); font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.6rem); font-weight: 700; }
h3 { font-size: 1.5rem; font-weight: 650; }
p { margin: 0 0 1em; }
.lead { font-size: clamp(1.35rem, 2.2vw, 1.6rem); color: var(--ink-2); line-height: 1.5; max-width: 40em; }
.small { font-size: 1.05rem; color: var(--ink-2); }

a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 2px; }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

.skip { position: absolute; left: -9999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: 12px 20px; z-index: 100; font-weight: 700; }
.skip:focus { left: 16px; top: 12px; }

/* ---------- Accessibility bar ---------- */
.a11y {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--line);
  font-size: 1.05rem;
}
.a11y .wrap { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; justify-content: flex-end; padding-top: 8px; padding-bottom: 8px; }
.a11y-group { display: flex; align-items: center; gap: 6px; }
.a11y-label { color: var(--ink-2); margin-right: 4px; }
.tbtn {
  font: inherit; font-family: var(--font-head); font-weight: 600;
  min-height: 44px; min-width: 44px; padding: 6px 14px;
  border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.tbtn:hover { border-color: var(--ink-2); }
.tbtn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tbtn svg { width: 22px; height: 22px; flex: none; }
.tbtn.listen { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tbtn.listen[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.size-a1 { font-size: .95rem; } .size-a2 { font-size: 1.15rem; } .size-a3 { font-size: 1.4rem; }
select.tbtn { appearance: none; padding-right: 14px; }

.speech-help { flex-basis: 100%; margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--soon-bg); color: var(--soon-ink); font-weight: 600; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); font-family: var(--font-head); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.02em; }
.brand svg { width: 36px; height: 36px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: var(--ink); text-decoration: none; font-family: var(--font-head); font-weight: 550;
  font-size: 1.1rem; padding: 10px 14px; border-radius: 999px; min-height: 44px; display: inline-flex; align-items: center;
}
.nav a:hover { background: var(--bg-alt); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.menu-btn {
  font: inherit; font-family: var(--font-head); font-weight: 700; font-size: 1.1rem;
  min-height: 48px; padding: 8px 18px 8px 14px; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--ink); background: var(--card); color: var(--ink);
  display: inline-flex; align-items: center; gap: 8px;
}
.menu-btn svg { width: 24px; height: 24px; }
.menu-btn .i-close, .menu-open .menu-btn .i-open { display: none; }
.menu-open .menu-btn .i-close { display: inline; }
.menu-open .menu-btn { background: var(--ink); color: var(--bg); }
@media (min-width: 901px) { .menu-btn { display: none !important; } }
@media (max-width: 900px) {
  /* Phones and small tablets: the full page list sits behind a Menu button, shown as large stacked rows. */
  .site-header .wrap { min-height: 64px; flex-wrap: nowrap; }
  .brand { font-size: 1.2rem; gap: 10px; white-space: nowrap; min-width: 0; }
  .menu-btn { white-space: nowrap; flex: none; }
  .brand svg { width: 32px; height: 32px; flex: none; }
  .has-menu .nav { display: none; }
  .has-menu.menu-open .nav {
    display: flex; flex-direction: column; gap: 6px;
    position: absolute; left: 0; right: 0; top: 100%;
    padding: 10px 16px 18px; background: var(--bg); border-bottom: 1px solid var(--line);
    box-shadow: 0 18px 30px -12px rgba(0,0,0,.25);
    max-height: calc(100vh - 80px); overflow-y: auto;
  }
  .has-menu .nav a {
    font-size: 1.25rem; padding: 14px 18px; min-height: 56px; border-radius: 14px;
    background: var(--bg-alt); gap: 8px;
  }
  .has-menu .nav a::after { content: "›"; margin-left: auto; font-size: 1.5em; line-height: 1; opacity: .5; }
  .has-menu .nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
  /* Without JavaScript the list stays visible and scrolls sideways. */
  html:not(.has-menu) .site-header .wrap { flex-wrap: wrap; }
  html:not(.has-menu) .nav { width: 100%; padding-bottom: 10px; overflow-x: auto; flex-wrap: nowrap; }
  html:not(.has-menu) .nav a { white-space: nowrap; }

  /* Reading tools: fewer rows. Labels stay for screen readers; speed shows only while reading aloud. */
  .a11y .wrap { justify-content: flex-start; gap: 8px 10px; padding-top: 6px; padding-bottom: 6px; }
  .a11y-group > .a11y-label:not(.speed-label), .a11y .speed-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #contrast-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #contrast-btn { padding: 6px 10px; }
  html:not(.is-reading) #rate-sel { display: none; }
  .tbtn { padding: 6px 12px; }
  .lang-switch { width: 100%; }
  .lang-switch a { padding: 6px 12px; flex: 1; justify-content: center; }
}

/* ---------- Sections ---------- */
.hero { padding: clamp(56px, 9vw, 120px) 0 clamp(40px, 6vw, 80px); }
.hero h1 { max-width: 14em; }
.eyebrow { font-family: var(--font-head); font-weight: 650; color: var(--accent); font-size: 1.1rem; letter-spacing: .02em; margin-bottom: 14px; display: block; }
.section { padding: clamp(48px, 7vw, 96px) 0; }
.section.alt { background: var(--bg-alt); }
.section-head { max-width: 46em; margin-bottom: 36px; }
.prose { max-width: 42em; }
.prose h2 { margin-top: 1.6em; }
.prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.prose li { margin-bottom: .45em; }

.btns { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 56px; padding: 14px 28px;
  border-radius: 999px; font-family: var(--font-head); font-weight: 650; font-size: 1.2rem; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); border: 2px solid var(--accent);
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.secondary { background: transparent; color: var(--accent); }

.grid { display: grid; gap: 22px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.card {
  background: var(--card); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.section.alt .card { border-color: transparent; }
.card h3 { margin-bottom: .4em; }
.card p:last-child { margin-bottom: 0; }
a.card { display: block; text-decoration: none; color: inherit; transition: transform .15s ease; }
a.card:hover { transform: translateY(-2px); }
a.card .more { color: var(--accent); font-family: var(--font-head); font-weight: 650; }
.icon-circle { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 18px; }
.icon-circle svg { width: 30px; height: 30px; }

.stat-row { display: flex; flex-wrap: wrap; gap: 40px; margin-top: 8px; }
.stat b { display: block; font-family: var(--font-head); font-size: clamp(2.6rem, 5vw, 3.6rem); line-height: 1; letter-spacing: -0.03em; }
.stat span { color: var(--ink-2); }

.notice {
  border-left: 6px solid var(--accent); background: var(--accent-soft); padding: 18px 22px; border-radius: 10px; margin: 0 0 28px; max-width: 46em;
}
.notice p:last-child { margin: 0; }
.draft-flag { background: var(--soon-bg); color: var(--soon-ink); text-align: center; padding: 10px 16px; font-size: 1.05rem; font-family: var(--font-head); font-weight: 600; }

/* Conditions list (learn page) */
.cond { border-top: 1px solid var(--line); padding: 34px 0; }
.cond:first-of-type { border-top: 0; }
.cond h3 { font-size: 1.7rem; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 16px; padding: 0; list-style: none; }
.tags li { margin: 0; }

.pill { display: inline-block; padding: 4px 14px; border-radius: 999px; font-size: 1rem; font-family: var(--font-head); font-weight: 600; background: var(--muted-bg); color: var(--muted-ink); }
.pill.ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill.soon { background: var(--soon-bg); color: var(--soon-ink); }
.pill.done { background: var(--bg-alt); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.kw { background: var(--bg); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); font-family: var(--font-body); }
.pill.kw::before { content: "#"; opacity: .55; }

/* Tables (clinicians) */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { border-collapse: collapse; width: 100%; min-width: 860px; font-size: 1.05rem; line-height: 1.5; }
th, td { text-align: left; padding: 16px 18px; vertical-align: top; border-bottom: 1px solid var(--line); }
th { font-family: var(--font-head); background: var(--bg-alt); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 700; }

/* ---------- Trials finder ---------- */
.filters { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.field label, .field legend { display: block; font-family: var(--font-head); font-weight: 650; margin-bottom: 8px; font-size: 1.1rem; padding: 0; }
.field fieldset { border: 0; margin: 0; padding: 0; }
.field input[type="search"], .field select {
  width: 100%; min-height: 56px; font: inherit; font-size: 1.15rem; padding: 10px 16px;
  border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--ink);
}
.field input[type="search"]:focus, .field select:focus { border-color: var(--accent); }
.field.wide { grid-column: 1 / -1; }
.checks { display: flex; flex-wrap: wrap; gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 22px 8px 16px; border: 2px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 1.1rem; line-height: 1.2; }
.field label.check { display: inline-flex; margin-bottom: 0; padding: 8px 22px 8px 16px; font-family: var(--font-body); font-weight: 400; font-size: 1.1rem; }
.check input { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--accent); }
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.results-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; margin: 30px 0 18px; }
.results-bar h2 { font-size: 1.7rem; margin: 0; }
.trial { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; margin-bottom: 18px; box-shadow: var(--shadow); }
.trial h3 { font-size: 1.4rem; line-height: 1.3; margin: 10px 0 12px; }
.trial .meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 8px 24px; margin: 16px 0; padding: 0; list-style: none; font-size: 1.1rem; }
.trial .meta li { margin: 0; }
.trial .meta b { font-family: var(--font-head); display: block; color: var(--ink-2); font-size: .95rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.trial-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 8px; }
.trial-actions a.btn { min-height: 48px; padding: 10px 22px; font-size: 1.1rem; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); }
.load-more { display: flex; justify-content: center; margin-top: 10px; }

/* ---------- Read-aloud highlight ---------- */
.reading { background: var(--reading) !important; box-shadow: 0 0 0 8px var(--reading); border-radius: 6px; color: var(--ink); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-alt); padding: 48px 0 56px; font-size: 1.05rem; color: var(--ink-2); }
.site-footer .cols { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.site-footer h2 { font-size: 1.15rem; margin-bottom: .6em; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Treatment guide ---------- */
.tx-list { display: grid; gap: 22px; }
.tx { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(22px, 4vw, 36px); box-shadow: var(--shadow); }
.section.alt .tx { border-color: transparent; }
.tx-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 6px 20px; }
.tx-head h3 { font-size: clamp(1.6rem, 3vw, 2rem); margin: 0; }
.tx-head .tags { margin: 4px 0 0; }
.tx-code { font-weight: 400; color: var(--ink-2); font-size: .75em; }
.tx-co { color: var(--ink-2); margin: 4px 0 0; }
.tx-what { font-size: 1.2rem; margin: 18px 0 8px; max-width: 46em; }
.tx-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 18px 36px; margin: 18px 0; }
.tx-facts div { border-top: 1px solid var(--line); padding-top: 12px; }
.tx-facts dt { font-family: var(--font-head); font-weight: 650; color: var(--ink-2); font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.tx-facts dd { margin: 0; }
.tx-trials h4 { font-family: var(--font-head); font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); margin: 0 0 6px; }
.tx-trials ul { list-style: none; padding: 0; margin: 0 0 14px; }
.tx-trials li { margin: 0 0 8px; }
.tx-phase { color: var(--ink-2); margin: 0 6px; }
.tx-actions { margin-top: 6px; }
.tx-actions .btn { min-height: 48px; padding: 10px 22px; font-size: 1.1rem; }
.tx-src { font-size: 1rem; color: var(--ink-2); margin: 16px 0 0; }
.also { margin-top: 36px; max-width: 52em; }
.also ul { padding-left: 1.2em; }
.also li { margin-bottom: .8em; }
.notice.caution { border-left-color: var(--soon-ink); background: var(--soon-bg); color: var(--soon-ink); margin-top: 32px; }
.glance table { min-width: 720px; }
.glance td:first-child a { font-weight: 700; }
@media (max-width: 700px) {
  /* Phones: each row becomes a small stacked block so nothing hides off-screen. */
  .glance table, .glance tbody, .glance tr, .glance td { display: block; min-width: 0; width: auto; }
  .glance thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .glance tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .glance tr:last-child { border-bottom: 0; }
  .glance td { border: 0; padding: 3px 0; }
  .glance td:first-child { font-size: 1.2rem; padding-bottom: 6px; }
  .glance td[data-label]::before { content: attr(data-label) ": "; font-family: var(--font-head); font-weight: 600; color: var(--ink-2); }
}

@media print {
  @page { margin: 14mm 14mm 16mm; }
  .a11y, .site-header .nav, .trial-actions, .filters, .tx-actions, .btns, .skip, .site-footer { display: none !important; }
  :root { font-size: 11.5pt; }
  body { background: #fff; color: #000; line-height: 1.4; }
  body, p, li, dd, td { font-size: 11pt; }
  h1 { font-size: 22pt; margin-bottom: 6pt; }
  h2, h3, h4, .section-head, .eyebrow { break-after: avoid; }
  h2 { font-size: 16pt; margin: 0 0 4pt; }
  h3 { font-size: 13pt; }
  .lead { font-size: 12pt; }
  .hero, .section { padding: 8pt 0; }
  .section.alt { background: #fff; }
  .section-head { margin-bottom: 8pt; }
  .eyebrow { margin-bottom: 2pt; }
  .grid { gap: 8pt; }
  .card { padding: 8pt 10pt; }
  .tx, .card, .section.alt .tx, .section.alt .card { box-shadow: none; border: 1px solid #999; border-radius: 6pt; break-inside: avoid; }
  .tx { padding: 9pt 11pt; }
  .tx-list { gap: 8pt; }
  .tx-head h3 { font-size: 14pt; }
  .tx-what { font-size: 11.5pt; margin: 5pt 0; }
  .tx-facts { grid-template-columns: 1fr 1fr; gap: 4pt 16pt; margin: 6pt 0; }
  .tx-facts div { padding-top: 3pt; }
  .tx-facts dt { font-size: 8.5pt; margin: 0; }
  .tx-trials ul { margin: 0; }
  .tx-trials li { margin: 0 0 2pt; }
  .tx-src { font-size: 8.5pt; margin-top: 4pt; }
  .also { margin-top: 8pt; break-inside: avoid; }
  .also li { margin-bottom: 3pt; }
  .table-wrap { overflow: visible; border: 0; }
  .glance table, table { min-width: 0; font-size: 10.5pt; }
  th, td { padding: 4pt 6pt; }
  th { position: static; }
  a { color: #000; }
  .pill { border: 1px solid #666; background: #fff !important; color: #000 !important; padding: 0 6pt; font-size: 9pt; white-space: nowrap; }
  .draft-flag { border: 1px solid #000; }
  .notice { margin: 8pt 0; padding: 6pt 10pt; }
}


/* Trials print list: picked studies print as one clean sheet each. */
.check.pick { min-height: 48px; padding: 6px 18px 6px 14px; }
.print-bar { position: sticky; bottom: 16px; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px;
  padding: 14px 20px; background: var(--card); border: 2px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 1.15rem; font-weight: 600; }
.print-bar[hidden] { display: none; }
.print-bar span { margin-right: auto; }
#print-sheet { display: none; }
@media print {
  body.print-trials > *:not(#print-sheet) { display: none !important; }
  body.print-trials #print-sheet { display: block; }
  .sheet { break-after: page; font-size: 11pt; }
  .sheet:last-child { break-after: auto; }
  .sheet-top { font-size: 9pt; color: #444; border-bottom: 1px solid #999; padding-bottom: 3pt; margin: 0 0 8pt; }
  .sheet h1 { font-size: 17pt; line-height: 1.25; margin: 0 0 6pt; }
  .sheet h2 { font-size: 13pt; margin: 10pt 0 3pt; }
  .sheet-tags { margin: 0 0 6pt; }
  .sheet-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 4pt 16pt; margin: 6pt 0; }
  .sheet-facts dt { font-size: 8.5pt; text-transform: uppercase; letter-spacing: .04em; color: #444; }
  .sheet-facts dd { margin: 0; }
  .sheet ul { margin: 2pt 0 4pt; padding-left: 16pt; }
  .sheet li { margin: 0 0 1.5pt; }
  .sheet .sites { columns: 2; column-gap: 16pt; }
  .sheet .crit { font-size: 10pt; }
  .sheet .crit-head { font-weight: 700; margin: 5pt 0 1pt; }
  .sheet-url { margin-top: 10pt; font-size: 11pt; }
  .sheet-note { font-size: 8.5pt; color: #444; }
}
#guide-hint { margin-bottom: 18px; }
#guide-hint ul { margin: 4px 0 0; }
@media print {
  .sheet-url { display: flex; align-items: center; gap: 12pt; margin-top: 10pt; break-inside: avoid; }
  .sheet-url svg { width: 26mm; height: 26mm; flex: none; }
  .sheet-url p { margin: 0; }
}
.pill.gene { background: var(--bg-alt); color: var(--ink); border: 1px solid var(--line); }

/* Community page */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.chip { font: inherit; font-size: 1.05rem; font-weight: 600; min-height: 48px; padding: 8px 18px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.chip:hover { border-color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.org-count { font-size: 1.3rem; margin: 26px 0 14px; }
.org[hidden] { display: none; }
.org-region { font-family: var(--font-head); font-size: .95rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); margin: 0 0 4px; }
.org h3 a { text-decoration: none; }
.org h3 a:hover { text-decoration: underline; }
.org-offers { margin: 8px 0 16px; padding-left: 1.2em; }
.org-offers li { margin: 2px 0; }
.filters .chips { grid-column: 1 / -1; }
#events { margin-top: 36px; } #events h3 { font-size: 1.5rem; margin-bottom: 14px; }
.card-link { display: block; color: inherit; text-decoration: none; border: 2px solid var(--accent); transition: box-shadow .15s, transform .15s; }
.card-link:hover, .card-link:focus-visible { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.card-link .card-more { color: var(--accent); font-weight: 700; margin-top: 12px; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .card-link { transition: none; } }
section[id] { scroll-margin-top: 140px; }
@media (max-width: 900px) { section[id] { scroll-margin-top: 16px; } }

/* Languages */
.lang-switch { display: flex; gap: 4px; align-items: center; }
.lang-switch a { font-family: var(--font-head); font-weight: 600; text-decoration: none; color: var(--ink); padding: 8px 12px; border-radius: 999px; min-height: 44px; display: inline-flex; align-items: center; border: 2px solid var(--line); }
.lang-switch a[aria-current="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.en-only { font-size: .8em; font-weight: 400; opacity: .75; }
.translated-note { padding-top: 14px; }
.translated-note p { margin: 0; }
html[lang^="zh"] { --font-body: "RG Digits", "Atkinson Hyperlegible", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif; --font-head: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif; }
html[lang^="zh"] body { line-height: 1.75; }
html[lang^="zh"] h1, html[lang^="zh"] h2, html[lang^="zh"] h3 { letter-spacing: 0; }
@media print { .lang-switch, .translated-note { display: none !important; } }

/* ---------- Illustrations (src/_art/*.svg, inlined at build so they follow the colour mode) ---------- */
:root {
  --ill-rod: #2f6fe0; --ill-rod-soft: #c9dafb; --ill-cone: #e8833a; --ill-cone-soft: #fad9bd;
  --ill-rpe: #8a5a2b; --ill-teal: #12a39a; --ill-variant: #d6336c; --ill-light: #e6a700;
  --ill-soft: var(--accent-soft); --ill-affected: #2f6fe0;
  --brand-grad: linear-gradient(100deg, #0a4fb5 0%, #2f6fe0 45%, #12a39a 100%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-contrast="high"]) {
    --ill-rod: #7ab1ff; --ill-rod-soft: #23406e; --ill-cone: #ffa45c; --ill-cone-soft: #5a3a1e;
    --ill-rpe: #c08850; --ill-teal: #3fd0c9; --ill-variant: #ff6b9a; --ill-light: #ffd34d; --ill-affected: #7ab1ff;
    --brand-grad: linear-gradient(100deg, #7ab1ff 0%, #a9ccff 45%, #3fd0c9 100%);
  }
}
:root[data-contrast="high"] {
  --ill-rod: #ffe14d; --ill-rod-soft: #000; --ill-cone: #ffffff; --ill-cone-soft: #000; --ill-rpe: #ffffff;
  --ill-teal: #7dffa0; --ill-variant: #ff5c8a; --ill-light: #ffe14d; --ill-soft: #000; --ill-affected: #ffe14d;
}
.art { display: block; width: 100%; height: auto; }
.art .f-rod { fill: var(--ill-rod); } .art .f-rod-soft { fill: var(--ill-rod-soft); }
.art .f-cone { fill: var(--ill-cone); } .art .f-cone-soft { fill: var(--ill-cone-soft); }
.art .f-rpe { fill: var(--ill-rpe); } .art .f-soft { fill: var(--ill-soft); }
.art .f-card { fill: var(--card); } .art .f-card-glass { fill: var(--card); fill-opacity: .55; }
.art .f-ink2 { fill: var(--ink-2); } .art .f-affected { fill: var(--ill-affected); }
.art .s-line { stroke: var(--ink-2); } .art .s-ink { stroke: var(--ink); } .art .s-card { stroke: var(--card); }
.art .s-rod { stroke: var(--ill-rod); } .art .s-cone { stroke: var(--ill-cone); } .art .s-rpe { stroke: var(--ill-rpe); }
.art .s-teal { stroke: var(--ill-teal); } .art .s-variant { stroke: var(--ill-variant); } .art .s-light { stroke: var(--ill-light); }

/* Hero with illustration */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: clamp(24px, 4vw, 64px); align-items: center; }
.hero-art { max-width: 520px; justify-self: end; width: 100%; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } .hero-art { justify-self: center; max-width: 320px; } }

/* Brand emphasis */
.brand { font-size: 1.6rem; gap: 14px; }
.brand svg { width: 46px; height: 46px; }
.brand .brand-2 { color: var(--accent); }
.brand-title { font-family: var(--font-head); font-weight: 800; font-size: clamp(3rem, 6.6vw, 5rem); line-height: 1.02; letter-spacing: -0.035em;
  margin: 0 0 18px; background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-contrast="high"] .brand-title { background: none; color: var(--accent); }
.hero-title { font-family: var(--font-head); font-weight: 700; font-size: clamp(1.9rem, 3.6vw, 2.7rem); line-height: 1.2; letter-spacing: -0.02em; color: var(--ink); margin: 0 0 16px; max-width: 18em; }

/* Section headings get a short accent bar */
.section-head > h2::before, .prose > h2:first-child::before {
  content: ""; display: block; width: 56px; height: 6px; border-radius: 3px; background: var(--brand-grad); margin-bottom: 18px; }
:root[data-contrast="high"] .section-head > h2::before, :root[data-contrast="high"] .prose > h2:first-child::before { background: var(--accent); }

/* Figures */
.figure { margin: 28px 0; }
.figure-row { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 28px; align-items: center; }
.figure-row .art-figure { max-width: 260px; }
@media (max-width: 640px) { .figure-row { grid-template-columns: 1fr; } .figure-row .art-figure { max-width: 220px; margin: 0 auto; } }
.figure-key dt { font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: 10px; }
.figure-key dd { margin: 2px 0 16px; }
.swatch { width: 18px; height: 18px; border-radius: 5px; display: inline-block; flex: none; }
.swatch.rod { background: var(--ill-rod); } .swatch.cone { background: var(--ill-cone); } .swatch.rpe { background: var(--ill-rpe); }
.pedigrees { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 18px; margin: 20px 0 8px; }
.pedigree { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 12px; margin: 0; }
.pedigree figcaption { font-size: 1.05rem; margin-top: 8px; }
.pedigree figcaption b { display: block; font-family: var(--font-head); font-size: 1.1rem; }
.ped-key { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; font-size: 1.05rem; margin-bottom: 18px; }
.ped-key span { display: inline-flex; align-items: center; gap: 8px; }
.ped-key .art-key { width: 56px; }
@media print { .hero-art { display: none; } .brand-title { color: #000; background: none; } }
:root { --ill-cc: #f6c9c4; --ill-rbc: #c8323c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]):not([data-contrast="high"]) { --ill-cc: #4a1f22; --ill-rbc: #ff6b6b; } }
:root[data-contrast="high"] { --ill-cc: #000; --ill-rbc: #ff5c8a; }
.art .f-cc { fill: var(--ill-cc); } .art .f-rbc { fill: var(--ill-rbc); }
.swatch.cc { background: var(--ill-rbc); } .swatch.bruch { background: var(--ink-2); height: 6px; }
.figure-wide picture, .figure-wide img { display: block; width: 100%; height: auto; }
.figure-wide img { border-radius: var(--radius); background: #fff; border: 1px solid var(--line); }
.figure-wide .figure-key { columns: 2 280px; column-gap: 32px; margin-top: 20px; }
.figure-wide .figure-key dt { break-after: avoid; } .figure-wide .figure-key dd { break-before: avoid; break-inside: avoid; }
.figure-wide .credit { color: var(--ink-2); }
.facet-n { color: var(--ink-2); font-weight: 400; }
.pill.approach { background: var(--muted-bg); color: var(--muted-ink); }

/* Retina layers panel: picture and key read as one unit */
.retina-panel { margin: 32px 0; background: var(--card); border: 1px solid var(--line); border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow); overflow: hidden; }
.retina-panel picture, .retina-panel img { display: block; width: 100%; height: auto; background: #fff; }
.layer-key { list-style: none; margin: 0; padding: 22px 24px 8px; display: grid; gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.layer-key li { margin: 0; padding: 14px 16px 16px; border-radius: 14px; background: var(--bg-alt); border-top: 6px solid var(--layer); }
.layer-name { display: block; font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; margin-bottom: 6px; color: var(--ink); }
.layer-text { display: block; font-size: 1.02rem; line-height: 1.5; color: var(--ink-2); }
.layer-cc { --layer: #d63a3f; } .layer-rpe { --layer: #a9805f; } .layer-rod { --layer: #6f9fd8; } .layer-cone { --layer: #f0a24f; }
:root[data-contrast="high"] .layer-key li { border: 2px solid var(--line); border-top-width: 6px; }
.retina-panel figcaption { padding: 4px 24px 18px; }
.retina-panel figcaption p { margin: 6px 0 0; }

@media (max-width: 520px) { .layer-key { grid-template-columns: 1fr; padding: 16px 16px 4px; } .retina-panel figcaption { padding: 4px 16px 16px; } }
