@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:ital,wght@0,400;0,500;1,400&display=swap");
:root {
  --bg: #fbfbf8; --ink: #1a1a1a; --muted: #6a6a66; --rule: #8f8f8a; --faint: #d9d9d3;
  --grid: #ececE6; --head: #efefea; --link: #1f4f8f; --mark: #fff6d6;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-id: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16.5px; line-height: 1.65; }
.wrap { max-width: 760px; margin: 0 auto; padding: 24px 16px 56px; }
a { color: var(--link); }
p { margin: 0 0 12px; }
h1 { font-family: var(--font-id); font-size: 28px; font-weight: 500; margin: 0; letter-spacing: -0.01em; }
h2 { font-family: var(--font-id); font-size: 16px; font-weight: 500; margin: 32px 0 10px; }
h2::before { content: "§ "; color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 16px 0; }
.id { font-family: var(--font-id); font-size: 0.8em; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sub { color: var(--muted); margin-top: 4px; }

/* top bar: logo and wordmark left, links right */
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--rule); margin-bottom: 32px; }
.bar .home { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-id); font-size: 16px; }
.bar .home svg { width: 30px; height: 25px; flex: none; }
.bar nav { font-family: var(--font-id); font-size: 13.5px; }
.bar nav a { margin-left: 14px; color: var(--muted); text-decoration: none; }
.bar nav a:hover { color: var(--ink); text-decoration: underline; }
.bar nav a[aria-current="page"] { color: var(--ink); }

/* grid paper: the banner and the lineage figure sit on it */
.paper { border: 1px solid var(--rule); padding: 12px 14px 10px; background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 16px 16px; }
.fig-cap { font-family: var(--font-id); font-size: 12.5px; color: var(--muted); margin: 0 0 6px; }
.fig svg { display: block; width: 100%; height: auto; }
.fig { color: var(--ink); }
.fig a { cursor: pointer; color: var(--ink); }
.fig a:hover text, .fig a:focus text { text-decoration: underline; }

.next { display: inline-block; margin-top: 18px; font-family: var(--font-id); font-size: 14.5px; }

/* individual */
dl.anat { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 4px 14px; margin: 8px 0 0; }
dl.anat dt { color: var(--muted); }
dl.anat dd { margin: 0; }
.age { margin: 8px 0 10px; display: grid; gap: 2px; max-width: 520px; }
.age input { width: 100%; accent-color: var(--link); }
.ticks { display: flex; justify-content: space-between; font-family: var(--font-id); font-size: 11px; color: var(--muted); }
.log { border: 1px solid var(--rule); min-height: 150px; max-height: 340px; overflow-y: auto; padding: 10px 12px; display: grid; gap: 4px; align-content: start; }
.line { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 10px; }
.line .who { font-family: var(--font-id); font-size: 12px; color: var(--muted); padding-top: 3px; }
.line .text { overflow-wrap: anywhere; }
.empty { color: var(--muted); font-style: italic; padding-block: 36px; text-align: center; margin: 0; }
form { display: flex; gap: 8px; margin-top: 10px; }
form input { flex: 1; min-width: 0; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--rule); padding: 3px 6px; }
form button { font: inherit; color: var(--ink); background: var(--head); border: 1px solid var(--rule); padding: 3px 14px; cursor: pointer; }
form :disabled { opacity: 0.5; cursor: not-allowed; }
footer { font-size: 14px; color: var(--muted); margin-top: 40px; border-top: 1px solid var(--rule); padding-top: 12px; }

