/* RadWorld project page.
   Palette taken from the manuscript figures: compared methods in three periwinkle steps
   (#b4c0e4, #7884b4, #484878) and RadWorld in pink (#f0c0cc), as in Figures 2 to 5.
   Layout rule: every block sits in one .container, so text and images share the same edges. */

:root {
  --text: #16171d;
  --muted: #4f5566;
  --faint: #6a6f80;            /* 5.0:1 on white, 4.55:1 on --bg-alt (WCAG AA) */
  --bg: #ffffff;
  --bg-alt: #f4f6fb;
  --line: #e2e5ee;
  --accent: #484878;           /* figure navy: links, labels, selected states (9:1 on white) */
  --accent-soft: #eef2fa;      /* figure panel fill */
  --tone-1: #b4c0e4;           /* figure periwinkle, light */
  --tone-2: #7884b4;           /* figure periwinkle, medium */
  --tone-3: #484878;           /* figure navy */
  --rw: #f0c0cc;               /* figure pink: RadWorld */
  --rw-soft: #fbedf1;
  --rw-ink: #a34f6d;           /* RadWorld pink as text, 5.4:1 on white */
  --km-high: #cf4a43;          /* Kaplan-Meier curves: red and blue as in Figure 5e */
  --km-low: #3b6db3;
  --real: #484878;
  --real-soft: #eef2fa;
  --syn: #a34f6d;
  --syn-soft: #fbedf1;
  --viewer: #0c0d11;
  --viewer-line: #262833;
  --viewer-text: #e7e8ee;
  --viewer-muted: #9a9eab;
  --container: 1160px;
  --gutter: 24px;
  --radius: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.nowrap { white-space: nowrap; }
h1, h2, h3 { letter-spacing: -0.015em; }
p { margin: 0 0 12px; }

.container {
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
@media (max-width: 640px) { :root { --gutter: 16px; } }

html[data-status="published"] .only-preprint { display: none !important; }
html[data-status="preprint"] .only-published { display: none !important; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 58px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.05rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 6px; }
.topnav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  color: var(--muted);
  font-size: 0.92rem;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
}
.topnav a:hover { color: var(--text); background: var(--bg-alt); text-decoration: none; }
.topnav a[aria-current="true"] { color: var(--text); font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  white-space: nowrap;
}
.pill:hover { background: #33363f; text-decoration: none; }
.pill.is-disabled { background: #eceef4; color: #666b7c; cursor: default; }
.pill .soon { font-size: 0.7rem; opacity: 0.85; }
@media (max-width: 860px) {
  .topbar-inner { gap: 12px; }
  .topbar-actions { display: none; }
}
@media (max-width: 520px) {
  .brand { font-size: 0.98rem; }
  .topnav a { padding: 6px 7px; font-size: 0.86rem; }
}

/* ---------------------------------------------------------------- hero */
.hero { padding: 64px 0 72px; border-bottom: 1px solid var(--line); }
.hero-text { text-align: center; }
.hero h1 { font-size: clamp(2.8rem, 7vw, 4.4rem); line-height: 1; margin: 0; letter-spacing: -0.03em; }
.hero .subtitle { font-size: clamp(1.2rem, 2.6vw, 1.6rem); line-height: 1.3; margin: 14px auto 0; font-weight: 500; color: #2b2e38; }
.hero .lead { font-size: 1.1rem; line-height: 1.6; color: var(--muted); max-width: 780px; margin: 18px auto 28px; }
.authors { font-size: 1rem; line-height: 1.8; max-width: 920px; margin: 0 auto 6px; }
.authors span { white-space: nowrap; }
.authors sup, .affils sup { font-size: 0.68em; color: var(--muted); margin-left: 1px; }
.affils { font-size: 0.88rem; color: var(--muted); line-height: 1.7; max-width: 920px; margin: 8px auto 0; }
.affils span { display: inline-block; margin: 0 8px; }
.notes { font-size: 0.84rem; color: var(--faint); margin-top: 6px; }

.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 24px 0 0; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  background: #22242c;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.2;
  border: 0;
  cursor: pointer;
}
.btn:hover { background: #3a3d49; text-decoration: none; }
.btn svg { width: 17px; height: 17px; fill: currentColor; flex: none; }
.btn.is-disabled { background: #eceef4; color: #666b7c; cursor: default; }
.btn .soon { font-size: 0.72rem; font-weight: 600; opacity: 0.85; }

.strip-label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin: 52px 0 12px; }
.strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.strip-item { margin: 0; }
.strip-item .frame { background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 1; }
.strip-item img { width: 100%; height: 100%; object-fit: contain; display: block; }
.strip-item figcaption { font-size: 0.84rem; color: var(--muted); margin-top: 9px; line-height: 1.4; }
.strip-item figcaption b { display: block; color: var(--text); font-weight: 600; }
@media (max-width: 900px) {
  .strip {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(200px, 42%);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 6px;
  }
  .strip-item { scroll-snap-align: start; }
}

/* ---------------------------------------------------------------- sections */
.section { padding: 88px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { margin-bottom: 36px; }
.kicker {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
}
.section-head h2 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); line-height: 1.15; margin: 0; }
.section-sub { font-size: 1.04rem; color: var(--muted); margin: 12px 0 0; line-height: 1.6; }
@media (max-width: 860px) {
  .section { padding: 64px 0; }
  .section-head { margin-bottom: 28px; }
}

/* ---------------------------------------------------------------- hero: the world-model figure */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wm-tagline { margin: 46px auto 26px; text-wrap: balance; text-align: center; font-size: clamp(1.2rem, 2.3vw, 1.55rem); font-weight: 650; line-height: 1.3; letter-spacing: -0.01em; color: var(--text); }
.wm { position: relative; margin: 0; }
.wm-row, .wm-values { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); column-gap: 20px; }
.wm-cell { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.wm-inputs .wm-cell { justify-content: flex-end; }  /* the images line up when a caption wraps */
.wm-cap { margin: 0 0 10px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); text-align: center; }
.wm-in { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 124px; }
.wm-in img { display: block; width: 124px; height: 124px; border-radius: 12px; object-fit: cover; background: #000; box-shadow: 0 10px 22px -14px rgba(0, 0, 0, 0.6); }
.wm-quote { padding: 12px 14px; border: 1.5px dashed #bfc5d8; border-radius: 14px; background: #fff; }
.wm-quote p { margin: 0; font-size: 0.98rem; line-height: 1.45; font-style: italic; text-align: center; color: #2b2e38; }
.wm-chip {  /* the procedural variables go in with the pre-treatment CT: a label on its arrow */
  position: absolute; top: calc(100% + 9px); left: 50%; z-index: 1; transform: translateX(-50%); margin: 0;
  padding: 3px 10px; border: 1.5px dashed #bfc5d8; border-radius: 999px; background: #fff;
  font-size: 0.72rem; font-weight: 600; line-height: 1.3; white-space: nowrap; color: var(--accent);
}
.wm-model { position: relative; z-index: 1; height: 124px; margin: 46px 0 50px; border-radius: 22px; overflow: hidden; box-shadow: 0 22px 40px -24px rgba(44, 44, 82, 0.75); }
.wm-ridges { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.wm-ridges .ridge { fill: none; stroke: #c9cdf0; stroke-width: 1.2; }
.wm-ridges .pick { fill: #f0c0cc; stroke: #fff; stroke-width: 1.5; }
.wm-name { position: relative; z-index: 1; margin: 0; padding-top: 14px; display: flex; flex-direction: column; align-items: center; gap: 1px; color: #fff; text-align: center; pointer-events: none; }
.wm-name b { font-size: 1.65rem; line-height: 1.15; letter-spacing: -0.02em; text-shadow: 0 2px 14px rgba(26, 26, 54, 0.9); }
.wm-name span { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: #d4d8f2; text-shadow: 0 1px 8px rgba(26, 26, 54, 0.9); }
.wm-out { width: 158px; height: 158px; margin-top: 18px; }
.wm-out img {  /* a stack of slices behind the front one: a 3D volume, as drawn in Figure 1 */
  display: block; width: 100%; height: 100%; border-radius: 12px; object-fit: cover; background: #000;
  box-shadow: 5px -5px 0 -1px #0b0c10, 6px -6px 0 -1px #6a6e84, 11px -11px 0 -2px #0b0c10, 12px -12px 0 -2px #6a6e84,
    17px -17px 0 -3px #0b0c10, 18px -18px 0 -3px #6a6e84, 0 16px 28px -16px rgba(0, 0, 0, 0.7);
}
.wm-task { margin: 14px 0 0; font-size: 0.98rem; font-weight: 700; text-align: center; color: var(--text); }
.wm-values { margin-top: 26px; row-gap: 12px; }
.wm-value {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 13px 18px; border: 1.5px solid #f0cbd6; border-radius: 14px; background: var(--rw-soft);
  color: var(--text); text-align: center; transition: background 0.15s, border-color 0.15s;
}
.wm-value[data-span="3"] { grid-column: span 3; }
.wm-value:hover { background: #f8e2e9; border-color: #e9b3c2; text-decoration: none; }
.wm-value b { font-size: 1rem; color: var(--rw-ink); }
.wm-value span { font-size: 0.84rem; line-height: 1.4; color: var(--muted); }
.wm-wires { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.wm-wires .wire { stroke: #b4bad0; stroke-width: 1.6; stroke-dasharray: 4 5; }
.wm-wires .head { fill: #b4bad0; }
@media (max-width: 1100px) {
  .wm-row, .wm-values { column-gap: 12px; }
  .wm-in, .wm-in img { height: 100px; }
  .wm-in img { width: 100px; }
  .wm-chip { font-size: 0.66rem; padding: 2px 8px; }
  .wm-out { width: 128px; height: 128px; }
  .wm-quote p { font-size: 0.84rem; }
  .wm-task { font-size: 0.88rem; }
}
/* tablets: smaller scans, so that their stacks stay apart, and the uses in two columns */
@media (min-width: 721px) and (max-width: 900px) {
  .wm-quote { padding: 8px 10px; }
  .wm-quote p { font-size: 0.8rem; line-height: 1.4; }
  .wm-out { width: 112px; height: 112px; }
  .wm-out img { box-shadow: 4px -4px 0 -1px #0b0c10, 5px -5px 0 -1px #6a6e84, 9px -9px 0 -2px #0b0c10, 10px -10px 0 -2px #6a6e84, 0 12px 22px -14px rgba(0, 0, 0, 0.7); }
  .wm-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wm-value[data-span="3"] { grid-column: 1 / -1; }
}
/* phones: the inputs on the left, RadWorld down the middle and the generated scans on the right, as on
   wide screens turned on its side, then the uses. Captions go under the inputs, as the tasks go under
   the scans, so that each input and its scan sit at the same height. */
@media (max-width: 720px) {
  .wm-tagline { margin: 34px auto 24px; }
  .wm { --wm-img: clamp(80px, 23vw, 120px); display: grid; grid-template-columns: minmax(0, 1fr) 84px minmax(0, 1fr); column-gap: 22px; row-gap: 22px; }
  .wm-row, .wm-values { display: contents; }
  .wm-inputs .wm-cell { grid-column: 1; justify-content: flex-start; }
  .wm-outputs .wm-cell { grid-column: 3; }
  .wm-row .wm-cell:nth-child(1) { grid-row: 1; }
  .wm-row .wm-cell:nth-child(2) { grid-row: 2; }
  .wm-row .wm-cell:nth-child(3) { grid-row: 3; }
  .wm-row .wm-cell:nth-child(4) { grid-row: 4; }
  .wm-row .wm-cell:nth-child(5) { grid-row: 5; }
  .wm-model { grid-column: 2; grid-row: 1 / 6; height: auto; margin: 0; border-radius: 18px; }
  .wm-name { position: absolute; top: 0; bottom: 0; left: 7px; padding: 0; justify-content: center; writing-mode: vertical-rl; transform: rotate(180deg); }
  .wm-name b { font-size: 1.3rem; }
  .wm-name span { font-size: 0.56rem; letter-spacing: 0.08em; }
  .wm-cap { order: 1; margin: 8px 0 0; font-size: 0.6rem; letter-spacing: 0.05em; }
  .wm-in { height: auto; }
  .wm-in img { width: var(--wm-img); height: var(--wm-img); }
  .wm-quote { min-height: var(--wm-img); padding: 8px 9px; }
  .wm-quote p { font-size: 0.7rem; line-height: 1.38; }
  .wm-chip { position: static; order: 2; transform: none; margin-top: 6px; padding: 2px 8px; border-radius: 10px; font-size: 0.62rem; white-space: normal; text-align: center; }
  .wm-out { width: var(--wm-img); height: var(--wm-img); margin-top: 0; }
  .wm-out img { box-shadow: 4px -4px 0 -1px #0b0c10, 5px -5px 0 -1px #6a6e84, 9px -9px 0 -2px #0b0c10, 10px -10px 0 -2px #6a6e84, 0 12px 22px -14px rgba(0, 0, 0, 0.7); }
  .wm-task { margin-top: 8px; font-size: 0.8rem; line-height: 1.3; }
  .wm-value, .wm-value[data-span="3"] { grid-column: 1 / -1; }
  .wm-values .wm-value:first-child { margin-top: 8px; }
}

/* ---------------------------------------------------------------- carousels (assets/js/carousel.js) */
.carousel { position: relative; }
.carousel-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.carousel-tabs { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.carousel-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px 7px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.carousel-tabs button:hover { border-color: var(--tone-1); }
.carousel-tabs .n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 0.78rem; font-weight: 700; }
.carousel-tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.carousel-tabs button[aria-selected="true"] .n { background: rgba(255, 255, 255, 0.18); color: #fff; }
.carousel-tabs button:focus-visible, .carousel-btn:focus-visible, .carousel-side:focus-visible { outline: 2px solid var(--tone-2); outline-offset: 2px; }
.carousel-pager { display: flex; align-items: center; gap: 8px; flex: none; }
.carousel-count { min-width: 3.2em; text-align: center; font-size: 0.86rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.carousel-btn, .carousel-side {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(22, 23, 29, 0.07);
  transition: box-shadow 0.15s, opacity 0.15s;
}
.carousel-btn:hover:not(:disabled), .carousel-side:hover:not(:disabled) { box-shadow: 0 4px 14px rgba(22, 23, 29, 0.14); }
.carousel-btn svg, .carousel-side svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.carousel-btn:disabled, .carousel-side:disabled { opacity: 0.3; cursor: default; box-shadow: none; }
.carousel-viewport {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 14px 34px -22px rgba(22, 23, 29, 0.28);
  transition: height 0.35s ease;
  touch-action: pan-y;
}
.carousel-track { display: flex; align-items: flex-start; transition: transform 0.5s cubic-bezier(0.22, 0.7, 0.18, 1); }
.carousel.is-equal .carousel-track { align-items: stretch; }  /* wide screens: every slide as tall as the tallest */
.slide { flex: 0 0 100%; min-width: 0; padding: 24px; }
/* large buttons beside the slide, level with its images */
.carousel-side { position: absolute; z-index: 5; top: var(--side-top, 50%); width: 48px; height: 48px; margin-top: -24px; }
.carousel-side[data-step="-1"] { left: -24px; }
.carousel-side[data-step="1"] { right: -24px; }
@media (min-width: 1041px) { .carousel-pager .carousel-btn { display: none; } }
@media (max-width: 1040px) { .carousel-side { display: none; } }
@media (max-width: 640px) {
  .carousel-bar { align-items: flex-start; }
  .carousel-tabs {  /* one scrolling row, faded at the right edge so the next tab shows there is more */
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 1px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  .carousel-tabs.at-end { -webkit-mask-image: none; mask-image: none; }
  .carousel-tabs::-webkit-scrollbar { display: none; }
  .carousel-tabs button { padding: 6px 12px 6px 6px; font-size: 0.86rem; }
  .carousel-btn { width: 36px; height: 36px; }
  .carousel-count { display: none; }
  .slide { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { .carousel-track, .carousel-viewport { transition: none; } }

/* slide content: heading with input and output, the viewer, then the chart for this task */
.slide-head { margin: 0 0 16px; }
.slide-head h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 8px; font-size: 1rem; }
.flow-in, .flow-out { display: inline-flex; align-items: center; padding: 5px 13px; border-radius: 999px; font-size: 0.95rem; line-height: 1.25; }
.flow-in { background: var(--accent-soft); color: var(--accent); }
.flow-out { background: var(--rw-soft); color: var(--rw-ink); }
.flow-arrow {
  display: inline-block; flex: none; width: 24px; height: 12px; background: var(--faint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M1 6h20M16 1.5 21 6l-5 4.5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M1 6h20M16 1.5 21 6l-5 4.5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.slide-head p { margin: 0; font-size: 0.94rem; color: var(--muted); max-width: 860px; }
.slide-media { margin-bottom: 22px; }
.slide > .chart, .slide-charts { border-top: 1px solid var(--line); padding-top: 20px; }
.slide > .chart { border-left: 0; border-right: 0; border-bottom: 0; border-radius: 0; padding-left: 0; padding-right: 0; padding-bottom: 0; background: none; }
.slide-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.slide-charts > .chart { border: 0; border-radius: 0; padding: 0; background: none; }
@media (max-width: 900px) { .slide-charts { grid-template-columns: minmax(0, 1fr); gap: 26px; } }

/* generation slides (assets/js/showcase.js): the input, then three views playing through the volume */
.show-cases { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.show-cases .chip {
  padding: 5px 13px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted);
  font: inherit; font-size: 0.84rem; cursor: pointer; transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.show-cases .chip:hover { border-color: var(--tone-1); color: var(--text); }
.show-cases .chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #fff; }
.show-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.show-input { position: relative; display: flex; flex-direction: column; aspect-ratio: 1; min-width: 0; padding: 16px 18px; overflow: hidden; border-radius: 12px; background: var(--accent-soft); }
.show-label { margin: 0 0 12px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.show-tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }
.show-tags li { padding: 5px 11px; border: 1px solid #d5daea; border-radius: 999px; background: #fff; font-size: 0.88rem; font-weight: 600; }
.show-tags li:first-child { background: var(--accent); border-color: var(--accent); color: #fff; }
.show-note { margin: auto 0 0; font-size: 0.82rem; color: var(--muted); }
.show-input blockquote { margin: 0; font-size: 0.95rem; line-height: 1.5; color: var(--text); }
.show-input[data-kind="mask"] { padding: 0; background: #000; }
.show-input[data-kind="mask"] .show-label { position: absolute; left: 10px; top: 9px; z-index: 1; margin: 0; color: #fff; text-shadow: 0 1px 3px #000; }
.show-input .slice.mask { position: absolute; inset: 0; background-repeat: no-repeat; }
.show-view { position: relative; margin: 0; aspect-ratio: 1; min-width: 0; overflow: hidden; border-radius: 12px; background: #000; cursor: ew-resize; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.show-view .slice { position: absolute; inset: 0; background-repeat: no-repeat; transition: opacity 0.18s ease; }
.show-view .overlay { opacity: 0; }
.show-view.is-active .overlay { opacity: 1; }  /* organ mask on the CT while the pointer is on the view */
.show-view .arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; transition: opacity 0.15s; }
.show-view .arrows.off { opacity: 0; }
.show-view .arrows line { stroke: #ffd60a; stroke-width: 1.6; stroke-linecap: round; }
.show-view .arrows path { fill: #ffd60a; }
.show-view figcaption { position: absolute; left: 10px; bottom: 8px; font-size: 0.74rem; color: #fff; text-shadow: 0 1px 3px #000; pointer-events: none; }
.show-grid.is-switching .slice, .show-grid.is-switching .show-input > * { opacity: 0.15; }
.show-input > * { transition: opacity 0.18s ease; }
.show-hint { display: flex; align-items: center; gap: 8px; width: fit-content; margin: 12px auto 0; padding: 5px 14px; border-radius: 999px; background: var(--bg-alt); font-size: 0.8rem; color: var(--muted); }
.show-hint::before {  /* a left-right arrow */
  content: ""; width: 18px; height: 10px; flex: none; background: var(--faint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 10'%3E%3Cpath d='M1 5h16M4.5 1.5 1 5l3.5 3.5M13.5 1.5 17 5l-3.5 3.5' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 10'%3E%3Cpath d='M1 5h16M4.5 1.5 1 5l3.5 3.5M13.5 1.5 17 5l-3.5 3.5' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
@media (max-width: 760px) {  /* phones: the input across the top, the three views in a row below */
  .show-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .show-input { grid-column: 1 / -1; aspect-ratio: auto; padding: 12px 14px; }
  .show-input[data-kind="mask"] { width: 46%; aspect-ratio: 1; justify-self: start; }
  .show-input blockquote { font-size: 0.86rem; }
  .show-note { margin-top: 10px; }
  .show-tags li { font-size: 0.78rem; padding: 3px 9px; }
  .show-view figcaption { left: 6px; bottom: 4px; font-size: 0.66rem; }
}

/* translation slides: input, arrow, the scan RadWorld generated and the real scan, all the same size */
.tr-media { display: grid; grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; max-width: 960px; margin-left: auto; margin-right: auto; }
.tr-frame { margin: 0; min-width: 0; }
.tr-frame img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: #000; }
.tr-frame figcaption { margin-top: 8px; text-align: center; font-size: 0.84rem; font-weight: 600; color: var(--muted); }
.tr-frame.ours img { box-shadow: 0 0 0 3px var(--rw); }
.tr-frame.ours figcaption { color: var(--rw-ink); }
.tr-arrow {
  align-self: center; justify-self: center; width: 34px; height: 16px; margin-bottom: 28px; background: var(--rw-ink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M1 6h20M16 1.5 21 6l-5 4.5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M1 6h20M16 1.5 21 6l-5 4.5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.tr-fan .fan { position: relative; aspect-ratio: 1; }  /* three input sequences fanned out in one frame */
.tr-fan .fan img { position: absolute; width: 74%; height: 74%; border-radius: 10px; box-shadow: 0 0 0 2px #fff, 0 10px 18px -10px rgba(0, 0, 0, 0.6); }
.tr-fan .fan img:nth-child(1) { left: 0; top: 0; }
.tr-fan .fan img:nth-child(2) { left: 13%; top: 13%; }
.tr-fan .fan img:nth-child(3) { left: 26%; top: 26%; }
@media (max-width: 760px) {
  .tr-media { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .tr-media > .tr-frame:first-child { grid-column: 1 / -1; justify-self: center; width: 62%; }
  .tr-arrow { grid-column: 1 / -1; margin: -4px 0; transform: rotate(90deg); }
}

/* two charts side by side in a slide: titles, legends and plots on shared rows, so they line up */
.slide-charts { grid-template-rows: auto auto auto; }
@supports (grid-template-rows: subgrid) {
  .slide-charts > .chart { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 0; }
}

/* lines (charts.js): retrieval curves and Hounsfield-unit profiles */
.chart.lines .l-plot { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px 22px; }
.chart.lines .l-plot[hidden] { display: none; }
.l-panel { min-width: 0; }
.v-area.l-area { display: block; }
.l-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.l-line { fill: none; stroke: var(--tone-2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.l-line[data-tone="1"] { stroke: var(--tone-1); }
.l-line[data-tone="3"] { stroke: var(--tone-3); }
.l-line.ours { stroke: var(--rw); stroke-width: 2.6; }
.l-dot { fill: var(--tone-2); stroke: #fff; stroke-width: 1.5; }
.l-dot[data-tone="1"] { fill: var(--tone-1); }
.l-dot[data-tone="3"] { fill: var(--tone-3); }
.l-dot.ours { fill: var(--rw); }
.l-guide { position: absolute; top: 0; bottom: 0; width: 1px; margin-left: -0.5px; background: #9ca2ba; pointer-events: none; }
.l-xlabels { position: relative; height: 20px; margin-left: 38px; font-size: 0.7rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.l-xlabels span { position: absolute; top: 5px; transform: translateX(-50%); white-space: nowrap; }
.l-xlabels.sparse span:nth-child(even) { display: none; }  /* small plots: every other category */
.l-xtitle { margin: 2px 0 0 38px; text-align: center; font-size: 0.72rem; color: var(--faint); }
.chart.lines .chart-legend .key i { width: 16px; height: 3px; border-radius: 2px; }
.chart-legend-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 14px; }
.chart-legend-row .chart-legend { margin: 0; }
.chart-variants { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.chart-variants button { padding: 3px 11px; border: 0; border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: 0.78rem; cursor: pointer; }
.chart-variants button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* treatment: input (pre-treatment CT and the treatment details), arrow, virtual CT, real CT */
.tace-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 56px minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 16px;
  row-gap: 10px;
  align-items: start;
  margin-bottom: 0;
}
.tace-label { grid-row: 1; margin: 0; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.tace-label[data-col="in"] { grid-column: 1 / 3; }
.tace-label[data-col="out"] { grid-column: 4; color: var(--rw-ink); }
.tace-label[data-col="ref"] { grid-column: 5; }
.tace-img { grid-row: 2; margin: 0; min-width: 0; }
.tace-img img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: #000; }
.tace-img figcaption { margin-top: 8px; text-align: center; font-size: 0.84rem; font-weight: 600; color: var(--muted); }
.tace-img.ours img { box-shadow: 0 0 0 3px var(--rw); }
.tace-img.ours figcaption { color: var(--rw-ink); }
.tace-flow [data-col="pre"] { grid-column: 1; }
.tace-flow [data-col="virtual"] { grid-column: 4; }
.tace-flow [data-col="real"] { grid-column: 5; }
.tace-rx { grid-column: 2; grid-row: 2; align-self: stretch; display: flex; flex-direction: column; justify-content: center; margin-bottom: 31px; padding: 16px 18px; border-radius: 12px; background: var(--accent-soft); }
.tace-rx-head { margin: 0 0 12px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.tace-rx dl { display: grid; gap: 10px; margin: 0; }
.tace-rx dt { font-size: 0.76rem; color: var(--faint); }
.tace-rx dd { margin: 1px 0 0; font-size: 0.92rem; font-weight: 600; line-height: 1.35; }
.tace-arrow {
  grid-column: 3; grid-row: 2; align-self: center; justify-self: center; width: 44px; height: 18px; margin-bottom: 31px; background: var(--rw-ink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M1 6h20M16 1.5 21 6l-5 4.5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M1 6h20M16 1.5 21 6l-5 4.5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
@media (max-width: 760px) {
  .tace-flow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 12px; }
  .tace-label[data-col="in"] { grid-column: 1 / -1; grid-row: 1; }
  .tace-flow [data-col="pre"] { grid-column: 1; grid-row: 2; }
  .tace-rx { grid-column: 2; grid-row: 2; padding: 12px; }
  .tace-rx dd { font-size: 0.84rem; }
  .tace-arrow { grid-column: 1 / -1; grid-row: 3; margin: 0; transform: rotate(90deg); }
  .tace-label[data-col="out"] { grid-column: 1; grid-row: 4; }
  .tace-label[data-col="ref"] { grid-column: 2; grid-row: 4; }
  .tace-flow [data-col="virtual"] { grid-column: 1; grid-row: 5; }
  .tace-flow [data-col="real"] { grid-column: 2; grid-row: 5; }
}

/* results under the treatment examples: C-index and both Kaplan-Meier cards side by side */
.results-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 24px; align-items: stretch; }
@media (max-width: 1100px) {
  .results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .results-grid > .chart { grid-column: 1 / -1; }
}
@media (max-width: 700px) { .results-grid { grid-template-columns: minmax(0, 1fr); } }

/* a block of chart cards (the synthetic-data section stacks them in one column) */
.evidence { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 20px; margin-top: 20px; }
.evidence.stack { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1100px) { .evidence { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- viewer (used by the explorer and the Turing test) */
.viewer {
  background: var(--viewer);
  color: var(--viewer-text);
  border-radius: var(--radius);
  padding: 14px;
  position: relative;
}
.viewer .tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.viewer .tab {
  background: transparent;
  color: var(--viewer-muted);
  border: 1px solid var(--viewer-line);
  border-radius: 999px;
  padding: 5px 13px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.viewer .tab:hover { color: var(--viewer-text); border-color: #3a3d4b; }
.viewer .tab[aria-selected="true"] { background: #e9ebf5; color: #16171d; border-color: #e9ebf5; }
.case { display: grid; gap: 14px; }
.case.with-text { grid-template-columns: minmax(230px, 320px) minmax(0, 1fr); }
@media (max-width: 860px) { .case.with-text { grid-template-columns: minmax(0, 1fr); } }
.case-text {
  align-self: start;
  background: #15161c;
  border: 1px solid var(--viewer-line);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #d7d9e2;
  max-height: 480px;
  overflow: auto;
}
.case-text .label { color: var(--viewer-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.case-text p { margin: 0 0 8px; }
.case-credit { font-size: 0.78rem; color: var(--viewer-muted); margin-top: 8px; }
.stage { position: relative; min-width: 0; }
.panes { display: flex; gap: 8px; align-items: flex-start; }
.panes.compare { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); }
.pane {
  position: relative;
  flex: var(--ar, 1) 1 0;
  min-width: 0;
  aspect-ratio: var(--ar, 1);
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.pane img.poster, .pane canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pane .pane-title, .pane .pane-info { z-index: 2; }
.pane canvas { cursor: crosshair; }
.pane .pane-title {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  padding: 7px 9px 14px;
  background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
  font-size: 0.76rem;
  color: #fff;
  pointer-events: none;
  line-height: 1.3;
}
.pane .pane-info {
  position: absolute;
  right: 8px;
  bottom: 5px;
  font: 11px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #cfd2dc;
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
}
@media (max-width: 640px) {
  .panes:not(.compare) { flex-direction: column; }
  .panes:not(.compare) .pane { width: 100%; flex: none; }
  .panes.compare { grid-template-columns: minmax(0, 1fr); }
}
.load-cover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to bottom, rgba(12, 13, 17, 0) 40%, rgba(12, 13, 17, 0.55));
  border-radius: 8px;
}
.load-btn {
  background: rgba(255, 255, 255, 0.95);
  color: #16171d;
  border: 0;
  border-radius: 999px;
  padding: 11px 20px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}
.load-btn small { font-weight: 500; color: #555b6b; margin-left: 6px; }
.load-btn:disabled { cursor: progress; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 12px; font-size: 0.82rem; color: var(--viewer-muted); }
.controls .group { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.controls .ctl-label { margin-right: 4px; }
.controls button.chip {
  background: #1b1c23;
  color: #cfd2dc;
  border: 1px solid var(--viewer-line);
  border-radius: 6px;
  padding: 3px 9px;
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.35;
  cursor: pointer;
}
.controls button.chip:hover { color: #fff; }
.controls button.chip[aria-pressed="true"] { background: #e9ebf5; color: #16171d; border-color: #e9ebf5; }
.controls label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.controls .opts { gap: 6px 14px; }
.controls .slice-group { flex: 1 1 280px; flex-wrap: nowrap; }
.controls .slice-count { flex: none; min-width: 7.2em; text-align: right; color: #cfd2dc; font-variant-numeric: tabular-nums; }
/* slider drawn explicitly so the track is visible on the dark viewer */
.controls input[type="range"] { -webkit-appearance: none; appearance: none; flex: 1 1 auto; min-width: 80px; height: 26px; margin: 0 8px 0 0; background: transparent; cursor: pointer; }
.controls input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: #3d4150; }
.controls input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin-top: -6px; border: 0; border-radius: 50%; background: #e9ebf5; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.controls input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: #3d4150; }
.controls input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #e9ebf5; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.controls input[type="range"]:focus-visible { outline: 2px solid #8f9bd1; outline-offset: 2px; border-radius: 4px; }
/* phones: one row per control, labels in one column so every row starts at the same place */
@media (max-width: 640px) {
  .stage > .controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .stage > .controls .group { display: flex; flex-wrap: nowrap; }
  .stage > .controls .ctl-label { flex: 0 0 56px; margin-right: 0; }
  .stage > .controls .opts { flex-wrap: wrap; padding-left: 60px; }  /* label column plus the group gap */
  .stage > .controls .slice-count { min-width: 6.4em; }
}
.controls[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.pending-box { border: 1px dashed #3d4050; border-radius: 10px; padding: 26px 18px; text-align: center; color: var(--viewer-muted); font-size: 0.9rem; }
.pending-box b { color: var(--viewer-text); display: block; margin-bottom: 4px; font-size: 1rem; }
.pending-box code { color: #d7d9e2; }
.viewer .error { color: #ffb4b4; font-size: 0.85rem; margin-top: 8px; }

/* ---------------------------------------------------------------- charts */
.chart {
  position: relative;
  margin: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
}
.chart figcaption { margin-bottom: 16px; }
.chart figcaption h3 { font-size: 1rem; line-height: 1.3; margin: 0 0 4px; }
.chart figcaption p { font-size: 0.84rem; color: var(--muted); margin: 0; line-height: 1.45; }
.chart table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.chart th, .chart td { text-align: left; padding: 6px 0; border-bottom: 1px solid var(--line); }
.chart th { color: var(--faint); font-weight: 600; font-size: 0.78rem; }
.chart td + td, .chart th + th { text-align: right; font-variant-numeric: tabular-nums; }
.chart tr[data-ours] td { font-weight: 700; }
.chart.has-bars table { display: none; }  /* the numbers stay in the HTML; the bars carry them as labels */
.chart-note { font-size: 0.82rem; color: var(--muted); margin: 12px 0 0; }
.hbars { position: relative; display: grid; gap: 10px; margin: auto 0; }  /* centered when the card is stretched by its neighbour */
/* reference line (for example chance level) across all bars: after the name column, or full width when narrow */
.hbars .ref-line { position: absolute; z-index: 1; top: -4px; bottom: -4px; width: 1.5px; margin-left: -0.75px; background: repeating-linear-gradient(to bottom, #6f7489 0 4px, transparent 4px 8px); left: calc(36% + 12px + (100% - 36% - 12px) * var(--ref)); pointer-events: none; }
.chart.is-narrow .hbars .ref-line { left: calc(100% * var(--ref)); top: 14px; }
.hbar { display: grid; grid-template-columns: minmax(0, 36%) minmax(0, 1fr); grid-template-areas: "name track"; gap: 4px 12px; align-items: center; outline: none; border-radius: 6px; }
.hbar .name { grid-area: name; font-size: 0.8rem; color: var(--muted); line-height: 1.25; }
.hbar.ours .name { color: var(--text); font-weight: 700; }
.hbar .track { grid-area: track; position: relative; height: 16px; }
.hbar .fill { position: absolute; left: 0; top: 0; bottom: 0; min-width: 3px; border-radius: 0 4px 4px 0; background: var(--tone-2); transition: filter 0.15s; }
.hbar[data-tone="1"] .fill { background: var(--tone-1); }
.hbar[data-tone="2"] .fill { background: var(--tone-2); }
.hbar[data-tone="3"] .fill { background: var(--tone-3); }
.hbar.ours .fill { background: var(--rw); }
.chart.is-narrow .hbar { grid-template-columns: minmax(0, 1fr); grid-template-areas: "name" "track"; gap: 3px; }
.ref-note { display: flex; align-items: center; gap: 6px; font-size: 0.76rem; color: var(--faint); margin: 10px 0 0; }
.ref-note i { width: 1.5px; height: 12px; background: repeating-linear-gradient(to bottom, #6f7489 0 4px, transparent 4px 8px); }
.chart.is-narrow .hbar .track { height: 14px; }
.hbar:hover .fill, .hbar:focus-visible .fill { filter: brightness(1.06) saturate(1.15); }
.hbar:focus-visible { box-shadow: 0 0 0 2px var(--accent-soft); }
.hbar-group { font-size: 0.78rem; font-weight: 700; color: var(--muted); margin: 4px 0 -4px; }
.hbar-group:first-child { margin-top: 0; }

.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 14px; font-size: 0.8rem; color: var(--muted); }
.chart-legend .key { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .key i { width: 11px; height: 11px; border-radius: 2px; background: var(--tone-2); }
.chart-legend .key[data-tone="1"] i { background: var(--tone-1); }
.chart-legend .key[data-tone="3"] i { background: var(--tone-3); }
.chart-legend .key.ours { color: var(--text); font-weight: 700; }
.chart-legend .key.ours i { background: var(--rw); }
.chart.lollipop .chart-legend .key i { border-radius: 50%; }
.chart.is-narrow .chart-legend.compact { display: grid; grid-template-columns: repeat(2, max-content); gap: 6px 22px; }

/* vertical charts: grouped bars and lollipops, as in the paper's figures */
.v-plot { display: flex; gap: 20px; }
.chart.stack-panels .v-plot { flex-direction: column; gap: 18px; }
.v-panel { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.v-panel-title { font-size: 0.8rem; font-weight: 700; color: var(--muted); margin: 0 0 2px 38px; }
.v-body { display: flex; height: 176px; padding-top: 8px; }
.v-axis { position: relative; width: 38px; flex: none; font-size: 0.7rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.v-axis span { position: absolute; right: 7px; transform: translateY(50%); }
.v-area { position: relative; flex: 1; display: flex; align-items: flex-end; border-bottom: 1px solid #c3c9dc; }
.v-grid { position: absolute; left: 0; right: 0; height: 1px; background: var(--line); }
.v-group { position: relative; flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding: 0 6px; outline: none; border-radius: 4px 4px 0 0; }
.v-group.lolli { padding: 0; }
.v-group:hover, .v-group:focus-visible { background: rgba(72, 72, 120, 0.05); }
.v-bar { position: relative; flex: 1 1 0; max-width: var(--bar-max, 30px); min-height: 1px; background: var(--tone-2); border-radius: 3px 3px 0 0; }
[data-same-bars] .v-group { padding: 0 4px; gap: 2px; }  /* charts that share one bar width (charts.js syncBars) */
.v-bar[data-tone="1"] { background: var(--tone-1); }
.v-bar[data-tone="3"] { background: var(--tone-3); }
.v-bar.ours { background: var(--rw); }
.v-xlabels { display: flex; margin-left: 38px; }
.v-xlabel { flex: 1 1 0; min-width: 0; text-align: center; font-size: 0.72rem; line-height: 1.25; padding: 7px 2px 0; }
.chart[data-bar] .v-xlabel { font-size: 0.68rem; }  /* many groups: keep long single words apart */
/* one setting across methods (data-by="method"): one group per metric panel, the legend names the methods */
.chart[data-by="method"] .v-group { gap: 6px; padding: 0 14%; }
.chart[data-by="method"] .v-plot { gap: 26px; }
.v-xlabel.metric { font-weight: 700; color: var(--muted); }
.m-row.named { display: grid; grid-template-columns: minmax(0, 36%) minmax(0, 1fr); gap: 10px; align-items: center; height: auto; margin-bottom: 6px; }
.m-row.named .m-name { font-size: 0.8rem; line-height: 1.2; }
.m-row.named.ours .m-name { font-weight: 700; }
.chart.lollipop .v-body { height: 260px; }
.lolli .stem { position: absolute; left: 50%; width: 2px; margin-left: -1px; background: #cdd2e4; }
.lolli .dot { position: absolute; left: 50%; width: 12px; height: 12px; margin: 0 0 -6px -6px; border-radius: 50%; background: var(--tone-2); box-shadow: 0 0 0 2px #fff; }
.lolli .dot[data-tone="1"] { background: var(--tone-1); }
.lolli .dot[data-tone="3"] { background: var(--tone-3); }
.lolli .dot.ours { width: 14px; height: 14px; margin: 0 0 -7px -7px; background: var(--rw); z-index: 2; }
/* narrow cards (phones): the same data drawn horizontally, text in aligned columns */
.m-chart { display: none; }
.chart.is-narrow .v-plot { display: none; }
.chart.is-narrow .m-chart { display: block; }
.m-panel-title { font-size: 0.8rem; font-weight: 700; color: var(--muted); margin: 16px 0 8px; }
.m-panel-title:first-child { margin-top: 0; }
.m-group { margin: 0 0 14px; }
.m-label { font-size: 0.8rem; line-height: 1.3; margin: 0 0 5px; }
.m-row { display: block; height: 14px; margin: 0 0 4px; }
.m-track { position: relative; display: block; height: 14px; }
.m-fill { position: absolute; left: 0; top: 0; bottom: 0; min-width: 2px; border-radius: 0 3px 3px 0; background: var(--tone-2); }
.m-row[data-tone="1"] .m-fill { background: var(--tone-1); }
.m-row[data-tone="3"] .m-fill { background: var(--tone-3); }
.m-row.ours .m-fill { background: var(--rw); }
.m-axis { display: grid; grid-template-columns: minmax(0, 1fr); margin-top: 2px; }
.m-axis.lead { grid-template-columns: minmax(0, 36%) minmax(0, 1fr); gap: 10px; }
.m-ticks { position: relative; display: block; height: 18px; border-top: 1px solid #c3c9dc; font-size: 0.7rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.m-ticks span { position: absolute; top: 3px; transform: translateX(-50%); }
.m-lrow { display: grid; grid-template-columns: minmax(0, 36%) minmax(0, 1fr); gap: 10px; align-items: center; min-height: 28px; padding: 3px 0; outline: none; border-radius: 6px; }
.m-group { outline: none; border-radius: 6px; }
.m-group:focus-visible, .m-lrow:focus-visible { box-shadow: 0 0 0 2px var(--accent-soft); }
.m-name { font-size: 0.8rem; line-height: 1.2; }
.m-ltrack { position: relative; display: block; height: 28px; }
.m-ltrack .m-grid { position: absolute; top: 0; bottom: 0; width: 1px; margin-left: -0.5px; background: var(--line); }
.m-ltrack .stem { position: absolute; top: 50%; height: 2px; margin-top: -1px; background: #cdd2e4; }
.m-ltrack .dot { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--tone-2); box-shadow: 0 0 0 2px #fff; }
.m-ltrack .dot[data-tone="1"] { background: var(--tone-1); }
.m-ltrack .dot[data-tone="3"] { background: var(--tone-3); }
.m-ltrack .dot.ours { width: 12px; height: 12px; margin: -6px 0 0 -6px; background: var(--rw); z-index: 1; }

.chart-tip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: #16171d;
  color: #fff;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.8rem;
  line-height: 1.35;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  max-width: 300px;
}
/* title line, then one grid row per method: colour key, name, value */
.tip-head { display: flex; align-items: baseline; gap: 8px; margin: 0 0 5px; }
.tip-head b { font-size: 0.9rem; }
.tip-sub { font-size: 0.74rem; color: #a9adbd; }
.tip-rows { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; align-items: center; gap: 3px 10px; }
.tip-key { width: 9px; height: 9px; border-radius: 2px; background: var(--tone-2); }
.tip-key[data-tone="1"] { background: var(--tone-1); }
.tip-key[data-tone="3"] { background: var(--tone-3); box-shadow: 0 0 0 1px #8d92b8; }  /* navy needs an edge on the dark tip */
.tip-key.ours { background: var(--rw); }
.tip-name { color: #c9ccd8; }
.tip-val { color: #fff; text-align: right; font-variant-numeric: tabular-nums; }
.tip-name.ours, .tip-val.ours { color: #fff; font-weight: 700; }

/* ---------------------------------------------------------------- Turing test */
.turing-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.turing-intro { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 32px; align-items: center; }
.turing-intro h3 { font-size: 1.2rem; margin: 0 0 8px; }
.turing-intro > div > p { color: var(--muted); }
.turing-intro .chart { border: 0; padding: 0; }
.turing-stat { font-size: 1rem; line-height: 1.5; color: var(--muted); margin: 0 0 22px; max-width: 520px; }
.turing-stat b { display: block; font-size: 2.6rem; line-height: 1.05; letter-spacing: -0.02em; color: var(--rw-ink); margin-bottom: 4px; }
@media (max-width: 860px) { .turing-intro { grid-template-columns: minmax(0, 1fr); } }
.turing-start {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 12px 26px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}
.turing-start:hover { background: #38385f; }
.turing-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.turing-head .title { font-weight: 700; }
.turing-head .meta { font-size: 0.86rem; color: var(--muted); }
.dots { display: flex; gap: 5px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: #d5d9e8; display: block; }
.dots i.done { background: var(--accent); }
.dots i.now { background: #fff; box-shadow: 0 0 0 2px var(--accent) inset; }
.turing-body { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; align-items: start; }
@media (max-width: 760px) { .turing-body { grid-template-columns: minmax(0, 1fr); } }
.turing-body .viewer { padding: 10px; }
.turing-body .pane { width: 100%; max-width: 580px; margin: 0 auto; }
.answer { display: grid; gap: 10px; }
.answer p { font-size: 0.9rem; color: var(--muted); margin: 0; }
.answer button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 13px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}
.answer button:hover { border-color: var(--accent); }
.answer button.real { color: var(--real); }
.answer button.syn { color: var(--syn); }
.answer button:disabled { opacity: 0.5; cursor: progress; }
.answer .kbd { font-weight: 500; color: var(--faint); font-size: 0.8rem; float: right; }
@media (hover: none) { .answer .kbd { display: none; } }
.result-score { font-size: 1.45rem; font-weight: 700; margin: 0 0 6px; }
.result-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 28px; align-items: start; margin-top: 8px; }
@media (max-width: 860px) { .result-grid { grid-template-columns: minmax(0, 1fr); } }
.review { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.review figure { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-size: 0.78rem; }
.review img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #000; }
.review figcaption { padding: 6px 8px; line-height: 1.4; }
.tag { display: inline-block; border-radius: 4px; padding: 0 5px; font-weight: 700; font-size: 0.74rem; }
.tag.real { background: var(--real-soft); color: var(--real); }
.tag.synthetic { background: var(--syn-soft); color: var(--syn); }
.ok { color: var(--real); font-weight: 700; }
.bad { color: var(--syn); font-weight: 700; }
.fineprint { font-size: 0.82rem; color: var(--faint); margin-top: 10px; }

/* ---------------------------------------------------------------- citation */
.cite-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 28px; align-items: start; }
@media (max-width: 860px) { .cite-grid { grid-template-columns: minmax(0, 1fr); } }
.bibtex { position: relative; }
.bibtex pre {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  margin: 0;
}
.copy-btn {
  position: absolute;
  right: 12px;
  top: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 10px;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.contact { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.contact h3 { font-size: 1rem; margin: 0 0 10px; }
.contact ul { list-style: none; margin: 0; padding: 0; }
.contact li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.contact li:last-child { border-bottom: 0; }
.contact li span:last-child { color: var(--muted); }

/* ---------------------------------------------------------------- footer */
footer { border-top: 1px solid var(--line); padding: 28px 0 calc(40px + env(safe-area-inset-bottom, 0px)); color: var(--faint); font-size: 0.84rem; }
.footer-inner p { margin: 0 0 8px; }
footer details { margin-top: 6px; }
footer summary { cursor: pointer; color: var(--muted); }
footer ul { margin: 8px 0; padding-left: 1.2em; }

/* ---------------------------------------------------------------- 3D dialog */
dialog.render3d { width: min(920px, 94vw); padding: 0; border: 0; border-radius: 12px; background: var(--viewer); color: var(--viewer-text); }
dialog.render3d::backdrop { background: rgba(10, 11, 15, 0.7); }
dialog:not([open]) { display: none; }
dialog.no-modal {
  display: block;
  position: fixed;
  top: 4vh;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  z-index: 100;
  max-height: 92vh;
  overflow: auto;
  box-shadow: 0 0 0 100vmax rgba(10, 11, 15, 0.7);
}
.render3d-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--viewer-line); font-size: 0.9rem; }
.render3d-head button { background: none; border: 0; color: var(--viewer-text); font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 2px 6px; }
.render3d-canvas-wrap { position: relative; aspect-ratio: 4 / 3; background: #000; }
.render3d-canvas-wrap canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.render3d-status { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--viewer-muted); font-size: 0.9rem; pointer-events: none; text-align: center; padding: 20px; }
.render3d .controls { padding: 0 14px 12px; }

/* ---------------------------------------------------------------- Kaplan-Meier curves (treatment) */
.km { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 20px 16px; display: flex; flex-direction: column; }
.km figcaption { margin-bottom: 10px; }
.km figcaption h3 { font-size: 1rem; line-height: 1.3; margin: 0 0 4px; }
.km figcaption p { font-size: 0.84rem; color: var(--muted); margin: 0; line-height: 1.45; }
.km .chart-legend .key i { width: 16px; height: 3px; border-radius: 2px; }
.km .chart-legend .key[data-risk="high"] i { background: var(--km-high); }
.km .chart-legend .key[data-risk="low"] i { background: var(--km-low); }
.km-body { display: grid; grid-template-columns: 38px minmax(0, 1fr); grid-template-rows: auto auto; }
.km-plot { position: relative; height: 210px; border-left: 1px solid #c3c9dc; border-bottom: 1px solid #c3c9dc; }
.km-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.km-plot path { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.km-plot path.high { stroke: var(--km-high); }
.km-plot path.low { stroke: var(--km-low); }
.km-plot .v-grid { left: 0; right: 0; }
.km-yaxis { position: relative; font-size: 0.7rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.km-yaxis span { position: absolute; right: 7px; transform: translateY(50%); }
.km-xaxis { grid-column: 2; position: relative; height: 22px; font-size: 0.7rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.km-xaxis span { position: absolute; top: 5px; transform: translateX(-50%); }
.km-xaxis span:last-child { transform: translateX(-100%); }
.km-axis-title { grid-column: 2; text-align: center; font-size: 0.72rem; color: var(--faint); margin-top: 2px; }
.km-stat { font-size: 0.84rem; margin: 10px 0 0; color: var(--text); }
