@font-face { font-family: 'Fraunces'; src: url('/fonts/fraunces.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('/fonts/figtree.woff2') format('woff2'); font-weight: 300 900; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #fbf6ec;
  --card: #fffdf8;
  --tint: #f3ead9;
  --ink: #26202f;
  --ink-2: #5a5364;
  --rule: #e4dac6;
  --fig: #65559a;
  --accent: #c94a1c;
  --alert-bg: #fdeee6;
  --lang: #2a78d6;
  --soc: #eb6834;
  --move: #1baf7a;
  --think: #eda100;
  --head: 60px;
  --rail: 148px;
}
:root[data-theme="night"] {
  color-scheme: dark;
  --paper: #15131c;
  --card: #1f1c28;
  --tint: #2a2636;
  --ink: #f3eee4;
  --ink-2: #b9b2c2;
  --rule: #38334a;
  --fig: #bdaee0;
  --accent: #f08b5e;
  --alert-bg: #33231e;
  --lang: #3987e5;
  --soc: #d95926;
  --move: #199e70;
  --think: #c98500;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--head) + 56px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.6 'Figtree', system-ui, sans-serif;
  overflow-x: hidden;
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 500; line-height: 1.08; letter-spacing: -.01em; margin: 0; font-variation-settings: 'SOFT' 100, 'WONK' 0; }
h2 { font-size: clamp(2rem, 4.4vw, 3rem); margin-bottom: .5rem; text-wrap: balance; }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
kbd { font: 600 .72em 'Figtree', sans-serif; border: 1px solid var(--rule); border-radius: 5px; padding: 1px 6px; color: var(--ink-2); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.skip { position: fixed; left: 12px; top: -60px; z-index: 50; background: var(--card); padding: 8px 14px; border-radius: 8px; }
.skip:focus { top: 10px; }

/* Top bar */
.bar {
  position: fixed; inset: 0 0 auto 0; height: var(--head); z-index: 30;
  display: flex; align-items: center; gap: 12px; padding: 0 18px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 9px; font: 600 1.05rem 'Fraunces', serif; text-decoration: none; white-space: nowrap; }
.brand-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--soc); }
.now { margin-left: auto; font-size: .88rem; color: var(--ink-2); white-space: nowrap; }
.tool {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
  background: var(--card); border: 1px solid var(--rule); border-radius: 19px; font-size: .9rem;
}
.tool.icon { width: 38px; padding: 0; justify-content: center; }
.tool svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool:hover { border-color: var(--ink-2); }

/* Side rail, a bottom strip on small screens */
.rail {
  position: fixed; left: 0; top: var(--head); bottom: 0; width: var(--rail); z-index: 20;
  display: flex; flex-direction: column; justify-content: center; padding: 14px 0 14px 18px;
}
.rail-in { position: relative; display: flex; flex-direction: column; flex: 0 1 646px; min-height: 0; justify-content: space-between; }
.rail-in::before { content: ''; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 2px; background: var(--rule); }
.rail a {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 20px;
  text-decoration: none; font-size: .84rem; color: var(--ink-2); white-space: nowrap;
}
.rail a::before {
  content: ''; flex: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--rule); transition: transform .2s, background .2s, border-color .2s;
}
.rail a.page::before { border-radius: 4px; transform: rotate(45deg) scale(.72); }
.rail a:hover { color: var(--ink); }
.rail a:hover::before { border-color: var(--ink-2); }
.rail a.active { color: var(--ink); font-weight: 700; }
.rail a.active::before { background: var(--accent); border-color: var(--accent); transform: scale(1.2); }
.rail a.page.active::before { transform: rotate(45deg) scale(.9); }
.rail a.here::after {
  content: 'here'; font-size: .66rem; font-weight: 700; color: var(--card); background: var(--accent);
  padding: 0 6px; border-radius: 8px; white-space: nowrap;
}

main { margin-left: var(--rail); padding: var(--head) 28px 60px; }
main > section { max-width: 1040px; margin-inline: auto; }

.kicker { font-size: .78rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); margin: 0 0 .6rem; }
.intro { max-width: 62ch; color: var(--ink-2); }
.block { padding: 72px 0 24px; }

