/* Layout: an iOS-style app shell. Frosted top bar (tabs on desktop), frosted tab bar on phone,
   grouped content on the home, origins and research screens, a full-bleed pan/zoom stage for the tree,
   and a person sheet that slides up on phone and docks as an inspector on desktop. */
:root {
  --bg: #f2f2f7;
  --bg-2: #ffffff;
  --bg-3: #f7f7fa;
  --fill: rgba(118, 118, 128, 0.12);
  --fill-2: rgba(118, 118, 128, 0.2);
  --label: #1c1c1e;
  --label-2: rgba(60, 60, 67, 0.68);
  --label-3: rgba(60, 60, 67, 0.4);
  --sep: rgba(60, 60, 67, 0.16);
  --material: rgba(250, 250, 252, 0.74);
  --material-strong: rgba(250, 250, 252, 0.9);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 8px 24px rgba(20, 20, 40, 0.08);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.06), 0 24px 60px rgba(20, 20, 40, 0.18);
  --focus: #0071e3;
  --link: #0066cc;
  --scrim: rgba(0, 0, 0, 0.22);
  --land: rgba(60, 60, 67, 0.26);
  --land-fill: rgba(60, 60, 67, 0.045);
  --water: #f2f2f7;

  --miller: #0a6cdc;
  --garlitz: #1f8a3c;
  --greenough: #8a3fc6;
  --carpenter: #c25400;
  --home: #3a3a3c;
  --dna1: #5856d6; --dna2: #0e8a9e; --dna3: #c2386f; --dna4: #8e8e93; --dna5: #a2845e;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --top-h: 52px;
  --tab-h: 0px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --gutter-l: max(16px, var(--safe-l));
  --gutter-r: max(16px, var(--safe-r));

  --spring: cubic-bezier(0.25, 1.1, 0.3, 1);
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}
@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --spring: linear(0, 0.049, 0.169, 0.324, 0.488, 0.643, 0.778, 0.887, 0.97, 1.027, 1.062, 1.079, 1.083, 1.079, 1.068, 1.055, 1.041, 1.029, 1.017, 1.009, 1.002, 0.997, 0.995, 0.993, 0.993, 0.994, 0.994, 0.996, 0.997, 0.998, 0.999, 0.999, 1);
  }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --bg-2: #1c1c1e; --bg-3: #2c2c2e;
    --fill: rgba(118, 118, 128, 0.24); --fill-2: rgba(118, 118, 128, 0.36);
    --label: #f5f5f7; --label-2: rgba(235, 235, 245, 0.66); --label-3: rgba(235, 235, 245, 0.34);
    --sep: rgba(84, 84, 88, 0.6);
    --material: rgba(28, 28, 30, 0.72); --material-strong: rgba(36, 36, 38, 0.92);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.5), 0 24px 60px rgba(0, 0, 0, 0.6);
    --focus: #409cff; --link: #4aa3ff; --scrim: rgba(0, 0, 0, 0.5);
    --land: rgba(235, 235, 245, 0.24); --land-fill: rgba(235, 235, 245, 0.04); --water: #000000;
    --miller: #4aa3ff; --garlitz: #3fcf6a; --greenough: #c68bf3; --carpenter: #ff9f2e; --home: #d1d1d6;
    --dna1: #7d7aff; --dna2: #40c8e0; --dna3: #ff6b9a; --dna4: #98989d; --dna5: #c4a77d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --bg-2: #1c1c1e; --bg-3: #2c2c2e;
  --fill: rgba(118, 118, 128, 0.24); --fill-2: rgba(118, 118, 128, 0.36);
  --label: #f5f5f7; --label-2: rgba(235, 235, 245, 0.66); --label-3: rgba(235, 235, 245, 0.34);
  --sep: rgba(84, 84, 88, 0.6);
  --material: rgba(28, 28, 30, 0.72); --material-strong: rgba(36, 36, 38, 0.92);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.5), 0 24px 60px rgba(0, 0, 0, 0.6);
  --focus: #409cff; --link: #4aa3ff; --scrim: rgba(0, 0, 0, 0.5);
  --land: rgba(235, 235, 245, 0.24); --land-fill: rgba(235, 235, 245, 0.04); --water: #000000;
  --miller: #4aa3ff; --garlitz: #3fcf6a; --greenough: #c68bf3; --carpenter: #ff9f2e; --home: #d1d1d6;
  --dna1: #7d7aff; --dna2: #40c8e0; --dna3: #ff6b9a; --dna4: #98989d; --dna5: #c4a77d;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--label);
  font: 400 15px/1.45 var(--font); letter-spacing: -0.008em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
