:root {
  --bg: #F6F7F9;
  --canvas: #F3F5F8;
  --band: #E9EDF3;
  --band-root: #E4E9FB;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6B7280;
  --faint: #9CA3AF;
  --rule: #E5E7EB;
  --rule-2: #D1D5DB;
  --line: #9AA3B2;
  --accent: #4F46E5;
  --accent-ink: #FFFFFF;
  --accent-soft: #EEF0FF;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, .06);
  --shadow: 0 1px 2px rgba(17, 24, 39, .05), 0 4px 14px -4px rgba(17, 24, 39, .10);
  --shadow-lg: 0 2px 4px rgba(17, 24, 39, .05), 0 18px 40px -12px rgba(17, 24, 39, .22);

  --Withers: #2563EB;
  --Twaddle: #0891B2;
  --Green: #16A34A;
  --Bancroft: #EA580C;
  --Flixon: #CA8A04;
  --Bird: #C026D3;
  --Mirfin: #0D9488;
  --Szabo: #DC2626;
  --Descendants: #64748B;

  --Confirmed: #15803D;
  --Probable: #B45309;
  --Unverified: #B91C1C;
  --Rejected: #6B7280;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --top-h: 60px;
  --drawer-w: 420px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0E1117;
  --canvas: #0E1117;
  --band: #151A23;
  --band-root: #1A1F3A;
  --surface: #171C26;
  --surface-2: #1D2330;
  --ink: #F3F4F6;
  --ink-2: #D1D5DB;
  --muted: #9CA3AF;
  --faint: #6B7280;
  --rule: #262D3B;
  --rule-2: #343C4D;
  --line: #5F6B80;
  --accent: #818CF8;
  --accent-ink: #0E1117;
  --accent-soft: #232848;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 16px -6px rgba(0, 0, 0, .6);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .4), 0 20px 44px -12px rgba(0, 0, 0, .8);
  --Withers: #60A5FA;
  --Twaddle: #22D3EE;
  --Green: #4ADE80;
  --Bancroft: #FB923C;
  --Flixon: #FACC15;
  --Bird: #E879F9;
  --Mirfin: #2DD4BF;
  --Szabo: #F87171;
  --Descendants: #94A3B8;
  --Confirmed: #4ADE80;
  --Probable: #FBBF24;
  --Unverified: #F87171;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14.5px/1.5 var(--sans);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
svg { flex: none; }
[hidden] { display: none !important; }

/* ---------- Header ---------- */
.top {
  height: var(--top-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  position: relative;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; min-width: 0; }
.logo {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  flex: none;
}
.logo svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.logo circle { fill: currentColor; stroke: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font: 600 18px/1.15 var(--display); letter-spacing: -.01em; white-space: nowrap; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--rule); border-radius: 10px; }
.tabs a {
  padding: 5px 14px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--rule); }

.search { position: relative; margin-left: auto; width: min(300px, 30vw); }
.search input {
  width: 100%;
  height: 36px;
  padding: 0 30px 0 34px;
  border-radius: 9px;
  border: 1px solid var(--rule);
  background: var(--surface-2);
}
.search input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-ico { position: absolute; left: 10px; top: 9px; width: 18px; height: 18px; fill: none; stroke: var(--faint); stroke-width: 1.8; stroke-linecap: round; }
.kbd {
  position: absolute; right: 8px; top: 8px;
  font: 500 11px/18px var(--sans);
  padding: 0 6px;
  border: 1px solid var(--rule-2);
  border-radius: 5px;
  color: var(--muted);
}
.search input:focus ~ .kbd, .search input:not(:placeholder-shown) ~ .kbd { display: none; }
#qres {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-height: 60vh;
  overflow: auto;
}
#qres li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
#qres li[aria-selected="true"], #qres li:hover { background: var(--accent-soft); }
#qres .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
#qres .yrs { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
#qres .none { color: var(--muted); cursor: default; }
.sw { width: 9px; height: 9px; border-radius: 3px; background: var(--b); flex: none; display: inline-block; }
.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 9px;
  color: var(--ink-2);
  flex: none;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--rule); }