/* Hero */
.hero { padding: 56px 0 24px; }
.hero h1 { font-size: clamp(3rem, 10vw, 6.4rem); font-weight: 400; line-height: .98; }
.hero h1 em { font-style: normal; color: var(--accent); font-weight: 500; }
.lede { font-size: clamp(1.1rem, 2vw, 1.3rem); max-width: 40em; margin: 1.1rem 0 0; color: var(--ink-2); }

.trail { position: relative; height: 230px; margin: 26px 0 14px; }
.trail-map { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.trail-map path { fill: none; stroke-linecap: round; }
.trail .track { stroke: var(--rule); stroke-width: 10; }
.trail .drawn { stroke: var(--soc); stroke-width: 10; }
.tstop {
  position: absolute; transform: translate(-50%, -50%); width: 26px; height: 26px; padding: 0;
  border: 3px solid var(--soc); border-radius: 50%; background: var(--card); text-decoration: none;
  transition: transform .15s; animation: pop .45s cubic-bezier(.3, 1.6, .5, 1) backwards; animation-delay: calc(var(--i) * .24s);
}
.tstop span { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: .92rem; font-weight: 600; }
.tstop.up span { bottom: 28px; } .tstop.down span { top: 28px; }
.tstop:hover, .tstop:focus-visible { transform: translate(-50%, -50%) scale(1.22); background: var(--soc); }
.traveller {
  position: absolute; width: 38px; height: 38px; margin: -19px 0 0 -19px; pointer-events: none; z-index: 2;
  filter: drop-shadow(0 3px 5px rgb(0 0 0 / .22));
}
.traveller circle.body { fill: var(--fig); }
.traveller .f { fill: var(--card); }
.traveller path { stroke: var(--card); stroke-width: 2.6; fill: none; stroke-linecap: round; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(0); } to { transform: translate(-50%, -50%) scale(1); } }

.agebox {
  display: grid; grid-template-columns: minmax(170px, 220px) 140px auto 1fr; gap: 14px 16px; align-items: end;
  background: var(--card); border: 1px solid var(--rule); border-radius: 18px; padding: 18px 20px;
}
.field label { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.field input { width: 100%; height: 44px; padding: 0 10px; background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; }
.primary { height: 44px; padding: 0 18px; background: var(--ink); color: var(--paper); border: 1px solid var(--ink); border-radius: 22px; font-weight: 600; white-space: nowrap; }
.primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary.ghost { background: transparent; color: var(--ink); min-width: 92px; }
.primary.ghost:hover { color: #fff; }
.ageout { margin: 0; font-size: .92rem; color: var(--ink-2); align-self: center; }
.ageout a { font-weight: 600; color: var(--ink); }
.ageout strong { color: var(--ink); }
.linkbtn { background: none; border: 0; padding: 0; text-decoration: underline; color: var(--ink-2); font-size: inherit; }

/* Legend + at a glance */
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 18px 0 10px; font-size: .86rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 26px; height: 10px; border-radius: 4px; background: color-mix(in srgb, var(--ink-2) 42%, transparent); }
.swatch.hatch { background: repeating-linear-gradient(135deg, var(--ink-2) 0 2px, transparent 2px 5px); }
.swatch.tick { width: 3px; height: 15px; background: var(--ink); border-radius: 2px; }
.swatch.dia { width: 11px; height: 11px; transform: rotate(45deg); border-radius: 2px; background: var(--ink); }
.swatch.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--card); border: 2.5px solid var(--ink); }
.swatch.d { width: 11px; height: 11px; border-radius: 3px; }

.d-lang { --c: var(--lang); } .d-soc { --c: var(--soc); } .d-move { --c: var(--move); } .d-think { --c: var(--think); }

