:root {
  /* Layout: a character panel beside a tabbed working area on wide screens; one column
     with the year button pinned to the bottom on a phone.
     Look: a family album crossed with a geneticist's pedigree chart. Portraits sit in
     circles (XX) and squares (XY), as on a real pedigree. The two accent colours are the
     stains of a microscope slide and mark the two copies of every gene:
     violet for the copy from the egg, rose for the copy from the sperm. */
  --ground: #f3f1f7;
  --surface: #fdfcff;
  --ink: #201936;
  --ink-soft: #5d5674;
  --line: #d9d3e6;
  --egg: #4534a6;
  --egg-wash: #e4dffa;
  --sperm: #b82d68;
  --sperm-wash: #fadfea;
  --good: #1f7a55;
  --bad: #b3372f;
  --gold: #8f6410;
  --gold-wash: #f6ecd2;
  --c-hs: #c2475e; --c-hp: #c58a1a; --c-sm: #4a54c7; --c-ft: #2f8f6b; --c-ch: #a33fb0;
  --display: "Old Standard TT", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --body: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #14111d; --surface: #1e192b; --ink: #ece8f7; --ink-soft: #a9a1c2; --line: #3a3352;
    --egg: #b0a3ff; --egg-wash: #2b2552; --sperm: #ff8fb8; --sperm-wash: #4b2139;
    --good: #5fd3a0; --bad: #ff8a80; --gold: #e0b45a; --gold-wash: #3a2f14;
    --c-hs: #f07a90; --c-hp: #e8b04a; --c-sm: #8a94ff; --c-ft: #5fc79e; --c-ch: #d27be0;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #14111d; --surface: #1e192b; --ink: #ece8f7; --ink-soft: #a9a1c2; --line: #3a3352;
  --egg: #b0a3ff; --egg-wash: #2b2552; --sperm: #ff8fb8; --sperm-wash: #4b2139;
  --good: #5fd3a0; --bad: #ff8a80; --gold: #e0b45a; --gold-wash: #3a2f14;
  --c-hs: #f07a90; --c-hp: #e8b04a; --c-sm: #8a94ff; --c-ft: #5fc79e; --c-ch: #d27be0;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 15.5px/1.5 var(--body); }
h1, h2, h3, h4, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--egg); outline-offset: 2px; }
[hidden] { display: none !important; }
.soft { color: var(--ink-soft); }
.num { font-variant-numeric: normal; }
#app { min-height: 100%; display: flex; flex-direction: column; }
.view { flex: 1; display: flex; flex-direction: column; }

/* ---------- controls ---------- */
.btn { border: 1.5px solid var(--ink); background: transparent; border-radius: 6px; padding: 9px 16px; font-weight: 500; line-height: 1.25; text-align: center; }
a.btn { display: inline-block; text-decoration: none; color: var(--ink); }
.btn:hover { background: var(--egg-wash); }
.btn.primary { background: var(--ink); color: var(--ground); }
.btn.primary:hover { background: var(--egg); border-color: var(--egg); }
.btn.quiet { border-color: var(--line); }
.btn.small { padding: 5px 11px; font-size: 0.88rem; }
.btn:disabled { opacity: 0.45; cursor: default; background: transparent; }
.link { border: 0; background: none; padding: 0; color: var(--egg); text-decoration: underline; text-underline-offset: 3px; }
.field { display: grid; gap: 4px; }
.field label, .field .legend { font-weight: 500; }
.field input[type="text"], .field textarea, .field select { width: 100%; border: 1.5px solid var(--ink); border-radius: 6px; background: var(--surface); padding: 8px 10px; }
.field input[type="range"] { width: 100%; accent-color: var(--egg); margin: 0; }
.field .row { display: flex; justify-content: space-between; gap: 8px; }
.seg { position: relative; display: flex; border: 1.5px solid var(--ink); border-radius: 6px; overflow: hidden; }
.seg label { flex: 1; text-align: center; padding: 6px 8px; cursor: pointer; font-weight: 400; border-left: 1.5px solid var(--ink); }
.seg label:first-of-type { border-left: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + label { background: var(--ink); color: var(--ground); }
.seg input:focus-visible + label { outline: 2px solid var(--egg); outline-offset: -4px; }
.seg input:disabled + label { opacity: 0.45; cursor: default; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); padding: 0; }
.swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ground), 0 0 0 4px var(--ink); }
.swatch.none { background: linear-gradient(135deg, transparent 46%, var(--bad) 46% 54%, transparent 54%); }

