:root {
  --bg: #05060d;
  --glass: rgba(var(--n1), 0.62);
  --glass-strong: rgba(var(--n2), 0.86);
  --line: rgba(150, 180, 255, 0.14);
  --line-strong: rgba(150, 180, 255, 0.26);
  --text: #eaf0ff;
  --muted: #93a0c4;
  --faint: #5f6b8c;
  --cyan: #3ee6ff;
  --violet: #8d7bff;
  --magenta: #ff3d9a;
  --cyan-rgb: 62, 230, 255; --magenta-rgb: 255, 61, 154; --hall-solid: #080a1d;
  --accent: linear-gradient(90deg, #3ee6ff, #8d7bff 55%, #ff3d9a);
  --radius: 18px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --top-h: 56px;
  --sub-h: 46px;
  --dock-h: 52px;
  --panel-w: clamp(320px, 31vw, 420px);
  color-scheme: dark;
  --ov: 255, 255, 255;              /* hover/track overlays */
  --n0: 5, 6, 13; --n1: 14, 18, 36; --n2: 12, 15, 30; --n3: 10, 13, 28; --n4: 3, 4, 10;   /* panel tints */
  --ok: #38e8b0;
  --pink-text: #ffc2de;
  --toast-bg: rgba(40,14,30,.92);
  --loading-bg: radial-gradient(ellipse at 50% 40%, #0d0f24, #05060d 70%);
  --dna-bg: radial-gradient(ellipse at 50% 0%, #11143a 0%, #070816 55%, #05060d 100%);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f8;
  --glass: rgba(255, 255, 255, 0.8);
  --glass-strong: rgba(255, 255, 255, 0.94);
  --line: rgba(30, 40, 80, 0.15);
  --line-strong: rgba(30, 40, 80, 0.3);
  --text: #0f172a;
  --muted: #3f4a5a;
  --faint: #556070;
  --cyan: #0e7490;
  --violet: #5b4bd6;
  --magenta: #be185d;
  --cyan-rgb: 14, 116, 144; --magenta-rgb: 190, 24, 93; --hall-solid: #f3f5fa;
  --ov: 30, 40, 80;
  --n0: 238, 241, 248; --n1: 255, 255, 255; --n2: 255, 255, 255; --n3: 255, 255, 255; --n4: 200, 206, 222;
  --ok: #047857;
  --pink-text: #9d174d;
  --toast-bg: rgba(255,240,246,.96);
  --loading-bg: radial-gradient(ellipse at 50% 40%, #ffffff, #e6e9f3 70%);
  --dna-bg: radial-gradient(ellipse at 50% 0%, #ffffff 0%, #f1f3f9 55%, #e9ecf5 100%);
}
/* Text, pills and dots colored inline from the dark palette (gap scores, stage and flag pills,
   organ dots): darken them to read on light. Brightness 0.48 takes
   the palette's lightest colors (mint #38e8b0, cyan #3ee6ff, yellow #ffd166) past 4.5:1 on white. */
:root[data-theme="light"] :is(.panel, .dock, .legend) [style*="color"] { filter: brightness(0.48) saturate(1.5); }
/* the floating organ label has its own white bubble, which a filter would turn grey: plain dark text */
:root[data-theme="light"] .organ-label { color: var(--text) !important; box-shadow: 0 2px 8px rgba(20, 30, 70, 0.1); }
/* glass that separates from the light backdrop: soft shadows, white cards with real borders */
:root[data-theme="light"] .panel { box-shadow: 0 14px 40px rgba(20, 30, 70, 0.14), 0 2px 6px rgba(20, 30, 70, 0.06); }
:root[data-theme="light"] :is(.topbar, .dock, .legend, .subbar .seg, .me-bar, .body-pick, .coat-btn) { box-shadow: 0 4px 16px rgba(20, 30, 70, 0.07); }
:root[data-theme="light"] .topbar { box-shadow: 0 1px 0 rgba(20, 30, 70, 0.04); }
:root[data-theme="light"] :is(.row-btn, .card, .news-item, .variant, .sample-btn) { background: rgba(255, 255, 255, 0.85); border-color: var(--line); box-shadow: 0 1px 2px rgba(20, 30, 70, 0.05); }
:root[data-theme="light"] :is(.row-btn, .news-item, .sample-btn):hover { background: #fff; border-color: var(--line-strong); }
:root[data-theme="light"] .modal-card { box-shadow: 0 24px 70px rgba(20, 30, 70, 0.22); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; overscroll-behavior: none; }
body { font: 14px/1.45 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
a { color: var(--cyan); text-decoration: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#app { position: fixed; inset: 0; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#gl:active { cursor: grabbing; }

/* ---------- glass ---------- */
.topbar, .subbar .seg, .me-bar, .body-pick, .panel, .dock, .legend, .modal-card, .organ-label, .tip {
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}

/* ---------- top bar ---------- */
.topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  height: calc(var(--top-h) + var(--sat));
  padding: var(--sat) calc(14px + var(--sar)) 0 calc(14px + var(--sal));
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(180deg, rgba(var(--n0), 0.85), rgba(var(--n0), 0.35));
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.glyph { width: 22px; height: 22px; border-radius: 50%; flex: none; background: conic-gradient(from 200deg, #3ee6ff, #8d7bff, #ff3d9a, #3ee6ff); box-shadow: 0 0 18px rgba(141, 123, 255, 0.7); position: relative; }
.glyph::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--bg); }
.brand-text { font-family: "Space Grotesk", Inter, sans-serif; font-size: 16px; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.brand-text b { color: var(--text); font-weight: 700; }
.actions { display: flex; gap: 4px; flex: 1; justify-content: flex-end; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); transition: background .2s, color .2s; }
.icon-btn:hover { background: rgba(var(--ov), 0.06); color: var(--text); }
#btn-theme .i-moon, :root[data-theme="light"] #btn-theme .i-sun { display: none; }
:root[data-theme="light"] #btn-theme .i-moon { display: block; }
.icon-btn:disabled { opacity: 0.3; cursor: default; pointer-events: none; }
.icon-btn.on { color: var(--cyan); background: rgba(62, 230, 255, 0.1); }

/* ---------- segmented controls ---------- */
.seg { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: 999px; background: rgba(var(--ov), 0.05); border: 1px solid var(--line); flex: none; }
.seg button { position: relative; z-index: 1; padding: 7px 16px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--muted); transition: color .25s; white-space: nowrap; }
.seg button[aria-selected="true"] { color: #071018; }
.seg-thumb { position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 999px; background: var(--accent); box-shadow: 0 0 22px rgba(141, 123, 255, 0.55); transition: transform .35s cubic-bezier(.3, 1.3, .5, 1); }
.seg[data-pos="1"] .seg-thumb { transform: translateX(100%); }

/* ---------- sub bar ---------- */
.subbar { position: absolute; z-index: 9; left: 0; right: calc(var(--panel-w) + 24px + var(--sar)); top: calc(var(--top-h) + var(--sat) + 8px); display: flex; justify-content: center; pointer-events: none; padding: 0 12px; }   /* centered over the body, clear of the side panel */
.subbar > * { pointer-events: auto; }
.subbar .seg { background: var(--glass); }
.subbar { gap: 8px; }
/* breed / body picker: a pill holding a native select (so phones get their own wheel picker) */
.body-pick { flex: none; position: relative; display: flex; align-items: center; gap: 6px; padding: 0 10px 0 14px; height: 40px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); cursor: pointer; min-width: 0; }
.body-pick:hover { border-color: var(--line-strong); }
.body-pick:focus-within { outline: 1px solid var(--cyan); outline-offset: 2px; }
.body-pick-k { font: 600 10.5px/1 Inter, system-ui, sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.body-pick select { appearance: none; -webkit-appearance: none; border: 0; background: none; color: var(--text); font: 600 13.5px/1 Inter, system-ui, sans-serif; padding: 0 22px 0 0; cursor: pointer; outline: none; min-width: 0; text-overflow: ellipsis; }
.body-pick select option { color: #111; background: #fff; }
.body-pick svg { position: absolute; right: 10px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
/* fur (dog) / skin (human) switch: just for fun, off by default */
.coat-btn { flex: none; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 10px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); color: var(--muted); font: 600 13px/1 Inter, system-ui, sans-serif; white-space: nowrap; }
.coat-btn:hover { border-color: var(--line-strong); color: var(--text); }
.coat-sw { position: relative; width: 26px; height: 15px; border-radius: 999px; background: rgba(var(--ov), 0.16); transition: background .25s; }
.coat-sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--muted); transition: transform .25s, background .25s; }
.coat-btn[aria-pressed="true"] { color: var(--text); }
.coat-btn[aria-pressed="true"] .coat-sw { background: var(--accent); }
.coat-btn[aria-pressed="true"] .coat-sw::after { transform: translateX(11px); background: #fff; }
#app[data-mode="me"] .coat-btn { display: none; }   /* Me mode is about the organs inside */
:root:not([data-fun]) :is(.body-pick, #btn-coat, #btn-sound) { display: none; }   /* breeds, fur / skin and barking only in Fun mode (About) */
/* sound (dogs only): an occasional bark, just for fun, off by default */
.sound-btn { padding: 0 11px; }
.sound-k { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }   /* the speaker alone (the word stays for screen readers) */
.sound-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sound-btn .sound-on, .sound-btn[aria-pressed="true"] .sound-off { display: none; }
.sound-btn[aria-pressed="true"] .sound-on { display: inline; }
.sound-btn[aria-pressed="true"] { border-color: var(--cyan); color: var(--cyan); }
#app[data-species="human"] .sound-btn { display: none; }
.body-note { margin: -4px 0 12px; font-size: 13px; color: var(--muted); }
.body-note b { color: var(--text); font-weight: 600; }
.me-bar { display: none; min-width: 0; flex: 0 1 auto; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); max-width: 100%; }
.me-bar #me-file { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.me-bar .lock { color: var(--ok); display: grid; }
.me-bar .lock svg { width: 16px; height: 16px; }
.chip-btn { padding: 6px 12px; border-radius: 999px; background: rgba(var(--ov), 0.08); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chip-btn:hover { background: rgba(var(--ov), 0.14); }
#app[data-mode="me"] .species-seg { display: none; }
#app[data-mode="me"] .me-bar { display: flex; }
#app[data-mode="me"] #btn-news { display: none; }

/* ---------- panel (side on wide, sheet on narrow) ---------- */
.panel {
  position: absolute; z-index: 8; display: flex; flex-direction: column;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  top: calc(var(--top-h) + var(--sat) + 12px); right: calc(12px + var(--sar)); bottom: calc(12px + var(--sab));
  width: var(--panel-w);
  transition: transform .45s cubic-bezier(.2, .9, .2, 1), height .45s cubic-bezier(.2, .9, .2, 1);
}
.panel-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 18px 18px 22px; flex: 1; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: rgba(var(--ov), .15) transparent; }
.sheet-handle { display: none; }

/* ---------- dock ---------- */
.dock {
  position: absolute; z-index: 7; left: calc(12px + var(--sal)); right: calc(var(--panel-w) + 24px + var(--sar));
  bottom: calc(12px + var(--sab)); height: var(--dock-h);
  display: flex; align-items: center; gap: 4px; padding: 0 6px 0 5px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 999px;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.dock-scroll {
  flex: 1 1 auto; min-width: 0; height: 100%; display: flex; gap: 4px; align-items: center; overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth; padding: 0 6px;
  mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
}
.dock-scroll::-webkit-scrollbar { display: none; }
/* "All": opens the grid of every area */
.dock-all { flex: none; display: inline-flex; align-items: center; gap: 6px; height: calc(var(--dock-h) - 12px); padding: 0 12px 0 9px; border-radius: 999px; font: 700 12.5px/1 Inter, system-ui, sans-serif; color: #071018; background: var(--accent); box-shadow: 0 0 18px rgba(141, 123, 255, .35); }
.dock-all svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.dock-all:hover { filter: brightness(1.08); }
.dock-arrow { flex: none; display: none; width: 28px; height: 28px; border-radius: 50%; place-items: center; color: var(--muted); }
.dock-arrow svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.dock-arrow:hover { color: var(--text); background: rgba(var(--ov), .07); }
@media (hover: hover) { .dock.can-prev .dock-arrow.prev, .dock.can-next .dock-arrow.next { display: grid; } }
/* region labels between the groups */
.dock-region { flex: none; padding: 0 2px 0 8px; font: 700 9.5px/1 Inter, system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.dock-region:first-child { padding-left: 2px; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 7px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--muted); border: 1px solid transparent; transition: background .2s, color .2s, border-color .2s, transform .15s; white-space: nowrap; }
.chip:hover { color: var(--text); background: rgba(var(--ov), 0.06); }
.chip:active { transform: scale(.96); }
.chip.on { color: var(--text); font-weight: 650; background: color-mix(in srgb, var(--accent-mid, #8d7bff) 22%, transparent); border-color: color-mix(in srgb, var(--accent-mid, #8d7bff) 55%, transparent); box-shadow: 0 0 16px rgba(141, 123, 255, .25); }
.chip:focus-visible, .pk-tile:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.ring { flex: none; display: block; width: auto; height: auto; stroke: none; }
.ring circle { fill: none; stroke-width: 2.6; }
.ring-bg { stroke: rgba(var(--ov), .14); }
.ring text { fill: var(--text); stroke: none; font: 700 13px/1 Inter, system-ui, sans-serif; }
.ring-fg { stroke: currentColor; stroke-linecap: round; filter: drop-shadow(0 0 3px currentColor); }
/* the "All areas" grid */
.picker { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal)); background: rgba(var(--n4, 4, 6, 18), .5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade .18s ease; }
.picker[hidden] { display: none; }
.pk-card { width: min(760px, 100%); max-height: 100%; display: flex; flex-direction: column; border-radius: 22px; background: var(--glass-strong); border: 1px solid var(--line-strong); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px); box-shadow: 0 24px 70px rgba(0, 0, 0, .45); overflow: hidden; animation: pk-in .22s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes pk-in { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.pk-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 16px 12px 10px 20px; border-bottom: 1px solid var(--line); }
.pk-head h3 { margin: 0; font: 700 18px "Space Grotesk", Inter, system-ui, sans-serif; }
.pk-head p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.pk-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 18px 18px; }
.pk-body h4 { margin: 14px 0 8px; font: 700 10.5px/1 Inter, system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); }
.pk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 8px; }
.pk-tile { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; text-align: left; background: rgba(var(--ov), .04); border: 1px solid var(--line); color: var(--text); transition: background .15s, border-color .15s, transform .15s; }
.pk-tile:hover { background: rgba(var(--ov), .09); border-color: var(--line-strong); transform: translateY(-1px); }
.pk-tile.on { border-color: color-mix(in srgb, #8d7bff 65%, transparent); background: color-mix(in srgb, #8d7bff 16%, transparent); }
.pk-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pk-t b { font-size: 13.5px; font-weight: 650; }
.pk-t small { font-size: 11.5px; color: var(--muted); }
@media (max-width: 560px) {
  .picker { place-items: end stretch; padding: 0; }
  .pk-card { border-radius: 22px 22px 0 0; max-height: 86vh; }
  .pk-grid { grid-template-columns: 1fr 1fr; }
  .dock-all span { display: none; }
  .dock-all { padding: 0 10px; }
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: 0 0 10px currentColor; background: currentColor; }

/* ---------- legend ---------- */
.legend { position: absolute; z-index: 7; left: calc(12px + var(--sal)); bottom: calc(var(--dock-h) + 22px + var(--sab)); padding: 9px 12px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); font-size: 11.5px; color: var(--muted); max-width: 300px; }
.legend .ramp { height: 6px; border-radius: 6px; margin: 6px 0 4px; background: linear-gradient(90deg, #3ee6ff, #8d7bff, #ff3d9a); width: 200px; }
.legend .ends { display: flex; justify-content: space-between; width: 200px; }
.legend .keys { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 4px; }
.legend .keys span { display: inline-flex; align-items: center; gap: 6px; }
.legend .t { color: var(--text); font-weight: 600; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }

/* ---------- labels ---------- */
.organ-label { position: absolute; z-index: 6; pointer-events: none; transform: translate(-50%, calc(-100% - 18px)); padding: 6px 12px; border-radius: 999px; font: 600 12.5px "Space Grotesk", Inter, sans-serif; background: rgba(var(--n3), 0.7); border: 1px solid var(--line-strong); white-space: nowrap; transition: opacity .2s; }
.organ-label::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: 14px; background: linear-gradient(var(--line-strong), transparent); }
.tip { position: absolute; z-index: 11; pointer-events: none; padding: 6px 10px; border-radius: 10px; background: rgba(var(--n3), 0.85); border: 1px solid var(--line-strong); font-size: 12px; white-space: nowrap; transform: translate(14px, 14px); }

/* ---------- panel content ---------- */
.eyebrow { font: 600 11px Inter, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); }
.panel h2, .modal h2 { font: 700 22px/1.15 "Space Grotesk", Inter, sans-serif; margin: 6px 0 8px; letter-spacing: -0.01em; }
.panel h3 { font: 600 12px Inter, sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 22px 0 10px; }
.muted { color: var(--muted); }
.lead { color: var(--muted); margin: 0 0 4px; }
.p-head { display: flex; align-items: flex-start; gap: 10px; }
.p-head > div { flex: 1; min-width: 0; }
.back { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); background: rgba(var(--ov), 0.05); flex: none; margin-top: 2px; }
.back:hover { color: var(--text); }
.meter { margin: 14px 0 6px; }
.meter .row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.meter .row b { color: var(--text); font-family: "Space Grotesk", Inter, system-ui, sans-serif; font-size: 15px; }
.meter .track { height: 8px; border-radius: 8px; background: rgba(var(--ov), 0.06); margin-top: 6px; overflow: hidden; }
.meter .fill { height: 100%; border-radius: 8px; background: var(--accent); background-size: 300px 100%; box-shadow: 0 0 14px rgba(255, 61, 154, 0.4); }
.list { display: flex; flex-direction: column; gap: 8px; }
.row-btn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(var(--ov), 0.03); border: 1px solid var(--line); text-align: left; width: 100%; transition: background .2s, border-color .2s; }
.row-btn:hover { background: rgba(var(--ov), 0.06); border-color: var(--line-strong); }
.row-btn .name { flex: 1; font-weight: 500; min-width: 0; }
.row-btn .sub { font-size: 12px; color: var(--faint); }
.mini { width: 54px; height: 5px; border-radius: 5px; background: rgba(var(--ov), 0.07); overflow: hidden; flex: none; }
.mini i { display: block; height: 100%; border-radius: 5px; }
.card { padding: 13px 14px; border-radius: 14px; background: rgba(var(--ov), 0.035); border: 1px solid var(--line); }
.card .top { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; }
.card .org { font: 600 15px "Space Grotesk", Inter, sans-serif; }
.card .prog { font-size: 12.5px; color: var(--cyan); margin-top: 2px; }
.card p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.card .note { color: var(--text); opacity: .9; }
.card .src { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; border: 1px solid currentColor; flex: none; }
.pill.solid { border: 0; color: #071018 !important; }
.empty { padding: 16px; border-radius: 14px; border: 1px dashed rgba(255, 61, 154, 0.5); color: var(--pink-text); background: rgba(255, 61, 154, 0.06); font-size: 13px; }
.news-item { display: block; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(var(--ov), 0.025); color: var(--text); }
.news-item:hover { border-color: var(--line-strong); background: rgba(var(--ov), 0.05); }
.news-item .meta { font-size: 11.5px; color: var(--faint); display: flex; gap: 8px; margin-bottom: 3px; }
.news-item .title { font-size: 13.5px; font-weight: 500; line-height: 1.35; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 4px; }
.stat { padding: 10px; border-radius: 12px; background: rgba(var(--ov), 0.04); border: 1px solid var(--line); }
.stat b { display: block; font: 700 18px "Space Grotesk", Inter, system-ui, sans-serif; }
.stat span { font-size: 11px; color: var(--faint); }
.variant { padding: 12px 13px; border-radius: 14px; background: rgba(var(--ov), 0.035); border: 1px solid var(--line); }
.variant .top { display: flex; gap: 8px; align-items: center; }
.variant .gene { font: 600 14px "Space Grotesk", Inter, system-ui, sans-serif; }
.variant .rs { font-size: 11.5px; color: var(--faint); }
.variant .trait { font-size: 13px; margin-top: 4px; }
.variant .eff { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.gt { font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 2px 7px; border-radius: 6px; background: rgba(var(--ov), 0.08); letter-spacing: .08em; }
.spacer { flex: 1; }
.fine { font-size: 11.5px; color: var(--faint); margin: 14px 0 0; }
.cta { display: flex; width: 100%; justify-content: center; padding: 12px; border-radius: 14px; font-weight: 600; background: var(--accent); color: #071018; box-shadow: 0 8px 30px rgba(141, 123, 255, 0.35); margin-top: 12px; }
.link-btn { display: block; margin: 8px 0 4px; padding: 4px 0; font-size: 13.5px; font-weight: 600; color: var(--cyan); text-align: left; }
.link-btn:hover { text-decoration: underline; }
details.untested summary { cursor: pointer; color: var(--faint); font-size: 12.5px; padding: 8px 0; }
.reveal { margin-top: 8px; font-size: 12.5px; font-weight: 600; color: var(--cyan); }

/* ---------- modal ---------- */
.modal { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal)); background: rgba(var(--n4), 0.55); animation: fade .25s ease; }
.modal[hidden] { display: none; }
.modal-card { position: relative; width: min(480px, 100%); max-height: 100%; overflow-y: auto; padding: 24px; border-radius: 24px; background: var(--glass-strong); border: 1px solid var(--line-strong); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(141, 123, 255, 0.08) inset; }
.modal .close { position: absolute; top: 12px; right: 12px; }
.modal p { margin: 0 0 14px; }
.ab-person { display: flex; align-items: center; gap: 14px; margin: 4px 0 14px; padding: 12px; border-radius: 16px; background: rgba(var(--ov), 0.04); border: 1px solid var(--line); }
.ab-person img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex: none; border: 2px solid rgba(62, 230, 255, 0.5); box-shadow: 0 0 18px rgba(62, 230, 255, 0.25); }
.ab-name { font: 700 18px/1.2 "Space Grotesk", Inter, system-ui, sans-serif; }
.ab-role { color: var(--muted); font-size: 13px; margin-top: 2px; }
.ab-links { display: flex; flex-wrap: wrap; gap: 8px; }
.ab-fun { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.ab-fun .muted { font-size: 13px; line-height: 1.4; }
.ab-links a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line-strong); color: var(--text); text-decoration: none; font-size: 13.5px; transition: background .2s, border-color .2s; }
.ab-links a:hover { background: rgba(62, 230, 255, 0.08); border-color: var(--cyan); }
.ab-links svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drop { display: grid; justify-items: center; gap: 4px; padding: 22px 16px; border-radius: 18px; border: 1.5px dashed rgba(141, 123, 255, 0.5); background: rgba(141, 123, 255, 0.06); cursor: pointer; text-align: center; transition: background .2s, border-color .2s; }
.drop:hover, .drop.over { background: rgba(141, 123, 255, 0.14); border-color: var(--cyan); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: rgba(62, 230, 255, 0.12); color: var(--cyan); margin-bottom: 6px; }
.drop-title { font-weight: 600; }
.drop-sub { font-size: 12px; color: var(--faint); }
.sample-btn { display: grid; gap: 2px; width: 100%; text-align: left; margin-top: 10px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-strong); background: rgba(var(--ov), 0.03); }
.sample-btn span { font-weight: 600; color: var(--cyan); }
.sample-btn small { color: var(--faint); font-size: 12px; }
.sample-btn:hover { background: rgba(var(--ov), 0.06); }
.toggle { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; font-size: 13px; color: var(--muted); cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.switch { width: 38px; height: 22px; border-radius: 22px; background: rgba(var(--ov), 0.12); position: relative; flex: none; transition: background .2s; margin-top: -1px; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .25s; }
.toggle input:checked + .switch { background: var(--violet); }
.toggle input:checked + .switch::after { transform: translateX(16px); }
.toggle input:focus-visible + .switch { outline: 2px solid var(--cyan); outline-offset: 2px; }
.progress { margin-top: 14px; }
.progress .bar { height: 6px; border-radius: 6px; background: rgba(var(--ov), 0.08); overflow: hidden; }
.progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.progress span { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- loading ---------- */
.loading { position: absolute; inset: 0; z-index: 40; display: grid; place-content: center; justify-items: center; gap: 18px; background: var(--loading-bg); transition: opacity .6s; }
.loading.done { opacity: 0; pointer-events: none; }
.loader-ring { width: 64px; height: 64px; border-radius: 50%; background: conic-gradient(from 0deg, transparent, #3ee6ff, #8d7bff, #ff3d9a); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); animation: spin 1.1s linear infinite; }
.loading-text { font: 500 13px Inter; color: var(--muted); letter-spacing: .04em; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* =========================================================
   Narrow / portrait: bottom sheet
   ========================================================= */
@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) {
  .subbar { right: 0; }   /* the panel is a bottom sheet here: the bar has the full width */
  :root { --peek: 118px; }
  .brand-text { font-size: 15px; }
  .panel {
    left: calc(8px + var(--sal)); right: calc(8px + var(--sar)); top: auto; bottom: 0; width: auto;
    border-radius: 22px 22px 0 0; border-bottom: 0;
    height: calc(var(--peek) + var(--sab));
    padding-bottom: var(--sab);
    background: var(--glass-strong);
  }
  .panel[data-sheet="half"] { height: min(56dvh, 560px, calc(100dvh - var(--top-h) - var(--sat) - var(--sub-h) - 30px)); }   /* never up over the toolbar */
  .panel[data-sheet="full"] { height: calc(100dvh - var(--top-h) - var(--sat) - 10px); }
  .panel[data-sheet="peek"] .panel-scroll { overflow: hidden; }
  .sheet-handle { display: grid; place-items: center; height: 26px; width: 100%; flex: none; cursor: grab; touch-action: none; }
  .sheet-handle span { width: 40px; height: 5px; border-radius: 5px; background: rgba(var(--ov), 0.25); }
  .panel-scroll { padding: 2px 16px 18px; }
  .panel h2 { font-size: 20px; }
  .dock { left: calc(8px + var(--sal)); right: calc(8px + var(--sar)); bottom: calc(var(--peek) + var(--sab) + 10px); transition: bottom .45s cubic-bezier(.2, .9, .2, 1), opacity .3s; }
  #app[data-sheet="half"] .dock, #app[data-sheet="full"] .dock { opacity: 0; pointer-events: none; }
  .legend { display: none; }
}
/* The top bar and the bar under it fit themselves to any screen: fitBars() in main.js steps
   data-fit up (1, 2, 3...) until everything fits, each step a little more compact. Nothing is
   ever dropped except words that have an icon or a meaning without them. */
.topbar[data-fit] .brand-text { display: none; }
.topbar[data-fit] .brand { flex: 0 0 auto; }
.topbar[data-fit] { justify-content: space-between; }
.topbar[data-fit] .actions { flex: 0 1 auto; }
.topbar[data-fit="2"] .actions, .topbar[data-fit="3"] .actions, .topbar[data-fit="4"] .actions { gap: 0; }
.topbar[data-fit="2"] .icon-btn { width: 36px; }
.topbar[data-fit="3"] .icon-btn { width: 33px; }
.topbar[data-fit="3"] .seg button, .topbar[data-fit="4"] .seg button { padding: 7px 11px; }
.topbar[data-fit="4"] { gap: 6px; }
.topbar[data-fit="4"] .brand { display: none; }
.topbar[data-fit="4"] .icon-btn, .topbar[data-fit="5"] .icon-btn { width: 30px; }
.topbar[data-fit="5"] { gap: 4px; padding-left: calc(8px + var(--sal)); padding-right: calc(8px + var(--sar)); }
.topbar[data-fit="5"] .brand { display: none; }
.topbar[data-fit="5"] .actions { gap: 0; }
.topbar[data-fit="5"] .icon-btn { width: 28px; }
.topbar[data-fit="5"] .seg button { padding: 7px 9px; font-size: 12.5px; }
/* step 6 (the narrowest phones, with every button): the tightest the bar gets */
.topbar[data-fit="6"] { gap: 3px; padding-left: calc(6px + var(--sal)); padding-right: calc(6px + var(--sar)); }
.topbar[data-fit="6"] .brand { display: none; }
.topbar[data-fit="6"] .actions { gap: 0; }
.topbar[data-fit="6"] .icon-btn { width: 26px; }
.topbar[data-fit="6"] .icon-btn svg { width: 18px; height: 18px; }
.topbar[data-fit="6"] .seg button { padding: 7px 7px; font-size: 12px; }

.subbar[data-fit] .body-pick-k { display: none; }
.subbar[data-fit] .coat-sw { display: none; }   /* the word alone, lit when on */
.subbar[data-fit] .coat-btn { padding: 0 11px; gap: 6px; }
.subbar[data-fit] .coat-btn[aria-pressed="true"] { border-color: var(--cyan); color: var(--cyan); }
.subbar[data-fit] .body-pick { flex: 0 1 auto; padding-left: 12px; }
.subbar[data-fit] .body-pick select { width: 100%; }
.subbar[data-fit] .sound-btn { padding: 0 10px; }
.subbar[data-fit="2"], .subbar[data-fit="3"], .subbar[data-fit="4"], .subbar[data-fit="5"] { gap: 5px; padding-left: calc(6px + var(--sal)); padding-right: calc(6px + var(--sar)); }
.subbar[data-fit="2"] .seg button, .subbar[data-fit="3"] .seg button { padding: 7px 11px; }
.subbar[data-fit="3"] .coat-btn, .subbar[data-fit="4"] .coat-btn { padding: 0 9px; }
.subbar[data-fit="3"] .sound-btn, .subbar[data-fit="4"] .sound-btn { padding: 0 8px; }
.subbar[data-fit="3"] .body-pick, .subbar[data-fit="4"] .body-pick { padding-left: 10px; }
.subbar[data-fit="4"] .seg button, .subbar[data-fit="5"] .seg button { padding: 7px 8px; font-size: 12.5px; }
.subbar[data-fit="5"] .coat-btn { padding: 0 7px; }
.subbar[data-fit="5"] .body-pick { padding-left: 8px; }
.subbar[data-fit="4"] .body-pick select, .subbar[data-fit="5"] .body-pick select { padding-right: 16px; font-size: 13px; }
.subbar[data-fit="4"] .body-pick svg, .subbar[data-fit="5"] .body-pick svg { right: 6px; }
#app[data-mode="me"] .subbar[data-fit] .body-pick { flex: none; }
.fit-measure > * { flex: none !important; }
.fit-measure .body-pick select { width: auto !important; }   /* Female / Male are short: the genome bar gives way instead */
/* the full-height sheet covers the bar (as it does the dock); dragging it down brings it back */
@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) {
  #app[data-sheet="full"] .subbar { opacity: 0; pointer-events: none; }
  #app[data-sheet="full"] .subbar > * { pointer-events: none; }
  .subbar { transition: opacity .3s; }
}

/* Phone landscape: short screens keep the side panel but slimmer */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --top-h: 48px; --panel-w: clamp(260px, 36vw, 340px); --dock-h: 44px; }
  .panel { left: auto; right: calc(8px + var(--sar)); top: calc(var(--top-h) + var(--sat) + 8px); bottom: calc(8px + var(--sab)); width: var(--panel-w); height: auto !important; border-radius: 16px; border-bottom: 1px solid var(--line); padding-bottom: 0; }
  .panel[data-sheet] .panel-scroll { overflow-y: auto; }
  .sheet-handle { display: none !important; }
  .panel-scroll { padding: 12px 14px 16px; }
  .subbar { top: calc(var(--top-h) + var(--sat) + 6px); justify-content: flex-start; padding-left: calc(12px + var(--sal)); right: calc(var(--panel-w) + 20px + var(--sar)); }
  .dock { left: calc(8px + var(--sal)); right: calc(var(--panel-w) + 16px + var(--sar)); bottom: calc(8px + var(--sab)); opacity: 1 !important; pointer-events: auto !important; }
  .legend { display: none; }
  .panel h2 { font-size: 18px; }
  .brand-text { display: inline; font-size: 14px; }
  .seg button { padding: 5px 12px; font-size: 12px; }
}

/* the smallest phones on their side: too narrow for the bar beside the panel, so the bar gets
   the full width and the panel starts under it */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 620px) {
  .subbar { right: calc(8px + var(--sar)); }
  .panel { top: calc(var(--top-h) + var(--sat) + var(--sub-h) + 10px); }   /* (the bar may be one row or two) */
}

.inline-legend { display: none; margin: 10px 0 2px; font-size: 11.5px; color: var(--muted); }
.inline-legend .ramp { height: 6px; border-radius: 6px; margin: 4px 0; background: linear-gradient(90deg, #3ee6ff, #8d7bff, #ff3d9a); }
.inline-legend .ends { display: flex; justify-content: space-between; }
.inline-legend .keys { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.inline-legend .keys span { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) { .inline-legend { display: block; } }
@media (orientation: landscape) and (max-height: 520px) { .inline-legend { display: block; } }

/* =========================================================
   DNA view
   ========================================================= */
.dna { position: absolute; inset: calc(var(--top-h) + var(--sat)) 0 0 0; z-index: 25; display: flex; flex-direction: column; background: var(--dna-bg); animation: fade .25s ease; }
.dna[hidden] { display: none; }
.dna-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px calc(12px + var(--sar)) 8px calc(12px + var(--sal)); border-bottom: 1px solid var(--line); background: rgba(var(--n0), .6); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.dna-crumbs { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1 1 auto; font: 600 13px "Space Grotesk", Inter, system-ui, sans-serif; white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
.dna-crumbs::-webkit-scrollbar { display: none; }
.dna-crumbs button, .dna-crumbs span { padding: 6px 10px; border-radius: 999px; color: var(--muted); }
.dna-crumbs button:hover { background: rgba(var(--ov), .06); color: var(--text); }
.dna-crumbs > :last-child { color: var(--text); background: rgba(141,123,255,.16); }
.dna-crumbs i { color: var(--faint); font-style: normal; }
.dna-search { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 38px; border-radius: 999px; background: rgba(var(--ov), .05); border: 1px solid var(--line); flex: 0 1 300px; min-width: 0; color: var(--muted); }
.dna-search:focus-within { border-color: var(--cyan); }
.dna-search.bad { border-color: #ff4d6d; }
.dna-search svg { width: 16px; height: 16px; flex: none; }
.dna-search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: 500 14px Inter, system-ui, sans-serif; }
.dna-search input::placeholder { color: var(--faint); }
/* + and − sit in a fixed corner (bottom right), the level chip and help above them, all aligned to
   the right edge: whatever the chip says, or when it opens, + and − never move */
.dna-zoom { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; z-index: 2; }
/* zoom ladder: the four levels, the current one lit, between + and − */
.dna-ladder { display: flex; flex-direction: column; gap: 2px; padding: 8px 8px 7px; border-radius: 14px; background: rgba(var(--n1), .82); border: 1px solid var(--line-strong); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); align-self: flex-end; min-width: 150px; }
.dl-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 2px 4px; font: 700 10.5px/1 Inter, system-ui, sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.dl-head .q { width: 20px; height: 20px; font-size: 11px; }
.dl-step::before { content: ""; position: absolute; inset: -4px 0; }   /* a taller target for a finger */
.dl-step { position: relative; display: flex; align-items: center; gap: 9px; padding: 5px 8px 5px 6px; border-radius: 10px; text-align: left; color: var(--faint); }
.dl-step i { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; }
.dl-step:not(:last-of-type) i::after { content: ""; position: absolute; left: 10px; top: calc(50% + 7px); width: 2px; height: calc(100% - 10px); background: var(--line-strong); }
.dl-l { display: flex; flex-direction: column; font: 600 13px/1.15 "Space Grotesk", Inter, system-ui, sans-serif; }
.dl-l small { font: 500 10.5px/1.2 Inter, system-ui, sans-serif; color: var(--faint); }
.dl-step:not(:disabled):hover { background: rgba(var(--ov), .06); color: var(--text); }
.dl-step:disabled { opacity: .45; cursor: default; }
.dl-step.on { color: var(--text); background: color-mix(in srgb, var(--cyan) 16%, transparent); }
.dl-step.on i { background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.dl-step.on .dl-l { font-weight: 700; }
.dl-step.on small { color: var(--muted); }
.dl-size { margin-top: 4px; padding: 5px 4px 0; border-top: 1px solid var(--line); font: 600 11.5px/1.3 Inter, system-ui, sans-serif; color: var(--cyan); text-align: center; }
.dna-zoom .icon-btn { background: rgba(var(--n1), .8); border: 1px solid var(--line-strong); color: var(--text); width: 44px; height: 44px; border-radius: 14px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.dna-stage { position: relative; flex: 1; min-height: 0; }
.dna-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
.dna-tip { position: absolute; pointer-events: none; transform: translate(12px, 12px); padding: 5px 9px; border-radius: 8px; background: rgba(var(--n3), .9); border: 1px solid var(--line-strong); font-size: 12px; white-space: nowrap; z-index: 2; }
.dna-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); font-size: 13px; }
.dna-loading[hidden] { display: none; }
.dna-toast { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); max-width: min(520px, calc(100% - 32px)); padding: 10px 14px; border-radius: 12px; background: var(--toast-bg); border: 1px solid rgba(255,77,109,.5); font-size: 13px; z-index: 3; }
.dna-foot { padding: 10px calc(12px + var(--sar)) calc(10px + var(--sab)) calc(12px + var(--sal)); border-top: 1px solid var(--line); background: rgba(var(--n0), .6); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); display: grid; gap: 8px; }
.dna-card { font-size: 13px; color: var(--text); line-height: 1.5; max-height: 34dvh; overflow-y: auto; }
.dna-card.hint { color: var(--muted); }
.dna-card .dc-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 3px; }
.dna-card .dc-title { font: 700 16px "Space Grotesk", Inter, system-ui, sans-serif; }
.dna-card .dc-rs, .dna-card .dc-sub { font: 500 12px Inter, system-ui, sans-serif; color: var(--faint); }
.dna-card .dc-body { color: var(--muted); }
.dna-card .dc-actions { margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; }
.dna-card .dc-actions button, .dna-card .dc-actions a { padding: 7px 12px; border-radius: 999px; background: rgba(var(--ov), .07); font-size: 12.5px; font-weight: 600; color: var(--text); }
.dna-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--faint); }
.dna-legend { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dna-legend i { font: 700 11px ui-monospace, SFMono-Regular, Menlo, monospace; font-style: normal; color: var(--c); padding: 1px 6px; border-radius: 5px; background: rgba(var(--ov), .05); }
/* letter chips: the same colors the canvas uses (DARK / LIGHT in dnaview.js) */
.dna-legend .b-a { --c: #38e8b0; } .dna-legend .b-c { --c: #4fd8ff; } .dna-legend .b-g { --c: #ffb547; } .dna-legend .b-t { --c: #ff5a7a; }
:root[data-theme="light"] .dna-legend .b-a { --c: #065f46; }
:root[data-theme="light"] .dna-legend .b-c { --c: #0369a1; }
:root[data-theme="light"] .dna-legend .b-g { --c: #92400e; }
:root[data-theme="light"] .dna-legend .b-t { --c: #be123c; }
.zoom-dna { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12.5px; font-weight: 600; color: var(--cyan); }
.zoom-dna svg { width: 16px; height: 16px; }
body.dna-open .subbar { visibility: hidden; }   /* the top bar stays; the DNA view sits below it */

/* ---------- DNA view help: "?" buttons and the help window (topics in src/dnahelp.js) ---------- */
:root { --fl-elevated: #ff4d6d; --fl-mild: #ffb547; --fl-carrier: #ffd166; --fl-typical: #38e8b0; --fl-protective: #4fd8ff; --fl-untested: #6b7a99; --fl-none: #b9a8ff; }
:root[data-theme="light"] { --fl-elevated: #be123c; --fl-mild: #b45309; --fl-carrier: #a16207; --fl-typical: #047857; --fl-protective: #0369a1; --fl-untested: #556070; --fl-none: #6d28d9; }
/* round "?": 22 px to look at, 38 px to tap */
.q { position: relative; flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font: 700 12.5px/1 Inter, system-ui, sans-serif; color: var(--cyan); background: color-mix(in srgb, var(--cyan) 14%, transparent); border: 1.2px solid var(--cyan); vertical-align: middle; transition: background .15s; }
.q::after { content: ""; position: absolute; inset: -8px; }
.q:hover, .q:focus-visible { background: color-mix(in srgb, var(--cyan) 28%, transparent); }
.q-inline { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font: 700 11px/1 Inter, system-ui, sans-serif; color: var(--cyan); border: 1.2px solid var(--cyan); vertical-align: -3px; }
.dna-guide { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px 0 7px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text); background: color-mix(in srgb, var(--cyan) 12%, transparent); border: 1px solid color-mix(in srgb, var(--cyan) 55%, transparent); white-space: nowrap; }
.dna-guide:hover { background: color-mix(in srgb, var(--cyan) 22%, transparent); }
.dna-guide .qm, .dc-help .qm { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--cyan); color: rgb(var(--n0)); font: 800 13px/1 Inter, system-ui, sans-serif; }
.dna-guide .short { display: none; }
/* "Spots we check": the list of every spot the app reads, each explained, with Go there */
.dna-spots { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 13px 0 10px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text); background: rgba(var(--ov), .05); border: 1px solid var(--line-strong); white-space: nowrap; }
.dna-spots:hover { background: rgba(var(--ov), .1); }
.dna-spots svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.dna-spots .short { display: none; }
.sp-kid { padding: 12px 14px; margin: 6px 0 14px; border-radius: 14px; background: color-mix(in srgb, var(--cyan) 8%, transparent); border: 1px solid color-mix(in srgb, var(--cyan) 35%, transparent); }
.sp-kid p { margin: 0 0 8px; }
.sp-apoe { border-collapse: collapse; margin: 4px 0 10px; font-size: 14px; }
.sp-apoe th, .sp-apoe td { padding: 4px 14px 4px 0; text-align: left; }
.sp-apoe th { font-size: 12px; color: var(--muted); font-weight: 600; }
.sp-apoe td:not(:last-child) { font: 700 14px ui-monospace, SFMono-Regular, Menlo, monospace; }
.sp-index { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.sp-index button { padding: 5px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: rgba(var(--ov), .06); border: 1px solid var(--line); color: var(--text); }
.dh-body h4 { margin: 18px 0 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--cyan); scroll-margin-top: 8px; }
.sp { padding: 11px 12px; margin: 8px 0; border-radius: 14px; background: rgba(var(--ov), .04); border: 1px solid var(--line); }
.sp p { margin: 6px 0; }
.sp-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.sp-gene { font-size: 15px; }
.sp-rs { font: 600 12.5px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }
.sp-size { padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: rgba(var(--ov), .07); color: var(--muted); }
.sp-size.mid { color: var(--text); }
.sp-size.big { background: color-mix(in srgb, var(--magenta) 18%, transparent); color: var(--text); }
.sp-go { margin-left: auto; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: color-mix(in srgb, var(--cyan) 16%, transparent); border: 1px solid color-mix(in srgb, var(--cyan) 50%, transparent); color: var(--text); }
.sp-go:hover { background: color-mix(in srgb, var(--cyan) 28%, transparent); }
.sp-trait { font-size: 13px; color: var(--muted); }
.sp-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--faint); }
.sp-meta a { color: var(--cyan); }
.sp-you { color: var(--text); }
.sp-spots { display: grid; gap: 6px; margin: 8px 0; }
.sp-spots > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; }
.sp-types { margin: 6px 0 8px; }
.sp-types summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.sp-types dl { margin: 8px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13.5px; }
.sp-types dt { font-weight: 700; white-space: nowrap; }
.sp-types dd { margin: 0; }
.dna-search .q { margin-right: -6px; }
.dna-zoom .dna-nav-q { font: 700 18px/1 Inter, system-ui, sans-serif; color: var(--cyan); }
.dna-card .dc-top .q { align-self: center; margin-left: auto; }
.dna-card .dc-top button.pill { cursor: pointer; }
.dna-card .dc-actions .dc-help { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 6px; color: var(--cyan); background: color-mix(in srgb, var(--cyan) 10%, transparent); }
.dna-card .dc-actions .dc-help .qm { width: 20px; height: 20px; font-size: 12px; }
.dna-card.hint .dc-actions { margin-top: 6px; }
.dna-src-wrap { display: inline-flex; align-items: center; gap: 8px; }
/* the key under the map: every item is a button that opens its explanation */
.dna-legend .lg { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 6px; border-radius: 999px; background: rgba(var(--ov), .05); border: 1px solid var(--line); color: var(--muted); font-size: 11.5px; min-height: 28px; }
.dna-legend .lg:hover { color: var(--text); border-color: var(--line-strong); }
.dna-legend .qd { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--cyan); color: var(--cyan); font: 700 9.5px/1 Inter, system-ui, sans-serif; }
.dna-legend .sw-letters { display: inline-flex; gap: 2px; }
.dna-legend .sw-letters i { padding: 0 4px; }
.dna-legend i.sw-dot { width: 9px; height: 9px; padding: 0; border-radius: 50%; background: var(--fl-none); }
.dna-legend i.sw-multi { background: conic-gradient(var(--fl-elevated) 0 25%, var(--fl-mild) 0 50%, var(--fl-typical) 0 75%, var(--fl-protective) 0); }
.dna-legend i.sw-tick { width: 3px; height: 12px; padding: 0; border-radius: 1px; background: var(--cyan); }
.dna-legend i.sw-bands { width: 9px; height: 14px; padding: 0; border-radius: 5px; background: repeating-linear-gradient(180deg, color-mix(in srgb, var(--violet) 75%, transparent) 0 3px, rgba(var(--ov), .12) 3px 6px); border: 1px solid var(--line-strong); }
.dna-legend i.sw-gene { width: 18px; height: 8px; padding: 0; border-radius: 1px; background: var(--violet); }
.dna-legend i.sw-diff { width: 14px; height: 14px; padding: 0; border-radius: 3px; border: 1.5px solid var(--magenta); background: color-mix(in srgb, var(--magenta) 20%, transparent); }

/* the help window: a card over the DNA view (a sheet from the bottom on phones) */
.dna-help { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal)); background: rgba(var(--n4), .55); animation: fade .18s ease; }
.dna-help[hidden] { display: none; }
.dh-card { width: min(620px, 100%); max-height: 100%; display: flex; flex-direction: column; border-radius: 20px; background: var(--glass-strong); border: 1px solid var(--line-strong); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: 0 24px 70px rgba(0, 0, 0, .45); overflow: hidden; }
:root[data-theme="light"] .dh-card { box-shadow: 0 24px 60px rgba(20, 30, 70, .22); }
.dh-head { display: flex; align-items: center; gap: 8px; padding: 12px 10px 10px 18px; border-bottom: 1px solid var(--line); }
.dh-head h3 { flex: 1; margin: 0; font: 700 18px/1.25 "Space Grotesk", Inter, system-ui, sans-serif; }
.dh-back { order: -1; margin-left: -8px; }
.dh-back, .dh-close { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); }
.dh-back[hidden] { display: none; }
.dh-back:hover, .dh-close:hover { background: rgba(var(--ov), .08); color: var(--text); }
.dh-back svg, .dh-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dh-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 18px 14px; font-size: 14.5px; line-height: 1.55; color: var(--text); -webkit-overflow-scrolling: touch; }
.dh-body p { margin: 10px 0; }
.dh-body h4 { margin: 18px 0 4px; font: 700 15px "Space Grotesk", Inter, system-ui, sans-serif; color: var(--cyan); }
.dh-body ul { margin: 8px 0; padding-left: 20px; }
.dh-body li { margin: 6px 0; }
.dh-body .pink { color: var(--magenta); }
.dh-pre { margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: rgba(var(--ov), .06); font: 600 13px ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.45; overflow-x: auto; white-space: pre; }
.dh-lead { font-size: 15.5px; }
.dh-now { padding: 9px 12px; border-radius: 12px; background: color-mix(in srgb, var(--cyan) 10%, transparent); border: 1px solid color-mix(in srgb, var(--cyan) 35%, transparent); }
.dh-tip { padding: 9px 12px; border-radius: 12px; background: rgba(var(--ov), .05); color: var(--muted); }
.dh-ladder { list-style: none; padding: 0 !important; margin: 10px 0; display: grid; gap: 6px; }
.dh-ladder li { display: flex; gap: 10px; align-items: flex-start; margin: 0 !important; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); color: var(--muted); }
.dh-ladder li b { color: var(--text); }
.dh-ladder li.here { border-color: var(--cyan); background: color-mix(in srgb, var(--cyan) 9%, transparent); }
.dh-n { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: rgba(var(--ov), .08); color: var(--text); }
.dh-ladder li.here .dh-n { background: var(--cyan); color: rgb(var(--n0)); }
.dh-tag { font-size: 12px; color: var(--faint); }
.dh-here { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--cyan); color: rgb(var(--n0)); }
.dh-flags { list-style: none; padding: 0 !important; }
.dh-flags li { display: flex; gap: 10px; align-items: baseline; }
.dh-flags .fl { flex: none; width: 11px; height: 11px; border-radius: 50%; transform: translateY(1px); }
.fl-elevated { background: var(--fl-elevated); } .fl-mild { background: var(--fl-mild); } .fl-carrier { background: var(--fl-carrier); } .fl-typical { background: var(--fl-typical); }
.fl-protective { background: var(--fl-protective); } .fl-untested, .fl-unreadable { background: var(--fl-untested); } .fl-none { background: var(--fl-none); }
.dh-try { list-style: none; padding: 0 !important; }
.dh-try button { margin-right: 6px; padding: 3px 10px; border-radius: 8px; font: 600 13px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--cyan); background: color-mix(in srgb, var(--cyan) 12%, transparent); border: 1px solid color-mix(in srgb, var(--cyan) 40%, transparent); }
.dh-words li { margin: 7px 0; }
/* the "you > cell > chromosome > ladder > letters" picture in the guide */
.dh-pic { margin: 12px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 2px; padding: 12px 8px; border-radius: 14px; background: rgba(var(--ov), .04); border: 1px solid var(--line); }
.dh-pic div { flex: 1 1 0; min-width: 0; display: grid; justify-items: center; gap: 4px; text-align: center; font-size: 12px; line-height: 1.25; color: var(--muted); }
.dh-pic small { font-size: 10.5px; color: var(--faint); }
.dh-pic svg { width: 44px; height: 44px; fill: none; stroke: var(--text); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dh-pic svg .hl { stroke: var(--cyan); }
.dh-pic svg text { fill: var(--cyan); stroke: none; font: 800 15px ui-monospace, SFMono-Regular, Menlo, monospace; }
.dh-pic > i { flex: none; align-self: center; margin-top: -22px; font-style: normal; color: var(--faint); font-size: 18px; }
@media (max-width: 420px) { .dh-pic svg { width: 36px; height: 36px; } .dh-pic div { font-size: 11px; } .dh-pic small { display: none; } }
.dh-foot { padding: 10px 18px 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.dh-foot:empty { display: none; }
.dh-rel { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--faint); }
.dh-rel button { padding: 6px 11px; border-radius: 999px; background: rgba(var(--ov), .06); border: 1px solid var(--line); color: var(--text); font-size: 12.5px; font-weight: 600; }
.dh-rel button:hover { border-color: var(--cyan); }
.dh-done { justify-self: stretch; padding: 12px; border-radius: 14px; font-weight: 700; background: var(--accent); color: #071018; }
@media (max-width: 760px) {
  .dna-guide { padding: 0 11px 0 6px; }
  .dna-guide .long { display: none; }
  .dna-guide .short { display: inline; }
  .dna-spots .long { display: none; }
  .dna-spots .short { display: inline; }
}
body.dna-open .build-stamp, body:has(#hall:not([hidden])) .build-stamp, body:has(#hl-menu:not([hidden])) .build-stamp, body:has(.hp-pop) .build-stamp, body:has(#file-menu:not([hidden])) .build-stamp, body.picker-open .build-stamp, body.about-open .build-stamp, body:has(#app[data-sheet="full"]) .build-stamp { display: none; }   /* it would sit on the DNA view's key and the dialogs' buttons */
@media (max-width: 560px) {
  /* phones: path + "?" on the first row, Guide + search on the second */
  .dna-bar { gap: 8px; row-gap: 6px; padding-top: 6px; padding-bottom: 6px; }
  .dna-bar .dna-close { width: 36px; height: 36px; }
  .dna-crumbs { flex: 1 1 calc(100% - 100px); }   /* forces Guide + search onto a second row */
  .dna-guide { order: 3; height: 38px; }
  .dna-search { order: 4; flex: 1 1 0; }
  /* the key under the map and the letters note share one row that scrolls sideways */
  .dna-foot { gap: 6px; padding-top: 8px; }
  .dna-meta { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 6px; margin: 0 -12px; padding: 0 12px; }
  .dna-meta::-webkit-scrollbar { display: none; }
  .dna-legend { flex-wrap: nowrap; gap: 6px; }
  .dna-legend .lg, .dna-src-wrap { flex: none; white-space: nowrap; }
  .dna-card .dc-actions { margin-top: 6px; gap: 8px; }
  .dna-zoom { right: 8px; bottom: 8px; gap: 5px; }
  .dna-zoom .icon-btn { width: 38px; height: 38px; border-radius: 12px; }
  .dna-zoom .dna-nav-q { display: none; }   /* "How do I move around?" is also in the box at the bottom */
}
@media (max-width: 560px) {
  /* phones: the help slides up from the bottom and fills most of the screen */
  .dna-help { place-items: end stretch; padding: 8px 0 0; }
  .dh-card { width: 100%; max-height: 92%; border-radius: 20px 20px 0 0; border-bottom: 0; }
  .dh-body { font-size: 15px; padding-bottom: 14px; }
  .dh-foot { padding-bottom: calc(12px + var(--sab)); gap: 8px; }
  /* related topics: one row that scrolls sideways, so the text gets the room */
  .dh-rel { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 0 18px; }
  .dh-rel::-webkit-scrollbar { display: none; }
  .dh-rel > * { flex: none; white-space: nowrap; }
  .dh-done { padding: 10px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  /* phone on its side: too short for map + box below it, so the box becomes a column on the
     right and the map gets the full height. One-row header, zoom buttons side by side. */
  .dna { display: grid; grid-template-columns: minmax(0, 1fr) min(290px, 36vw); grid-template-rows: auto minmax(0, 1fr); }
  .dna-bar { grid-column: 1 / -1; flex-wrap: nowrap; gap: 8px; padding-top: 5px; padding-bottom: 5px; }
  .dna-stage { grid-column: 1; grid-row: 2; }
  .dna-foot { grid-column: 2; grid-row: 2; align-content: start; overflow-y: auto; overscroll-behavior: contain; border-top: 0; border-left: 1px solid var(--line); padding: 8px calc(10px + var(--sar)) calc(8px + var(--sab)) 10px; gap: 8px; }
  .dna-card { max-height: none; overflow: visible; font-size: 12.5px; }
  .dna-meta { flex-direction: column; align-items: stretch; gap: 6px; }
  .dna-legend .lg { min-height: 26px; }
  .dna-bar .dna-close { width: 34px; height: 34px; }
  .dna-crumbs { font-size: 12px; }
  .dna-crumbs button, .dna-crumbs span { padding: 5px 8px; }
  .dna-guide { height: 34px; padding: 0 11px 0 6px; }
  .dna-guide .long { display: none; }
  .dna-guide .short { display: inline; }
  .dna-spots .long { display: none; }
  .dna-spots .short { display: inline; }
  .dna-search { height: 34px; flex: 0 1 240px; }
  .dna-zoom { flex-direction: row; right: 8px; bottom: calc(8px + var(--sab)); gap: 5px; }
  .dna-stage { padding-left: var(--sal); }
  .dna-zoom .icon-btn { width: 36px; height: 36px; border-radius: 11px; }
  .dna-zoom .dna-nav-q { display: none; }
}
@media (orientation: landscape) and (max-height: 520px) {
  /* phone on its side: little height, so a tighter header and text */
  .dna-help { padding: 6px calc(10px + var(--sar)) calc(6px + var(--sab)) calc(10px + var(--sal)); }
  .dh-head { padding: 6px 8px 6px 14px; }
  .dh-head h3 { font-size: 16px; }
  .dh-body { font-size: 14px; }
  .dh-foot { padding: 6px 14px 8px; display: flex; align-items: center; gap: 10px; }
  .dh-rel { flex: 1; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .dh-rel::-webkit-scrollbar { display: none; }
  .dh-rel > * { flex: none; white-space: nowrap; }
  .dh-rel button { padding: 5px 10px; }
  .dh-done { flex: none; padding: 8px 16px; }
  .dh-done-long { display: none; }
}
@media (max-width: 560px) {
  .dna-crumbs { font-size: 12px; }
  .dna-card { max-height: 28dvh; }
}
/* a short phone: the map area is too short for the zoom ladder; the path at the top (Genome ›
   Chr 19 › APOE) jumps between levels the same way, and + / − stay */
@media (max-width: 560px) and (max-height: 700px) {
  .dna-ladder, .dna-zoom .dl-head { display: none; }
}

/* build stamp: version + commit + build time in the bottom-right corner (in the gap under the
   side panel); a button that opens .build-pop, a card explaining each part */
.build-stamp { position: fixed; z-index: 60; right: calc(8px + var(--sar)); bottom: calc(0px + var(--sab)); padding: 0 2px; font: 500 10.5px/12px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.01em; color: var(--muted); opacity: 0.8; cursor: pointer; text-decoration: underline dotted transparent; text-underline-offset: 2px; transition: opacity .2s, color .2s, text-decoration-color .2s; }
/* the same label inside each full screen's bottom strip (DNA, helix, grid, a full panel) */
.build-inline { padding: 2px 0; font: 500 10.5px/12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); opacity: 0.8; background: none; border: 0; cursor: pointer; white-space: nowrap; }
.build-inline:hover { opacity: 1; color: var(--text); text-decoration: underline dotted; }
.dna-meta .build-inline { margin-left: auto; }
.build-inline { position: relative; }
.build-inline::after { content: ""; position: absolute; inset: -14px -6px; }   /* a finger-sized target round the small print */
/* very short phones (an iPhone SE held upright): the bottom card and the helix's footer scroll
   inside a capped height, so the view keeps room for its zoom buttons */
@media (orientation: portrait) and (max-height: 600px) {
  .dna-foot { max-height: 36dvh; overflow-y: auto; overscroll-behavior: contain; }
  .hx-foot { max-height: 30dvh; overflow-y: auto; overscroll-behavior: contain; }
  .hx-zoom { flex-direction: row; bottom: 6px; } .hx-zoom .icon-btn { width: 36px; height: 36px; }
}
.dna-build-own { display: none; }
/* phones: the key row scrolls sideways, so the label gets a line of its own under it */
@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) {
  .dna-meta .build-inline { display: none; }
  .dna-build-own { display: block; margin: 2px 0 0 auto; padding: 0; }
}
.hx-legend .hx-build { order: 9; margin-left: auto; color: #8b96bb; }
.hall-foot { display: flex; justify-content: flex-end; padding: 2px calc(12px + var(--sar)) calc(2px + var(--sab)) calc(12px + var(--sal)); }
.panel-build { display: none; }
#app[data-sheet="full"] .panel-build, .panel[data-sheet="full"] .panel-build { display: block; align-self: flex-end; margin: 2px 12px calc(4px + var(--sab)); }
.build-stamp::after { content: ""; position: absolute; inset: -10px -6px -4px; }   /* a finger-sized target round the small print */
.build-stamp:hover, .build-stamp[aria-expanded="true"] { opacity: 1; color: var(--text); text-decoration-color: currentColor; }
.build-stamp:focus-visible { outline: 1px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }
.build-pop { position: fixed; z-index: 61; right: calc(8px + var(--sar)); bottom: calc(18px + var(--sab)); width: min(360px, calc(100vw - 16px - var(--sar) - var(--sal))); max-height: calc(100vh - var(--top-h) - 40px); overflow-y: auto; padding: 14px 16px; border-radius: 16px; background: var(--glass-strong); border: 1px solid var(--line-strong); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35); font-size: 13px; line-height: 1.45; color: var(--text); animation: fade .2s ease; }
.build-pop[hidden] { display: none; }
.build-pop code { font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.bp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-family: "Space Grotesk", Inter, system-ui, sans-serif; font-size: 15px; }
.bp-close { width: 28px; height: 28px; border-radius: 8px; font-size: 18px; line-height: 1; color: var(--muted); }
.bp-close:hover { background: rgba(var(--ov), 0.08); color: var(--text); }
.bp-big { font-weight: 600; }
.bp-sub { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.build-pop dl { margin: 0 0 10px; }
.build-pop dt { font-weight: 600; margin-top: 8px; }
.build-pop dd { margin: 2px 0 0; color: var(--muted); }
.bp-data { border-top: 1px solid var(--line); padding-top: 8px; display: grid; gap: 4px; font-size: 12.5px; }
.bp-data div { display: flex; justify-content: space-between; gap: 12px; }
.bp-data span { color: var(--muted); }
@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) {
  /* bottom-sheet layout: the sheet covers the bottom edge, so a small pill just under the top bar */
  .build-stamp { bottom: auto; top: calc(var(--top-h) + var(--sat) + var(--sub-h) + 8px); padding: 3px 8px; border-radius: 999px; font-size: 10px; background: rgba(var(--n1), 0.55); border: 1px solid var(--line); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
  .build-pop { bottom: auto; top: calc(var(--top-h) + var(--sat) + var(--sub-h) + 36px); }
}
@media (orientation: landscape) and (max-height: 520px) {
  /* phone on its side: side panel, not a sheet; the corner under it is only 8 px tall */
  .build-stamp { top: auto; bottom: var(--sab); padding: 0 2px; border: 0; background: none; font-size: 8.5px; line-height: 8px; }
  .build-pop { top: auto; bottom: calc(14px + var(--sab)); }
}
/* zoom ladder on phones: just the dots, with the current level named */
@media (max-width: 560px) {
  .dna-ladder { min-width: 0; padding: 6px 6px 5px; }
  .dl-head span, .dl-l small { display: none; }
  .dl-head { justify-content: center; padding-bottom: 2px; }
  .dl-step:not(.on) .dl-l { display: none; }
  .dl-step { padding: 5px 6px; }
  .dl-size { font-size: 10.5px; max-width: 92px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .dna-ladder { flex-direction: row; align-items: center; min-width: 0; padding: 4px 6px; gap: 0; }
  .dl-head, .dl-size, .dl-l small { display: none; }
  .dl-step:not(.on) .dl-l { display: none; }
  .dl-step i::after { display: none; }
  .dl-step { padding: 4px 6px; }
}

/* About: model credits */
.ab-credits { margin-top: 14px; font-size: 13px; color: var(--muted); }
.ab-credits summary { cursor: pointer; font-weight: 600; color: var(--text); }
.ab-credits ul { margin: 6px 0; padding-left: 18px; }
.ab-credits a { color: var(--cyan); }

/* sample genomes: one button each */
.samples { margin-top: 12px; }
.samples-k { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.samples-k span { font-weight: 400; color: var(--faint); }
.samples-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.samples-list .sample-btn { margin-top: 0; padding: 9px 11px; }
.samples-list .sample-btn span { font-size: 13px; }
.samples-list .sample-btn small { font-size: 11.5px; line-height: 1.3; }
@media (max-width: 420px) { .samples-list { grid-template-columns: 1fr; } }

/* ---------- helix viewer (helixview.js): one row of letters as the molecule ---------- */
.dh-link { display: inline; padding: 0; color: var(--cyan); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.dna-card .dc-actions .dc-helix { color: var(--cyan); }
.helix { position: absolute; inset: 0; z-index: 29; display: flex; flex-direction: column; background: #05060d; color: #eaf0ff; animation: fade .2s ease; }
.hx-bar { display: flex; align-items: center; gap: 10px; padding: 8px calc(10px + var(--sar)) 8px calc(10px + var(--sal)); border-bottom: 1px solid rgba(150, 180, 255, .14); }
.hx-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.hx-title b { font: 700 15px "Space Grotesk", Inter, system-ui, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-title span { font-size: 11.5px; color: #93a0c4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-seg { flex: none; }
.helix .hx-close, .helix .q { flex: none; }
.hx-stage { position: relative; flex: 1; min-height: 0; }
.hx-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hx-zoom { position: absolute; right: calc(10px + var(--sar)); bottom: 10px; display: flex; flex-direction: column; gap: 8px; }
.hx-zoom .icon-btn { background: rgba(20, 26, 50, .75); border: 1px solid rgba(150, 180, 255, .2); }
.hx-foot { padding: 8px calc(14px + var(--sar)) calc(10px + var(--sab)) calc(14px + var(--sal)); border-top: 1px solid rgba(150, 180, 255, .14); font-size: 12.5px; color: #93a0c4; line-height: 1.45; }
.hx-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 4px; color: #cdd6f4; font-weight: 600; }
.hx-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; box-shadow: 0 0 8px currentColor; }
.hx-note { margin: 0; max-height: 7.4em; overflow-y: auto; overscroll-behavior: contain; }   /* a long note scrolls; it never squeezes the 3D view */
@media (max-height: 700px) { .hx-note { max-height: 4.4em; } }
.hx-note b { color: #eaf0ff; }
.hx-aa-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 6px; }
.hx-aa-msg { font-size: 12px; color: #b9c4e4; flex: 1 1 200px; }
.hx-aa { display: inline-flex; align-items: center; gap: 7px; margin: 0; padding: 6px 12px; min-height: 32px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: #cfd8f5; background: rgba(150, 180, 255, .08); border: 1px solid rgba(150, 180, 255, .25); }
.hx-aa i { width: 26px; height: 14px; border-radius: 999px; background: rgba(150, 180, 255, .25); position: relative; transition: background .2s; }
.hx-aa i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: #fff; transition: transform .2s; }
.hx-aa[aria-pressed="true"] { color: #fff; border-color: var(--cyan); }
.hx-aa[aria-pressed="true"] i { background: var(--cyan); }
.hx-aa[aria-pressed="true"] i::after { transform: translateX(12px); }
.helix:not(.is-double) .hx-dbl { display: none; }
@media (max-width: 520px) {
  .hx-title span { font-size: 10.5px; }
  .hx-foot { font-size: 11.5px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .hx-bar { padding-top: 4px; padding-bottom: 4px; }
  .hx-foot { padding-top: 4px; padding-bottom: calc(4px + var(--sab)); }
  .hx-note { display: none; }
}
@media (max-width: 520px) { .hx-title b { font-size: 13px; } .hx-seg button { padding: 7px 11px; font-size: 12.5px; } }

/* ---------- hallmarks grid (gridview.js): programs by body area x hallmark of aging ---------- */
.hall { position: absolute; inset: calc(var(--top-h) + var(--sat)) 0 0 0; z-index: 25; display: flex; flex-direction: column; background: var(--dna-bg); animation: fade .25s ease; }
.hall[hidden] { display: none; }
.hall-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 8px calc(12px + var(--sar)) 8px calc(12px + var(--sal)); border-bottom: 1px solid var(--line); }
.hall-title { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.hall-title b { font: 700 16px "Space Grotesk", Inter, system-ui, sans-serif; }
.hall-sub { font-size: 12px; color: var(--muted); }
.hall-body { flex: 1; min-height: 0; overflow: auto; padding: 12px calc(12px + var(--sar)) calc(16px + var(--sab)) calc(12px + var(--sal)); overscroll-behavior: contain; }
.g-wrap { overflow-x: auto; overscroll-behavior-x: contain; padding-bottom: 4px; }
.g-table { border-collapse: separate; border-spacing: 2px; font-size: 13px; margin: 0 auto; }
.g-table th, .g-table td { padding: 0; }
.g-corner { text-align: left; vertical-align: bottom; font-size: 11px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 0 8px 4px 0 !important; }
.g-tier { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; text-align: left; border-bottom: 2px solid var(--line-strong); padding: 0 0 3px 4px !important; }
.g-tier span { white-space: nowrap; }
.g-tier-x { border-bottom: 0; }
/* column names stand slanted so twelve fit */
/* column names read upward, in up to two lines, so twelve fit side by side */
.g-hh { height: 118px; vertical-align: bottom; width: 40px; max-width: 40px; padding-bottom: 6px !important; }
.g-hh > span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); max-height: 112px; white-space: normal; text-align: left; font-size: 11.5px; line-height: 13px; font-weight: 600; color: var(--text); }
.g-uncl-h > span, .g-tot-h > span { color: var(--muted); }
.g-rh { text-align: right; white-space: nowrap; padding: 0 10px 0 0 !important; font-weight: 600; color: var(--text); position: sticky; left: 0; background: var(--hall-solid); z-index: 1; }
.g-corner { position: sticky; left: 0; background: var(--hall-solid); z-index: 1; }
.g-cell, .g-tot { width: 40px; min-width: 40px; height: 32px; text-align: center; border-radius: 6px; font-variant-numeric: tabular-nums; font-weight: 700; }
.g-cell { background: rgba(var(--cyan-rgb, 62, 230, 255), calc(var(--heat) * .85)); color: var(--text); }
.g-cell.hot { color: #04121a; }
:root[data-theme="light"] .g-cell.hot { color: #ffffff; }
/* nothing here: a hatch and a faint 0, so an empty cell reads as absence even without color */
.g-cell.zero { background: repeating-linear-gradient(135deg, rgba(var(--magenta-rgb, 255, 61, 154), .13) 0 3px, transparent 3px 7px); color: rgba(var(--magenta-rgb, 255, 61, 154), .7); font-weight: 500; box-shadow: inset 0 0 0 1px rgba(var(--magenta-rgb, 255, 61, 154), .25); }
.g-cell.zero span { opacity: .75; }
.tier-start { box-shadow: -3px 0 0 -1px var(--line-strong); }
.g-cell.zero.tier-start { box-shadow: inset 0 0 0 1px rgba(var(--magenta-rgb, 255, 61, 154), .25), -3px 0 0 -1px var(--line-strong); }
.g-gap { width: 10px; min-width: 10px; }
.g-uncl { background: rgba(var(--ov), .07); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.g-uncl.none { color: var(--fainter, var(--faint)); background: transparent; }
.g-tot { color: var(--muted); background: rgba(var(--ov), .03); }
.g-tot-r { color: var(--muted); }
tfoot .g-tot { color: var(--text); }
.g-foot { max-width: 760px; margin: 12px auto 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; text-align: center; }
.g-foot b { color: var(--text); }
@media (max-width: 760px) {
  .g-hh { width: 34px; max-width: 34px; }
  .g-hh > span { font-size: 11px; line-height: 12px; }
  .g-cell, .g-tot { width: 34px; min-width: 34px; height: 30px; font-size: 12px; }
  .g-rh { font-size: 12px; padding-right: 6px !important; }
}
.hm-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 2px; }
.hm-tag { padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--violet, #8d7bff); background: rgba(141, 123, 255, .12); border: 1px solid rgba(141, 123, 255, .3); }
.hm-tag:hover { border-color: var(--cyan); }
.hm-tag.none { color: var(--muted); background: transparent; border-style: dashed; border-color: var(--line); }
.hm-filter-note { margin: 0 0 10px; padding: 9px 12px; border-radius: 12px; font-size: 12.5px; color: var(--muted); background: rgba(141, 123, 255, .1); border: 1px solid rgba(141, 123, 255, .28); line-height: 1.45; }
.hm-filter-note b { color: var(--text); }
.hm-filter-note button { margin-left: 4px; color: var(--cyan); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.g-tip { position: absolute; z-index: 5; max-width: 300px; padding: 10px 12px; border-radius: 12px; background: var(--glass-strong); border: 1px solid var(--line-strong); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: 0 12px 30px rgba(0, 0, 0, .4); font-size: 12.5px; line-height: 1.4; color: var(--text); pointer-events: none; }
.g-tip[hidden] { display: none; }
.g-tip b { display: block; margin-bottom: 3px; }
.g-tip span { display: block; color: var(--muted); }
.g-tip ul { margin: 4px 0 0; padding-left: 16px; }
.g-tip li { margin: 1px 0; }
.g-tip i { color: var(--faint); font-style: normal; }
.g-tip em { display: block; margin-top: 5px; font-style: normal; font-size: 11.5px; color: var(--cyan); }
.g-cell, .g-tot, .g-rh, .g-hh { cursor: pointer; }
.g-cell:hover, .g-tot:hover { outline: 2px solid var(--cyan); outline-offset: -1px; }
.g-table [tabindex]:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.g-rh:hover, .g-hh:hover > span { color: var(--cyan); }
.seg3 { grid-auto-columns: auto; }
.seg3 .seg-thumb { width: calc(33.333% - 2px); }
.seg3[data-pos="1"] .seg-thumb { transform: translateX(100%); }
.seg3[data-pos="2"] .seg-thumb { transform: translateX(200%); }
.seg3 button { min-width: 0; }
.seg3 { grid-template-columns: repeat(3, 1fr); }
.hall-species .short { display: none; }
@media (max-width: 520px) { .hall-species .long { display: none; } .hall-species .short { display: inline; } .hall-species button { padding: 7px 12px; } }
.g-pair { display: flex; flex-wrap: wrap; gap: 18px 28px; justify-content: center; align-items: flex-start; }
.g-side { min-width: 0; max-width: 100%; }
.g-side h3 { margin: 0 0 6px; font: 700 15px "Space Grotesk", Inter, system-ui, sans-serif; color: var(--text); }
.g-side h3 span { display: block; font: 500 12px Inter, system-ui, sans-serif; color: var(--muted); }
/* the compact grid, for side by side */
.g-table.compact { border-spacing: 1.5px; font-size: 11px; margin: 0; }
.g-table.compact .g-cell, .g-table.compact .g-tot { width: 24px; min-width: 24px; height: 22px; border-radius: 4px; font-size: 10.5px; }
.g-table.compact .g-hh { width: 24px; max-width: 24px; height: 146px; }
.g-table.compact .g-hh > span { font-size: 10px; line-height: 11px; max-height: 142px; }
.g-table.compact .g-rh { font-size: 11px; padding-right: 6px !important; }
.g-table.compact .g-tier { font-size: 8.5px; }
.g-table.compact .g-gap { width: 6px; min-width: 6px; }
.g-tier { max-width: 0; overflow: hidden; }
.g-tier span { display: block; overflow: hidden; text-overflow: ellipsis; }
/* ---------- hallmark filter on the map ---------- */
.hl-btn { flex: none; display: flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px 0 11px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); color: var(--muted); font: 600 13px/1 Inter, system-ui, sans-serif; white-space: nowrap; }
.hl-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; flex: none; }
.hl-btn .hl-k { overflow: hidden; text-overflow: ellipsis; }
.hl-btn:hover { border-color: var(--line-strong); color: var(--text); }
.hl-btn.on { color: var(--text); border-color: rgba(var(--cyan-rgb), .6); box-shadow: 0 0 18px rgba(var(--cyan-rgb), .25); }
#app[data-mode="me"] .hl-pick { display: none; }
.hl-menu { position: fixed; z-index: 66; width: min(300px, calc(100vw - 16px)); max-height: min(70vh, 560px); overflow-y: auto; padding: 10px 6px 8px; border-radius: 16px; background: var(--glass-strong); border: 1px solid var(--line-strong); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: 0 18px 50px rgba(0, 0, 0, .45); animation: fade .15s ease; }
.hl-menu[hidden] { display: none; }
.hl-head { padding: 0 10px 6px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.hl-head span { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.hl-tier { padding: 8px 10px 2px; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.hl-list label { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 10px; font-size: 13px; color: var(--text); cursor: pointer; min-height: 32px; }
.hl-list label:hover { background: rgba(var(--ov), .06); }
.hl-list input { width: 16px; height: 16px; accent-color: var(--cyan); flex: none; }
.hl-all { font-weight: 600; }
.chip.hl-out { opacity: .38; }
/* ---------- help popover (helppop.js) ---------- */
.hp-pop { position: fixed; inset: 0; z-index: 70; background: rgba(var(--n4, 2, 3, 10), .35); animation: fade .15s ease; }
.hp-card { position: absolute; width: min(400px, calc(100vw - 24px)); max-height: min(78vh, 640px); display: flex; flex-direction: column; border-radius: 18px; background: var(--glass-strong); border: 1px solid var(--line-strong); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px); box-shadow: 0 24px 70px rgba(0, 0, 0, .5); overflow: hidden; }
.hp-pop.sheet .hp-card { left: 0; right: 0; bottom: 0; width: 100%; max-height: 86dvh; border-radius: 20px 20px 0 0; padding-bottom: var(--sab); }
.hp-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 6px 18px; }
.hp-head h3 { flex: 1; margin: 0; font: 700 17px "Space Grotesk", Inter, system-ui, sans-serif; color: var(--text); }
.hp-close { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(var(--ov), .07); flex: none; }
.hp-close svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; }
.hp-body { padding: 4px 18px 12px; overflow-y: auto; font-size: 14px; line-height: 1.55; color: var(--muted); }
.hp-body p { margin: 0 0 10px; }
.hp-body b { color: var(--text); }
.hp-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--cyan); margin-bottom: 8px; line-height: 1.4; }
.hp-links { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 18px 16px; border-top: 1px solid var(--line); }
.hp-links a { padding: 8px 13px; border-radius: 999px; background: rgba(var(--ov), .07); font-size: 13px; font-weight: 600; color: var(--text); text-decoration: none; }
.hp-links a:hover { background: rgba(var(--cyan-rgb), .15); }
.hp-q { width: 22px; height: 22px; font-size: 12px; vertical-align: middle; margin-left: 4px; }
.hall-title .hp-q { margin-left: 6px; }
.g-tier .hp-q { width: 18px; height: 18px; font-size: 10.5px; margin-left: 6px; letter-spacing: 0; }
.g-tier { overflow: visible; }
.g-tot-r .hp-q { width: 18px; height: 18px; font-size: 10.5px; margin: 0 6px 0 0; }
.g-hh { position: relative; }
.g-q { position: absolute; left: 50%; bottom: -1px; transform: translate(-50%, 0); font-style: normal; font-size: 9px; font-weight: 700; color: var(--cyan); opacity: .7; }
.g-hh:hover .g-q, .g-hh:focus-visible .g-q { opacity: 1; }
.g-hh { padding-bottom: 12px !important; }
.hl-head .hp-q { width: 20px; height: 20px; font-size: 11px; }
/* the grid / reference tabs */
.hall-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: rgba(var(--ov), .05); border: 1px solid var(--line); flex: none; }
.hall-tabs button { padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.hall-tabs button[aria-selected="true"] { color: var(--text); background: rgba(var(--cyan-rgb), .16); box-shadow: inset 0 0 0 1px rgba(var(--cyan-rgb), .45); }
.hall[data-tab="ref"] .hall-species, .hall[data-tab="ref"] [data-hp="compare"] { display: none; }
.g-pick { max-width: 760px; margin: 0 auto 10px; padding: 8px 12px; border-radius: 12px; font-size: 13px; color: var(--muted); background: rgba(var(--cyan-rgb), .08); border: 1px solid rgba(var(--cyan-rgb), .3); text-align: center; }
.g-pick b { color: var(--text); }
.g-unpick { margin-left: 6px; color: var(--cyan); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.g-wrap[data-col] .g-cell:not(.picked), .g-wrap[data-col] tfoot .g-tot:not(.picked) { opacity: .28; }
.g-wrap[data-col] .g-hh:not(.picked) > span { opacity: .4; }
.g-cell.picked, .g-tot.picked { outline: 2px solid rgba(var(--cyan-rgb), .8); outline-offset: -1px; }
/* the reference page */
.ref { max-width: 760px; margin: 0 auto; color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.ref h2 { margin: 6px 0 10px; font: 700 24px "Space Grotesk", Inter, system-ui, sans-serif; color: var(--text); }
.ref b { color: var(--text); }
.ref-intro p { margin: 0 0 10px; }
.ref-tier { margin-top: 26px; }
.ref-tier h3 { margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line-strong); font: 700 13px Inter, system-ui, sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--cyan); }
.ref-tier h3 span { display: block; margin-top: 3px; font-size: 13.5px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.ref-h { padding: 14px 16px; margin: 10px 0; border-radius: 16px; background: rgba(var(--ov), .035); border: 1px solid var(--line); }
.ref-h-top { display: flex; align-items: center; gap: 10px; }
.ref-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--text); background: rgba(var(--cyan-rgb), .15); flex: none; }
.ref-h h4 { margin: 0; font: 700 17px "Space Grotesk", Inter, system-ui, sans-serif; color: var(--text); }
.ref-short { margin: 6px 0 4px; color: var(--text); font-weight: 500; }
.ref-h p { margin: 6px 0; }
.ref-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; font-size: 13px; }
.ref-stats .none { color: var(--magenta); }
.ref-stats .none b { color: var(--magenta); }
.ref-stats a { display: inline-block; padding: 6px 0; color: var(--cyan); font-weight: 600; text-decoration: none; }
.ref-stats a:hover { text-decoration: underline; }
.ref-src { margin: 26px 0 8px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--faint); }
.ref-src a { color: var(--cyan); }
@media (max-width: 520px) {
  .hall-tabs button { padding: 7px 10px; font-size: 12.5px; }
  .ref h2 { font-size: 20px; }
  .ref-h { padding: 12px; }
}
.cap-list { display: flex; flex-direction: column; gap: 2px; }
.cap-list button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 10px; border-radius: 10px; text-align: left; }
.cap-list button:hover, .cap-list button:focus-visible { background: rgba(var(--ov), .07); outline: none; }
.cap-list b { font-size: 13.5px; color: var(--text); }
.cap-list span { font-size: 12px; color: var(--muted); }
body:has(#cap-menu:not([hidden])) .build-stamp { display: none; }

/* the map's tools: the hallmark filter (its button doubles as the badge when a filter is on) and
   the camera, just under the Human | Dog row */
.map-tools { position: absolute; z-index: 6; left: calc(12px + var(--sal)); top: calc(var(--top-h) + var(--sat) + var(--sub-h) + 14px); display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 24px - var(--sal) - var(--sar)); }
.hl-pick { display: flex; align-items: center; gap: 4px; min-width: 0; }
.hl-btn { min-width: 0; }
.hl-btn .hl-count { color: var(--cyan); font-weight: 700; padding-left: 8px; margin-left: 2px; border-left: 1px solid var(--line-strong); white-space: nowrap; }
.hl-btn .hl-count[hidden] { display: none; }
.hl-clear { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--glass); border: 1px solid var(--line); position: relative; }
.hl-clear[hidden] { display: none; }
.hl-clear svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2.2; fill: none; }
.hl-clear::after { content: ""; position: absolute; inset: -6px; }
.map-tools .cap-btn { flex: none; background: var(--glass); border: 1px solid var(--line); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
body.dna-open .map-tools, #app[data-sheet="full"] .map-tools, body:has(#hall:not([hidden])) .map-tools { display: none; }
.hall-bar .cap-btn { flex: none; }
@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) {
  /* under the version pill on phones and tablets in portrait */
  .map-tools { top: calc(var(--top-h) + var(--sat) + var(--sub-h) + 40px); }
}
@media (max-width: 460px) {
  .hl-btn .hl-k { display: none; }   /* the icon, or the count when a filter is on */
  .hl-btn { padding: 0 11px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  /* clear of the slim side panel: the icon and the count only (the panel names the filter) */
  .map-tools { top: calc(var(--top-h) + var(--sat) + var(--sub-h) + 8px); max-width: calc(100vw - var(--panel-w) - 36px - var(--sal) - var(--sar)); }
  .hl-btn .hl-k { display: none; }
  .hl-btn { padding: 0 11px; }
  .hl-btn .hl-count { border-left: 0; padding-left: 4px; }
}
/* the wide side-panel layout too: never reach under the panel */
@media (min-width: 761px) and (orientation: landscape), (min-width: 1101px) {
  .map-tools { max-width: calc(100vw - var(--panel-w) - 48px - var(--sal) - var(--sar)); }
}
.hx-row { position: relative; display: inline-flex; align-items: center; max-width: 100%; }
.hx-row select { appearance: none; -webkit-appearance: none; max-width: 100%; padding: 4px 26px 4px 10px; border-radius: 999px; border: 1px solid rgba(150, 180, 255, .3); background: rgba(20, 26, 50, .8); color: #eaf0ff; font: 700 14px "Space Grotesk", Inter, system-ui, sans-serif; text-overflow: ellipsis; }
.hx-row svg { position: absolute; right: 8px; width: 14px; height: 14px; stroke: #93a0c4; stroke-width: 2; fill: none; pointer-events: none; }
.hx-row .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hx-title { gap: 2px; }
.hx-legend i.ring { background: transparent; border: 2px solid #ff3d9a; border-radius: 50%; box-shadow: 0 0 8px #ff3d9a; }
.dna.hx-loading { cursor: progress; }
.dna.hx-loading .dna-dim { opacity: .6; }

/* the zoom ladder folds to one chip (the level you're on); tap it for the four steps */
.dna-ladder:not(.open) { padding: 0; min-width: 0; background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
.dl-chip { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 9px; border-radius: 14px; background: rgba(var(--n1), .82); border: 1px solid var(--line-strong); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: var(--text); text-align: left; min-height: 44px; }
.dl-chip i { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.dl-chip .dl-l { font-weight: 700; }
.dl-chip small { color: var(--cyan); }
.dl-chip svg { width: 14px; height: 14px; stroke: var(--muted); stroke-width: 2; fill: none; flex: none; }
.dl-chip:hover { border-color: var(--cyan); }
.dl-fold { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.dl-fold svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }
.dl-fold::after { content: ""; position: absolute; inset: -8px; }
.dl-fold { position: relative; }
@media (max-width: 560px) {
  .dl-chip small { display: none; }
  .dl-chip { padding: 6px 8px; min-height: 38px; }
  .dl-head .dl-fold { margin-left: 2px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .dl-chip small { display: none; }
  .dl-chip { min-height: 36px; padding: 4px 8px; }
}
.dl-head span { flex: 1; }

/* the 3D helix button: the one coloured pill in the DNA bar, so it's easy to find */
.dna-dim, .hx-dim { flex: none; }
.dna-dim button, .hx-dim button { min-width: 44px; font-weight: 700; }
.hx-spin { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-weight: 600; color: #cdd6f4; }
.hx-spin input { flex: 1; max-width: 260px; min-width: 100px; height: 32px; accent-color: #3ee6ff; }
.hx-dir { font-size: 16px; color: #93a0c4; }
.hx-spin-v { min-width: 150px; font-weight: 600; color: #3ee6ff; white-space: nowrap; }
@media (max-width: 520px) { .hx-spin-v { min-width: 0; font-size: 11px; } }
/* full screen (fullscreen.js): hidden where the browser can't do it (an iPhone); the icon flips */
.no-fullscreen [data-fullscreen] { display: none; }
[data-fullscreen] .fs-out, .is-fullscreen [data-fullscreen] .fs-in { display: none; }
.is-fullscreen [data-fullscreen] .fs-out { display: block; }
.hx-bar .hx-full { flex: none; }
/* narrow screens: the top bar has no room for it; the helix viewer keeps its own */
@media (max-width: 600px) { #btn-full { display: none; } }
.hx-title { min-width: 0; flex: 1 1 0; }
.hx-row { min-width: 0; width: 100%; }
.hx-row select { width: 100%; min-width: 0; }
@media (max-width: 400px) { .hx-bar { gap: 6px; } .hx-seg button { padding: 7px 9px; } }
/* the DNA view's two modes, and the known-variants list */
.dna-modes { flex: none; }
.dna-modes .short { display: none; }
@media (max-width: 760px) { .dna-modes .long { display: none; } .dna-modes .short { display: inline; } .dna-modes button { padding: 7px 11px; font-size: 12.5px; } }
.kv-kind { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: rgba(var(--ov), .08); color: var(--muted); }
.kv-kind.recessive { color: #4fd8ff; } .kv-kind.dominant { color: #ff7a9e; } .kv-kind.x { color: #b9a8ff; } .kv-kind.trait { color: #38e8b0; }
.kv-kind.drug { color: #ffb84d; }
:root[data-theme="light"] .kv-kind.recessive { color: #0a7fa8; } :root[data-theme="light"] .kv-kind.dominant { color: #c2185b; } :root[data-theme="light"] .kv-kind.x { color: #5b44c9; } :root[data-theme="light"] .kv-kind.trait { color: #0b8a62; } :root[data-theme="light"] .kv-kind.drug { color: #a35f00; }
.kv-here { margin-left: auto; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--magenta); color: #fff; }
.kv-item.cur { border-color: color-mix(in srgb, var(--magenta) 60%, transparent); }
.kv-item[hidden], .kv-h[hidden] { display: none; }
/* the list's finder: a search box and two drop-downs, pinned to the top while the list scrolls */
.kv-about { margin: 4px 0 8px; }
.kv-about summary { cursor: pointer; font-weight: 600; color: var(--cyan); padding: 6px 0; min-height: 32px; }
.kv-tools { position: sticky; top: -4px; z-index: 2; margin: 6px -18px 0; padding: 10px 18px 8px; background: rgb(var(--n2)); border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.kv-q { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 42px; border-radius: 12px; background: rgba(var(--ov), .06); border: 1px solid var(--line-strong); }
.kv-q:focus-within { border-color: var(--cyan); }
.kv-q svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.kv-q input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--text); font: 500 15px Inter, system-ui, sans-serif; }
.kv-sel { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kv-sel label { display: grid; gap: 3px; min-width: 0; }
.kv-sel span { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kv-sel select { width: 100%; min-width: 0; height: 40px; padding: 0 10px; border-radius: 10px; background: rgba(var(--ov), .06); border: 1px solid var(--line-strong); color: var(--text); font: 600 14px Inter, system-ui, sans-serif; }
.kv-sel select option { background: rgb(var(--n2)); color: var(--text); }
.kv-count { display: flex; align-items: center; gap: 10px; min-height: 28px; font-size: 13px; color: var(--muted); }
.kv-clear { padding: 4px 12px; min-height: 28px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: rgba(var(--ov), .08); border: 1px solid var(--line); color: var(--cyan); }
.kv-none { color: var(--muted); }
.kv-prompt { margin: 8px 0 4px; padding: 10px 12px; border-radius: 12px; font-weight: 700; color: var(--text); background: color-mix(in srgb, var(--cyan) 14%, transparent); border: 1px solid color-mix(in srgb, var(--cyan) 45%, transparent); }
/* a very short screen (a phone held sideways): the variant finder scrolls away with the list, so the list keeps room */
@media (max-height: 520px) { .kv-tools { position: static; margin-bottom: 4px; } }
.kv-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.kv-btns .sp-go { margin-left: 0; }
.kv-btns .kv-3d { color: var(--cyan); }
.hx-ver { flex: none; }
.hx-ver .short { display: none; }
@media (max-width: 600px) { .hx-ver .long { display: none; } .hx-ver .short { display: inline; } .hx-ver button { padding: 7px 9px; font-size: 12px; } }
/* narrow phones: the helix viewer's switches get their own row under the title */
@media (max-width: 600px) {
  .hx-bar { flex-wrap: wrap; row-gap: 6px; }
  .hx-title { flex: 1 1 calc(100% - 150px); }
  .hx-ver, .hx-seg { order: 5; }
  .hx-ver { margin-right: auto; }
}
/* a short phone on its side: the DNA bar's buttons go to icons so the search keeps its room */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 760px) {
  .dna-modes button { padding: 5px 9px; font-size: 12px; }
  .dna-spots .short, .dna-guide .short { display: none; }
  .dna-spots, .dna-guide { padding: 0 9px; }
  .dna-search { flex: 1 1 110px; min-width: 110px; }
  .dna-crumbs { min-width: 0; overflow: hidden; }
}
@media (orientation: landscape) and (max-height: 520px) and (max-width: 760px) {
  .dna-crumbs { display: none; }   /* the level chip by the zoom buttons does the same job */
  .dna-bar { flex-wrap: nowrap; }
  /* the helix viewer: one row again (no room for two), the title gives way */
  .hx-bar { flex-wrap: nowrap; }
  .hx-ver, .hx-seg { order: 0; margin-right: 0; }
  .hx-title { flex: 1 1 0; min-width: 0; }
  .hx-ver button, .hx-seg button { padding: 5px 8px; font-size: 11.5px; }
}
.kv-nav { align-items: center; }
.kv-nav .kv-pos { font-size: 12px; color: var(--faint); }
/* the small "?" beside an address, and the address picture in its help */
.q.q-addr { width: 18px; height: 18px; font-size: 10.5px; margin-left: 5px; vertical-align: 1px; }
.q.q-addr::after { content: ""; position: absolute; inset: -4px; }
.addr-demo { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px; margin: 4px 0 10px; padding: 12px 14px; border-radius: 12px; background: rgba(var(--ov), .05); font: 700 22px ui-monospace, SFMono-Regular, Menlo, monospace; }
.addr-demo .a-sep { color: var(--faint); }
.a-chr { color: #b9a8ff; } .a-start { color: var(--cyan); } .a-end { color: #ff7a9e; }
@media (max-width: 420px) { .addr-demo { font-size: 17px; } }
.hx-mode { flex: none; }
.hx-mode .short { display: none; }
@media (max-width: 760px) { .hx-mode .long { display: none; } .hx-mode .short { display: inline; } .hx-mode button { padding: 7px 9px; font-size: 12px; } }
@media (max-width: 600px) { .hx-mode { order: 4; } }
@media (orientation: landscape) and (max-height: 520px) and (max-width: 760px) { .hx-mode { order: 0; } .hx-mode button { padding: 5px 8px; font-size: 11.5px; } }
.hx-addr { display: flex; align-items: center; min-width: 0; }
.hx-addr span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: #93a0c4; }
.hx-addr .q-addr { flex: none; }
@media (max-width: 1100px), (orientation: landscape) and (max-height: 520px) {
  .helix.many .hx-bar { flex-wrap: wrap; row-gap: 6px; }
  .helix.many .hx-title { flex: 1 1 calc(100% - 150px); }
  .helix.many .hx-mode, .helix.many .hx-ver, .helix.many .hx-seg { order: 5; }
}
@media (orientation: landscape) and (max-height: 520px) { .hx-zoom { flex-direction: row; bottom: 8px; } .hx-zoom .icon-btn { width: 36px; height: 36px; } }
/* helix transitions: the new one fades in over the one leaving (which pulls back and fades) */
.helix.entering { background: transparent; }
.helix.entering .hx-stage canvas { opacity: 0; transition: opacity .55s ease .1s; }
.helix.entering.in .hx-stage canvas { opacity: 1; }
.helix.leaving { pointer-events: none; }
.helix.leaving .hx-stage canvas { opacity: 0; transition: opacity .5s ease; }
.hx-bar, .hx-foot { background: #05060d; position: relative; z-index: 1; }

/* ===================== one layout for every screen =====================
   top bar: logo · the three views (Body | Grid | DNA) · settings (theme, full screen, about)
   toolbar (per view, the row under it): what to show on the left, its tools, then help on the right
   view controls (zoom, fit, level): bottom right, always the same place */
.view-nav { flex: none; }
.view-nav button { display: flex; align-items: center; justify-content: center; gap: 6px; }
.view-nav svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.topbar[data-fit="3"] .view-nav svg, .topbar[data-fit="4"] .view-nav svg, .topbar[data-fit="5"] .view-nav svg, .topbar[data-fit="6"] .view-nav svg { display: none; }
.topbar[data-fit="5"] .view-nav button, .topbar[data-fit="6"] .view-nav button { padding: 7px 10px; }
/* no X on the grid and DNA screens: the tabs above switch between the views (Esc goes back to Body) */
.hall-close, .dna-close { display: none !important; }
/* the body toolbar: what to show, then its tools; the tools wrap onto a second row when the
   first is full */
.subbar { flex-wrap: wrap; row-gap: 8px; }
.tb-group { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; min-width: 0; pointer-events: auto; max-width: 100%; }
.tb-tools .icon-btn { flex: none; background: var(--glass); border: 1px solid var(--line); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.tb-tools .hl-pick { min-width: 0; }
/* the DNA file: one chip, the same in Me mode and on the DNA screen; it opens a menu */
.file-pick { display: none; min-width: 0; }
#app[data-mode="me"] .file-pick { display: flex; }
.file-btn { display: flex; align-items: center; gap: 7px; min-width: 0; max-width: 260px; height: 40px; padding: 0 10px 0 12px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); color: var(--text); font: 600 12.5px/1 Inter, system-ui, sans-serif; }
.file-btn:hover { border-color: var(--line-strong); }
.file-btn .lock { width: 15px; height: 15px; stroke: var(--ok, #38e8b0); fill: none; stroke-width: 2; flex: none; }
.file-btn .chev { width: 14px; height: 14px; stroke: var(--muted); fill: none; stroke-width: 2; flex: none; }
.file-btn .file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-btn.empty .file-name { color: var(--cyan); }
.file-menu .fm-list { display: flex; flex-direction: column; gap: 2px; }
.file-menu .fm-list button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 10px; border-radius: 10px; text-align: left; min-height: 32px; }
.file-menu .fm-list button:hover, .file-menu .fm-list button:focus-visible { background: rgba(var(--ov), .07); outline: none; }
.file-menu .fm-list b { font-size: 13.5px; color: var(--text); }
.file-menu .fm-list span { font-size: 12px; color: var(--muted); }
.file-menu .fm-list .on b::after { content: " ✓"; color: var(--cyan); }
.file-menu .fm-remove b { color: #ff7a9e !important; }
.file-menu .fm-sep { height: 1px; background: var(--line); margin: 4px 8px; }
.file-menu .fm-k { padding: 6px 10px 2px; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
/* the DNA screen's toolbar, in a fixed order: mode · file · where you are … search · Spots · 3D helix · Guide */
.dna-bar .dna-modes { order: 1; }
.dna-bar .dna-file { order: 2; }
.dna-bar .dna-crumbs { order: 3; }
.dna-bar > .q[data-help="levels"] { order: 4; }
.dna-bar .dna-search { order: 5; margin-left: auto; }
.dna-bar .dna-spots { order: 6; }
.dna-bar .dna-dim { order: 7; }
.dna-bar .dna-guide { order: 8; }
.dna-file { display: none; height: 36px; max-width: 220px; }
.dna[data-mode="mine"] .dna-file, .dna:not([data-mode]) .dna-file { display: flex; }

/* phones: the DNA toolbar in three tidy rows: mode and file · search · Spots, 3D helix, Guide
   (where you are: the level chip by the zoom buttons) */
@media (max-width: 760px) {
  .dna-bar .dna-crumbs, .dna-bar > .q[data-help="levels"] { display: none; }
  .dna-bar .dna-file { flex: 1 1 0; min-width: 0; max-width: none; }
  .dna-bar .dna-search { flex: 1 1 100%; margin-left: 0; order: 5; }
  .dna-bar .dna-spots, .dna-bar .dna-guide { flex: 1 1 0; justify-content: center; }
  .tb-tools .file-pick { flex: 1 1 auto; }
  .tb-tools .file-btn { max-width: none; width: 100%; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .dna-bar .dna-crumbs, .dna-bar > .q[data-help="levels"] { display: none; }
  .dna-bar .dna-search { flex: 1 1 140px; min-width: 120px; }
}
/* the toolbar's groups: Research/Me + Human/Dog · body, Fur, Sound (Fun mode) · the tools, which
   may wrap among themselves */
.tb-fun:not(:has(> :not([hidden]):not(.body-pick:empty))) { display: none; }
:root:not([data-fun]) .tb-fun { display: none; }
#app[data-mode="me"] .tb-fun .coat-btn { display: none; }
.tb-tools { flex-wrap: wrap; justify-content: center; row-gap: 8px; }
@media (max-width: 400px) { .dna-bar .dna-file { flex: 1 1 100%; } }