body.lock { overflow: hidden; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
svg { display: block; }
.tnum { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* line colors: any element with data-line gets --c */
[data-line] { --c: var(--home); }
[data-line="miller"] { --c: var(--miller); }
[data-line="garlitz"] { --c: var(--garlitz); }
[data-line="greenough"] { --c: var(--greenough); }
[data-line="carpenter"] { --c: var(--carpenter); }

/* ---------- materials ---------- */
.glass {
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

/* ---------- top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto; z-index: 40;
  padding-top: var(--safe-t);
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid transparent;
  transition: border-color 0.2s, background-color 0.2s;
}
.topbar.scrolled, body[data-view="tree"] .topbar { border-bottom-color: var(--sep); }
.topbar-in {
  height: var(--top-h); display: flex; align-items: center; gap: 12px;
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  max-width: 1400px; margin: 0 auto; position: relative;
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: 16px; letter-spacing: -0.02em; border-radius: 10px; padding: 4px 6px 4px 2px; }
.brand-mark { width: 24px; height: 24px; fill: var(--label); stroke: var(--label); }
.brand-mark circle:nth-of-type(n+4):nth-of-type(-n+5) { fill: var(--miller); }
.brand-mark circle:nth-of-type(4) { fill: var(--miller); }
.brand-mark circle:nth-of-type(5) { fill: var(--garlitz); }
.brand-mark circle:nth-of-type(6) { fill: var(--greenough); }
.brand-mark circle:nth-of-type(7) { fill: var(--carpenter); }
.compact-title {
  position: absolute; left: 50%; transform: translate(-50%, 4px); opacity: 0;
  font-weight: 600; font-size: 17px; letter-spacing: -0.02em; pointer-events: none;
  transition: opacity 0.2s, transform 0.3s var(--ease-out); white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis;
}
.topbar.scrolled .compact-title { opacity: 1; transform: translate(-50%, 0); }
.tabs-top { flex: 1; display: flex; justify-content: center; }
@media (min-width: 900px) { .compact-title { display: none; } }
.search-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px;
  border-radius: 10px; background: var(--fill); color: var(--label-2);
}
.search-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.icon-btn.search-btn { display: inline-flex; width: auto; border-radius: 10px; }
.search-btn:hover { background: var(--fill-2); }
.search-hint { font-size: 14px; min-width: 120px; text-align: left; }
.kbd { font: 500 11px/1 var(--font); padding: 3px 5px; border-radius: 5px; border: 0.5px solid var(--sep); color: var(--label-3); background: var(--bg-2); }

/* segmented control */
.segmented {
  display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: relative;
  padding: 2px; border-radius: 9px; background: var(--fill); isolation: isolate;
}
.segmented .seg-thumb {
  position: absolute; z-index: -1; top: 2px; bottom: 2px; left: 0; border-radius: 7px;
  background: var(--bg-2); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
  transition: transform 0.42s var(--spring), width 0.42s var(--spring);
}
:root[data-theme="dark"] .segmented .seg-thumb { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .segmented .seg-thumb { background: #636366; } }
.segmented button {
  height: 28px; padding: 0 14px; border-radius: 7px; font-size: 13px; font-weight: 500; white-space: nowrap;
  color: var(--label); transition: color 0.2s;
}
.segmented button[aria-selected="true"], .segmented button[aria-checked="true"] { font-weight: 600; }
.segmented button:focus-visible { outline-offset: -2px; }

/* phone: tab bar */
.tabbar { display: none; }
@media (max-width: 899px) {
  :root { --tab-h: 50px; }
  .tabs-top, .search-hint, .kbd { display: none; }
  .brand-text { display: none; }
  .icon-btn.search-btn { width: 36px; padding: 0; justify-content: center; border-radius: 50%; }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; inset: auto 0 0; z-index: 40;
    padding: 0 var(--gutter-r) var(--safe-b) var(--gutter-l);
    background: var(--material);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--sep);
  }
  .tabbar button {
    height: var(--tab-h); display: grid; place-items: center; align-content: center; gap: 2px;
    font-size: 10px; font-weight: 500; color: var(--label-3); letter-spacing: 0.01em;
  }
  .tabbar button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.35s var(--spring); }
  .tabbar button[aria-selected="true"] { color: var(--label); }
  .tabbar button[aria-selected="true"] svg { fill: currentColor; fill-opacity: 0.14; }
  .tabbar button:active svg { transform: scale(0.86); }
}

.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--label); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.round { background: var(--fill); color: var(--label-2); width: 30px; height: 30px; }
.icon-btn.round svg { width: 14px; height: 14px; stroke-width: 2.6; }
.icon-btn:hover { background: var(--fill); }
.text-btn { color: var(--link); font-size: 16px; padding: 6px 4px; border-radius: 8px; white-space: nowrap; }

/* ---------- views ---------- */
main { padding-top: calc(var(--safe-t) + var(--top-h)); padding-bottom: calc(var(--tab-h) + var(--safe-b)); }
.page {
  max-width: 1120px; margin: 0 auto;
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  padding-block: 20px 56px;
  display: grid; gap: 40px; grid-template-columns: minmax(0, 1fr);
}
.view { animation: view-in 0.45s var(--ease-out) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
.large-title { font-size: clamp(32px, 7vw, 46px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.04; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--label-2); }
.lede { font-size: 17px; line-height: 1.45; color: var(--label-2); max-width: 62ch; }
.section { display: grid; gap: 14px; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.025em; }
.section-head .more { font-size: 15px; color: var(--link); border-radius: 8px; padding: 2px 4px; }
.group { background: var(--bg-2); border-radius: 14px; overflow: hidden; }
.muted { color: var(--label-2); }
.small { font-size: 13px; }

/* ---------- home ---------- */
.hero { display: grid; gap: 14px; padding-top: 8px; grid-template-columns: minmax(0, 1fr); }
.hero-row { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); align-items: end; }
@media (min-width: 900px) { .hero-row { grid-template-columns: minmax(0, 1fr) auto; } }
.home-search {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 11px;
  background: var(--fill); color: var(--label-3); font-size: 16px; text-align: left; width: 100%; max-width: 520px;
}
.home-search svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.home-search:hover { background: var(--fill-2); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--bg-2); border-radius: 14px; padding: 14px 16px 13px; display: grid; gap: 2px; min-width: 0; }
.stat b { font: 700 30px/1.1 var(--font-round); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--label-2); }

