*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }

/* Layout: full-height app. Pannable hourglass tree (ancestors above, descendants below) beside a story panel; panel drops below the tree on phones. */
:root {
  --bg: #e9ede8;
  --surface: #fbfcfa;
  --ink: #1c2a26;
  --muted: #5d6c66;
  --line: #a9b5ae;
  --rule: #d3dbd5;
  --accent: #2c5a86;
  --accent-soft: #dce6f0;
  --ghost: #f3f5f2;
  --shadow: 0 1px 2px rgba(28,42,38,.08), 0 4px 14px rgba(28,42,38,.06);
  --f-display: "Young Serif", Georgia, "Times New Roman", serif;
  --f-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #111715; --surface: #1a2320; --ink: #e3eae6; --muted: #93a29b; --line: #4b5a54; --rule: #2b3632;
  --accent: #8fb6dd; --accent-soft: #22364a; --ghost: #151c19; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.25); color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #111715; --surface: #1a2320; --ink: #e3eae6; --muted: #93a29b; --line: #4b5a54; --rule: #2b3632;
  --accent: #8fb6dd; --accent-soft: #22364a; --ghost: #151c19; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.25); color-scheme: dark }

[hidden] { display: none !important; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 14px; overflow: hidden; }
.app { height: 100%; display: flex; flex-direction: column; }
header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-block: 10px; padding-inline: 16px; border-bottom: 1px solid var(--rule); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand h1 { font-family: var(--f-display); font-weight: 400; font-size: 20px; margin: 0; line-height: 1; display: flex; align-items: center; }
.brand h1 a { display: inline-flex; align-items: center; gap: 8px; }
.brand-logo { width: 30px; height: 30px; flex: none; border-radius: 50%; }
.gate-logo { width: 132px; height: 132px; align-self: center; margin: -6px 0 -4px; border-radius: 50%; }
/* the logo's deep greens need a light disc to read on the dark theme */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-logo, :root:not([data-theme="light"]) .gate-logo { background: #fdfaf0; padding: 2px; box-sizing: border-box; } :root:not([data-theme="light"]) .gate-logo { padding: 10px; } }
:root[data-theme="dark"] .brand-logo, :root[data-theme="dark"] .gate-logo { background: #fdfaf0; padding: 2px; box-sizing: border-box; } :root[data-theme="dark"] .gate-logo { padding: 10px; }
.brand small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; line-height: 1; }
.search { position: relative; margin-left: auto; flex: 0 1 300px; min-width: 0; }
.search input { width: 100%; box-sizing: border-box; font: inherit; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); }
.search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; box-shadow: var(--shadow); z-index: 30; max-height: 320px; overflow: auto; padding: 4px; margin: 0; list-style: none; }
.results li { padding: 7px 10px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.results li[aria-selected="true"], .results li:hover { background: var(--accent-soft); }
.results .yrs { font-family: var(--f-mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 360px; }
.stage { position: relative; overflow: hidden; touch-action: none; cursor: grab; min-width: 0; }
.stage.dragging { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.world.glide { transition: transform .5s cubic-bezier(.2,.7,.2,1); }
svg.links { position: absolute; left: 0; top: 0; overflow: visible; width: 1px; height: 1px; transition: opacity .2s; }
svg.links path { fill: none; stroke: var(--line); stroke-width: 1.5; }
svg.links .mline { stroke: var(--accent); stroke-width: 2; }
svg.links text { fill: var(--muted); font-family: var(--f-mono); font-size: 11px; }
svg.links .tag { fill: var(--bg); }

.card { position: absolute; left: 0; top: 0; box-sizing: border-box; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 9px 12px; box-shadow: var(--shadow); cursor: pointer; transition: transform .5s cubic-bezier(.2,.7,.2,1), opacity .35s, width .5s, height .5s; display: flex; flex-direction: column; justify-content: center; gap: 2px; overflow: hidden; color: var(--ink); text-align: left; font: inherit; }
.card:hover { border-color: var(--line); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card .nm { font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .sn { font-weight: 400; color: var(--muted); }
.card .yr { font-family: var(--f-mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.card .pl { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .sx { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; border: 1.5px solid var(--muted); box-sizing: border-box; }
.card .sx.F { border-radius: 50%; }
.card .sx.U { transform: rotate(45deg); }
.card.c3 { padding: 7px 10px; }
.card.c3 .nm { font-size: 13px; }
.card.focus { border: 2px solid var(--accent); padding: 12px 16px; }
.card.focus .nm { font-family: var(--f-display); font-weight: 400; font-size: 19px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card.focus .sn { color: var(--ink); }
.card.focus .yr { font-size: 13px; }
.card.me::after { content: "You"; position: absolute; bottom: 8px; right: 10px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.card.ghost { background: var(--ghost); border: 1.5px dashed var(--line); box-shadow: none; color: var(--muted); align-items: center; }
.card.enter { opacity: 0; }
.gen-label { position: absolute; left: 0; top: 0; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; transition: transform .5s cubic-bezier(.2,.7,.2,1), opacity .3s; pointer-events: none; }

.controls { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
.controls button, .back { font: inherit; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: var(--shadow); font-size: 17px; line-height: 1; }
.controls button:focus-visible, .back:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.back { position: absolute; left: 12px; top: 12px; z-index: 5; width: auto; padding: 0 12px; font-size: 13px; }
.hint { position: absolute; left: 12px; bottom: 12px; font-size: 12px; color: var(--muted); z-index: 5; background: color-mix(in srgb, var(--bg) 85%, transparent); padding: 4px 8px; border-radius: 6px; }
.hint kbd { font-family: var(--f-mono); font-size: 11px; border: 1px solid var(--rule); border-radius: 4px; padding: 0 4px; background: var(--surface); }

aside { background: var(--surface); border-left: 1px solid var(--rule); overflow: auto; min-width: 0; }
.panel { padding-block: 22px 32px; padding-inline: 24px; display: flex; flex-direction: column; gap: 22px; }
.p-head { display: flex; flex-direction: column; gap: 8px; }
.kin { align-self: flex-start; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 999px; }
.p-head h2 { font-family: var(--f-display); font-weight: 400; font-size: 28px; line-height: 1.15; margin: 0; text-wrap: balance; }
.p-head .life { font-family: var(--f-mono); color: var(--muted); font-size: 13px; }
.p-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 7px; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); }
h3 { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; font-weight: 600; }
.tl { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 14px; }
.tl li { display: contents; }
.tl .when { font-family: var(--f-mono); font-size: 12.5px; color: var(--muted); text-align: right; padding-block: 7px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl .when b { display: block; color: var(--ink); font-weight: 500; font-size: 13px; }
.tl .what { padding-block: 7px; border-left: 2px solid var(--rule); padding-left: 14px; position: relative; line-height: 1.4; min-width: 0; }
.tl .what::before { content: ""; position: absolute; left: -6px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); box-sizing: border-box; width: 10px; height: 10px; }
.tl .what.own::before { border-color: var(--accent); background: var(--accent); }
.tl .what .place { display: block; color: var(--muted); font-size: 12.5px; }
.tl .what .ds { color: var(--ink); }
.tl a, .fam a { color: var(--accent); text-decoration: none; cursor: pointer; }
.tl a:hover, .fam a:hover { text-decoration: underline; }
.fam { display: grid; gap: 14px; }
.fam ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.fam li { display: flex; justify-content: space-between; gap: 10px; padding-block: 4px; border-bottom: 1px solid var(--rule); }
.fam li .y { font-family: var(--f-mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.fam .lbl { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.empty { color: var(--muted); font-size: 13px; }
.foot { font-size: 12px; color: var(--muted); line-height: 1.5; border-top: 1px solid var(--rule); padding-top: 14px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 9px 14px; border-radius: 8px; font-size: 13px; z-index: 50; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: calc(100% - 32px); }
.toast.on { opacity: 1; }

.p-add { display: flex; flex-wrap: wrap; gap: 6px; }
.p-add .btn { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .45; cursor: default; }
.card.more { background: var(--ghost); border: 1.5px solid var(--rule); box-shadow: none; color: var(--accent); align-items: center; font-weight: 600; }
.sheet-bg { position: fixed; inset: 0; background: color-mix(in srgb, var(--ink) 35%, transparent); z-index: 40; display: grid; place-items: center; padding: 16px; }
.sheet { background: var(--surface); color: var(--ink); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: min(520px, 100%); max-height: calc(100% - 8px); overflow: auto; box-sizing: border-box; padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 14px; }
.sheet h2 { font-family: var(--f-display); font-weight: 400; font-size: 23px; margin: 0; text-wrap: balance; }
.sheet .f-sub { margin: -8px 0 0; color: var(--muted); font-size: 13px; }
.sheet label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; min-width: 0; }
.sheet input:not([type=radio]), .sheet select { font: inherit; font-size: 14px; color: var(--ink); background: var(--bg); border: 1px solid var(--rule); border-radius: 7px; padding: 8px 10px; min-width: 0; }
.sheet input:focus-visible, .sheet select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sheet .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sheet fieldset { border: 0; padding: 0; margin: 0; display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.sheet legend { font-size: 12px; color: var(--muted); font-weight: 500; padding: 0; margin-bottom: 6px; }
.sheet fieldset label { flex-direction: row; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); }
.sheet .hint2 { font-size: 11.5px; color: var(--muted); margin: -6px 0 0; }
.f-err { color: #b3261e; font-size: 13px; margin: 0; min-height: 0; }
.f-err:empty { display: none; }
.f-actions { display: flex; justify-content: flex-end; gap: 8px; }
.discard { font: inherit; font-size: 12px; background: none; border: 0; color: var(--accent); padding: 0; cursor: pointer; text-decoration: underline; }
@media (max-width: 520px) { .sheet .row2 { grid-template-columns: 1fr; } .sheet-bg { place-items: end stretch; padding: 0; } .sheet { border-radius: 14px 14px 0 0; width: 100%; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); } }

/* ---- round 3 ---- */
:root { --warm: #b0652a; --cat0: #c9cfc9; --cat1: #3d6f99; --cat2: #c08a2e; --cat3: #5b8f5a; --cat4: #a3544f; --cat5: #7a62a3; --cat6: #3b8f8c; --cat7: #b66f97; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --warm: #e3a06b; --cat0: #3a4541; --cat1: #4f86b5; --cat2: #b98a3a; --cat3: #5f9a5d; --cat4: #b0655f; --cat5: #8a74b6; --cat6: #4a9d99; --cat7: #c07fa4; } }
:root[data-theme="dark"] { --warm: #e3a06b; --cat0: #3a4541; --cat1: #4f86b5; --cat2: #b98a3a; --cat3: #5f9a5d; --cat4: #b0655f; --cat5: #8a74b6; --cat6: #4a9d99; --cat7: #c07fa4; }

.tabs { display: flex; gap: 2px; overflow-x: auto; padding-inline: 12px; background: var(--surface); border-bottom: 1px solid var(--rule); scrollbar-width: none; }
.tabs button { font: inherit; font-size: 13.5px; background: none; border: 0; color: var(--muted); padding: 10px 12px 9px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rolechip { font-size: 12.5px; background: var(--accent-soft); color: var(--accent); padding: 5px 10px; border-radius: 999px; }
.rolechip button { font: inherit; background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0; font-weight: 600; }
.views { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.views > .stage { flex: 1; }
.view:not(.stage) { flex: 1; overflow: auto; padding-block: 22px 40px; padding-inline: 28px; }
.v-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.v-head h2 { font-family: var(--f-display); font-weight: 400; font-size: 26px; margin: 0; text-wrap: balance; }
.sub { color: var(--muted); font-size: 13px; margin: 4px 0 0; line-height: 1.5; max-width: 70ch; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--bg); }
.seg button { font: inherit; font-size: 12.5px; padding: 6px 11px; border: 0; background: none; color: var(--muted); cursor: pointer; border-right: 1px solid var(--rule); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.btn.sm { font-size: 12px; padding: 4px 9px; }
.count { display: inline-block; font-size: 11px; font-family: var(--f-mono); background: var(--bg); border: 1px solid var(--rule); border-radius: 999px; padding: 0 7px; margin-left: 4px; color: var(--muted); letter-spacing: 0; vertical-align: 1px; }
.y { font-family: var(--f-mono); font-size: 12px; color: var(--muted); margin-left: 4px; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.view section { margin-top: 26px; }
.view a[data-go] { color: var(--accent); cursor: pointer; text-decoration: none; }
.view a[data-go]:hover { text-decoration: underline; }

/* avatars */
.ava { display: inline-grid; place-items: center; border-radius: 50%; flex: none; background-color: var(--accent-soft); color: var(--accent); font-family: var(--f-display); background-repeat: no-repeat; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent); }
.card.has-ava { padding-left: 58px; }
.card.has-ava .c-ava { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); }
.card.focus.has-ava { padding-left: 82px; }
.card.focus .c-ava { left: 14px; }
.card.has-ava .sx { display: none; }
.p-ava { margin-bottom: 4px; }

/* story */
.story { max-width: 720px; margin: 0 auto; }
.s-head { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.s-head h2 { font-family: var(--f-display); font-weight: 400; font-size: 36px; line-height: 1.1; margin: 6px 0 4px; text-wrap: balance; }
.s-head .life { font-family: var(--f-mono); color: var(--muted); margin: 0; }
.s-body { margin-top: 24px; font-size: 17px; line-height: 1.7; max-width: 65ch; }
.s-body p { margin: 0 0 12px; }
.s-body p:first-child::first-letter { font-family: var(--f-display); font-size: 3.1em; float: left; line-height: .9; padding: 4px 8px 0 0; color: var(--accent); }
.minimap { margin: 26px 0 0; border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; background: var(--surface); }
.minimap figcaption { font-size: 12px; color: var(--muted); padding: 8px 12px; border-top: 1px solid var(--rule); }
.minimap text { font-size: 11px; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.states path { fill: var(--ghost); stroke: var(--rule); stroke-width: .8; }
polyline.life { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 4; }
circle.t-Birth, .dot.t-Birth { fill: var(--accent); }
circle.t-Marriage, .dot.t-Marriage { fill: var(--warm); }
circle.t-Death, .dot.t-Death { fill: var(--muted); }
.s-sec { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.s-sec h3 { margin: 0; }
.s-photos { display: flex; gap: 12px; overflow-x: auto; padding: 12px 0 4px; }
.s-ph { flex: none; border: 1px solid var(--rule); background: var(--surface); border-radius: 10px; padding: 0; overflow: hidden; cursor: pointer; width: 170px; text-align: left; font: inherit; color: var(--ink); }
.s-ph img { display: block; width: 100%; height: 130px; object-fit: cover; }
.s-ph span { display: block; font-size: 12px; padding: 6px 9px; color: var(--muted); }
.note, .memory { margin: 10px 0 0; padding: 12px 16px; border-left: 3px solid var(--rule); background: var(--surface); border-radius: 0 8px 8px 0; font-size: 14px; line-height: 1.6; }
.memory { border-left-color: var(--warm); }
.memory p { margin: 0 0 6px; font-family: var(--f-display); font-size: 16px; }
.memory cite { font-style: normal; font-size: 12px; color: var(--muted); }
.memform { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; align-items: flex-end; }
.memform textarea, .invite input, .invite select, .members select, .picker input, .lb-pick input { font: inherit; width: 100%; box-sizing: border-box; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); }
.memform textarea:focus-visible, .picker input:focus-visible, .invite input:focus-visible, .lb-pick input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* fan */
.fan-wrap { overflow-x: auto; }
.fan { display: block; width: 100%; max-width: 900px; min-width: 0; height: auto; margin: 0 auto; }
.wedge path { stroke: var(--bg); stroke-width: 1.5; cursor: pointer; transition: opacity .15s; }
.wedge:hover path, .wedge:focus-visible path { opacity: .82; }
.wedge:focus { outline: none; }
.wedge:focus-visible path { stroke: var(--ink); stroke-width: 2; }
.wedge text { fill: var(--ink); font-size: 11px; pointer-events: none; }
.wedge .fn { font-weight: 600; font-size: 12.5px; }
.wedge .sn2 { font-size: 11.5px; }
.wedge .yy { font-family: var(--f-mono); font-size: 10px; fill: var(--muted); }
.wedge .small { font-size: 10px; } .wedge .tiny { font-size: 8.5px; }
.wedge.centre path { stroke: var(--accent); stroke-width: 2; cursor: default; }
.f-empty path { fill: transparent; stroke: var(--line); stroke-dasharray: 3 3; }
.f-none path { fill: var(--ghost); }
.cat0 path, .sw.cat0 { fill: var(--cat0); background: var(--cat0); }
.cat1 path, .sw.cat1 { fill: color-mix(in srgb, var(--cat1) 55%, var(--surface)); background: color-mix(in srgb, var(--cat1) 55%, var(--surface)); }
.cat2 path, .sw.cat2 { fill: color-mix(in srgb, var(--cat2) 55%, var(--surface)); background: color-mix(in srgb, var(--cat2) 55%, var(--surface)); }
.cat3 path, .sw.cat3 { fill: color-mix(in srgb, var(--cat3) 55%, var(--surface)); background: color-mix(in srgb, var(--cat3) 55%, var(--surface)); }
.cat4 path, .sw.cat4 { fill: color-mix(in srgb, var(--cat4) 55%, var(--surface)); background: color-mix(in srgb, var(--cat4) 55%, var(--surface)); }
.cat5 path, .sw.cat5 { fill: color-mix(in srgb, var(--cat5) 55%, var(--surface)); background: color-mix(in srgb, var(--cat5) 55%, var(--surface)); }
.cat6 path, .sw.cat6 { fill: color-mix(in srgb, var(--cat6) 55%, var(--surface)); background: color-mix(in srgb, var(--cat6) 55%, var(--surface)); }
.cat7 path, .sw.cat7 { fill: color-mix(in srgb, var(--cat7) 55%, var(--surface)); background: color-mix(in srgb, var(--cat7) 55%, var(--surface)); }
.q0 path, .sw.q0 { fill: var(--ghost); background: var(--ghost); }
.q1 path, .sw.q1 { fill: color-mix(in srgb, var(--accent) 18%, var(--surface)); background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.q2 path, .sw.q2 { fill: color-mix(in srgb, var(--accent) 34%, var(--surface)); background: color-mix(in srgb, var(--accent) 34%, var(--surface)); }
.q3 path, .sw.q3 { fill: color-mix(in srgb, var(--accent) 52%, var(--surface)); background: color-mix(in srgb, var(--accent) 52%, var(--surface)); }
.q4 path, .sw.q4 { fill: color-mix(in srgb, var(--accent) 72%, var(--surface)); background: color-mix(in srgb, var(--accent) 72%, var(--surface)); }
.f-none.sw, .sw.f-none { background: var(--ghost); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 12.5px; color: var(--ink); margin-top: 14px; justify-content: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid var(--rule); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.t-Birth { background: var(--accent); } .dot.t-Marriage { background: var(--warm); } .dot.t-Death { background: var(--muted); }

/* descendants */
.dtree, .dtree ul { list-style: none; margin: 0; padding: 0; }
.dtree ul { margin-left: 15px; padding-left: 18px; border-left: 1.5px solid var(--rule); }
.dtree li { margin: 2px 0; }
.dtree summary { list-style: none; cursor: pointer; }
.dtree summary::-webkit-details-marker { display: none; }
.dtree summary .d-row::before { content: "▸"; color: var(--muted); width: 12px; flex: none; transition: transform .15s; }
.dtree details[open] > summary .d-row::before { transform: rotate(90deg); }
.dtree li > .d-row { padding-left: 22px; }
.d-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; }
.d-row:hover { background: var(--surface); }
.d-txt { min-width: 0; flex: 1; }
.d-sp { display: block; font-size: 12.5px; color: var(--muted); }
.d-sp a[data-go] { color: var(--muted) !important; text-decoration: underline; text-decoration-color: var(--rule); }
.d-n { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* map */
.map-wrap { position: relative; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); overflow: hidden; }
.usmap { display: block; width: 100%; height: auto; }
.usmap circle { stroke: var(--surface); stroke-width: 1; opacity: .55; cursor: pointer; }
.usmap circle.recent { opacity: .95; }
.usmap circle:hover, .usmap circle:focus-visible { opacity: 1; stroke: var(--ink); outline: none; }
.m-year { position: absolute; right: 16px; bottom: 10px; font-family: var(--f-display); font-size: 44px; color: color-mix(in srgb, var(--ink) 22%, transparent); pointer-events: none; font-variant-numeric: tabular-nums; }
.m-time { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.m-time input { flex: 1; accent-color: var(--accent); min-width: 0; }
.m-span { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.m-detail h3 { margin-top: 20px; }
.m-detail ul { list-style: none; padding: 0; margin: 0; columns: 2 260px; }
.m-detail li { padding: 4px 0; break-inside: avoid; }
.m-detail .y { margin: 0 8px 0 0; }

/* photos */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.g-item { border: 1px solid var(--rule); background: var(--surface); border-radius: 12px; overflow: hidden; padding: 0; cursor: pointer; text-align: left; font: inherit; color: var(--ink); }
.g-item:hover { border-color: var(--line); }
.g-item img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; max-width: 100%; }
.g-cap { display: block; padding: 9px 12px 11px; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.g-cap b { display: block; color: var(--ink); font-weight: 600; text-transform: capitalize; }
.lightbox { position: fixed; inset: 0; z-index: 45; background: color-mix(in srgb, #000 70%, transparent); display: grid; place-items: center; padding: 16px; }
.lb-inner { background: var(--surface); border-radius: 14px; padding: 14px; max-width: min(900px, 100%); max-height: 100%; overflow: auto; box-sizing: border-box; display: flex; flex-direction: column; gap: 10px; }
.lb-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lb-top b { text-transform: capitalize; }
.lb-top .sp { flex: 1; }
.lb-img { position: relative; align-self: center; line-height: 0; user-select: none; touch-action: none; }
.lb-img img { max-width: 100%; max-height: 62vh; border-radius: 8px; }
.lb-img.tagging { cursor: crosshair; }
.face { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5); border-radius: 6px; background: transparent; padding: 0; cursor: pointer; }
.face span { position: absolute; left: 50%; top: 100%; transform: translate(-50%, 4px); white-space: nowrap; font-size: 11.5px; line-height: 1.3; background: rgba(0,0,0,.75); color: #fff; padding: 2px 6px; border-radius: 4px; opacity: 0; transition: opacity .15s; pointer-events: none; }
.face:hover span, .face:focus-visible span { opacity: 1; }
.lb-img.tagging .face { pointer-events: none; }
.face.draft { border-style: dashed; cursor: crosshair; }
.lb-people { font-size: 13px; color: var(--muted); line-height: 1.5; }
.lb-pick { position: relative; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.lb-pick .results { position: static; box-shadow: none; }

/* relate */
.r-pick { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.picker { position: relative; flex: 1 1 220px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.r-verdict { font-size: 18px; margin: 22px 0 6px; font-family: var(--f-display); line-height: 1.4; }
.r-verdict b { font-weight: 400; color: var(--accent); }
.r-card { display: inline-flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 8px 12px; cursor: pointer; box-shadow: var(--shadow); max-width: 100%; box-sizing: border-box; }
.r-card b { display: block; font-weight: 600; font-size: 13.5px; }
.r-card .y { margin: 0; }
.r-card.end { border: 2px solid var(--accent); }
.r-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.r-chart { margin-top: 18px; display: flex; flex-direction: column; align-items: center; }
.r-top { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.r-cap { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.r-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; width: 100%; max-width: 640px; }
.r-cols.one { grid-template-columns: 1fr; max-width: 320px; }
.r-col { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.r-step { display: flex; flex-direction: column; align-items: center; max-width: 100%; }
.r-line { width: 2px; height: 22px; background: var(--line); }
.r-chain { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.r-how { font-size: 12px; color: var(--muted); padding-left: 18px; }

/* research */
.bar-row { display: grid; grid-template-columns: minmax(120px, 190px) 1fr 70px; gap: 12px; align-items: center; padding: 4px 0; font-size: 13px; }
.bar { height: 10px; background: var(--ghost); border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bn { font-family: var(--f-mono); font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.todo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 10px; }
.todo { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 14px 16px; margin-top: 16px !important; min-width: 0; }
.todo ul, .sugg { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--rule); font-size: 13.5px; }
.todo li:last-child { border-bottom: 0; }
.dup { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.dup-p { display: flex; gap: 10px; align-items: center; min-width: 0; }
.dup-p > span { min-width: 0; }
.dup-p .y { display: block; margin: 2px 0 0; }
.dup-sc { font-family: var(--f-mono); font-size: 12px; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.dup-act { grid-column: 1 / -1; display: flex; gap: 8px; }

/* sharing */
.sh-preview { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 14px 16px; margin-top: 0 !important; }
.sh-preview h3 { margin-bottom: 10px; }
.sugg li { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.sugg li > div:first-child { min-width: 0; flex: 1 1 260px; }
.sugg b { display: block; font-weight: 600; }
.sugg blockquote { margin: 6px 0; font-family: var(--f-display); }
.sugg img { display: block; max-width: 160px; border-radius: 6px; margin: 6px 0; }
.sugg .y { margin: 0; }
.members { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.members th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--rule); }
.members td { padding: 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.members select { width: auto; padding: 4px 8px; }
.ex { font-size: 10.5px; color: var(--muted); border: 1px solid var(--rule); border-radius: 4px; padding: 0 4px; }
.lnk { font-family: var(--f-mono); font-size: 11px; color: var(--muted); word-break: break-all; }
.invite { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.invite label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); flex: 1 1 180px; }
.inv-link { display: flex; gap: 8px; align-items: center; margin-top: 10px; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 8px 10px; }
.inv-link code { font-family: var(--f-mono); font-size: 12px; word-break: break-all; flex: 1; }
.roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 0; }
.roles div { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; }
.roles dt { font-weight: 600; } .roles dd { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.tog { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.tog input { accent-color: var(--accent); width: 16px; height: 16px; }
@media (max-width: 820px) {
  .view:not(.stage) { padding-inline: 16px; }
  .views { min-height: 0; }
  .dup { grid-template-columns: 1fr; }
  .s-head h2 { font-size: 28px; }
  .r-cols { gap: 10px; }
  .bar-row { grid-template-columns: 110px 1fr 60px; }
}

@media (max-width: 820px) {
  main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1.15fr) minmax(0, 1fr); }
  aside { border-left: 0; border-top: 1px solid var(--rule); }
  .panel { padding-inline: 16px; padding-block: 16px 28px; }
  .hint { display: none; }
  .brand small { display: none; }
  .search { flex: 1 1 160px; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .gen-label, .world.glide, svg.links { transition: none !important; }
}

/* ---- sign-in + saving ---- */
.gate { min-height: 100%; display: grid; place-items: center; padding: 16px; box-sizing: border-box; background: var(--bg); }
.gate[hidden] { display: none; }
.gate-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; padding: 28px 26px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; box-sizing: border-box; }
.gate-card h1 { font-family: var(--f-display); font-weight: 400; font-size: 34px; margin: 0; text-align: center; }
.gate-sub { text-align: center; }
.gate-sub { margin: -6px 0 4px; color: var(--muted); }
#gate-fields { display: flex; flex-direction: column; gap: 12px; }
.gate-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
.gate-card input { font: inherit; font-size: 15px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); }
.gate-card input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.gate-card .btn { padding: 10px; font-size: 14px; }
.gate-load { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--rule); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
body.saving { cursor: progress; }
.tbl { overflow-x: auto; }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }
img.broken { background: var(--line, #ddd); min-height: 80px; object-fit: none; }

.fan-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 8px; }
.fan-nav .lbl { font-size: 12px; color: var(--muted); margin-left: 8px; }
.aka { color: var(--muted); font-size: 13px; margin-top: 2px; }
.ev-edit { margin-left: 8px; font: inherit; font-size: 11.5px; color: var(--muted); background: none; border: 0; padding: 0 2px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.ev-edit:hover { color: var(--accent); }
.panel .s-sec { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.btn.danger { color: #c0392b; border-color: color-mix(in srgb, #c0392b 40%, var(--rule)); }
.f-actions .sp { flex: 1; }
.p-photos { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.p-photos figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.p-photos figcaption { font-size: 11.5px; color: var(--muted); }
.p-ph { padding: 0; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; width: 76px; height: 76px; cursor: pointer; background: var(--bg); }
.p-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dropping { outline: 2px dashed var(--accent); outline-offset: -6px; }

/* ---------- phones: the person panel is a bottom sheet over a full-screen view ---------- */
.grip { display: none; }
@media (max-width: 820px) {
  :root { --peek: 100px; }
  main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .view:not(.stage) { padding-bottom: calc(var(--peek) + 24px) !important; }
  aside#panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: min(86dvh, calc(100dvh - 64px)); border-top: 1px solid var(--rule); border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.25);
    transform: translateY(calc(100% - var(--peek) - env(safe-area-inset-bottom, 0px))); transition: transform .3s cubic-bezier(.2,.7,.2,1); overflow: hidden; overscroll-behavior: contain; }
  body.sheet-open aside#panel { transform: none; overflow-y: auto; }
  aside#panel.dragging { transition: none; }
  .grip { display: flex; justify-content: center; align-items: center; position: sticky; top: 0; z-index: 2; width: 100%; height: 24px; margin-bottom: -10px; padding: 0; border: 0; background: var(--surface); cursor: pointer; touch-action: none; }
  .grip span { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
  .panel { padding-block: 8px calc(28px + env(safe-area-inset-bottom, 0px)); gap: 18px; }
  .p-head { display: grid; grid-template-columns: 56px 1fr; column-gap: 12px; row-gap: 2px; align-items: center; touch-action: pan-y; }
  .p-head > .p-ava { grid-row: span 3; width: 56px !important; height: 56px !important; font-size: 20px !important; }
  .p-head h2 { font-size: 22px; }
  .p-head .kin { justify-self: start; }
  .p-head .p-actions, .p-head .empty { grid-column: 1 / -1; margin-top: 10px; }
  body:not(.sheet-open) .p-head .kin { display: none; }
  body:not(.sheet-open) .p-head .p-actions { visibility: hidden; }
  .s-head .s-ava { width: 72px !important; height: 72px !important; font-size: 26px !important; }
  .s-head { gap: 14px; }
  /* touch sizes */
  .btn { min-height: 44px; padding-inline: 14px; }
  .btn.sm, .p-add .btn { min-height: 40px; }
  .tabs button { min-height: 44px; padding-inline: 14px; }
  .controls { bottom: calc(var(--peek) + 12px); }
  .controls button, .back { width: 44px; height: 44px; }
  .back { width: auto; }
  .ev-edit { padding: 8px 4px; margin: -8px 0 -8px 6px; }
  input, select, textarea { font-size: 16px !important; }
  header { gap: 10px; padding-block: 8px; }
  .rolechip { font-size: 12px; padding: 4px 9px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .lb-inner { padding: 10px; }
  .lb-img img { max-height: 58dvh; }
  .lb-nav { min-width: 44px; }
}
.lb-nav { font-size: 18px; }

/* couple panel and marriage links */
svg.links .mlink { cursor: pointer; pointer-events: all; }
svg.links .mhit { fill: transparent; stroke: none; }
svg.links .mlink:hover .mline { stroke-width: 3; }
.fam-open { margin-left: 8px; font-size: 11.5px; color: var(--accent); cursor: pointer; text-transform: none; letter-spacing: 0; font-weight: 500; }
.c-back { align-self: flex-start; margin-bottom: 4px; }
.c-partners { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.c-card { display: flex; gap: 10px; align-items: center; text-align: left; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--rule); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.c-card > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.c-card .y { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.c-missing { cursor: default; border-style: dashed; }
.c-add { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.c-add .picker { position: relative; }
.c-add input { font: inherit; width: 100%; box-sizing: border-box; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); }
.c-type select { font: inherit; font-size: 13px; color: var(--ink); background: var(--bg); border: 1px solid var(--rule); border-radius: 7px; padding: 3px 6px; margin-left: 6px; }
.story a[data-couple] { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
@media (max-width: 820px) { .p-head.c-head { display: flex; } }
.c-card .ava { flex: none; width: 44px; height: 44px; }

/* date control */
.sheet fieldset.dfield { display: flex; flex-direction: column; align-items: stretch; gap: 8px; border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px 12px; }
.sheet fieldset.dfield legend { padding: 0 4px; margin: 0; }
.sheet fieldset.dfield[hidden] { display: none; }
.dctl { display: flex; flex-direction: column; gap: 6px; }
.dctl .drow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dctl .drow[hidden] { display: none; }
.dctl .dparts { display: flex; gap: 6px; align-items: center; flex: 1 1 260px; min-width: 0; }
.sheet .dctl .dd { width: 3.6em; flex: none; }
.sheet .dctl .dm { flex: 1 1 7em; min-width: 0; }
.sheet .dctl .dy { width: 4.6em; flex: none; }
.sheet .dctl .dq { flex: none; }
.dctl .dcal { flex: none; padding: 6px 9px; }
.dctl .dnative { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dctl .dparts { position: relative; }
.dctl .dand { font-size: 13px; color: var(--muted); width: 5.6em; text-align: right; }
.dctl .dprev { margin: 0; font-size: 12.5px; color: var(--muted); }
.dctl .dprev.bad { color: #c0392b; }
.dctl .dtext { margin: 0; font-size: 12.5px; color: var(--ink); background: var(--bg); border-radius: 6px; padding: 6px 8px; }
@media (max-width: 520px) { .dctl .dand { width: auto; } .dctl .dparts { flex-basis: 100%; } }
.sheet fieldset.dfield label { flex-direction: column; align-items: stretch; font-size: 12px; color: var(--muted); }
.c-merge { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 6px; }
.c-merge .btn { text-align: left; }
.c-row { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.c-row .c-card { align-self: stretch; }
.btn.danger.solid { background: #c0392b; border-color: #c0392b; color: #fff; }
.btn.danger.solid:disabled { opacity: .4; }
.del-list { font-size: 14px; line-height: 1.5; }
.del-list ul { margin: 4px 0 12px; padding-left: 20px; }
.f-link { display: flex; flex-direction: column; gap: 4px; background: var(--bg); border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; }
.f-link[hidden] { display: none; }
.f-link > label { font-size: 12px; color: var(--muted); font-weight: 500; }
.f-link .picker { position: relative; }
.f-link input { width: 100%; box-sizing: border-box; }
.f-link .hint2 { margin: 0; }
svg.links .mhit-path { fill: none; stroke: transparent; stroke-width: 16; }
.card.out { opacity: .62; border-style: dashed; box-shadow: none; }
.card.out .outlbl { font-style: italic; }
.c-acts { display: flex; gap: 10px; flex-wrap: wrap; }
.sheet label.f-check { flex-direction: row; align-items: baseline; gap: 8px; font-size: 14px; color: var(--ink); flex-wrap: wrap; }
.sheet label.f-check[hidden] { display: none; }
.fam-open.dup { color: #c27a1a; }
.c-banner { background: color-mix(in srgb, #c27a1a 14%, var(--surface)); border: 1px solid color-mix(in srgb, #c27a1a 45%, var(--rule)); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; line-height: 1.5; }
.c-banner .btn { margin-left: 6px; }
.hist { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; }
.hist li { display: grid; grid-template-columns: 9.5em 1fr auto; gap: 12px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.hist li.undone { opacity: .6; }
.hist .h-when { font-family: var(--f-mono); font-size: 12.5px; color: var(--muted); padding-top: 2px; }
.hist .h-what { font-size: 14px; line-height: 1.45; min-width: 0; }
.hist .h-who { color: var(--muted); font-size: 13px; }
.hist .h-who a { color: var(--accent); cursor: pointer; }
.hist .gone { font-style: italic; }
@media (max-width: 520px) { .hist li { grid-template-columns: 1fr auto; } .hist .h-when { grid-column: 1 / -1; padding: 0; } }

/* Leaflet maps */
.lmap { height: min(62vh, 560px); border-radius: 12px; border: 1px solid var(--rule); background: var(--ghost); z-index: 0; }
.lmap.small { height: 300px; }
.minimap .mm { height: 260px; border-radius: 10px; border: 1px solid var(--rule); z-index: 0; }
.mm-tip { font-size: 11px; padding: 2px 6px; }
.dot.t-Other { background: var(--cat3); }
.pl-pin { background: var(--accent); border: 3px solid #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.sheet.wide { width: min(680px, 100%); }
.pl-search { display: flex; gap: 8px; } .pl-search input { flex: 1; }
.pl-res { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 9em; overflow: auto; }
.pl-res .btn { text-align: left; width: 100%; }
.todo.places ul { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.todo.places li { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.leaflet-container { font: inherit; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .leaflet-tile-pane { filter: brightness(.75) invert(1) contrast(.85) hue-rotate(190deg) saturate(.6); } }
:root[data-theme="dark"] .leaflet-tile-pane { filter: brightness(.75) invert(1) contrast(.85) hue-rotate(190deg) saturate(.6); }

/* storybook */
.s-book { margin-top: 8px; }
#book { position: fixed; inset: 0; height: 100vh; height: 100dvh; z-index: 60; background: #e9e6df; display: flex; flex-direction: column; color: #1d1d1b; }
#bk-frame { flex: 1; min-height: 0; border: 0; width: 100%; background: #e9e6df; }
#book[hidden] { display: none; }
body.booking { overflow: hidden; }
.bk-bar { position: sticky; top: 0; display: flex; gap: 8px; align-items: center; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--rule); z-index: 2; }
.bk-bar .sp { flex: 1; }
.bk-name { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.bk-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-name .y { white-space: nowrap; }
.bk-bar .btn { white-space: nowrap; flex: none; }
/* the book form: a close button beside the heading; full screen on a phone */
.bk-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bk-x { font: inherit; font-size: 26px; line-height: 1; width: 40px; height: 40px; margin: -8px -10px -8px 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; flex: none; }
.bk-x:hover { background: var(--ghost); color: var(--ink); }
@media (max-width: 699px) {
  .book-sheet { padding: 0; place-items: stretch; }
  .book-sheet .sheet { width: 100%; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; box-shadow: none; padding: 0 16px; overscroll-behavior: contain; }
  .book-sheet .bk-head { position: sticky; top: 0; z-index: 1; background: var(--surface); margin: 0 -16px; padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 10px; border-bottom: 1px solid var(--rule); }
  .book-sheet .bk-head h2 { font-size: 21px; }
  .book-sheet .bk-x { margin: -6px -8px -6px 0; }
  .book-sheet .f-sub { margin: 0; }
  .book-sheet .f-actions { position: sticky; bottom: 0; background: var(--surface); margin: 0 -16px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--rule); }
  .book-sheet .f-actions .btn { flex: 1; justify-content: center; }
  .book-sheet .f-actions .sp { display: none; }
  .bk-bar { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .bk-bar .btn { padding-left: 10px; padding-right: 10px; }
  .bk-close span, .bk-long { display: none; }
  .bk-name { flex-direction: column; gap: 0; flex: 1; }
  .bk-name b { font-size: 14px; max-width: 100%; }
  .bk-name .y { font-size: 11.5px; }
  .bk-bar .sp { display: none; }
}
.bk-pages { padding: 24px 12px 60px; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.bk-pages > section { background: #fffdf8; width: min(210mm, 100%); box-sizing: border-box; padding: 18mm 18mm 20mm; box-shadow: 0 2px 14px rgba(0,0,0,.15); font-family: var(--f-body, Figtree), sans-serif; font-size: 11.5pt; line-height: 1.5; }
.bk-pages h1, .bk-pages h2 { font-family: var(--f-display); font-weight: 400; color: #1d1d1b; }
.bk-cover { min-height: 260mm; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.bk-cover img { width: 60mm; height: 60mm; object-fit: cover; border-radius: 50%; margin-bottom: 10mm; }
.bk-cover h1 { font-size: 34pt; margin: 0 0 6mm; }
.bk-small { color: #6b6b66; font-size: 9.5pt; margin-top: 18mm; }
.bk-toc h3, .bk-chap h3 { font-size: 10pt; letter-spacing: .08em; text-transform: uppercase; color: #6b6b66; margin: 8mm 0 2mm; }
.bk-toc ol { margin: 0; padding-left: 8mm; }
.bk-num { color: #8a6d3b; font-size: 9.5pt; letter-spacing: .06em; text-transform: uppercase; margin: 0; }
.bk-chap h2 { font-size: 24pt; margin: 2mm 0 0; }
.bk-years { color: #6b6b66; font-family: var(--f-mono); margin: 0 0 4mm; }
.bk-story p { margin: 0 0 3mm; }
.bk-note { font-style: italic; color: #6b6b66; }
.bk-ev { border-collapse: collapse; width: 100%; font-size: 10.5pt; }
.bk-ev td { border-top: 1px solid #e3ded3; padding: 1.5mm 2mm 1.5mm 0; vertical-align: top; }
.bk-ev td:first-child { white-space: nowrap; color: #6b6b66; width: 32mm; font-family: var(--f-mono); font-size: 9.5pt; }
.bk-ev small { color: #6b6b66; }
.bk-photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4mm; }
.bk-photos img { width: 100%; height: 55mm; object-fit: cover; border-radius: 2mm; }
.bk-photos figcaption { font-size: 9pt; color: #6b6b66; }
.bk-chap blockquote { margin: 0 0 3mm; padding-left: 4mm; border-left: 2px solid #d8cfbd; }
.bk-chap cite { display: block; font-size: 9pt; color: #6b6b66; font-style: normal; }
.bk-chart { display: flex; flex-direction: column; align-items: center; gap: 0; font-size: 9.5pt; }
.bk-row { display: flex; flex-wrap: wrap; gap: 3mm; justify-content: center; }
.bk-box { border: 1px solid #cfc7b7; border-radius: 2mm; padding: 1.5mm 3mm; display: flex; flex-direction: column; align-items: center; background: #fff; }
.bk-box.me { border-color: #8a6d3b; border-width: 1.5px; }
.bk-box.out { border-style: dashed; opacity: .7; }
.bk-box small { color: #6b6b66; font-family: var(--f-mono); font-size: 8pt; }
.bk-line { width: 1px; height: 4mm; background: #cfc7b7; }
.bk-ref { color: #8a6d3b; font-size: .85em; }
.bk-index ul { columns: 2; list-style: none; padding: 0; font-size: 10pt; }
.bk-index li { break-inside: avoid; margin-bottom: 1mm; }
@page { size: A4; margin: 16mm 0 18mm; @bottom-center { content: counter(page); font-size: 9pt; color: #6b6b66; } }
@media print {
  body.booking > *:not(#book) { display: none !important; }
  body.booking { background: #fff; }
  #book { position: static; overflow: visible; background: #fff; }
  .bk-bar { display: none; }
  .bk-pages { padding: 0; gap: 0; display: block; }
  .bk-pages > section { box-shadow: none; width: auto; break-after: page; margin: 0; padding: 0 18mm; }
  .bk-cover { min-height: 230mm; }
  .bk-chap h3, .bk-chart, .bk-photos figure, .bk-ev tr { break-inside: avoid; }
}
.otd { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--rule)); border-radius: 12px; padding: 10px 12px 12px; }
.otd ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; }
.otd li { display: grid; grid-template-columns: 6.2em 1fr; gap: 8px; }
.otd .when { color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.otd a { color: var(--accent); cursor: pointer; text-decoration: none; }
.leaflet-control-attribution svg { width: auto; height: auto; max-width: 12px; }
.me-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 6px; }
.me-row a { color: var(--accent); cursor: pointer; }
.me-row .picker { position: relative; min-width: 220px; }
.me-row input { font: inherit; width: 100%; box-sizing: border-box; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); }
.gome-top { white-space: nowrap; }
.todo.probs li { align-items: flex-start; } .todo.probs li > span:first-child { line-height: 1.45; }
.todo.probs .acts { display: flex; gap: 6px; flex: none; }
.todo.probs li.info { color: var(--muted); }
.todo.probs a { color: var(--accent); cursor: pointer; }
.cal-list { list-style: none; padding: 0; margin: 8px 0 14px; display: flex; flex-direction: column; gap: 10px; }
.cal-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; }
.cal-list code { display: block; font-size: 11.5px; margin-top: 4px; word-break: break-all; }
.cal-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.cal-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; align-items: end; }
.cal-form .picker { position: relative; }
.cal-kinds { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; grid-column: 1 / -1; font-size: 14px; }
.cal-kinds label { display: flex; gap: 6px; align-items: center; }
.s-back { margin-bottom: 14px; }

/* timeline */
.tl-box { position: relative; display: flex; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); overflow: hidden; }
.tl-names { flex: none; border-right: 1px solid var(--rule); }
.tl-wrap { overflow-x: auto; flex: 1; min-width: 0; -webkit-overflow-scrolling: touch; }
.tl-zoom { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 4px; }
.tline { display: block; font-family: var(--f-body, inherit); }
.tline .tl-grid { stroke: var(--rule); }
.tline .tl-yr { fill: var(--muted); font-size: 11px; font-family: var(--f-mono); text-anchor: middle; }
.tline .tl-now { stroke: var(--accent); stroke-dasharray: 3 3; }
.tline .tl-world rect:first-child { fill: color-mix(in srgb, var(--warm) 55%, transparent); cursor: help; }
.tline .tl-band { fill: color-mix(in srgb, var(--warm) 7%, transparent); pointer-events: none; }
.tline .tl-name { fill: var(--ink); font-size: 12.5px; text-anchor: end; }
.tline .tl-row { cursor: pointer; }
.tline .tl-row:hover .tl-name, .tline .tl-row:focus .tl-name, .tline .tl-row.me .tl-name { fill: var(--accent); font-weight: 600; }
.tline .tl-bar { fill: color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.tline .tl-bar.F { fill: color-mix(in srgb, var(--cat7, #c07fa4) 55%, var(--surface)); }
.tline .tl-bar.open { opacity: .45; }
.tline .tl-mk { stroke: var(--surface); stroke-width: 1.5; }
.tline .tl-mk.k, .dot.tl-k { fill: var(--accent); background: var(--accent); }
.tline .tl-mk.m, .dot.tl-m { fill: var(--warm); background: var(--warm); }
.tline .tl-mk.o, .dot.tl-o { fill: var(--muted); background: var(--muted); }
.tline .tl-bar.out { opacity: .35; stroke: var(--muted); stroke-dasharray: 4 3; }
.tline .tl-age { fill: var(--muted); font-size: 10.5px; text-anchor: middle; }
.tline .tl-lane { fill: var(--muted); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; }
.tline .tl-lab { fill: var(--ink); font-size: 11.5px; }
.tline .tl-life { fill: var(--accent); opacity: .6; }
.tline .tl-wbar { fill: color-mix(in srgb, var(--warm) 45%, transparent); }
.tline .tl-mk.b, .tline .tl-mk.d { fill: var(--ink); } .tline .tl-mk.g, .tline .tl-mk.s { fill: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.tl li.fam .what { color: var(--muted); } .tl li.fam .what a { color: var(--accent); }
.tl li.world .what { color: var(--muted); font-style: italic; } .tl li.world .what::before { border-color: var(--warm); }
.tl li.tl-unk .what::before { display: none; } .tl li.tl-unk .what b { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tline .tl-span { fill: color-mix(in srgb, var(--accent) 30%, transparent); stroke: color-mix(in srgb, var(--accent) 60%, transparent); }
.tline .tl-span.m { fill: color-mix(in srgb, var(--warm) 30%, transparent); stroke: color-mix(in srgb, var(--warm) 60%, transparent); }
.tline .tl-seg { fill: var(--muted); opacity: .7; }
.c-span { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); }
.tline .tl-seg.m { fill: var(--warm); opacity: .55; }
svg.links .mlink.div .mline { stroke: var(--muted); }

/* home */
.brand h1 a { color: inherit; text-decoration: none; }
.home { display: flex; flex-direction: column; gap: 18px; max-width: 1100px; }
.h-hero { display: flex; gap: 16px; align-items: center; }
.h-hero h2 { font-family: var(--f-display); font-weight: 400; font-size: 28px; margin: 0 0 4px; }
.h-hero a, .h-card a { color: var(--accent); cursor: pointer; text-decoration: none; }
.h-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.h-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.h-card { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 12px 14px 14px; }
.h-card h3 { margin: 0; }
.h-card.h-otd { padding: 0; border: 0; background: none; }
.h-card.h-otd .otd { margin: 0; }
.h-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.h-spot { display: flex; gap: 12px; margin-top: 8px; } .h-spot p { margin: 6px 0 8px; font-size: 14px; line-height: 1.5; }
.h-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.h-ava { flex: none; }
.lb-manage { display: flex; flex-wrap: wrap; gap: 8px; }
.lb-confirm { border: 1px solid color-mix(in srgb, #c0392b 45%, var(--rule)); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.lb-confirm p { margin: 0 0 8px; line-height: 1.5; }
.lb-img.tagging, .lb-img.cropping { cursor: crosshair; }
.lb-capt { display: flex; gap: 8px; } .lb-capt input { flex: 1; font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); }
.bk-row.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 3mm; position: relative; padding-bottom: 3mm; }
.bk-row.pair::after { content: ""; position: absolute; left: 25%; right: 25%; bottom: 0; border-bottom: 1px solid #cfc7b7; }
.bk-row.pair::before { content: ""; position: absolute; left: 25%; bottom: 0; height: 3mm; border-left: 1px solid #cfc7b7; }
.bk-row.pair > .bk-box:last-child { position: relative; }
.bk-row.pair > .bk-box:last-child::after { content: ""; position: absolute; left: 50%; bottom: -3mm; height: 3mm; border-left: 1px solid #cfc7b7; }
.bk-cover-pick { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; } .bk-cover-pick legend { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.bk-ph { display: flex; align-items: center; gap: 4px; cursor: pointer; } .bk-ph img { width: 54px; height: 54px; object-fit: cover; border-radius: 6px; border: 2px solid transparent; } .bk-ph input:checked + img { border-color: var(--accent); }
.sheet textarea { font: inherit; font-size: 14px; color: var(--ink); background: var(--bg); border: 1px solid var(--rule); border-radius: 7px; padding: 8px 10px; }

/* pedigree on the story page */
.s-ped .pg-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.s-ped .pg-box { border: 1px solid var(--rule); border-radius: 8px; padding: 6px 9px; background: var(--surface); display: flex; flex-direction: column; position: relative; font-size: 13px; }
.s-ped .pg-box a { color: var(--accent); text-decoration: none; cursor: pointer; } .s-ped .pg-box small { color: var(--muted); font-family: var(--f-mono); font-size: 11px; }
.s-ped .pg-box.me { border-color: var(--accent); border-width: 1.5px; } .s-ped .pg-box.out { border-style: dashed; opacity: .75; }
.s-ped .pg-more { font-size: 11.5px; margin-top: 2px; }
/* ancestors: a sideways tree, only known branches */
.s-ped .pg-up { margin-top: 8px; width: max-content; }
.s-ped .an { display: flex; align-items: center; position: relative; }
.s-ped .an > .pg-box { width: 168px; flex: none; }
.s-ped .an-par { display: flex; flex-direction: column; gap: 6px; padding-left: 24px; position: relative; }
.s-ped .an > .pg-box:not(:last-child)::after { content: ""; position: absolute; right: -13px; top: 50%; width: 12px; border-top: 1px solid var(--line); }
.s-ped .an-par > .an::before { content: ""; position: absolute; left: -12px; top: 50%; width: 12px; border-top: 1px solid var(--line); }
.s-ped .an-par > .an:first-child:not(:last-child)::after { content: ""; position: absolute; left: -12px; top: 50%; bottom: -3px; border-left: 1px solid var(--line); }
.s-ped .an-par > .an:last-child:not(:first-child)::after { content: ""; position: absolute; left: -12px; top: -3px; bottom: 50%; border-left: 1px solid var(--line); }
/* descendants: an indented tree, grouped by family */
.s-ped .pg-down { margin-top: 16px; width: max-content; min-width: 100%; }
.s-ped .pg-down h4, .s-ped .pg-wrap > h4 { margin: 0 0 8px; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.s-ped .dn-row { display: flex; align-items: center; gap: 6px; }
.s-ped .dn-row .pg-box { min-width: 150px; }
.s-ped .dn-amp { color: var(--muted); font-size: 12px; }
.s-ped .dn-grp.top + .dn-grp.top { margin-top: 12px; }
.s-ped .dn { list-style: none; margin: 6px 0 0 14px; padding: 0 0 0 18px; display: flex; flex-direction: column; gap: 6px; }
.s-ped .dn > li { position: relative; }
.s-ped .dn > li::before { content: ""; position: absolute; left: -18px; top: 18px; width: 16px; border-top: 1px solid var(--line); }
.s-ped .dn > li::after { content: ""; position: absolute; left: -18px; top: -6px; bottom: 0; border-left: 1px solid var(--line); }
.s-ped .dn > li:last-child::after { bottom: auto; height: 24px; }
.s-ped .dn-grp:not(.top) { margin-top: 6px; } .s-ped .dn-grp:not(.top) > .dn-with { margin-left: 2px; }

/* "keep who you are?" offer, shown once when this browser knew you but your account didn't */
.me-offer { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  max-width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: 0 8px 30px rgba(0,0,0,.18); }
.me-offer[hidden] { display: none; }
.me-offer span { flex: 1 1 260px; }

/* phones: a bottom tab bar (Home, Tree, Timeline, Photos, More) instead of the scrolling top tabs */
.btabs, .more-bg { display: none; }
@media (max-width: 699px) {
  :root { --btab: calc(56px + env(safe-area-inset-bottom, 0px)); }
  .tabs { display: none; }
  header { flex-wrap: nowrap; gap: 8px; padding-block: 6px; padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right)); }
  header .brand small, header .rolechip { display: none; }
  header .brand h1 { font-size: 20px; }
  header .search { flex: 1; min-width: 0; } header .search input { width: 100%; min-width: 0; }
  .gome-top { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: none; }
  .btabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: var(--btab); padding-bottom: env(safe-area-inset-bottom, 0px); padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
    background: var(--surface); border-top: 1px solid var(--rule); }
  .btabs button { flex: 1; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font: inherit; font-size: 11px; color: var(--muted); background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .btabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .btabs button[aria-current="page"] { color: var(--accent); font-weight: 600; }
  .btabs button[aria-current="page"] svg { stroke-width: 2.2; }
  .btabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; border-radius: 10px; }
  /* everything that sat on the bottom edge now sits on the bar */
  aside#panel { bottom: var(--btab); height: min(86dvh, calc(100dvh - 64px - var(--btab))); transform: translateY(calc(100% - var(--peek))); }
  .view:not(.stage) { padding-bottom: calc(var(--peek) + var(--btab) + 24px) !important; }
  .controls { bottom: calc(var(--peek) + var(--btab) + 12px); }
  .toast { bottom: calc(var(--btab) + var(--peek) + 12px); }
  .me-offer { bottom: calc(var(--btab) + var(--peek) + 12px); }
  .sheet-bg { padding-bottom: 0; }
  .more-bg:not([hidden]) { display: block; position: fixed; inset: 0 0 var(--btab) 0; z-index: 39; background: rgba(0,0,0,.35); }
  .more-sheet { position: absolute; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--rule); border-radius: 16px 16px 0 0; padding: 14px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)); box-shadow: 0 -8px 30px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 10px; }
  .more-who { color: var(--muted); font-size: 13px; padding: 0 4px; }
  .more-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .more-list button { min-height: 48px; font: inherit; font-size: 15px; text-align: left; padding: 0 14px; color: var(--ink); background: var(--bg); border: 1px solid var(--rule); border-radius: 10px; cursor: pointer; }
  .more-list button[hidden] { display: none; }
  .more-list button[aria-current="page"] { border-color: var(--accent); color: var(--accent); font-weight: 600; }
  #more-signout { align-self: flex-start; }
}
@media (max-width: 699px) { .btabs [data-more] svg { stroke-width: 3.4; } }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); text-decoration: underline dotted; text-underline-offset: 3px; }
.btn.ghost:hover { color: var(--ink); }

/* accounts */
.accts td { vertical-align: middle; } .accts td:first-child { display: flex; flex-direction: column; gap: 2px; } .accts tr.off td { opacity: .6; }
.accts .u-who { min-width: 170px; } .accts .u-who .picker { display: inline-block; min-width: 160px; } .accts .u-acts { white-space: nowrap; } .accts .u-acts .btn + .btn { margin-left: 6px; }
.u-badge { font-size: 11.5px; color: var(--warm, #b98a3a); }
.u-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; white-space: normal; max-width: 420px; } .u-confirm span { flex: 1 1 220px; font-size: 13px; }
#inv-box { margin: 10px 0 14px; } .inv-done { border: 1px solid var(--accent); border-radius: 10px; padding: 12px 14px; margin: 10px 0 14px; }
.inv-msg { white-space: pre-wrap; font-family: var(--f-mono); font-size: 12.5px; background: var(--bg); border: 1px solid var(--rule); border-radius: 8px; padding: 10px 12px; margin: 8px 0 10px; user-select: all; }
@media (max-width: 699px) { .accts thead { display: none; } .accts, .accts tbody, .accts tr, .accts td { display: block; width: 100%; } .accts tr { border-bottom: 1px solid var(--rule); padding: 10px 0; } .accts td { border: 0 !important; padding: 3px 0 !important; } .accts .u-acts { white-space: normal; } }
@media (max-width: 699px) { .accts .u-seen::before { content: "Last seen in Kindred: "; } }

/* children who aren't by birth: Gramps' Adopted / Stepchild / Foster / Sponsored */
svg.links path.nonbirth { stroke-dasharray: 5 4; }
.rtag { display: inline-block; font-family: var(--f-body, inherit); font-size: 10px; line-height: 1.3; letter-spacing: .02em; color: var(--muted); border: 1px dashed var(--line); border-radius: 4px; padding: 0 4px; vertical-align: 1px; }
.c-rels { display: flex; flex-wrap: wrap; gap: 4px 10px; width: 100%; margin: 2px 0 4px; } .c-rel { font-size: 11.5px; color: var(--muted); } .c-rel select { font: inherit; font-size: 12px; color: var(--ink); background: var(--bg); border: 1px solid var(--rule); border-radius: 6px; padding: 1px 4px; margin-left: 3px; }
.fam li { flex-wrap: wrap; }

/* places */
.pl-list { list-style: none; margin: 0; padding: 0; }
.pl-row { border-bottom: 1px solid var(--rule); padding: 9px 0; }
.pl-main { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 6px 12px; }
.pl-name { min-width: 0; } .pl-name .y { margin-left: 6px; font-size: 12px; }
.pl-type { font: inherit; font-size: 12.5px; color: var(--ink); background: var(--bg); border: 1px solid var(--rule); border-radius: 6px; padding: 2px 4px; }
.pl-miss { font-size: 12px; color: var(--warm, #b98a3a); }
.pl-uses { font: inherit; font-size: 12.5px; color: var(--accent); background: none; border: 0; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; white-space: nowrap; } .pl-uses:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.pl-tools { margin-top: 4px; } .pl-acts .ev-edit { margin: 0 12px 0 0; padding-left: 0; }
.pl-inline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } .pl-inline input { font: inherit; padding: 5px 8px; border: 1px solid var(--rule); border-radius: 7px; background: var(--surface); color: var(--ink); min-width: 220px; } .pl-inline .picker { position: relative; }
.pl-evs { margin: 6px 0 2px 14px; padding: 0; list-style: none; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.pl-split { border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.pl-lv { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .pl-lv input, .pl-lv select { font: inherit; font-size: 13px; padding: 4px 7px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); color: var(--ink); }
.pl-dups .pl-dup { border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; } .pl-dup ul { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.pl-confirm { max-width: none; } .pl-confirm .pl-evs { flex-basis: 100%; }
.pl-filter input { font: inherit; width: min(360px, 100%); padding: 7px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink); margin-bottom: 8px; }
.m-places { display: inline-block; margin-top: 2px; padding-left: 0; }
@media (max-width: 699px) { .pl-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; } .pl-name { flex-basis: 100%; } .pl-type { width: auto; max-width: 10em; font-size: 14px !important; } .pl-inline input { min-width: 0; flex: 1; } .pl-acts .ev-edit { min-height: 32px; } }

/* migration map */
.m-mode { align-self: flex-start; }
.mg-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 10px; } .mg-who { position: relative; } .mg-who input { font: inherit; padding: 7px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink); min-width: 220px; }
.mg-cap { min-height: 66px; margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 8px 8px 0; }
.mg-cap p { margin: 0 0 3px; font-size: 14px; } .mg-cap p b { font-family: var(--f-mono); font-weight: 600; margin-right: 6px; } .mg-cap p.older { color: var(--muted); font-size: 13px; }
path.mg-line.mg-new { stroke-dasharray: 100; stroke-dashoffset: 100; animation: mgdraw 1.1s ease-out forwards; }
@keyframes mgdraw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { path.mg-line.mg-new { animation: none; stroke-dashoffset: 0; } }
@media (max-width: 699px) { .mg-who { flex: 1 1 100%; order: 3; } .mg-who input { min-width: 0; width: 100%; box-sizing: border-box; } #mg-map { height: 46dvh; min-height: 280px; } .mg-cap { min-height: 0; } }
/* one life on the map */
.mg-life { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 12px; align-items: start; }
.mg-stops { list-style: none; margin: 0; padding: 0; max-height: 460px; overflow-y: auto; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); }
.mg-stops li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-bottom: 1px solid var(--rule); cursor: pointer; font-size: 13.5px; }
.mg-stops li span:last-child { display: flex; flex-direction: column; gap: 1px; } .mg-stops li .y { font-size: 12px; }
.mg-stops li.future { opacity: .45; } .mg-stops li.now, .mg-stops li.sel { background: var(--bg); } .mg-stops li.now b { color: var(--accent); }
.mg-n { flex: none; width: 22px; height: 22px; border-radius: 50%; color: #fff; font: 600 11px/22px var(--f-mono); text-align: center; }
.mg-pin span { display: inline-block; min-width: 22px; height: 22px; padding: 0 5px; box-sizing: border-box; border-radius: 11px; border: 2px solid #fff; color: #fff; font: 600 11px/18px var(--f-mono); text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.35); white-space: nowrap; transform: translate(-50%, -50%); }
.mg-arrow span { display: block; font-size: 14px; line-height: 16px; text-shadow: 0 0 2px #fff; }
.tl-onmap { margin-left: 6px; cursor: pointer; }
@media (max-width: 900px) { .mg-life { grid-template-columns: 1fr; } .mg-stops { max-height: 260px; } }
/* Moved… */
.mv-who { border: 0; padding: 0; margin: 4px 0; } .mv-who legend { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
#mv-who { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 12px; } #mv-who .y { font-size: 12px; }
.mv-preview { border: 1px solid var(--rule); border-radius: 10px; padding: 8px 12px; margin-top: 6px; font-size: 13.5px; background: var(--bg); } .mv-preview ul { margin: 4px 0 0; padding-left: 18px; }
/* the accounts table scrolls sideways, which would clip a floating results list: show it in the row */
.accts .u-who .results { position: static; box-shadow: none; margin-top: 4px; max-height: 220px; overflow-y: auto; }
/* history by person */
.h-whof select { font: inherit; font-size: 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: 7px; padding: 4px 6px; margin-left: 4px; }
.h-day { margin: 18px 0 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.h-lines { margin: 0; padding-left: 16px; } .h-lines li { margin: 1px 0; }
.h-bulk { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; margin: 6px 0 4px; } .h-bulk input { font: inherit; padding: 4px 6px; border: 1px solid var(--rule); border-radius: 7px; background: var(--surface); color: var(--ink); }
.h-done { border: 1px solid var(--accent); border-radius: 10px; padding: 10px 12px; margin: 6px 0; } .h-done ul { margin: 6px 0 0; padding-left: 18px; }
.u-plan { max-height: 50vh; overflow-y: auto; font-size: 13.5px; } .u-plan ul { margin: 4px 0 10px; padding-left: 18px; }
.u-hist { padding-left: 0; text-align: left; font-size: 12px; }
.hist .h-lines li { display: list-item; grid-template-columns: none; padding: 0; border: 0; background: none; }
/* before you've said who you are, person views ask instead of opening on the tree's home person */
main { position: relative; }
.nofocus { position: absolute; inset: 0; z-index: 25; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.nofocus[hidden] { display: none; }
.nofocus > div { max-width: 420px; text-align: center; } .nofocus h2 { font-family: var(--f-display); font-weight: 400; margin: 0 0 8px; } .nofocus .f-actions { justify-content: center; margin: 14px 0 8px; }
.pub-url { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 6px 0 4px; } .pub-url label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); } .pub-url input { font: inherit; min-width: 280px; padding: 6px 9px; border: 1px solid var(--rule); border-radius: 7px; background: var(--surface); color: var(--ink); }
/* sign-ins */
.si-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; } .si-filters select { font: inherit; font-size: 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: 7px; padding: 4px 6px; }
.si-last { list-style: none; margin: 4px 0 8px; padding: 0; font-size: 13.5px; } .si-last li { padding: 2px 0; }
.si-tbl tr.si-fail td { color: #d0705a; } .si-warn { color: #d0705a; } .si-new { border-color: var(--accent); color: var(--accent); }
/* obituaries */
.ob-card { border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px; background: var(--surface); margin-top: 8px; }
.ob-head { margin-bottom: 6px; } .ob-head .y { margin-left: 4px; }
.ob-text p { margin: 0 0 8px; line-height: 1.55; } .ob-text.clip { max-height: 12em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.ob-media { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; } .ob-th { padding: 0; border: 1px solid var(--rule); border-radius: 6px; background: none; cursor: zoom-in; } .ob-th img { display: block; height: 96px; width: auto; border-radius: 5px; }
.ob-pdf { display: inline-block; padding: 6px 10px; border: 1px dashed var(--line); border-radius: 6px; font-size: 13px; }
#obsheet textarea { font: inherit; width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink); line-height: 1.5; }
.ob-title { font-weight: 600; }
/* whole tree */
.view.wt { position: relative; padding: 0 !important; overflow: hidden; height: 100%; min-height: 60vh; }
.view.wt[hidden] { display: none; }
#wt-c { position: absolute; inset: 0; display: block; touch-action: none; cursor: grab; } #wt-c:active { cursor: grabbing; }
.wt-bar #wt-family { pointer-events: auto; }
.wt-bar { position: absolute; left: 12px; top: 10px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 12.5px; color: var(--muted); background: color-mix(in srgb, var(--surface) 85%, transparent); padding: 6px 10px; border-radius: 8px; pointer-events: none; }
.wt-key i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 0 4px 0 8px; vertical-align: -1px; }
.wt-ctl { position: absolute; right: 12px; bottom: 12px; }
.controls .ctl-wide { width: auto !important; padding: 0 10px; font-size: 13px; }
@media (max-width: 699px) { .view.wt { height: calc(100dvh - 53px - var(--btab)); } .wt-ctl { bottom: calc(var(--peek) + 12px); } .wt-key { display: none; } }