.glance { background: var(--card); border: 1px solid var(--rule); border-radius: 18px; padding: 12px 18px 16px; }
.g-axis, .g-row { display: grid; grid-template-columns: 196px 1fr; align-items: center; }
.g-axis .scale { position: relative; height: 26px; grid-column: 2; }
.g-axis .scale span { position: absolute; transform: translateX(-50%); font-size: .75rem; color: var(--ink-2); white-space: nowrap; }
.g-row { min-height: 31px; text-decoration: none; border-radius: 8px; }
.g-row:hover { background: var(--tint); }
.g-name { font-size: .92rem; font-weight: 500; padding: 0 12px 0 8px; line-height: 1.15; }
.g-track { position: relative; height: 31px; }
.vt { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--rule); }
.bar-range, .bar-iqr, .bar-band, .mark-med, .mark-dia, .mark-dot { position: absolute; top: 50%; }
.bar-range, .bar-band, .bar-iqr { transform: translateY(-50%) scaleX(0); transform-origin: left; transition: transform .7s cubic-bezier(.2, .7, .2, 1); transition-delay: calc(var(--i, 0) * 35ms); }
.seen .bar-range, .seen .bar-band, .seen .bar-iqr { transform: translateY(-50%) scaleX(1); }
.bar-range { height: 11px; border-radius: 4px; background: color-mix(in srgb, var(--c) 34%, transparent); }
.bar-iqr { height: 11px; border-radius: 4px; background: var(--c); }
.bar-band { height: 11px; border-radius: 4px; background: repeating-linear-gradient(135deg, var(--c) 0 2.5px, transparent 2.5px 5.5px); }
.mark-med { width: 3px; height: 19px; margin-top: -9.5px; margin-left: -1.5px; background: var(--ink); border-radius: 2px; box-shadow: 0 0 0 1.5px var(--card); }
.mark-dia { width: 12px; height: 12px; margin: -6px 0 0 -6px; transform: rotate(45deg); border-radius: 2px; background: var(--c); box-shadow: 0 0 0 2px var(--card); }
.mark-dot { width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--card); border: 2.5px solid var(--c); }
.age-line { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); z-index: 3; pointer-events: none; }

.tableview { margin-top: 12px; font-size: .92rem; }
.tableview summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
.tablewrap { overflow-x: auto; margin-top: 8px; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { text-align: left; padding: 6px 12px 6px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 700; }

/* 100 babies */
.twoup { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; max-width: 880px; margin-top: 12px; color: var(--ink-2); }
.twoup strong { color: var(--ink); }
.sim { background: var(--card); border: 1px solid var(--rule); border-radius: 18px; padding: 22px 24px; margin-top: 12px; }
.sim-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.sim-read { margin: 0; font: 400 clamp(1.25rem, 2.6vw, 1.75rem)/1.2 'Fraunces', serif; }
.sim-read b { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent); }
.sim-grid { display: grid; grid-template-columns: 250px 1fr; gap: 30px; align-items: start; }
.waffle { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.waffle i { aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--rule); background: transparent; transition: background .18s, border-color .18s, transform .25s cubic-bezier(.3, 1.8, .5, 1); transform: scale(.82); }
.waffle i.on { background: var(--move); border-color: var(--move); transform: scale(1); }
.win-row {
  display: grid; grid-template-columns: 158px 1fr 52px; align-items: center; width: 100%; min-height: 36px; padding: 0;
  background: none; border: 0; border-radius: 8px; text-align: left;
}
.win-row:hover { background: var(--tint); }
.win-row.sel { background: var(--tint); }
.win-row.sel .wn { font-weight: 700; }
.wn { font-size: .9rem; padding-left: 8px; }
.wt { position: relative; height: 34px; }
.wp { font-size: .9rem; font-weight: 700; text-align: right; padding-right: 8px; font-variant-numeric: tabular-nums; }
.win-rows { position: relative; }
.win-axis { display: grid; grid-template-columns: 158px 1fr 52px; height: 24px; }
.win-axis .scale { grid-column: 2; position: relative; }
.win-axis span { position: absolute; transform: translateX(-50%); font-size: .75rem; color: var(--ink-2); white-space: nowrap; }
.win-slider { display: grid; grid-template-columns: 158px 1fr 52px; align-items: center; margin-top: 4px; }
.win-slider label { font-size: .86rem; font-weight: 600; padding-left: 8px; }
.slider-wrap { margin: 0 -11px; }
input[type=range] { width: 100%; height: 30px; margin: 0; background: none; accent-color: var(--accent); cursor: grab; }
.sim-age-line { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); pointer-events: none; z-index: 2; }
.sim-note { margin: 14px 0 0; font-size: .92rem; color: var(--ink-2); }