.icon-btn svg, .ctl svg, .lb-nav svg, .lb-btn svg, .legend summary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }
:root[data-theme="dark"] .theme-btn .sun { display: none; }

/* ---------- Shell ---------- */
.shell { flex: 1; min-height: 0; display: flex; position: relative; }
main { flex: 1; min-width: 0; position: relative; }
.view { position: absolute; inset: 0; display: none; }
.view.active { display: block; }
#view-people, #view-records, #view-about { overflow: auto; }

/* ---------- Tree canvas ---------- */
.viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  background: var(--canvas);
}
.viewport:focus-visible { outline-offset: -3px; }
.viewport.dragging { cursor: grabbing; }
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.stage.animate { transition: transform .45s cubic-bezier(.3, .7, .2, 1); }

/* Generation bands span the whole width, behind the tree. */
.bands { position: absolute; inset: 0; pointer-events: none; }
.band { position: absolute; left: 0; right: 0; top: 0; }
.band.odd { background: var(--band); }
.band.root { background: var(--band-root); }
.viewport.animate .band { transition: transform .45s cubic-bezier(.3, .7, .2, 1), height .45s cubic-bezier(.3, .7, .2, 1); }

.links { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; transition: opacity .25s; }
.links.hide { opacity: 0; transition: none; }
.ln { fill: none; stroke: var(--line); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; transition: stroke .15s, opacity .15s; }
.ln.g-Probable { stroke-dasharray: 7 5; }
.ln.g-Unverified { stroke-dasharray: 1.5 5; stroke-width: 2.2; }
.ln.marriage { stroke-width: 2.4; }
.has-sel .ln { opacity: .45; }
.has-sel .ln.hi { stroke: var(--accent); stroke-width: 2.8; opacity: 1; }