.lines { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .lines { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1080px) { .lines { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.line-card {
  position: relative; text-align: left; display: grid; gap: 12px; align-content: start;
  background: var(--bg-2); border-radius: 18px; padding: 16px; min-width: 0; overflow: hidden;
  transition: transform 0.45s var(--spring), box-shadow 0.3s;
}
.line-card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 92px; pointer-events: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 16%, transparent), transparent);
}
.line-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.line-card:active { transform: scale(0.985); }
.line-top { display: flex; align-items: center; gap: 12px; position: relative; }
.line-top .who { min-width: 0; display: grid; }
.line-name { font-size: 20px; font-weight: 700; letter-spacing: -0.025em; color: var(--c); }
.line-gp { font-size: 14px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line-chev { margin-left: auto; width: 18px; height: 18px; fill: none; stroke: var(--label-3); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.line-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; position: relative; }
.line-facts div { display: grid; min-width: 0; }
.line-facts b { font: 700 19px/1.2 var(--font-round); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.line-facts span { font-size: 11.5px; color: var(--label-2); }
.conf-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; gap: 2px; background: transparent; }
.conf-bar i { display: block; height: 100%; background: var(--c); border-radius: 2px; }
.conf-bar i.likely { opacity: 0.55; }
.conf-bar i.possible { opacity: 0.22; }
.line-oldest { font-size: 13.5px; color: var(--label-2); position: relative; }
.line-oldest b { color: var(--label); font-weight: 600; }
.line-status { font-size: 13.5px; line-height: 1.4; color: var(--label-2); border-top: 0.5px solid var(--sep); padding-top: 10px; }

.home-grid { display: grid; gap: 40px 28px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .home-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }

/* list rows (inset grouped) */
.rows { background: var(--bg-2); border-radius: 14px; overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; min-height: 56px;
  padding: 9px 16px; position: relative;
}
.row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 64px; border-top: 0.5px solid var(--sep); }
button.row:hover, a.row:hover { background: var(--fill); text-decoration: none; }
.row-text { min-width: 0; display: grid; flex: 1; }
.row-title { font-size: 16px; font-weight: 500; color: var(--label); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 13px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-chev { width: 14px; height: 14px; fill: none; stroke: var(--label-3); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* avatar / monogram */
.av {
  --s: 40px; width: var(--s); height: var(--s); flex: none; border-radius: 50%; position: relative; overflow: hidden;
  display: grid; place-items: center; color: #fff;
  font: 600 calc(var(--s) * 0.38)/1 var(--font-round); letter-spacing: -0.02em;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 72%, #fff), var(--c) 70%);
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.08);
}
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.av.possible { opacity: 0.66; }
.av.unknown { background: var(--fill); color: var(--label-3); }

/* legend + confidence */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 13px; color: var(--label-2); }
.legend > span { display: inline-flex; align-items: center; gap: 7px; }
.sw { width: 22px; height: 14px; border-radius: 5px; border: 2px solid var(--label-2); }
.sw.likely { border-style: dashed; }
.sw.possible { border-style: dotted; opacity: 0.7; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 12px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--c) 55%, transparent);
}
.badge.likely { border-style: dashed; }
.badge.possible { border-style: dotted; opacity: 0.85; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.likely::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.badge.possible::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; opacity: 0.6; }

.confidence-key { display: grid; gap: 0; }
.ck { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 12px 16px; align-items: start; }
.ck + .ck { border-top: 0.5px solid var(--sep); }
.ck .sw { margin-top: 3px; width: 30px; height: 18px; border-color: var(--label); }
.ck b { font-weight: 600; }
.ck p { font-size: 14px; color: var(--label-2); }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 36px;
  padding: 4px 12px 4px 4px; border-radius: 18px; background: var(--fill); font-size: 14px; font-weight: 500;
  text-align: left; transition: background-color 0.2s, transform 0.35s var(--spring);
}
.chip .av { --s: 28px; }
.chip:hover { background: var(--fill-2); }
.chip:active { transform: scale(0.96); }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chip small { color: var(--label-2); font-weight: 400; font-size: 12px; }
.chip.ghost { padding-left: 12px; color: var(--label-2); background: transparent; border: 1.5px dashed var(--sep); cursor: default; }
.chip.plain { padding-left: 12px; }