/* chat: message bubbles */
.chat { border: 1px solid var(--rule); background: var(--bg); max-width: 560px; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--faint); }
.chat-avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); flex: none; }
.chat-name { font-family: var(--font-id); font-weight: 500; }
.chat-sub { font-family: var(--font-id); font-size: 12.5px; color: var(--muted); }
.chat-log { display: flex; flex-direction: column; gap: 3px; padding: 14px 12px; height: 340px; overflow-y: auto; }
.chat-empty { margin: auto; color: var(--muted); font-size: 14px; }
.bubble { max-width: 78%; padding: 7px 12px; border-radius: 18px; line-height: 1.35; font-size: 15.5px; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: #2f7cf6; color: #fff; }
.bubble.it { align-self: flex-start; background: var(--head); color: var(--ink); }
.bubble.me.tail { border-bottom-right-radius: 5px; margin-bottom: 6px; }
.bubble.it.tail { border-bottom-left-radius: 5px; margin-bottom: 6px; }
.bubble.typing { display: flex; gap: 4px; padding: 11px 13px; }
.bubble.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.bubble.typing span:nth-child(2) { animation-delay: 0.2s; }
.bubble.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .bubble.typing span { animation: none; opacity: 0.6; } }
.chat-compose { display: flex; gap: 8px; align-items: center; margin: 0; padding: 9px 10px; border-top: 1px solid var(--faint); }
.chat-compose input { flex: 1; min-width: 0; font: inherit; font-size: 15px; color: var(--ink); background: var(--bg); border: 1px solid var(--rule); border-radius: 18px; padding: 6px 14px; }
.chat-compose input:focus-visible { outline: 2px solid #2f7cf6; outline-offset: 0; }
.chat-compose button { width: 32px; height: 32px; flex: none; border-radius: 50%; border: 0; background: #2f7cf6; color: #fff; font-size: 17px; line-height: 1; cursor: pointer; padding: 0; }
.chat-compose button:disabled { opacity: 0.4; cursor: default; }

/* overview: a wider page with a hero, tiles, a registry table and two columns */
.wrap.wide { max-width: 1120px; }
.hero { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 28px; align-items: start; }
.hero .lede { color: var(--ink); margin-top: 14px; }
.hero .links a { margin-right: 16px; font-family: var(--font-id); font-size: 14px; }
.hero-fig { margin-top: 4px; }
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; margin-top: 30px; border: 1px solid var(--rule); }
.tile { padding: 12px 14px; border-right: 1px solid var(--faint); }
.tile:last-child { border-right: 0; }
.tile-v { font-family: var(--font-id); font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }
.tile-k { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tbl-wrap { overflow-x: auto; }
table.reg { border-collapse: collapse; width: 100%; min-width: 760px; font-size: 14.5px; }
.reg th { font-family: var(--font-id); font-size: 12.5px; font-weight: 500; text-align: left; color: var(--muted);
  border-top: 1.5px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 6px 10px 6px 0; white-space: nowrap; }
.reg td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--faint); white-space: nowrap; vertical-align: middle; }
.reg tbody tr { cursor: pointer; }
.reg tbody tr:hover td, .reg tbody tr:focus-visible td { background: var(--mark); outline: none; }
.reg tbody tr:last-child td { border-bottom: 1.5px solid var(--ink); }
.reg .mono, .mono { font-family: var(--font-id); font-size: 0.86em; }
.reg .num, .reg th.num { text-align: right; font-family: var(--font-id); font-variant-numeric: tabular-nums; }
.reg .spark { color: var(--ink); line-height: 0; }
.tbl-note { font-size: 13px; color: var(--muted); margin-top: 6px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; }
.latest { list-style: none; padding: 0; margin: 0; }
.latest li { padding: 8px 0; border-bottom: 1px solid var(--faint); }
.latest a { text-decoration: none; color: var(--ink); }
.latest a:hover { text-decoration: underline; }
.log-id { color: var(--muted); margin-right: 6px; }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { padding: 8px 0 8px 0; border-bottom: 1px solid var(--faint); }
.step-k { display: inline-block; min-width: 4.6rem; font-family: var(--font-id); font-size: 13px; color: var(--muted); }
.prov { display: flex; flex-wrap: wrap; gap: 6px 22px; font-family: var(--font-id); font-size: 12px; }
@media (max-width: 860px) {
  .hero, .cols { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile:nth-child(3) { border-right: 0; }
  .tile:nth-child(-n+3) { border-bottom: 1px solid var(--faint); }
}
@media (max-width: 560px) {
  .bar { flex-wrap: wrap; row-gap: 6px; }
  .bar nav a { margin-left: 0; margin-right: 12px; font-size: 13px; }
}

/* the lineage map */
.map { position: relative; height: var(--map-h, 340px); border: 1px solid var(--rule); background: var(--bg); overflow: hidden; }
.map > svg { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.map.dragging > svg { cursor: grabbing; }
.map a { cursor: pointer; }
.map-ui { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; border: 1px solid var(--rule); background: var(--bg); }
.map-ui button { width: 28px; height: 28px; border: 0; border-bottom: 1px solid var(--faint); background: none; color: var(--ink); font: 15px/1 var(--font-id); cursor: pointer; padding: 0; }
.map-ui button:last-child { border-bottom: 0; }
.map-ui button:hover { background: var(--head); }
.map-hint { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); font: 11.5px var(--font-id); color: var(--muted); background: var(--bg); border: 1px solid var(--faint); padding: 2px 8px; opacity: 0; transition: opacity .2s; pointer-events: none; white-space: nowrap; }
.map.show-hint .map-hint { opacity: 1; }
.map-card { position: absolute; width: 236px; background: var(--bg); border: 1px solid var(--ink); box-shadow: 3px 3px 0 var(--faint); padding: 10px 12px; font-size: 13px; line-height: 1.45; z-index: 2; }
.map-card .card-n { font: 500 18px var(--font-id); }
.map-card .card-id { font: 12px var(--font-id); color: var(--muted); margin-bottom: 6px; }
.map-card .kv { display: flex; justify-content: space-between; gap: 10px; border-top: 1px dotted var(--faint); padding: 2px 0; }
.map-card .kv span:first-child { color: var(--muted); }
.map-card .kv span:last-child { font-family: var(--font-id); font-size: 12px; text-align: right; }
.map-card .card-spark { display: flex; align-items: center; gap: 6px; margin-top: 6px; font: 11px var(--font-id); color: var(--muted); }
.map-card .card-spark svg { width: 120px; height: 24px; color: var(--ink); }
.map-card .card-go { display: inline-block; margin-top: 6px; font: 12.5px var(--font-id); }
@media (max-width: 560px) { .map { --map-h: 280px; } }

.map-legend { display: flex; flex-wrap: wrap; gap: 2px 16px; padding: 6px 0 0; font: 11.5px/1.6 var(--font-id); color: var(--muted); }
.map-legend div { display: flex; align-items: center; gap: 6px; }
.map-legend svg { color: var(--ink); width: 26px; height: 12px; flex: none; }
.map-hint { bottom: auto; top: 8px; }

/* variants */
.var-top { align-items: start; }
.var-tools { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font: 13px var(--font-id); margin-bottom: 8px; }
.var-tools select, .var-tools input { font: 13px var(--font-id); padding: 3px 6px; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); }
.reg.var tr { cursor: pointer; }
.reg.var tr.on td { background: var(--mark); }
.kv-big { display: flex; gap: 24px; margin: 6px 0 10px; flex-wrap: wrap; }
.kv-big div { display: flex; flex-direction: column; }
.kv-big .big { font: 500 28px var(--font-id); }
.kv-big span:last-child { font-size: 13px; color: var(--muted); }
.dose { display: grid; grid-template-columns: 64px 1fr 56px; gap: 8px; align-items: center; font-size: 12.5px; margin: 2px 0; }
.dose-bar { height: 10px; border: 1px solid var(--rule); }
.dose-bar span { display: block; height: 100%; background: var(--ink); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
@media (max-width: 560px) { .bar nav { display: flex; flex-wrap: wrap; row-gap: 2px; } }
.reg.var tr.ex-row { cursor: default; }
.reg.var tr.ex-row td { background: var(--bg); padding: 10px 8px 14px; white-space: normal; }
.ex-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.ex-col h3 { font: 500 12.5px var(--font-id); margin: 0 0 6px; color: var(--muted); }
.ex-item { border-left: 2px solid var(--faint); padding: 2px 0 2px 8px; margin: 0 0 8px; font-size: 13.5px; line-height: 1.45; }
.ex-meta { font: 11px var(--font-id); color: var(--muted); }
.ex-ctx { color: var(--muted); }
.sent mark { background: var(--mark); color: var(--ink); outline: 1px solid #e3c25b; padding: 0 1px; }
.sent .lapse { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 2px; }
@media (max-width: 820px) { .ex-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 820px) { .reg.var tr.ex-row td > * { position: sticky; left: 0; max-width: calc(100vw - 48px); } }
.edge-pick { display: inline-flex; border: 1px solid var(--rule); }
.edge-pick button { font: 13px var(--font-id); padding: 3px 10px; border: 0; border-right: 1px solid var(--rule); background: var(--bg); color: var(--ink); cursor: pointer; }
.edge-pick button:last-child { border-right: 0; }
.edge-pick button.on { background: var(--ink); color: var(--bg); }
.ex-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .ex-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .ex-grid.four { grid-template-columns: minmax(0, 1fr); } }
.reg td.strong { font-weight: 500; }
.dose { grid-template-columns: 112px 1fr 150px; }

/* life phases on the age slider */
:root { --p0: #cfcfc6; --p1: #8fb0e6; --p2: #93d1b2; }
.age input[type=range] { -webkit-appearance: none; appearance: none; height: 6px; border-radius: 3px; }
.age input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); border: 2px solid var(--bg); cursor: pointer; }
.age input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 2px solid var(--bg); cursor: pointer; }
.age input[type=range]::-moz-range-track { background: transparent; }
.phases { display: flex; font: 11px var(--font-id); color: var(--muted); margin-top: 2px; }
.phases span { border-top: 3px solid; padding-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phases .p0 { border-color: var(--p0); }
.phases .p1 { border-color: var(--p1); }
.phases .p2 { border-color: var(--p2); }
.cmp-ages { display: flex; gap: 16px; flex-wrap: wrap; font: 13px var(--font-id); margin-bottom: 8px; }
.cmp-ages select { font: 13px var(--font-id); padding: 3px 6px; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); }
.cmp-compose { border: 1px solid var(--rule); }
.cmp-log { margin-top: 10px; }
.cmp-item { border-top: 1px solid var(--faint); padding: 8px 0; }
.cmp-adult { font-size: 14.5px; margin-bottom: 6px; }
.cmp-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.cmp-cell { border-left: 2px solid var(--faint); padding-left: 8px; font-size: 14.5px; line-height: 1.45; }
.ind-top, .ind-talk { align-items: start; }
.ind-talk .chat, .ind-talk .age { max-width: none; }