.card {
  position: absolute;
  left: 0; top: 0;
  width: 176px;
  height: 78px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .45s cubic-bezier(.3, .7, .2, 1), opacity .3s, box-shadow .15s, border-color .15s, background .15s;
}
.card::before {
  content: "";
  position: absolute;
  left: -1px; top: -1px; bottom: -1px;
  width: 5px;
  border-radius: 12px 0 0 12px;
  background: var(--b);
}
.card:hover { box-shadow: var(--shadow-lg); border-color: var(--rule-2); }
.card.enter { opacity: 0; }
.card.private {
  background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--line) 12%, transparent) 6px 7px), var(--surface);
}
.card.root { border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); }
.card.loose { opacity: .85; }
.card.sel {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent), var(--shadow-lg);
  z-index: 2;
}
.has-sel .card:not(.sel):not(.rel) { opacity: .55; }
.card.rel { border-color: color-mix(in srgb, var(--accent) 55%, var(--rule)); }
.mono {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  font: 600 13px/1 var(--sans);
  color: var(--b);
  background: color-mix(in srgb, var(--b) 12%, var(--surface));
}
.ctext { min-width: 0; display: flex; flex-direction: column; line-height: 1.22; }
.ctext .gv { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctext .sn { font-size: 16px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctext .sn i { font-weight: 400; color: var(--muted); font-size: 13px; }
.ctext .yr { font-size: 12px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Expand / collapse buttons on the card edges. */
.tg {
  position: absolute;
  z-index: 1;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--rule-2);
  background: var(--surface);
  color: var(--ink-2);
  font: 600 11px/20px var(--sans);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.tg:hover { border-color: var(--accent); color: var(--accent); }
.tg:not(.open) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tg:not(.open):hover { filter: brightness(1.1); color: var(--accent-ink); }
.tg.up { top: -12px; left: 50%; transform: translateX(-50%); }
.tg.down { bottom: -12px; left: 50%; transform: translateX(-50%); }
.tg.sibs { bottom: -12px; }
.tg.sibs.left { left: 8px; }
.tg.sibs.right { right: 8px; }
.tg.open { opacity: 0; pointer-events: none; transition: opacity .15s; }
.card:hover .tg.open, .card:focus-within .tg.open, .card.sel .tg.open { opacity: 1; pointer-events: auto; }
.far .tg.open { display: none; }

.loose-label { position: absolute; left: 0; top: 0; display: flex; justify-content: center; border-top: 1px dashed var(--rule-2); }
.loose-label span { margin-top: -12px; padding: 2px 12px; background: var(--canvas); border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); }

/* ---------- Floating controls ---------- */
.controls {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 6;
  white-space: nowrap;
}
.ctl {
  height: 34px;
  min-width: 34px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-weight: 500;
  font-size: 13.5px;
  color: var(--ink-2);
}
.ctl.icon { padding: 0; }
.ctl:hover { background: var(--surface-2); color: var(--ink); }
#expandAll { color: var(--accent); }
.zoom-val { width: 46px; text-align: center; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sep { width: 1px; height: 20px; background: var(--rule); margin: 0 4px; }
.hint {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12.5px;
  z-index: 6;
  pointer-events: none;
  transition: opacity .4s;
  white-space: nowrap;
}
.hint.gone { opacity: 0; }

.minimap {
  position: absolute;
  right: 16px;
  bottom: 18px;
  z-index: 6;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: crosshair;
  padding: 4px;
}
.minimap svg { width: 100%; height: 100%; display: block; }
.minimap rect[data-id] { opacity: .55; }
.minimap rect.sel { opacity: 1; stroke: var(--ink); stroke-width: 30; }
.mm-view { fill: color-mix(in srgb, var(--accent) 10%, transparent); stroke: var(--accent); }

.legend {
  position: absolute;
  right: 16px;
  top: 14px;
  z-index: 6;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 13px;
  max-width: 280px;
}
.legend summary { padding: 7px 12px; cursor: pointer; font-weight: 500; list-style: none; display: flex; align-items: center; gap: 7px; color: var(--ink-2); }
.legend summary::-webkit-details-marker { display: none; }
.lg-body { padding: 0 14px 12px; }
.lg-body h4 { margin: 8px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.lg-lines, .lg-branches { display: grid; gap: 5px; }
.lg-branches { grid-template-columns: 1fr 1fr; }
.lg-lines span, .lg-branches span { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.lg-card { width: 36px; height: 14px; border: 1px solid var(--rule-2); border-radius: 4px; display: inline-block; }
.lg-card.private { background: repeating-linear-gradient(135deg, transparent 0 4px, color-mix(in srgb, var(--line) 35%, transparent) 4px 5px), var(--surface); }

/* ---------- Drawer ---------- */
.drawer {
  width: var(--drawer-w);
  flex: none;
  background: var(--surface);
  border-left: 1px solid var(--rule);
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  display: none;
  overscroll-behavior: contain;
}
.drawer.open { display: block; }
.drawer .close { position: absolute; right: 12px; top: 12px; z-index: 2; }
#drawerBody { padding: 24px 24px 48px; }
.d-branch { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.d-branch .st { margin-left: 2px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--rule); font-weight: 500; }
.d-name { font: 600 28px/1.15 var(--display); letter-spacing: -.015em; margin: 10px 40px 2px 0; }
.d-years { font-size: 15px; color: var(--muted); margin: 0 0 8px; font-variant-numeric: tabular-nums; }
.aka { margin: 2px 0; color: var(--muted); font-size: 13.5px; }
.d-actions { display: flex; gap: 8px; margin: 14px 0 4px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid var(--rule-2);
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 14px;
  margin: 16px 0 0;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: 12px;
  font-size: 13.5px;
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.note-box {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--Probable) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--Probable) 30%, var(--rule));
  font-size: 13px;
}
.d-sec { margin-top: 26px; }
.d-sec h3 { font-size: 15px; font-weight: 600; margin: 0 0 10px; display: flex; align-items: baseline; gap: 8px; }
.d-sec h3 small { font-weight: 500; font-size: 12.5px; color: var(--muted); }
.fam { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 0; }
.fam > div { min-width: 0; }
.fam dt { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-bottom: 5px; }
.fam dd { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: var(--surface);
}
.chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.chip .cn { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip small { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip.cand { border-style: dashed; }
.badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .03em;
  padding: 1px 7px;
  border-radius: 999px;
  color: var(--g);
  background: color-mix(in srgb, var(--g) 12%, transparent);
  white-space: nowrap;
}
.g-Confirmed { --g: var(--Confirmed); }
.g-Probable { --g: var(--Probable); }
.g-Unverified { --g: var(--Unverified); }
.g-Rejected { --g: var(--Rejected); }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumb {
  position: relative;
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; transition: transform .25s; }
.thumb:hover img { transform: scale(1.04); }
.thumb .badge { position: absolute; left: 5px; bottom: 5px; background: var(--surface); box-shadow: var(--shadow-sm); }
.show-all { margin-top: 10px; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 20px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: var(--rule); }
.timeline li { position: relative; padding: 0 0 16px; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -19px; top: 6px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--g);
}
.ev-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ev-type { font-weight: 600; }
.ev-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.ev-top .badge { margin-left: auto; }
.ev-place { font-size: 13.5px; }
.ev-note { font-size: 13px; color: var(--muted); margin-top: 2px; }
.ev-src { font-size: 12.5px; margin-top: 4px; }
.ev-src summary { cursor: pointer; color: var(--accent); list-style: none; font-weight: 500; }
.ev-src summary::-webkit-details-marker { display: none; }
.ev-src ul { margin: 6px 0 0; padding-left: 16px; color: var(--muted); }
.ev-src li { margin-bottom: 4px; }
.plain { margin: 0; padding-left: 18px; }
.plain li { margin-bottom: 6px; font-size: 13.5px; }

/* ---------- Pages ---------- */
.page { max-width: 1200px; margin: 0 auto; padding: 32px 28px 80px; }
.page-head h1, .about h1 { font: 600 34px/1.1 var(--display); letter-spacing: -.02em; margin: 0 0 8px; }
.lede { color: var(--muted); font-size: 15.5px; max-width: 68ch; margin: 0 0 20px; }
.list-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 18px;
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg);
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}
.filters, .seg { display: flex; flex-wrap: wrap; gap: 6px; }
.filters button, .seg button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.filters button:hover, .seg button:hover { border-color: var(--rule-2); }
.filters button[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.filters small { opacity: .65; font-size: 12px; }
.list-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.list-tools input, .sort select { height: 34px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--rule); background: var(--surface); }
.list-tools input { width: 210px; }
.sort { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }

.people-list h2 { font: 600 20px var(--display); display: flex; align-items: center; gap: 10px; margin: 28px 0 12px; }
.people-list h2:first-child { margin-top: 6px; }
.people-list h2 .sw { width: 12px; height: 12px; }
.people-list h2 small { font: 500 13px var(--sans); color: var(--muted); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.prow {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 10px 12px 10px 15px;
  border: 1px solid var(--rule);
  border-radius: 11px;
  background: var(--surface);
  min-width: 0;
  overflow: hidden;
}
.prow::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--b); }
.prow:hover { border-color: var(--rule-2); box-shadow: var(--shadow); }
.prow .mono { width: 34px; height: 34px; font-size: 12px; }
.prow .pt { min-width: 0; flex: 1; }
.prow .nm { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .meta { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .rc { font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.prow.private { background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--line) 10%, transparent) 6px 7px), var(--surface); }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