/* Timeline */
.timeline-wrap { position: relative; }
.filters {
  position: sticky; top: calc(var(--head) + 8px); z-index: 12; display: flex; gap: 8px; width: fit-content; max-width: 100%;
  overflow-x: auto; padding: 6px; margin: 18px 0 8px;
  background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px);
  border: 1px solid var(--rule); border-radius: 24px; scrollbar-width: none;
}
.fchip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; font-size: .88rem; font-weight: 600; background: var(--card); border: 1px solid var(--rule); border-radius: 17px; white-space: nowrap; }
.fchip i { width: 11px; height: 11px; border-radius: 3px; background: var(--c); }
.fchip[aria-pressed=false] { opacity: .55; text-decoration: line-through; background: transparent; }
.fchip[aria-pressed=false] i { background: var(--rule); }

.line { position: absolute; left: 14px; width: 4px; top: var(--t, 300px); bottom: 20px; background: var(--rule); border-radius: 2px; }
.line-fill { position: absolute; inset: 0 0 auto 0; height: 0; background: var(--soc); border-radius: 2px; }

.stop { position: relative; padding: 56px 0 26px 56px; }
.stop::before {
  content: ''; position: absolute; left: 6px; top: 68px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--card); border: 4px solid var(--soc); z-index: 1;
}
.stop-top { display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; align-items: start; }
.age-num { font: 400 clamp(3.6rem, 8vw, 5.4rem)/.9 'Fraunces', serif; margin: 0 0 8px; display: flex; align-items: baseline; gap: 10px; color: var(--accent); }
.age-num.word { font-size: clamp(2.8rem, 6vw, 4rem); }
.age-num span { font-size: .3em; color: var(--ink-2); font-family: 'Figtree', sans-serif; font-weight: 600; }
.here-badge { display: inline-block; margin-left: 4px; font: 700 .72rem 'Figtree', sans-serif; color: #fff; background: var(--accent); padding: 3px 9px; border-radius: 10px; align-self: center; }
.stop h3 { font-size: clamp(1.55rem, 3vw, 2.1rem); margin-bottom: 10px; }
.blurb { color: var(--ink-2); }
.facts { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 0; padding: 0; list-style: none; }
.facts li { flex: 1 1 150px; max-width: 240px; background: var(--tint); border-radius: 12px; padding: 9px 12px; font-size: .86rem; line-height: 1.3; }
.facts b { display: block; font: 600 1.28rem/1.15 'Fraunces', serif; margin-bottom: 2px; }
.facts small { color: var(--ink-2); font-size: .72rem; font-weight: 700; }
.stop-note { margin: 14px 0 0; padding: 9px 13px; font-size: .92rem; border-left: 3px solid var(--accent); background: var(--alert-bg); border-radius: 0 10px 10px 0; }

.scene { margin: 0; background: var(--card); border: 1px solid var(--rule); border-radius: 18px; overflow: hidden; }
.scene svg { display: block; width: 100%; height: auto; max-height: 300px; }
.scene line { stroke: var(--fig); stroke-linecap: round; }
.scene .fig { fill: var(--fig); }
.scene .limb-back { opacity: .62; }
.scene .mark { fill: var(--card); }
.scene .mark-line, .scene .grin { fill: none; stroke: var(--card); stroke-width: 4.5; stroke-linecap: round; }
.scene .grin { stroke-width: 9; }
.scene .soft { fill: var(--tint); }
.scene .wrap { fill: color-mix(in srgb, var(--soc) 55%, var(--card)); }
.scene .wrap-line { fill: none; stroke: var(--card); stroke-width: 3; stroke-linecap: round; opacity: .7; }
.scene .floor { stroke: var(--rule); stroke-width: 5; }
.scene .floor.rolling { stroke-dasharray: 16 22; }
.scene .furn { fill: color-mix(in srgb, var(--think) 62%, var(--card)); }
.scene .furn-line { stroke: var(--rule); }
.scene .paper { fill: var(--paper); stroke: var(--rule); stroke-width: 2; }
.scene .toy.t-lang { fill: var(--lang); }
.scene .toy.t-think { fill: var(--think); }
.scene .heart { fill: var(--soc); }
.scene .crayon { fill: var(--accent); }
.scene .draw { fill: none; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke: var(--c); }
.scene text { font-family: 'Fraunces', serif; fill: var(--ink); }
.scene .z { font-size: 24px; fill: var(--ink-2); }
.scene .say { font-size: 18px; text-anchor: middle; }

/* Scene motion runs only in view */
.scene * { animation-play-state: paused; }
.scene.playing * { animation-play-state: running; }
.breathe { animation: breathe 3.2s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.03, 1.05); } }
.z { animation: zfloat 3.6s ease-in infinite; opacity: 0; }
.z2 { animation-delay: .9s; } .z3 { animation-delay: 1.8s; }
@keyframes zfloat { 0% { opacity: 0; transform: translate(0, 12px); } 25% { opacity: 1; } 100% { opacity: 0; transform: translate(10px, -14px); } }
.blink { animation: blink 4.4s infinite; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.grin { stroke-dasharray: 1; animation: grin 4.4s ease-in-out infinite; }
@keyframes grin { 0%, 8% { stroke-dashoffset: 1; opacity: 0; } 12% { opacity: 1; } 34%, 88% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.heart { animation: rise 4.4s ease-out infinite; opacity: 0; }
.h2 { animation-delay: .35s; } .h3 { animation-delay: .7s; }
@keyframes rise { 0%, 28% { opacity: 0; transform: translateY(16px); } 42% { opacity: 1; } 80%, 100% { opacity: 0; transform: translateY(-26px); } }
.pushup { animation: pushup 3s ease-in-out infinite; }
@keyframes pushup { 0%, 100% { transform: rotate(-9deg); } 45%, 62% { transform: rotate(16deg); } }
.forearm { animation: forearm 3s ease-in-out infinite; }
@keyframes forearm { 0%, 100% { transform: rotate(-12deg) scaleY(.9); } 45%, 62% { transform: rotate(4deg) translateY(-8px); } }
.flip { animation: flip 5s ease-in-out infinite; }
@keyframes flip {
  0%, 14% { transform: translateX(-58px) scaleX(1); } 30% { transform: translateX(0) scaleX(.16); }
  46%, 62% { transform: translateX(58px) scaleX(1); } 78% { transform: translateX(0) scaleX(.16); }
  94%, 100% { transform: translateX(-58px) scaleX(1); }
}
.flip-face { animation: flipface 5s step-end infinite; }
@keyframes flipface { 0% { opacity: 1; } 30% { opacity: 0; } 78% { opacity: 1; } }
.floor.rolling { animation: floor 1s linear infinite; }
@keyframes floor { to { stroke-dashoffset: 38; } }
.crawler { animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.armA, .legB { animation: swingA 1.2s ease-in-out infinite; }
.armB, .legA { animation: swingB 1.2s ease-in-out infinite; }
@keyframes swingA { 0%, 100% { transform: rotate(14deg); } 50% { transform: rotate(-14deg); } }
@keyframes swingB { 0%, 100% { transform: rotate(-14deg); } 50% { transform: rotate(14deg); } }
.cruiser { animation: cruise 6s ease-in-out infinite; }
@keyframes cruise { 0%, 100% { transform: translateX(-64px); } 50% { transform: translateX(64px); } }
.stepA { animation: stepA 1.5s ease-in-out infinite; }
.stepB { animation: stepB 1.5s ease-in-out infinite; }
@keyframes stepA { 0%, 100% { transform: rotate(9deg); } 50% { transform: rotate(-2deg); } }
@keyframes stepB { 0%, 100% { transform: rotate(2deg); } 50% { transform: rotate(-9deg); } }
.wobble { animation: wobble 1.1s ease-in-out infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(-3.5deg) translateY(0); } 25%, 75% { transform: rotate(0) translateY(-4px); } 50% { transform: rotate(3.5deg); } }
.legA2 { animation: legA2 1.1s ease-in-out infinite; }
.legB2 { animation: legB2 1.1s ease-in-out infinite; }
@keyframes legA2 { 0%, 100% { transform: rotate(24deg); } 50% { transform: rotate(-24deg); } }
@keyframes legB2 { 0%, 100% { transform: rotate(-24deg); } 50% { transform: rotate(24deg); } }
.arm-sway { animation: sway 1.1s ease-in-out infinite; }
@keyframes sway { 50% { transform: rotate(9deg); } }
.draw { stroke-dashoffset: 1; animation: draw 5s ease-in-out infinite; }
@keyframes draw { 0%, 6% { stroke-dashoffset: 1; opacity: 1; } 62%, 92% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.scribbler { animation: scrib .7s ease-in-out infinite; }
.scribbler.slow { animation-duration: 2.4s; }
@keyframes scrib { 0%, 100% { transform: rotate(-9deg); } 50% { transform: rotate(9deg); } }
.kickleg { animation: kick 3s ease-in-out infinite; }
@keyframes kick { 0%, 14% { transform: rotate(0); } 26% { transform: rotate(24deg); } 36% { transform: rotate(-58deg); } 50%, 100% { transform: rotate(0); } }
.ball { animation: ball 3s ease-out infinite; }
@keyframes ball { 0%, 34% { transform: translate(0, 0); opacity: 1; } 62% { transform: translate(150px, -90px); opacity: 1; } 68% { transform: translate(175px, -60px); opacity: 0; } 72% { transform: translate(-30px, 0); opacity: 0; } 86%, 100% { transform: translate(0, 0); opacity: 1; } }
.hop { animation: hop 1.5s infinite; }
@keyframes hop {
  0%, 100% { transform: scale(1.04, .9); animation-timing-function: ease-out; }
  14% { transform: scale(.97, 1.04); animation-timing-function: ease-out; }
  48% { transform: translateY(-46px); animation-timing-function: ease-in; }
  84% { transform: scale(1, 1); }
}
.jump-shadow { animation: shadow 1.5s infinite; }
@keyframes shadow { 0%, 100% { transform: scale(1.05); } 48% { transform: scale(.62); opacity: .55; } }
.bubble { animation: bubble 3s ease-in-out infinite; }
@keyframes bubble { 0%, 10% { transform: scale(0); opacity: 0; } 20%, 84% { transform: scale(1); opacity: 1; } 96%, 100% { transform: scale(0); opacity: 0; } }

.reflex { margin-top: 18px; background: var(--card); border: 1px solid var(--rule); border-radius: 18px; padding: 14px 18px; }
.reflex h4 { margin: 0 0 8px; font: 600 1.02rem 'Fraunces', serif; }
.rf-row { display: grid; grid-template-columns: minmax(130px, 200px) 1fr; align-items: center; min-height: 34px; gap: 10px; padding: 5px 0; }
.rf-name { font-size: .9rem; font-weight: 600; line-height: 1.15; }
.rf-name small { display: block; font-weight: 400; color: var(--ink-2); font-size: .76rem; }
.rf-track { position: relative; height: 26px; }
.rf-solid { position: absolute; left: 0; top: 8px; height: 10px; background: var(--move); border-radius: 0 4px 4px 0; transform: scaleX(0); transform-origin: left; transition: transform .8s cubic-bezier(.2, .7, .2, 1); transition-delay: calc(var(--i) * 70ms); }
.seen .rf-solid { transform: scaleX(1); }
.rf-fade { position: absolute; top: 8px; height: 10px; background: linear-gradient(to right, var(--move), transparent); }
.rf-label { position: absolute; top: 3px; font-size: .78rem; color: var(--ink-2); padding-left: 6px; white-space: nowrap; }
.rf-axis { display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 10px; height: 20px; }
.rf-axis div { grid-column: 2; position: relative; }
.rf-axis span { position: absolute; transform: translateX(-50%); font-size: .74rem; color: var(--ink-2); }

.dgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 18px; }
.dcol { background: var(--card); border: 1px solid var(--rule); border-top: 4px solid var(--c); border-radius: 12px; padding: 11px 14px; }
.dcol h4 { margin: 0 0 4px; font-size: .8rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.dcol ul { margin: 0; padding: 0; list-style: none; }
.dcol li { font-size: .92rem; line-height: 1.32; padding: 5px 0; border-radius: 6px; }
.dcol li + li { border-top: 1px solid var(--rule); }
.dcol li.flash { animation: flash 2.4s ease-out; }
.stop-title-flash { animation: flash 2.4s ease-out; }
@keyframes flash { 0%, 55% { background: color-mix(in srgb, var(--accent) 24%, transparent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 24%, transparent); } 100% { background: transparent; box-shadow: 0 0 0 5px transparent; } }
.no-lang .dcol.d-lang, .no-soc .dcol.d-soc, .no-move .dcol.d-move, .no-think .dcol.d-think { display: none; }
.stop-nav { display: flex; justify-content: space-between; margin-top: 14px; font-size: .9rem; color: var(--ink-2); }
.stop-nav a { text-decoration: none; font-weight: 600; }
.stop-nav a:hover { color: var(--accent); }

/* Talking */
.talk { display: grid; grid-template-columns: 1fr 1.25fr; gap: 40px; align-items: start; margin-top: 14px; }
.talk-copy { color: var(--ink-2); position: sticky; top: calc(var(--head) + 24px); }
.talk-copy strong { color: var(--ink); }
.chat { list-style: none; margin: 0; padding: 22px; background: var(--card); border: 1px solid var(--rule); border-radius: 18px; }
.chat li { opacity: 0; transform: translateY(14px) scale(.96); transform-origin: left bottom; transition: opacity .4s, transform .45s cubic-bezier(.3, 1.5, .5, 1); transition-delay: calc(var(--i) * .19s); margin-bottom: 11px; }
.seen .chat li, .chat.seen li { opacity: 1; transform: none; }
.chat a { display: inline-block; text-decoration: none; background: color-mix(in srgb, var(--lang) 14%, var(--card)); border-radius: 18px 18px 18px 5px; padding: 8px 15px; font-family: 'Fraunces', serif; font-size: calc(1.02rem + var(--i) * .075rem); line-height: 1.2; }
.chat a:hover { background: color-mix(in srgb, var(--lang) 26%, var(--card)); }
.chat a.quiet { font-family: 'Figtree', sans-serif; font-style: italic; font-size: .9rem; color: var(--ink-2); }
.chat small { display: block; font-size: .74rem; font-weight: 600; color: var(--ink-2); margin: 0 0 2px 4px; }

/* Concerns */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.step { background: var(--card); border: 1px solid var(--rule); border-radius: 16px; padding: 15px 16px; font-size: .96rem; }
.step.alert { background: var(--alert-bg); border-color: var(--accent); }
.step h3 { font-size: 1.22rem; margin-bottom: 7px; }
.step p { margin: 0; }
.sub { font-size: 1.3rem; margin: 34px 0 10px; }
.screen { position: relative; height: 112px; background: var(--card); border: 1px solid var(--rule); border-radius: 16px; }
.screen-in { position: absolute; inset: 0 38px; }
.screen-axis { position: absolute; left: 0; right: 0; top: 56px; height: 3px; background: var(--rule); }
.screen-mark { position: absolute; transform: translateX(-50%); text-align: center; font-size: .82rem; line-height: 1.15; }
.screen-mark b { display: block; }
.screen-mark i { display: block; width: 13px; height: 13px; margin: 0 auto; }
.screen-mark.dev { top: 50px; } .screen-mark.dev i { background: var(--lang); border-radius: 50%; margin-bottom: 3px; }
.screen-mark.aut { top: 16px; } .screen-mark.aut i { background: var(--soc); transform: rotate(45deg); border-radius: 2px; margin-top: 4px; }
.screen-key { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 8px; font-size: .86rem; color: var(--ink-2); }
.screen-key span { display: inline-flex; align-items: center; gap: 7px; }
.fine { font-size: .88rem; color: var(--ink-2); max-width: 70ch; margin-top: 16px; }

.srcs { padding: 0; margin: 16px 0 0; list-style: none; max-width: 76ch; }
.srcs li { padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: .94rem; color: var(--ink-2); }
.srcs a { color: var(--ink); font-weight: 600; }

/* Tooltip */
.tip { position: fixed; z-index: 40; max-width: 290px; pointer-events: none; background: var(--ink); color: var(--paper); padding: 9px 12px; border-radius: 10px; font-size: .84rem; line-height: 1.35; }
.tip b { display: block; margin-bottom: 2px; }

/* Finder */
.finder { border: 1px solid var(--rule); border-radius: 18px; padding: 0; width: min(620px, calc(100vw - 24px)); background: var(--card); color: var(--ink); margin-top: 11vh; box-shadow: 0 24px 60px rgb(0 0 0 / .3); }
.finder::backdrop { background: rgb(20 14 30 / .45); }
.finder-in { display: flex; flex-direction: column; max-height: 72vh; }
#findInput { height: 58px; padding: 0 20px; border: 0; border-bottom: 1px solid var(--rule); background: none; font-size: 1.12rem; outline: none; }
#findList { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
#findList button { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; width: 100%; min-height: 40px; padding: 6px 12px; text-align: left; background: none; border: 0; border-radius: 9px; font-size: .95rem; line-height: 1.25; }
#findList button.cur { background: var(--tint); }
#findList i { width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--ink)); }
#findList small { color: var(--ink-2); white-space: nowrap; }
.finder-foot { margin: 0; padding: 9px 18px; border-top: 1px solid var(--rule); font-size: .78rem; color: var(--ink-2); }

@media (max-width: 1160px) {
  .rail {
    top: auto; bottom: 0; right: 0; left: 0; width: auto; height: 56px; z-index: 25;
    flex-direction: row; justify-content: flex-start; align-items: center; gap: 4px; padding: 0 10px;
    background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(10px);
    border-top: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none;
  }
  .rail-in { flex: none; flex-direction: row; gap: 4px; }
  .rail-in::before { display: none; }
  .rail a { flex: none; height: 38px; padding: 0 12px; border-radius: 19px; gap: 6px; white-space: nowrap; }
  .rail a::before { display: none; }
  .rail a.active { background: var(--ink); color: var(--paper); }
  .rail a.here::after { content: '•'; background: none; color: var(--accent); padding: 0; font-size: 1.1rem; }
  main { margin-left: 0; padding: var(--head) 18px 90px; }
  .tip { display: none; }
}
@media (max-width: 860px) {
  .agebox { grid-template-columns: 1fr 120px; }
  .agebox .primary { grid-column: 1 / -1; }
  .ageout { grid-column: 1 / -1; }
  .stop-top, .talk, .sim-grid, .twoup { grid-template-columns: 1fr; }
  .talk-copy { position: static; }
  .waffle { width: 100%; max-width: 280px; margin: auto; }
  .steps { grid-template-columns: 1fr 1fr; }
  .scene { order: -1; }
  .scene svg { max-height: 240px; }
  .tool span, .tool kbd, .now { display: none; }
  .tool { padding: 0; width: 38px; justify-content: center; }
  .bar { justify-content: space-between; }
  .brand { margin-right: auto; }
}
@media (max-width: 620px) {
  body { font-size: 16px; }
  .block { padding-top: 56px; }
  .hero { padding-top: 34px; }
  .trail { height: 180px; }
  .tstop { width: 20px; height: 20px; border-width: 3px; }
  .tstop span { font-size: .72rem; }
  .tstop.up span { bottom: 22px; } .tstop.down span { top: 22px; }
  .traveller { width: 30px; height: 30px; margin: -15px 0 0 -15px; }
  .glance { padding: 10px; }
  .g-axis, .g-row { grid-template-columns: 1fr; }
  .g-axis .scale { grid-column: 1; }
  .g-axis .scale .minor { display: none; }
  .g-axis .scale span:first-child { transform: none; }
  .g-axis .scale span:last-child { transform: translateX(-100%); }
  .g-row { padding-top: 5px; }
  .g-name { padding: 0 2px; }
  .g-track { height: 22px; }
  .sim { padding: 16px 12px; }
  .sim-top { align-items: flex-start; flex-direction: column; }
  .win-row, .win-axis, .win-slider { grid-template-columns: 96px 1fr 42px; }
  .wn { font-size: .78rem; padding-left: 2px; line-height: 1.1; }
  .win-slider label { font-size: .78rem; padding-left: 2px; }
  .steps { grid-template-columns: 1fr; }
  .stop { padding-left: 34px; padding-top: 44px; }
  .line { left: 6px; }
  .stop::before { left: 0; top: 52px; width: 16px; height: 16px; border-width: 3px; }
  .rf-row, .rf-axis { grid-template-columns: 112px 1fr; }
  .screen-in { inset: 0 26px; }
  .srcs li { font-size: .9rem; }
  .reflex { padding: 12px; }
}

@media (max-width: 380px) {
  .rf-row, .rf-axis { grid-template-columns: 90px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .z, .heart { opacity: 1; }
  .grin { stroke-dashoffset: 0; }
  .draw { stroke-dashoffset: 0; }
  .bubble { opacity: 1; }
  .chat li { opacity: 1; transform: none; }
  .bar-range, .bar-band, .bar-iqr { transform: translateY(-50%); }
  .rf-solid { transform: none; }
}
@media (forced-colors: active) {
  .bar-range, .bar-iqr, .bar-band, .mark-dia, .mark-med { forced-color-adjust: none; background: CanvasText; }
  .waffle i.on { background: CanvasText; forced-color-adjust: none; }
}