/* ---------- portrait tiles: circle for XX, square for XY, a slash for the dead ---------- */
.tile { --sz: 48px; position: relative; display: inline-block; flex: none; width: var(--sz); height: var(--sz); border: 2px solid var(--ink); background: var(--surface); overflow: hidden; vertical-align: middle; padding: 0; }
.tile.xx { border-radius: 50%; }
.tile.xy { border-radius: 9%; }
.tile svg { display: block; width: 100%; height: 100%; }
.tile.dead::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top right, transparent calc(50% - 1.2px), var(--ink) calc(50% - 1.2px), var(--ink) calc(50% + 1.2px), transparent calc(50% + 1.2px)); }
.tile.dead svg { filter: grayscale(0.7); opacity: 0.85; }
button.tile:hover { border-color: var(--egg); }
.tile.me { box-shadow: 0 0 0 3px var(--ground), 0 0 0 5px var(--egg); }
.meter { height: 7px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: var(--v, 0%); background: var(--c, var(--ink)); border-radius: 4px; transition: width 0.35s ease; }
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; font-size: 0.82rem; font-weight: 500; border: 1px solid var(--line); white-space: nowrap; }
.chip.up { border-color: var(--good); color: var(--good); }
.chip.down { border-color: var(--bad); color: var(--bad); }
.chip.gold { border-color: var(--gold); color: var(--gold); background: var(--gold-wash); }
.deltas { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- title ---------- */
.title { max-width: 1040px; width: 100%; margin: 0 auto; padding: calc(28px + env(safe-area-inset-top)) 20px 48px; display: grid; gap: 30px; }
.wordmark { font: 700 clamp(3rem, 2rem + 6vw, 5.6rem)/0.95 var(--display); letter-spacing: -0.02em; }
.wordmark i { font-style: normal; display: inline-block; width: 0.16em; height: 0.16em; margin-left: 0.06em; border: 0.035em solid var(--egg); border-radius: 50%; vertical-align: baseline; }
.wordmark i + i { border-color: var(--sperm); border-radius: 12%; margin-left: 0.04em; }
.title .lede { font: 400 clamp(1.25rem, 1rem + 1.2vw, 1.7rem)/1.25 var(--display); max-width: 24em; text-wrap: balance; }
.title .cta { display: flex; flex-wrap: wrap; gap: 10px; }
.title .cta .btn { padding: 12px 22px; font-size: 1.05rem; }
.strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.strip figure { margin: 0; display: grid; gap: 4px; }
.strip svg { display: block; width: 100%; height: auto; border-radius: 6px; }
.strip figcaption { font-size: 0.85rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.strip-note { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; margin-top: -18px; color: var(--ink-soft); }
@media (max-width: 640px) { .strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 32px; }
.points h2 { font: 400 1.3rem/1.2 var(--display); margin-bottom: 4px; }
.points p { color: var(--ink-soft); }
@media (max-width: 720px) { .points { grid-template-columns: minmax(0, 1fr); } }
.slots { display: grid; gap: 8px; max-width: 560px; }
.slot { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.slot .grow { flex: 1; min-width: 0; }
.slot b { font: 400 1.15rem/1.2 var(--display); display: block; }
.fine { border-top: 1px solid var(--line); padding-top: 16px; color: var(--ink-soft); font-size: 0.9rem; max-width: 76ch; }

/* ---------- game frame ---------- */
.game { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 1120px; margin: 0 auto; }
.side, .main { display: contents; }
#hud { order: 1; padding: calc(12px + env(safe-area-inset-top)) 16px 10px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 14px; align-items: center; }
#hud .tile { --sz: 76px; }
#hud .who { min-width: 0; display: grid; gap: 1px; }
#hud .name { font: 400 1.4rem/1.15 var(--display); overflow-wrap: anywhere; }
#hud .cash { font-weight: 600; }
#hud .stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.st { display: grid; gap: 3px; min-width: 0; }
.st span { font-size: 0.72rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st b { display: none; font-weight: 500; font-variant-numeric: tabular-nums; }
#tabs { order: 2; position: sticky; top: 0; z-index: 5; display: flex; background: var(--ground); border-bottom: 1px solid var(--line); padding: 0 8px; }
.tab { flex: 1; border: 0; background: none; padding: 11px 4px 9px; font-weight: 500; color: var(--ink-soft); border-bottom: 3px solid transparent; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
#panel { order: 3; flex: 1; padding: 18px 16px 28px; min-width: 0; }
#bar { order: 4; position: sticky; bottom: 0; z-index: 6; display: flex; align-items: center; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--ground); border-top: 1px solid var(--line); }
.age-btn { flex: 1; border: 0; border-radius: 8px; background: var(--egg); color: #fff; padding: 12px 16px; font-weight: 600; font-size: 1.08rem; display: flex; justify-content: center; align-items: baseline; gap: 8px; }
:root[data-theme="dark"] .age-btn { color: #14111d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .age-btn { color: #14111d; } }
.age-btn small { font-weight: 400; opacity: 0.85; font-size: 0.85rem; }
.age-btn:hover { filter: brightness(1.12); }
.pips { display: flex; gap: 5px; align-items: center; }
.pips i { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--ink); }
.pips i.on { background: var(--ink); }
.pips span { font-size: 0.8rem; color: var(--ink-soft); margin-right: 3px; }
@media (min-width: 900px) {
  .game { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 0 44px; align-items: start; padding: 28px 24px 40px; }
  .side { display: grid; gap: 18px; position: sticky; top: 20px; }
  .main { display: block; min-width: 0; }
  #hud { padding: 0; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  #hud .tile { --sz: 220px; justify-self: start; }
  #hud .name { font-size: 1.9rem; }
  #hud .stats { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .st { grid-template-columns: 5.6rem minmax(0, 1fr) 2rem; align-items: center; gap: 8px; }
  .st span { font-size: 0.88rem; }
  .st b { display: block; text-align: right; font-size: 0.88rem; }
  #tabs { padding: 0; top: 0; }
  #panel { padding: 22px 0 0; }
  #bar { position: static; padding: 0; border: 0; flex-wrap: wrap; }
  .age-btn { flex: 1 1 100%; padding: 14px; }
}

/* ---------- panels ---------- */
.sec { display: grid; gap: 10px; margin-bottom: 28px; max-width: 760px; }
.sec > h2 { font: 400 1.45rem/1.15 var(--display); }
.sec > h3 { font: 600 1rem/1.3 var(--body); }
.hint { background: var(--egg-wash); border-radius: 6px; padding: 9px 12px; max-width: 760px; margin-bottom: 18px; }
.yr { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr); gap: 0 12px; padding: 12px 0; border-top: 1px solid var(--line); max-width: 760px; }
.yr h3 { font: 400 1.2rem/1.3 var(--display); font-variant-numeric: tabular-nums; }
.yr li { padding: 2px 0; }
.yr li + li { margin-top: 5px; }
.yr li .q { display: block; color: var(--ink-soft); }
.yr li.mile { font-weight: 600; }
.yr li.gene { border-left: 3px solid var(--egg); padding-left: 10px; }
.yr li.album { border-left: 3px solid var(--gold); padding-left: 10px; color: var(--gold); }
.yr li.bad { border-left: 3px solid var(--bad); padding-left: 10px; }
.yr li.good { border-left: 3px solid var(--good); padding-left: 10px; }
.acts { display: grid; }
.act { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; text-align: left; border: 0; border-top: 1px solid var(--line); background: none; padding: 11px 4px; width: 100%; }
.act:hover:not(:disabled) { background: var(--egg-wash); }
.act b { font-weight: 500; }
.act small { grid-column: 1; color: var(--ink-soft); font-size: 0.88rem; }
.act .cost { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 6px; align-items: center; color: var(--ink-soft); font-size: 0.85rem; }
.act .pip { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); display: inline-block; }
.act:disabled { cursor: default; }
.act:disabled b { color: var(--ink-soft); }
.act:disabled .pip { background: var(--line); }
.prow { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; align-items: center; text-align: left; border: 0; border-top: 1px solid var(--line); background: none; padding: 9px 4px; width: 100%; }
.prow:hover { background: var(--egg-wash); }
.prow .tile { grid-row: 1 / span 3; }
.prow b { font: 400 1.12rem/1.2 var(--display); }
.prow small { color: var(--ink-soft); font-size: 0.88rem; }
.prow .meter { max-width: 180px; height: 5px; }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; max-width: 460px; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; text-align: right; font-weight: 500; }
.kv .total { border-top: 1px solid var(--ink); padding-top: 6px; font-weight: 600; color: var(--ink); }
.loom { padding: 8px 0; border-top: 1px solid var(--line); }
.loom b { font: 400 1.1rem/1.2 var(--display); }
.subtabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.subtabs .btn[aria-selected="true"] { background: var(--ink); color: var(--ground); }

/* family tree: nested lists joined by rules */
.tree-wrap { overflow-x: auto; padding: 6px 2px 14px; }
.tree, .tree ul { display: flex; justify-content: center; position: relative; padding-top: 18px; }
.tree { width: max-content; min-width: 100%; padding-top: 0; }
.tree li { position: relative; padding: 18px 7px 0; display: flex; flex-direction: column; align-items: center; }
.tree > li { padding-top: 0; }
.tree li::before, .tree li::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 18px; border-top: 2px solid var(--ink); }
.tree li::after { right: auto; left: 50%; border-left: 2px solid var(--ink); }
.tree li:only-child::before { display: none; }
.tree li:only-child::after { border-top: 0; }
.tree li:first-child::before, .tree li:last-child::after { border-top: 0; }
.tree > li::before, .tree > li::after { display: none; }
.tree ul::before { content: ""; position: absolute; top: 0; left: calc(50% - 1px); height: 18px; border-left: 2px solid var(--ink); }
.pair { display: flex; align-items: flex-start; gap: 0; }
.pair .join { width: 14px; height: 2px; background: var(--ink); margin-top: 27px; }
.node { display: grid; justify-items: center; gap: 2px; width: 74px; text-align: center; }
.node .tile { --sz: 54px; }
.node b { font-size: 0.8rem; font-weight: 500; line-height: 1.15; overflow-wrap: anywhere; }
.node small { font-size: 0.72rem; color: var(--ink-soft); }
.node .you { color: var(--egg); font-weight: 600; }
.elders { display: flex; gap: 8px 36px; justify-content: center; margin: 0 auto 22px; width: max-content; min-width: 100%; }

.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.ach { border: 1.5px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; gap: 2px; }
.ach b { font: 400 1.1rem/1.2 var(--display); }
.ach small { color: var(--ink-soft); }
.ach.got { border-color: var(--gold); background: var(--gold-wash); }
.ach.got small { color: var(--ink); }
.seen { display: flex; flex-wrap: wrap; gap: 6px; }
.seen .chip.has { background: var(--egg-wash); border-color: var(--egg); }
.seen .chip:not(.has) { color: var(--ink-soft); border-style: dashed; }
.photo { border-top: 1px solid var(--line); padding: 10px 0; display: grid; gap: 6px; }
.photo .row { display: flex; flex-wrap: wrap; gap: 8px; }
.photo .tile { --sz: 58px; }
.head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.head .tile { grid-row: 1 / span 3; --sz: 64px; }
.head b { font: 400 1.15rem/1.2 var(--display); }

/* genome ledger */
.key { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; color: var(--ink-soft); font-size: 0.88rem; }
.group { border-top: 1px solid var(--ink); }
.group summary { cursor: pointer; padding: 9px 0; font-weight: 600; }
.group .note { color: var(--ink-soft); font-size: 0.88rem; max-width: 62ch; margin-bottom: 6px; }
.locus { display: grid; grid-template-columns: 1.9rem minmax(0, 1fr) 5.7rem 5.7rem; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); }
.chr { justify-self: start; min-width: 1.7rem; text-align: center; font-size: 0.78rem; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 999px; padding: 1px 0; }
.chr:empty { border: 0; }
.gene { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; min-width: 0; }
.sym { font-weight: 500; }
.sym.real { font: italic 400 1.08rem/1.3 var(--display); }
.does { color: var(--ink-soft); font-size: 0.88rem; }
.allele { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 28px; padding: 2px 8px; border-radius: 999px; border: 1.5px solid; font-size: 0.86rem; font-weight: 500; line-height: 1.2; white-space: nowrap; }
.allele.egg { border-color: var(--egg); background: var(--egg-wash); }
.allele.sperm { border-color: var(--sperm); background: var(--sperm-wash); }
button.allele.egg:hover { background: var(--egg); color: var(--ground); }
button.allele.sperm:hover { background: var(--sperm); color: var(--ground); }
.allele.fixed { border-style: dashed; }
.allele.none { border-color: var(--line); color: var(--ink-soft); }
.pip2 { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.pip2.egg { background: var(--egg); }
.pip2.sperm { background: var(--sperm); }
@media (max-width: 480px) {
  .locus { grid-template-columns: 1.7rem minmax(0, 1fr) 4.9rem 4.9rem; gap: 6px; }
  .allele { font-size: 0.78rem; padding: 2px 4px; }
}
.apt { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 6px 12px; align-items: center; max-width: 420px; }
.apt .dots { display: flex; gap: 4px; }
.apt .dots i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--egg); }
.apt .dots i.on { background: var(--egg); }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(20, 14, 40, 0.55); padding: 0; }
.sheet { background: var(--surface); width: 100%; max-width: 520px; max-height: 92%; overflow-y: auto; border-radius: 14px 14px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 14px; border: 2px solid var(--ink); border-bottom: 0; animation: rise 0.18s ease-out; }
.sheet.wide { max-width: 760px; }
@media (min-width: 620px) {
  .modal { align-items: center; padding: 20px; }
  .sheet { border-radius: 12px; border-bottom: 2px solid var(--ink); padding: 24px; }
}
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } .meter i { transition: none; } }
.sheet h2 { font: 400 1.6rem/1.15 var(--display); text-wrap: balance; }
.sheet .top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; }
.sheet .top .tile { --sz: 88px; }
.sheet .big { justify-self: center; width: min(100%, 300px); }
.sheet .big svg { display: block; width: 100%; height: auto; border-radius: 8px; }
.sheet .body { font-size: 1.05rem; }
.sheet .acts-row { display: flex; flex-wrap: wrap; gap: 8px; }
.opts { display: grid; gap: 8px; }
.opt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; text-align: left; border: 1.5px solid var(--ink); border-radius: 8px; background: none; padding: 10px 14px; }
.opt:hover:not(:disabled) { background: var(--egg-wash); }
.opt .tile { grid-row: 1 / span 2; --sz: 56px; }
.opt b { grid-column: 2; font-weight: 500; }
.opt small { grid-column: 2; color: var(--ink-soft); }
.opt .cost { grid-column: 3; grid-row: 1 / span 2; color: var(--ink-soft); }
.opt:disabled { border-color: var(--line); cursor: default; }
.opt:disabled b { color: var(--ink-soft); }
.pairup { display: flex; gap: 18px; }
.pairup figure { margin: 0; display: grid; gap: 3px; justify-items: center; }
.pairup figcaption { font-size: 0.8rem; color: var(--ink-soft); }
.notes { display: grid; gap: 12px; }
.notes .n { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; align-items: center; }
.notes .n .tile { grid-row: 1 / span 2; --sz: 52px; }
.notes .n b { font: 400 1.15rem/1.2 var(--display); }
.notes .n.album b { color: var(--gold); }
.notes .n p { grid-column: 2; }
.notes .n.solo p, .notes .n.solo b { grid-column: 1 / -1; }
.faces { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.faces figure { margin: 0; display: grid; gap: 3px; }
.faces svg { display: block; width: 100%; height: auto; border-radius: 6px; }
.faces figcaption { font-size: 0.8rem; color: var(--ink-soft); }
@media (max-width: 420px) { .faces { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 30; width: min(92%, 520px); background: var(--ink); color: var(--ground); border-radius: 10px; padding: 12px 14px; display: grid; gap: 8px; box-shadow: 0 8px 28px rgba(20, 14, 40, 0.35); }
#toast .chip { border-color: currentColor; color: inherit; }
@media (min-width: 900px) { #toast { bottom: 28px; } }

/* ---------- the end of a life ---------- */
.end { max-width: 720px; width: 100%; margin: 0 auto; padding: calc(28px + env(safe-area-inset-top)) 20px 48px; display: grid; gap: 22px; }
.end .obit { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; }
.end .obit .tile { --sz: 120px; }
.end h1 { font: 700 clamp(2rem, 1.4rem + 3vw, 3rem)/1.02 var(--display); }
.end .ribbon { font: 400 1.5rem/1.2 var(--display); color: var(--gold); }
.end h2 { font: 400 1.45rem/1.15 var(--display); }

/* ---------- lab ---------- */
.lab { max-width: 1120px; width: 100%; margin: 0 auto; padding: calc(24px + env(safe-area-inset-top)) 20px 48px; display: grid; gap: 26px; }
.lab h1 { font: 700 clamp(2rem, 1.3rem + 3vw, 3.2rem)/1.02 var(--display); }
.lab .cols { display: grid; grid-template-columns: minmax(250px, 340px) minmax(0, 1fr); gap: 30px 44px; align-items: start; }
.lab .stage { position: sticky; top: 16px; display: grid; gap: 12px; }
.lab .stage svg { display: block; width: 100%; height: auto; border-radius: 6px; }
.lab .work { display: grid; gap: 30px; min-width: 0; }
.lab h2 { font: 400 1.45rem/1.15 var(--display); margin-bottom: 4px; }
@media (max-width: 820px) { .lab .cols { grid-template-columns: minmax(0, 1fr); } .lab .stage { position: static; max-width: 360px; } }
.pedigree { --t: clamp(56px, 16vw, 80px); --lab: 28px; --gapy: 16px; display: grid; justify-items: center; max-width: 500px; padding-top: 6px; }
.pedigree .tile { --sz: var(--t); }
.pedigree .tile[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ground), 0 0 0 6px var(--ink); }
.gen1 { display: flex; align-items: flex-start; justify-content: center; }
.pslot { display: flex; flex-direction: column; align-items: center; position: relative; }
.ptag { height: var(--lab); display: flex; align-items: flex-end; font-weight: 500; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.mate { width: clamp(36px, 10vw, 90px); height: 2px; background: var(--ink); margin-top: calc(var(--t) / 2 - 1px); position: relative; }
.mate::after { content: ""; position: absolute; left: calc(50% - 1px); top: 0; width: 2px; background: var(--ink); height: calc(var(--t) / 2 + var(--lab) + var(--gapy) + 1px); }
.gen2 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; position: relative; margin-top: var(--gapy); padding-top: 18px; }
.gen2::before { content: ""; position: absolute; top: 0; left: 12.5%; right: 12.5%; height: 2px; background: var(--ink); }
.gen2 .pslot::before { content: ""; position: absolute; top: -18px; left: calc(50% - 1px); width: 2px; height: 18px; background: var(--ink); }
.living { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 26px; max-width: 620px; }
@media (max-width: 520px) { .living { grid-template-columns: minmax(0, 1fr); } }
.rowb { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
/* ---------- more: ambitions, traditions, the wider world ---------- */
.tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em; background: var(--gold-wash); color: var(--gold); border: 1px solid var(--gold); vertical-align: middle; white-space: nowrap; }
.btn.primary .tag { background: transparent; color: inherit; border-color: currentColor; }
.who .times { font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.yr li.news { color: var(--ink-soft); font-style: italic; }
.yr li.good { border-left: 3px solid var(--good); padding-left: 10px; }
.goals { display: grid; gap: 8px; max-width: 760px; margin-bottom: 18px; padding: 12px 14px; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--surface); }
.goals h3 { font: 600 0.78rem/1.2 var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.goal { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 10px; align-items: center; }
.goal + .goal { border-top: 1px solid var(--line); padding-top: 8px; }
.goal b { font: 400 1.12rem/1.2 var(--display); }
.goal small { grid-column: 1; color: var(--ink-soft); font-size: 0.88rem; }
.goal .chip { grid-column: 2; grid-row: 1 / span 2; }
.goal.wish b { color: var(--gold); }
.trads { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.trad { display: grid; gap: 4px; align-content: start; padding: 12px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); }
.trad b { font: 400 1.12rem/1.2 var(--display); }
.trad small { color: var(--ink-soft); font-size: 0.88rem; }
.trad .btn, .trad .chip { justify-self: start; margin-top: 4px; }
.trad.has { border-color: var(--gold); background: var(--gold-wash); }
.world-strip { display: grid; gap: 10px; max-width: 560px; }
.world-strip:empty { display: none; }
.daily-btn { display: grid; gap: 2px; text-align: left; padding: 12px 16px; border: 1.5px solid var(--egg); border-radius: 8px; background: var(--egg-wash); }
.daily-btn:hover { filter: brightness(0.97); }
.daily-btn b { font: 400 1.25rem/1.2 var(--display); color: var(--egg); }
.daily-btn small { color: var(--ink-soft); }
.fams { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.fam { display: grid; gap: 4px; align-content: start; text-align: left; padding: 12px; border: 1.5px solid var(--ink); border-radius: 8px; background: none; }
.fam:hover { background: var(--egg-wash); }
.fam .trio { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.fam .arrow { color: var(--ink-soft); }
.fam b { font: 400 1.2rem/1.2 var(--display); }
.fam small { color: var(--ink-soft); font-size: 0.88rem; }
.prow.far { grid-template-columns: auto auto minmax(0, 1fr); }
.prow.far > b, .prow.far > small { grid-column: 3; }
.prow.far .tile { grid-column: 2; grid-row: 1 / span 3; }
.prow.far .rank { grid-column: 1; grid-row: 1 / span 3; min-width: 1.6em; text-align: right; font: 400 1.1rem/1 var(--display); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.prow.far.mine { background: var(--egg-wash); }
div.prow.far:hover { background: none; }
.card-preview { justify-self: center; width: min(100%, 300px); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.card-preview svg { display: block; width: 100%; height: auto; }
.end .acts-row { display: flex; flex-wrap: wrap; gap: 8px; }
#world-body h3 { font: 600 1rem/1.3 var(--body); margin-top: 6px; }
@media (max-width: 480px) { .tab { font-size: 0.86rem; padding-left: 2px; padding-right: 2px; } }