.count { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }
.rec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; align-items: start; }
.rec {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  text-align: left;
}
.rec:hover { box-shadow: var(--shadow-lg); }
.rec img { width: 100%; display: block; aspect-ratio: 4 / 3; object-fit: cover; object-position: top; background: var(--surface-2); border-bottom: 1px solid var(--rule); }
.rec .cap { display: block; padding: 9px 11px 11px; }
.rec .who { display: block; font-weight: 600; font-size: 13.5px; }
.rec .txt { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; color: var(--muted); margin-top: 3px; }
.rec .badge { margin-top: 6px; }
.sentinel { height: 40px; }

.about { max-width: 740px; margin: 0 auto; font-size: 15.5px; line-height: 1.65; }
.about h2 { font: 600 21px var(--display); margin: 34px 0 10px; }
.about p { margin: 0 0 14px; }
.about .lede { font-size: 17px; color: var(--ink-2); line-height: 1.6; }
.plink { color: var(--accent); cursor: pointer; text-decoration: none; font-weight: 500; }
.plink:hover { text-decoration: underline; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 24px 0; }
.stat { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 14px 16px; }
.stat b { display: block; font: 600 28px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--muted); }
.gtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.gtable th, .gtable td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.gtable th { font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.gtable td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 110px 1fr 40px; align-items: center; gap: 12px; font-size: 14px; }
.bar .track { height: 10px; background: var(--surface-2); border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--b); }
.bar span:last-child { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar button { all: unset; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.bar button:hover { color: var(--accent); }
.fine { color: var(--muted); font-size: 13.5px; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 12, 18, .94);
  color: #F3F4F6;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.lb-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.lb-count { margin-right: auto; font-size: 13px; opacity: .7; font-variant-numeric: tabular-nums; }
.lb-btn {
  height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: transparent;
  color: inherit;
  text-decoration: none;
  font-size: 13.5px;
}
.lb-btn.icon { width: 36px; padding: 0; justify-content: center; }
.lb-btn:hover { background: rgba(255, 255, 255, .1); }
.lb-img { overflow: auto; display: grid; place-items: center; min-height: 0; padding: 0 64px; }
.lb-img img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; border-radius: 4px; background: #fff; }
.lb-img.zoomed { place-items: start center; }
.lb-img.zoomed img { max-width: none; max-height: none; cursor: zoom-out; }
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(20, 22, 30, .6);
  color: inherit;
  display: grid;
  place-items: center;
  z-index: 2;
}
.lb-nav:hover { background: rgba(255, 255, 255, .15); }
.lb-nav.prev { left: 10px; }
.lb-nav.next { right: 10px; }
.lb-cap { padding: 12px 20px 18px; max-width: 980px; margin: 0 auto; font-size: 14px; text-align: center; }
.lb-cap .who { margin-top: 6px; font-size: 13px; opacity: .75; }
.lb-cap button { all: unset; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.lb-cap a { color: #A5B4FC; }
.lb-cap .badge { margin-left: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .drawer { position: absolute; right: 0; top: 0; bottom: 0; z-index: 15; box-shadow: var(--shadow-lg); }
}
@media (max-width: 1000px) {
  .minimap { display: none; }
  .controls { left: 16px; transform: none; }
}
@media (max-width: 860px) {
  :root { --top-h: auto; }
  .top { flex-wrap: wrap; gap: 8px 12px; padding: 10px 14px; }
  .brand-sub { display: none; }
  .search { width: auto; flex: 1; min-width: 150px; margin-left: 0; order: 2; }
  .theme-btn { order: 1; margin-left: auto; }
  .tabs { order: 3; width: 100%; justify-content: space-between; }
  .tabs a { flex: 1; text-align: center; padding: 5px 6px; }
  .kbd { display: none; }
  .legend { display: none; }
  .hint { display: none; }
  .controls { left: 10px; right: 10px; bottom: 10px; justify-content: space-between; }
  .ctl span { display: none; }
  .zoom-val { display: none; }
  .page { padding: 22px 16px 60px; }
  .page-head h1 { font-size: 28px; }
  .list-head { position: static; }
  .list-tools, .list-tools input { width: 100%; }
}
@media (max-width: 640px) {
  .drawer { width: 100%; top: auto; height: 80%; border-left: 0; border-top: 1px solid var(--rule); border-radius: 16px 16px 0 0; }
  #drawerBody { padding: 20px 18px 40px; }
  .d-name { font-size: 24px; }
  .lb-img { padding: 0 8px; }
  .lb-nav { top: auto; bottom: 14px; transform: none; }
  .bar { grid-template-columns: 90px 1fr 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .stage, .links, .band { transition: none !important; }
}