/* ---------- tree stage ---------- */
body[data-view="tree"] { overflow: hidden; }
body[data-view="tree"] main { padding: 0; }
#view-tree { animation: none; }
.stage {
  position: fixed; left: 0; right: 0; top: calc(var(--safe-t) + var(--top-h)); bottom: calc(var(--tab-h) + var(--safe-b));
  overflow: hidden; background: var(--bg);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.stage.grab { cursor: grab; }
.stage.dragging { cursor: grabbing; }
.stage-dots {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.55;
  background-image: radial-gradient(circle at 1px 1px, var(--fill-2) 1px, transparent 1.4px);
  background-size: 22px 22px;
}
.canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.canvas svg.links { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.tree-toolbar {
  position: absolute; z-index: 5; left: 50%; top: 12px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 5px; border-radius: 14px;
  background: var(--material); box-shadow: var(--shadow);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  max-width: calc(100% - 24px);
}
.root-chip {
  position: absolute; z-index: 5; left: max(12px, var(--safe-l)); top: 64px;
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 12px; border-radius: 17px;
  background: var(--material); box-shadow: var(--shadow); font-size: 13px; max-width: calc(100% - 24px);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.root-chip b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.root-chip button { height: 26px; padding: 0 10px; border-radius: 13px; background: var(--fill); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.zoom-ctl {
  position: absolute; z-index: 5; right: max(12px, var(--safe-r)); bottom: 12px;
  display: grid; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow);
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.zoom-ctl button { width: 44px; height: 44px; display: grid; place-items: center; color: var(--label); }
.zoom-ctl button + button { border-top: 0.5px solid var(--sep); }
.zoom-ctl button:hover { background: var(--fill); }
.zoom-ctl svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tree-legend {
  position: absolute; z-index: 5; left: max(12px, var(--safe-l)); bottom: 12px;
  padding: 9px 12px; border-radius: 14px; box-shadow: var(--shadow); max-width: calc(100% - 92px);
  background: var(--material); font-size: 12px;
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.tree-legend .legend { font-size: 12px; gap: 4px 12px; }
.tree-legend .sw { width: 18px; height: 12px; }
.expand-all { display: inline-flex; align-items: center; gap: 6px; }
.tool-btn { height: 28px; padding: 0 10px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--label); white-space: nowrap; }
.tool-btn:hover { background: var(--fill); }
@media (max-width: 520px) { .tree-toolbar .tool-btn { display: none; } }

/* pedigree cards */
.pcard {
  position: absolute; left: 0; top: 0; width: 212px; height: 64px;
  display: flex; align-items: center; gap: 10px; padding: 0 10px 0 8px; text-align: left;
  background: var(--bg-2); border-radius: 16px; border: 2px solid color-mix(in srgb, var(--c) 70%, transparent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px rgba(0, 0, 0, 0.05);
  transition: transform 0.6s var(--spring), opacity 0.35s, box-shadow 0.25s, background-color 0.25s;
}
.pcard.likely { border-style: dashed; }
.pcard.possible { border-style: dotted; border-color: color-mix(in srgb, var(--c) 55%, transparent); background: color-mix(in srgb, var(--bg-2) 70%, transparent); }
.pcard.possible .pc-name { color: var(--label-2); }
.pcard:hover { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06), 0 10px 28px rgba(0, 0, 0, 0.1); }
.pcard.sel { background: color-mix(in srgb, var(--c) 14%, var(--bg-2)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 28%, transparent); }
.pcard .av { --s: 40px; }
.pc-text { min-width: 0; display: grid; gap: 1px; }
.pc-name { font-size: 14px; font-weight: 600; line-height: 1.2; letter-spacing: -0.015em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pc-years { font-size: 12px; color: var(--label-2); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard.root { border-width: 2.5px; box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 14%, transparent), 0 4px 14px rgba(0, 0, 0, 0.06); }
.toggle {
  position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--bg-2); color: var(--label-2);
  box-shadow: 0 0 0 1px var(--sep), 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: transform 0.6s var(--spring), opacity 0.3s, background-color 0.2s, color 0.2s;
}
.toggle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; transition: transform 0.4s var(--spring); }
.toggle:hover { color: var(--label); background: var(--bg-3); }
.toggle .n { position: absolute; top: -6px; right: -8px; min-width: 18px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--c); color: #fff; font: 700 10px/16px var(--font-round); text-align: center; }
.links path { fill: none; stroke: color-mix(in srgb, var(--c) 60%, var(--label-3)); stroke-width: 2; stroke-linecap: round; }
.links path.likely { stroke-dasharray: 7 5; }
.links path.possible { stroke-dasharray: 1.5 5; opacity: 0.75; }
.links path[data-line] { stroke: color-mix(in srgb, var(--c) 65%, transparent); }
.gen-labels { position: absolute; left: 0; top: 0; pointer-events: none; }
.gen-label { position: absolute; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--label-3); white-space: nowrap; transform: translateX(-50%); }

/* grow-in for newly shown branches */
@keyframes grow-in { from { opacity: 0; } }
.links path.grow { animation: draw 0.7s var(--ease-out) both; }
@keyframes draw { from { opacity: 0; stroke-dashoffset: 0; clip-path: inset(0 100% 0 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }

/* fan chart */
.fan path.seg { stroke: var(--bg); stroke-width: 1.5; cursor: pointer; transition: opacity 0.2s, filter 0.2s; }
.fan path.seg:hover { filter: brightness(1.08) saturate(1.1); }
.fan path.seg:focus-visible { outline: none; stroke: var(--focus); stroke-width: 3; }
.fan path.seg.sel { stroke: var(--label); stroke-width: 2.5; }
.fan path.edge { fill: none; stroke: var(--c); stroke-width: 1.6; pointer-events: none; }
.fan path.edge.likely { stroke-dasharray: 5 4; }
.fan path.edge.possible { stroke-dasharray: 1.2 3.6; }
.fan text { fill: var(--label); font-family: var(--font); pointer-events: none; }
.fan text.sub { fill: var(--label-2); }
.fan .center-name { font-weight: 700; }
.fan .ghost { fill: var(--fill); stroke: var(--bg); stroke-width: 1.5; }
.fan g.ring { animation: ring-in 0.7s var(--spring) both; transform-origin: 0 0; }
@keyframes ring-in { from { opacity: 0; transform: scale(0.82) rotate(-6deg); } }

/* focus layout */
.focus-wrap { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; touch-action: pan-y; user-select: auto; -webkit-user-select: auto; overscroll-behavior: contain; }
.focus {
  position: relative; max-width: 620px; margin: 0 auto; min-height: 100%;
  padding: 64px var(--gutter-r) 96px var(--gutter-l); display: grid; gap: 0; align-content: start;
}
.f-row { display: grid; gap: 10px; position: relative; z-index: 1; }
.f-gp { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.f-par { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.f-lbl { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--label-3); text-align: center; margin: 0 0 8px; position: relative; z-index: 1; }
.f-gap { height: 34px; }
.fcard {
  position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; min-width: 0;
  padding: 12px 8px 10px; border-radius: 16px; background: var(--bg-2);
  border: 2px solid color-mix(in srgb, var(--c) 65%, transparent);
  transition: transform 0.45s var(--spring), box-shadow 0.25s, background-color 0.2s;
}
.fcard:hover { box-shadow: var(--shadow); }
.fcard:active { transform: scale(0.97); }
.fcard.likely { border-style: dashed; }
.fcard.possible { border-style: dotted; border-color: color-mix(in srgb, var(--c) 50%, transparent); }
.fcard.possible .fc-name { color: var(--label-2); }
.fcard.empty { border: 1.5px dashed var(--sep); background: transparent; color: var(--label-3); cursor: default; box-shadow: none; transform: none; }
.fcard .av { --s: 44px; }
.f-gp .fcard { padding: 8px 4px; border-radius: 14px; gap: 4px; }
.f-gp .fcard .av { --s: 30px; }
.fc-name { font-size: 14px; font-weight: 600; line-height: 1.2; letter-spacing: -0.015em; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.f-gp .fc-name { font-size: 11.5px; }
.fc-years { font-size: 12px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.f-gp .fc-years { font-size: 10.5px; }
.fc-more { position: absolute; top: -8px; right: -6px; box-shadow: 0 0 0 2px var(--bg); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--c); color: #fff; font: 700 10px/18px var(--font-round); }
.f-me {
  position: relative; z-index: 1; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; text-align: left;
  padding: 16px; border-radius: 22px; background: var(--bg-2);
  border: 2.5px solid color-mix(in srgb, var(--c) 75%, transparent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--c) 12%, transparent), var(--shadow);
}
.f-me.likely { border-style: dashed; }
.f-me.possible { border-style: dotted; }
.f-me .av { --s: 72px; }
.f-me-name { font: 600 23px/1.15 var(--font-serif); letter-spacing: -0.01em; text-wrap: balance; }
.f-me-rel { font-size: 14px; color: var(--c); font-weight: 600; }
.f-me-years { font-size: 14px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.f-me-open { margin-top: 8px; display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--link); font-weight: 500; }
.f-me-open svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.f-kids { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.f-kids .fcard { width: min(260px, 100%); grid-template-columns: auto minmax(0, 1fr); justify-items: start; text-align: left; align-items: center; padding: 10px 12px; }
.f-links { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 0; }
.f-links path { fill: none; stroke: color-mix(in srgb, var(--c) 60%, var(--label-3)); stroke-width: 2; stroke-linecap: round; }
.f-links path.likely { stroke-dasharray: 7 5; }
.f-links path.possible { stroke-dasharray: 1.5 5; opacity: 0.75; }
.f-path { display: flex; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 14px; margin-bottom: 6px; position: relative; z-index: 1; }
.f-path::-webkit-scrollbar { display: none; }
.f-path button { flex: none; height: 28px; padding: 0 11px; border-radius: 14px; background: var(--fill); font-size: 13px; font-weight: 500; white-space: nowrap; }
.f-path button[aria-current="true"] { background: var(--c); color: #fff; }
.f-path svg { flex: none; width: 10px; height: 10px; fill: none; stroke: var(--label-3); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.f-hint { text-align: center; font-size: 12.5px; color: var(--label-3); margin-top: 22px; }

/* view transitions */
::view-transition-group(*) { animation-duration: 0.5s; animation-timing-function: var(--spring); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.25s; }
::view-transition-new(sheet) { animation: 0.5s var(--ease-sheet) both sheet-up; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@media (min-width: 900px) { ::view-transition-new(sheet) { animation-name: sheet-left; } }
@keyframes sheet-left { from { transform: translateX(105%); opacity: 0.4; } }
::view-transition-old(sheet) { animation: 0.3s var(--ease-out) both fade-out; }
@keyframes fade-out { to { opacity: 0; } }

/* ---------- person sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: var(--scrim); opacity: 0; transition: opacity 0.35s; }
.scrim.on { opacity: 1; }
.sheet {
  position: fixed; z-index: 60; left: 0; right: 0; bottom: 0;
  height: calc(100dvh - var(--safe-t) - 10px); max-height: calc(100vh - var(--safe-t) - 10px);
  display: flex; flex-direction: column;
  background: var(--material-strong);
  -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px);
  border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg);
  transform: translateY(var(--sheet-y, 100%));
  transition: transform 0.5s var(--ease-sheet);
  view-transition-name: sheet;
}
.sheet.dragging { transition: none; }
.sheet-grab { flex: none; height: 22px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--fill-2); }
.sheet-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px 4px max(12px, var(--safe-l)); min-height: 36px; touch-action: none; position: relative; }
.sheet-head .round { margin-left: auto; }
.sheet-head-title { position: absolute; left: 56px; right: 56px; text-align: center; font-weight: 600; font-size: 16px; opacity: 0; transition: opacity 0.2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.sheet.scrolled .sheet-head-title { opacity: 1; }
.sheet.scrolled .sheet-head { border-bottom: 0.5px solid var(--sep); }
.sheet-body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 4px var(--gutter-r) calc(28px + var(--safe-b)) var(--gutter-l); display: grid; gap: 22px; align-content: start; grid-auto-rows: max-content;
}
@media (min-width: 900px) {
  .scrim { display: none; }
  .sheet {
    left: auto; right: max(12px, var(--safe-r)); top: calc(var(--safe-t) + var(--top-h) + 12px); bottom: 12px;
    width: 400px; height: auto; max-height: none; border-radius: 20px;
    transform: translateX(var(--sheet-x, calc(100% + 24px)));
  }
  .sheet-grab { display: none; }
  .sheet-head { padding: 10px 12px 4px; }
  .sheet-body { padding: 4px 20px 28px; }
}
.p-hero { display: grid; justify-items: center; text-align: center; gap: 10px; padding-top: 4px; }
.p-photo { width: 132px; height: 132px; }
.p-photo .av { --s: 132px; font-size: 46px; box-shadow: 0 10px 30px color-mix(in srgb, var(--c) 30%, transparent); }
.p-photo .av.has-photo { border-radius: 24px; }
.p-caption { font-size: 12px; color: var(--label-2); max-width: 36ch; }
.p-name { font: 600 28px/1.12 var(--font-serif); letter-spacing: -0.015em; text-wrap: balance; }
.p-rel { font-size: 15px; font-weight: 600; color: var(--c); }
.p-side { font-size: 13px; color: var(--label-2); margin-top: -6px; }
.p-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.p-life { font-size: 15px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.facts { background: var(--bg-2); border-radius: 14px; overflow: hidden; }
.fact { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 11px 16px; position: relative; }
.fact + .fact::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--sep); }
.fact dt { font-size: 14px; color: var(--label-2); }
.fact dd { margin: 0; font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
.fact dd small { display: block; color: var(--label-2); font-size: 13px; }
.facts dl { margin: 0; }
.p-sec { display: grid; gap: 8px; }
.p-sec h3 { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--label-2); padding-left: 4px; }
.conf-explain { background: var(--bg-2); border-radius: 14px; padding: 14px 16px; display: grid; gap: 6px; font-size: 14.5px; }
.conf-explain .badge { justify-self: start; }
.notes { background: var(--bg-2); border-radius: 14px; padding: 14px 16px; font-size: 15px; line-height: 1.5; }
.srcs { background: var(--bg-2); border-radius: 14px; overflow: hidden; }
.srcs a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; position: relative; min-width: 0; }
.srcs a + a::before { content: ""; position: absolute; top: 0; left: 52px; right: 0; border-top: 0.5px solid var(--sep); }
.srcs a:hover { background: var(--fill); text-decoration: none; }
.src-ic { width: 24px; height: 24px; border-radius: 6px; background: var(--fill); display: grid; place-items: center; flex: none; color: var(--label-2); }
.src-ic svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.src-t { min-width: 0; display: grid; }
.src-t b { font-weight: 500; color: var(--label); font-size: 15px; }
.src-t span { font-size: 12.5px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.act {
  display: grid; justify-items: center; gap: 4px; padding: 12px 8px; border-radius: 14px; background: var(--bg-2);
  font-size: 13px; font-weight: 500; color: var(--link); transition: transform 0.35s var(--spring), background-color 0.2s;
}
.act svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.act:hover { background: var(--bg-3); }
.act:active { transform: scale(0.96); }
.living-note { background: var(--bg-2); border-radius: 14px; padding: 14px 16px; font-size: 14.5px; color: var(--label-2); }

/* ---------- search ---------- */
.search { position: fixed; inset: 0; z-index: 80; background: var(--scrim); display: flex; justify-content: center; align-items: flex-start; padding: calc(var(--safe-t) + 10vh) var(--gutter-r) 24px var(--gutter-l); animation: fade-in 0.2s both; }
@keyframes fade-in { from { opacity: 0; } }
.search-panel {
  width: min(620px, 100%); max-height: 70vh; display: flex; flex-direction: column; border-radius: 18px; overflow: hidden;
  background: var(--material-strong); box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px);
  animation: pop-in 0.45s var(--spring) both;
}
@keyframes pop-in { from { opacity: 0; transform: scale(0.96) translateY(-8px); } }
.search-field { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 0.5px solid var(--sep); }
.search-field svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--label-2); stroke-width: 2.2; stroke-linecap: round; }
.search-field input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 18px; outline: none; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field input:focus-visible { outline: none; }
.search-results { overflow-y: auto; padding: 6px; }
.search-results li { list-style: none; }
.sr { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: 12px; text-align: left; }
.sr[aria-selected="true"], .sr:hover { background: var(--fill); }
.sr .row-text { flex: 1; }
.sr mark { background: color-mix(in srgb, var(--c) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.sr-gen { font-size: 12px; color: var(--label-3); white-space: nowrap; }
.sr-empty { padding: 26px 16px; text-align: center; color: var(--label-2); }
@media (max-width: 899px) {
  .search { padding: 0; align-items: stretch; background: var(--bg); }
  .search-panel { width: 100%; max-height: none; border-radius: 0; box-shadow: none; background: var(--bg); animation: none; padding-top: var(--safe-t); }
  .search-field { padding: 10px var(--gutter-r) 10px var(--gutter-l); border-bottom: 0; }
  .search-field input { background: var(--fill); border-radius: 10px; height: 38px; padding: 0 12px; font-size: 17px; }
  .search-field > svg { display: none; }
  .search-results { padding: 0 var(--gutter-r) calc(20px + var(--safe-b)) var(--gutter-l); }
}

/* ---------- origins ---------- */
.maps { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .maps { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); } }
.map { background: var(--bg-2); border-radius: 18px; padding: 12px; display: grid; gap: 6px; min-width: 0; position: relative; }
.map-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 2px 4px 0; }
.map-title b { font-size: 15px; font-weight: 600; }
.map-title span { font-size: 12px; color: var(--label-2); }
.map svg { width: 100%; height: auto; overflow: visible; }
.map .land { fill: url(#dots); }
.map .land-tint { fill: var(--land-fill); }
.map .lake { fill: var(--bg-2); }
.map .dotpat circle { fill: var(--land); }
.map .route { fill: none; stroke: var(--c); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0.85; }
.map .route-stop { fill: var(--bg-2); stroke: var(--c); stroke-width: 2; }
.map .route.anim { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: route-draw 1.6s var(--ease-out) forwards; }
@keyframes route-draw { to { stroke-dashoffset: 0; } }
.map .pin { cursor: pointer; }
.map .pin circle.halo { fill: color-mix(in srgb, var(--c) 22%, transparent); transition: r 0.35s var(--spring); }
.map .pin circle.dot { fill: var(--c); stroke: var(--bg-2); stroke-width: 2; }
.map .pin:hover circle.halo, .map .pin:focus-visible circle.halo, .map .pin.on circle.halo { r: 15; }
.map .pin:focus-visible { outline: none; }
.map .pin text { font: 600 12.5px var(--font); fill: var(--label); paint-order: stroke; stroke: var(--bg-2); stroke-width: 3.5px; stroke-linejoin: round; }
.map .pin text.sub { font-weight: 400; font-size: 10.5px; fill: var(--label-2); }
.map .home-pin text { font: 700 12px var(--font); fill: var(--label); paint-order: stroke; stroke: var(--bg-2); stroke-width: 3.5px; }
.map .home-pin circle { fill: var(--label); stroke: var(--bg-2); stroke-width: 2; }
.map .stop-label { font: 500 10px var(--font); fill: var(--label-2); paint-order: stroke; stroke: var(--bg-2); stroke-width: 3px; }
.map .dim { opacity: 0.12; transition: opacity 0.3s; }
.map g, .map path { transition: opacity 0.3s; }
.atlantic { font: italic 500 11px var(--font-serif); fill: var(--label-3); letter-spacing: 0.2em; }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.filter-row .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.filter-row .segmented button { padding: 0 11px; }
@media (max-width: 560px) { .filter-row .segmented { display: flex; width: 100%; } .filter-row .segmented button { flex: 1 1 auto; padding: 0 6px; font-size: 12.5px; } }
.places { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .places { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .places { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.place { background: var(--bg-2); border-radius: 16px; padding: 14px 16px; display: grid; gap: 10px; align-content: start; min-width: 0; transition: box-shadow 0.3s, transform 0.45s var(--spring); scroll-margin-top: 90px; }
.place.flash { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 55%, transparent); transform: scale(1.01); }
.place-h { display: flex; align-items: center; gap: 10px; }
.place-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent); }
.place-h b { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.place-h span { font-size: 13px; color: var(--label-2); }
.place-h .branch { margin-left: auto; font-size: 12px; color: var(--c); font-weight: 600; white-space: nowrap; }
.place p { font-size: 14px; color: var(--label-2); }

.timeline { position: relative; display: grid; gap: 0; padding-left: 4px; }
.tl-item { display: grid; grid-template-columns: 92px 22px minmax(0, 1fr); gap: 0 10px; position: relative; padding-bottom: 18px; }
.tl-item::before { content: ""; position: absolute; left: calc(92px + 10px + 10px); top: 14px; bottom: -2px; width: 2px; background: var(--sep); }
.tl-item:last-child::before { display: none; }
.tl-when { text-align: right; font: 700 15px/1.3 var(--font-round); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; padding-top: 1px; }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); margin: 4px 0 0 4px; box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px color-mix(in srgb, var(--c) 25%, transparent); position: relative; z-index: 1; }
.tl-body { display: grid; gap: 6px; min-width: 0; padding-bottom: 4px; }
.tl-route { font-size: 15px; font-weight: 600; }
.tl-route .arrow { color: var(--label-3); font-weight: 400; padding: 0 4px; }
.tl-note { font-size: 14px; color: var(--label-2); }
@media (max-width: 520px) {
  .tl-item { grid-template-columns: 68px 22px minmax(0, 1fr); }
  .tl-item::before { left: calc(68px + 20px); }
  .tl-when { font-size: 13.5px; }
}

/* ---------- research ---------- */
.dna-bar { display: flex; height: 44px; border-radius: 12px; overflow: hidden; gap: 2px; }
.dna-bar i { display: block; height: 100%; min-width: 3px; transform-origin: left; animation: bar-in 0.9s var(--spring) both; }
@keyframes bar-in { from { transform: scaleX(0); } }
.dna-list { display: grid; gap: 0; }
.dna-row { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 16px; }
.dna-row + .dna-row { border-top: 0.5px solid var(--sep); }
.dna-row i { width: 12px; height: 12px; border-radius: 4px; }
.dna-row b { font: 600 16px var(--font-round); font-variant-numeric: tabular-nums; }
.dna-card { background: var(--bg-2); border-radius: 18px; padding: 16px; display: grid; gap: 14px; min-width: 0; }
.dna-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .dna-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
.findings { display: grid; gap: 10px; }
.findings li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px; font-size: 15px; }
.findings li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--label-3); margin: 8px 0 0 6px; }
.hap { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start; padding: 14px 16px; }
.hap + .hap { border-top: 0.5px solid var(--sep); }
.hap-v { font: 700 22px/1 var(--font-round); padding: 10px 12px; border-radius: 12px; background: var(--fill); min-width: 74px; text-align: center; }
.hap-k { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--label-2); }
.hap-path { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 8px; }
.hap-path button { font-size: 12.5px; height: 24px; padding: 0 9px; border-radius: 12px; background: var(--fill); font-weight: 500; }
.hap-path button:hover { background: var(--fill-2); }
.hap-path svg { width: 9px; height: 9px; fill: none; stroke: var(--label-3); stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.match { display: grid; grid-template-columns: 6px minmax(0, 1fr); gap: 14px; padding: 13px 16px; align-items: start; }
.match + .match { border-top: 0.5px solid var(--sep); }
.match-bar { width: 4px; align-self: stretch; border-radius: 2px; background: var(--c); }
.match b { font-weight: 600; font-size: 15px; }
.match p { font-size: 14px; color: var(--label-2); }
.match .chip { margin-top: 8px; }
.q-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .q-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.q-card { background: var(--bg-2); border-radius: 18px; padding: 16px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.q-card h3 { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; }
.q-card h3 .av { --s: 30px; }
.q-card ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; counter-reset: q; }
.q-card li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; font-size: 14.5px; counter-increment: q; }
.q-card li::before { content: counter(q); width: 22px; height: 22px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; font: 700 12px/1 var(--font-round); color: var(--label-2); }
.walls { display: grid; gap: 0; }
.footnote { font-size: 13px; color: var(--label-2); max-width: 70ch; }

/* toast */
.toast {
  position: fixed; z-index: 90; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 20px); transform: translateX(-50%);
  padding: 10px 16px; border-radius: 22px; background: var(--material-strong); box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500;
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  animation: pop-in 0.4s var(--spring) both;
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
