/* ───────────────────────── The Width of a Day ───────────────────────── */

:root {
  --paper: #efe8d8;
  --paper-2: #e4dbc6;
  --paper-3: #d8cdb4;
  --ink: #1b2430;
  --ink-soft: rgba(27, 36, 48, .58);
  --ink-faint: rgba(27, 36, 48, .22);
  --red: #d2402a;
  --sea: #6f8996;
  --sea-wash: rgba(111, 137, 150, .16);
  --ice: #f7f8f5;
  --night: #0e151d;
  --night-2: #16212c;
  --frost: #cfdde6;
  --lamp: #f0b443;

  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --hand: "Caveat", "Bradley Hand", cursive;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --gutter: clamp(16px, 4vw, 64px);
  --halo: 0 0 6px var(--paper), 0 0 14px var(--paper), 0 0 24px var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  background-image: linear-gradient(90deg, #e9e7df 0%, var(--paper) 46%, var(--paper) 54%, #f1e5cf 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--display);
  font-variation-settings: "SOFT" 60, "WONK" 0;
  font-size: clamp(17px, 1.15vw, 20px);
  line-height: 1.45;
  overflow-x: hidden;
}
::selection { background: var(--red); color: var(--paper); }
a { color: inherit; text-decoration-color: var(--red); text-underline-offset: 3px; }
b { font-weight: 600; }
em { font-style: italic; font-variation-settings: "SOFT" 100, "WONK" 1; }
.defs { position: absolute; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hand { font-family: var(--hand); font-size: 1.5em; line-height: 1.1; color: var(--ink-soft); }
.red { color: var(--red); }

/* paper grain + vignette over everything */
.grain {
  position: fixed; inset: -50%; z-index: 60; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .1  0 0 0 0 .09  0 0 0 0 .07  0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .32; mix-blend-mode: multiply;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 59; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(60, 45, 20, .16) 100%);
}

/* ───────── the date line ───────── */
.dateline {
  position: fixed; top: 0; bottom: 0; left: 50%; width: 40px; margin-left: -20px;
  z-index: 40; pointer-events: none; transition: opacity .8s ease;
}
.dateline-svg { width: 100%; height: 100%; overflow: visible; }
.dateline-path {
  fill: none; stroke: var(--red); stroke-width: 2.4; stroke-linecap: round;
  stroke-dasharray: 0 11; opacity: .78;
  transition: stroke .8s, opacity .8s;
}
body.drawn-in .dateline-path { animation: none; }
.dateline-note {
  position: absolute; left: 28px; top: 34%; white-space: nowrap;
  font-family: var(--hand); font-size: 1.35rem; color: var(--red);
  opacity: 0; transform: rotate(-4deg); transition: opacity .6s;
}
body[data-scene="lines"] .dateline, body[data-scene="curtain"] .dateline, body[data-scene="game"] .dateline { opacity: 0; }
body[data-scene="beringia"] .dateline-path { stroke-dasharray: 0 22; opacity: .4; }
body[data-scene="beringia"] .dateline-note { opacity: .9; }
body[data-scene="send"] .dateline, body[data-scene="coda"] .dateline { opacity: 1; }

/* chapter knots tied along the thread */
.knots {
  position: fixed; left: 50%; top: 0; bottom: 0; width: 0; z-index: 45;
  transition: opacity .6s;
}
body[data-scene="lines"] .knots { opacity: 0; pointer-events: none; }
.knot {
  position: absolute; left: -9px; width: 18px; height: 18px; padding: 0; border: 0;
  background: none; cursor: pointer;
}
.knot::before {
  content: ""; position: absolute; inset: 5px; border-radius: 50%;
  border: 1.5px solid var(--red); background: var(--paper);
  transition: transform .3s, background .3s;
}
.knot.on::before { background: var(--red); transform: scale(1.25); }
.knot:hover::before, .knot:focus-visible::before { transform: scale(1.6); }
.knot:focus-visible { outline: none; }
.knot span {
  position: absolute; left: 22px; top: -4px; white-space: nowrap;
  font-family: var(--hand); font-size: 1.3rem; color: var(--red);
  opacity: 0; transform: translateX(-6px); transition: opacity .25s, transform .25s; pointer-events: none;
  text-shadow: var(--halo);
}
.knot:hover span, .knot:focus-visible span { opacity: 1; transform: none; }
body.dark .knot::before { background: var(--night); }
body.dark .knot span { text-shadow: 0 0 8px var(--night), 0 0 16px var(--night); }

/* ───────── HUD ───────── */
.hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 12px;
  padding: 14px var(--gutter); pointer-events: none;
  font-family: var(--mono); font-size: 12px; letter-spacing: .02em;
  color: var(--ink); transition: color .8s;
}
.hud-side { display: flex; flex-direction: column; gap: 2px; transition: opacity .4s; }
.hud-right { text-align: right; align-items: flex-end; }
.hud-place { text-transform: uppercase; letter-spacing: .14em; font-size: 10.5px; color: var(--ink-soft); }
.hud-place em { font-style: normal; opacity: .7; }
.hud-time b { font-weight: 500; }
.hud-side.here .hud-place { color: var(--red); }
.sound {
  pointer-events: auto; cursor: pointer; display: flex; align-items: center; gap: 8px;
  background: none; border: 0; padding: 4px 8px; margin-top: 2px;
  font: inherit; font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-soft);
}
.sound svg { width: 30px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.sound[aria-pressed="true"] { color: var(--red); }
.sound[aria-pressed="true"] svg path { animation: wave 1.6s linear infinite; stroke-dasharray: 4 2; }
@keyframes wave { to { stroke-dashoffset: -12; } }
body.dark .hud { color: var(--frost); }
body.dark .hud-place, body.dark .sound { color: rgba(207, 221, 230, .6); }

/* cursor stamps and flying birds */
.stamps { position: fixed; inset: 0; z-index: 55; pointer-events: none; overflow: hidden; }
.stamp {
  position: absolute; font-family: var(--hand); font-size: 1.7rem; color: var(--red);
  white-space: nowrap; transform: translate(-50%, -120%) rotate(-6deg);
  animation: stamp 1.6s cubic-bezier(.2, .8, .3, 1) forwards; text-shadow: var(--halo);
}
.stamp small { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-align: center; color: var(--ink-soft); }
body.dark .stamp { text-shadow: 0 0 10px var(--night); }
@keyframes stamp {
  0% { opacity: 0; transform: translate(-50%, -80%) rotate(-12deg) scale(.7); }
  15% { opacity: 1; transform: translate(-50%, -120%) rotate(-6deg) scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -190%) rotate(-3deg) scale(1); }
}
.sky-layer { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 54; pointer-events: none; overflow: visible; }
.sky-layer path { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
body.dark .sky-layer path { stroke: var(--frost); }

/* ───────── scenes ───────── */
.scene { position: relative; }
.scene.sticky { height: var(--len, 400vh); }
.stage {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
}
.art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scene:not(.active) .art { visibility: hidden; }
.boil { filter: url(#boil); }
.boil-soft { filter: url(#boil-soft); }
.scene:not(.active) .boil, .scene:not(.active) .boil-soft { filter: none; }
@media (prefers-reduced-motion: reduce) { .boil, .boil-soft { filter: none; } }

/* SVG ink vocabulary */
.ink-stroke, .stroke { fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.stroke.thin, .thin { stroke-width: 1; }
.stroke.soft { stroke: var(--ink-soft); }
.stroke.faint { stroke: var(--ink-faint); }
.stroke.red { stroke: var(--red); }
.fill-paper { fill: var(--paper); }
.fill-paper2 { fill: var(--paper-2); }
.fill-ink { fill: var(--ink); }
.fill-sea { fill: var(--sea-wash); }
.lbl { font-family: var(--hand); fill: var(--ink); font-size: 30px; paint-order: stroke; stroke: var(--paper); stroke-width: 6px; stroke-linejoin: round; }
.lbl.small { font-size: 22px; fill: var(--ink-soft); }
.lbl.red { fill: var(--red); }
.lbl.mono { font-family: var(--mono); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
.lbl.serif { font-family: var(--display); font-style: italic; }

/* text beats */
.beat {
  position: absolute; z-index: 5; max-width: min(32vw, 440px);
  opacity: 0; transform: translateY(14px); filter: blur(3px);
  transition: opacity .7s ease, transform .9s cubic-bezier(.2, .8, .2, 1), filter .7s;
  pointer-events: none; text-shadow: var(--halo);
}
.beat.on { opacity: 1; transform: none; filter: none; pointer-events: auto; }
.beat.left { left: var(--gutter); top: 16vh; }
.beat.right { right: var(--gutter); top: 16vh; }
.beat.center { left: 50%; transform: translate(-50%, 14px); text-align: center; max-width: min(860px, 86vw); }
.beat.center.on { transform: translate(-50%, 0); }
.beat.center.top { top: 11vh; }
.beat.center.bottom { bottom: 9vh; }
.beat p { margin: 0 0 .6em; }
.beat h2 {
  margin: 0; font-weight: 340; font-size: clamp(2.6rem, 6.4vw, 6.4rem); line-height: .95;
  letter-spacing: -.02em; font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}
.beat .big { font-size: clamp(1.4rem, 2.2vw, 2.1rem); line-height: 1.2; font-weight: 360; }
.beat .huge { font-size: clamp(2.4rem, 6vw, 5.6rem); line-height: 1; font-weight: 320; letter-spacing: -.02em; }
.beat .year {
  font-family: var(--mono); font-size: 12px; letter-spacing: .2em; color: var(--red);
  margin-bottom: .4em;
}
.chapter-no { font-family: var(--mono); font-size: 12px; letter-spacing: .3em; color: var(--red); margin-bottom: 1em !important; }
.big-hand { font-size: clamp(1.6rem, 2.6vw, 2.4rem) !important; color: var(--red); }
.beat.panel { text-shadow: none; }
.beat.panel::before {
  content: ""; position: absolute; inset: -18px -22px; z-index: -1;
  background: var(--paper); opacity: .9;
  border-radius: 3px 14px 6px 18px / 16px 4px 14px 5px;
  box-shadow: 0 1px 0 var(--ink-faint), 0 18px 40px -24px rgba(40, 30, 10, .35);
}
.live-note { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--ink-soft); }

/* ───────── cover ───────── */
.cover { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; }
.cover-inner { width: 100%; padding: 16vh var(--gutter) 10vh; text-align: center; }
.kicker {
  margin: 0 0 7vh; font-family: var(--mono); font-weight: 400; font-size: 12px;
  letter-spacing: .3em; text-transform: uppercase; color: var(--ink);
}
.kicker span { color: var(--ink-soft); }
.halves { display: grid; grid-template-columns: 1fr 1fr; }
.half { display: flex; flex-direction: column; align-items: center; padding: 0 3vw; }
.lead { font-family: var(--hand); font-size: clamp(1.4rem, 2.2vw, 2.1rem); color: var(--ink-soft); }
.bigday {
  font-size: clamp(3.4rem, 10.5vw, 11rem); line-height: .9; font-weight: 300; letter-spacing: -.035em;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
  margin: .08em 0 .1em;
}
.half-left .bigday { font-style: italic; }
.bigclock { font-family: var(--mono); font-size: clamp(14px, 1.3vw, 18px); letter-spacing: .2em; color: var(--ink-soft); }
.cover-sub { margin: 8vh auto 0; max-width: 36ch; font-size: clamp(1.1rem, 1.6vw, 1.5rem); }
.cue { margin-top: 6vh; color: var(--red); }
.cue-arrow { display: inline-block; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(6px); } }
.cover .half, .cover .kicker, .cover-sub, .cue { animation: rise 1.6s cubic-bezier(.2, .8, .2, 1) both; }
.cover .half-left { animation-delay: .5s; }
.cover .half-right { animation-delay: .8s; }
.cover-sub { animation-delay: 1.3s; }
.cue { animation-delay: 1.8s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } }

/* ───────── map extras ───────── */
.compass { position: absolute; left: var(--gutter); bottom: 7vh; width: 92px; opacity: .85; z-index: 4; transform: rotate(-8deg); }
.compass .ink-stroke { stroke-width: 1.2; }
.compass text { font-family: var(--hand); font-size: 16px; fill: var(--ink); }
.scalebar { position: absolute; right: var(--gutter); bottom: 7vh; z-index: 4; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--ink-soft); display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.scalebar i { display: block; height: 7px; border: 1.5px solid var(--ink); border-top: 0; width: 120px; }
.map .land { fill: var(--paper-2); stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.map .waterline { fill: none; stroke: var(--sea); vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.map .grat { fill: none; stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 2 6; vector-effect: non-scaling-stroke; }
.map .border { fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-dasharray: 8 6; vector-effect: non-scaling-stroke; }
.map .idl { fill: none; stroke: var(--red); stroke-width: 2.4; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.map .ship path { fill: none; stroke: var(--ink); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.map .ship .sail { fill: var(--paper); }
.map text { font-family: var(--hand); fill: var(--ink); paint-order: stroke; stroke: var(--paper-2); stroke-linejoin: round; }
.map text.sea-lbl { font-family: var(--display); font-style: italic; fill: var(--sea); stroke: var(--paper); }
.map text.region { font-family: var(--mono); letter-spacing: .4em; fill: var(--ink-soft); }
.map text.red { fill: var(--red); stroke: var(--paper); }
.map text.on-sea { stroke: var(--paper); }
.map .dot { fill: var(--ink); }

/* ───────── beringia gauge ───────── */
.gauge {
  position: absolute; left: 50%; bottom: 6vh; transform: translateX(-50%); z-index: 6;
  display: flex; gap: 46px; font-family: var(--mono); text-align: center;
}
.gauge > div { display: flex; flex-direction: column; min-width: 130px; }
.gauge-label { white-space: nowrap; font-size: 10.5px; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-soft); }
.gauge-num { white-space: nowrap; font-size: clamp(20px, 2.2vw, 30px); color: var(--ink); text-shadow: var(--halo); font-variant-numeric: tabular-nums; }
.gauge > div:first-child .gauge-num { color: var(--sea); }

/* ───────── dark scene (Ice Curtain) ───────── */
.scene.dark .stage { background: var(--night); color: var(--frost); }
.scene.dark .beat { text-shadow: 0 0 10px var(--night), 0 0 22px var(--night); }
.scene.dark .chapter-no, .scene.dark .year { color: #e8735c; }
.scene.dark .stroke { stroke: var(--frost); }
.scene.dark .stroke.soft { stroke: rgba(207, 221, 230, .5); }
.scene.dark .stroke.faint { stroke: rgba(207, 221, 230, .18); }
.scene.dark .lbl { fill: var(--frost); stroke: var(--night); }
.scene.dark .stage::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(60% 50% at 50% 30%, rgba(80, 110, 140, .18), transparent 70%);
}
.star { fill: var(--frost); animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .2; } }
.lamp { fill: var(--lamp); transition: opacity .6s; }
.lamp.glow { filter: drop-shadow(0 0 4px var(--lamp)); }

/* ───────── swim ───────── */
.swimlog {
  position: absolute; left: 50%; bottom: 5vh; transform: translateX(-50%); z-index: 6;
  font-family: var(--mono); font-size: 12px; text-align: center; min-width: 300px;
  opacity: 0; transition: opacity .6s;
}
.scene.active[data-swim-on] .swimlog { opacity: 1; }
.swimlog-title { margin: 0 0 8px; letter-spacing: .22em; text-transform: uppercase; color: var(--red); font-size: 10.5px; }
.swimlog dl { margin: 0; display: grid; grid-template-columns: repeat(4, auto); gap: 4px 26px; }
.swimlog dt { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft); }
.swimlog dd { margin: 0; font-size: 14px; color: var(--ink); white-space: nowrap; text-shadow: var(--halo); }
.swimlog dd.flip { animation: flip .9s ease; color: var(--red); }
@keyframes flip { 0% { transform: rotateX(90deg); } 60% { transform: rotateX(-15deg); } 100% { transform: none; } }
.current { fill: none; stroke: var(--sea); stroke-width: 1.1; stroke-linecap: round; stroke-dasharray: 14 46; animation: flow 3.2s linear infinite; opacity: .7; }
@keyframes flow { to { stroke-dashoffset: -60; } }
.arm { animation: stroke-arm .9s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes stroke-arm { 50% { transform: scaleX(-1); } }
.watermark { font-family: var(--display); font-style: italic; font-size: 120px; fill: var(--ink); opacity: .06; font-weight: 300; }

/* ───────── winter ───────── */
.snow { fill: #fff; opacity: .9; }
.flake { animation: fall linear infinite; }
@keyframes fall { from { transform: translate(0, -60px); } to { transform: translate(-40px, 980px); } }

/* ───────── village ───────── */
.hot { cursor: pointer; outline: none; }
.hot .ring { fill: none; stroke: var(--red); stroke-width: 1.6; transform-box: fill-box; transform-origin: center; animation: pulse 2.4s ease-out infinite; }
.hot .core { fill: var(--red); }
.hot:hover .core, .hot:focus-visible .core { fill: var(--ink); }
.hot:focus-visible .ring { stroke-width: 3; }
@keyframes pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(2.2); opacity: 0; } }
.note {
  position: fixed; z-index: 57; max-width: 300px; padding: 16px 18px 14px;
  background: var(--paper); color: var(--ink); font-size: 16px; line-height: 1.4;
  border-radius: 3px 14px 6px 18px / 16px 4px 14px 5px;
  box-shadow: 0 1px 0 var(--ink-faint), 0 20px 40px -20px rgba(30, 20, 5, .45);
  transform: translate(-50%, calc(-100% - 22px)) rotate(-1deg);
  animation: rise .5s cubic-bezier(.2, .8, .2, 1);
}
.note b { display: block; font-family: var(--hand); font-size: 1.5rem; font-weight: 600; color: var(--red); line-height: 1; margin-bottom: 4px; }
.village-night .stage { background: linear-gradient(#1a2633, #2c3a47 60%, #3e4b55); }
.village-night .beat { color: var(--paper); text-shadow: 0 0 10px #1a2633, 0 0 20px #1a2633; }
.village-night .live-note { color: rgba(239, 232, 216, .7); }

/* ───────── send ───────── */
.send { min-height: 100vh; min-height: 100svh; display: grid; align-items: center; padding: 14vh 0 8vh; }
.boat-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 3; }
.boat-layer path { fill: var(--paper); stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.boat-layer .wake { fill: none; stroke: var(--sea); stroke-width: 1.2; stroke-dasharray: 6 8; }
.send-grid { display: grid; grid-template-columns: 1fr 1fr; width: 100%; position: relative; z-index: 4; }
.send-left, .send-right { padding: 0 calc(var(--gutter) + 2vw); }
.send-left { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.send-right h2 {
  margin: 0 0 .5em; font-weight: 320; font-size: clamp(2.2rem, 4.6vw, 4.6rem); line-height: .98; letter-spacing: -.02em;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}
.send-form { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.hand-input {
  width: min(100%, 460px); border: 0; border-bottom: 1.5px solid var(--ink); background: transparent;
  font-family: var(--hand); font-size: 2rem; color: var(--ink); padding: 4px 2px; outline: none;
}
.hand-input:focus { border-bottom-color: var(--red); }
.hand-input::placeholder { color: var(--ink-faint); }
.send-btn, .link-btn {
  font-family: var(--mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  background: none; border: 1.5px solid var(--ink); color: var(--ink); padding: 12px 18px; cursor: pointer;
  border-radius: 2px 10px 3px 12px / 10px 3px 10px 3px; transition: background .25s, color .25s;
}
.send-btn:hover, .send-btn:focus-visible { background: var(--ink); color: var(--paper); outline: none; }
.send-btn:disabled { opacity: .4; cursor: default; }
.link-btn { border: 0; padding: 8px 0; color: var(--red); }
.link-btn:hover { text-decoration: underline; }
.fine { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); margin-top: 26px; letter-spacing: .04em; }
.send-placeholder { margin-top: 2em; }
.postcard {
  position: relative; width: min(100%, 420px); padding: 26px 26px 18px; text-align: left;
  background: #f6f1e4; border-radius: 2px;
  box-shadow: 0 1px 0 var(--ink-faint), 0 26px 50px -26px rgba(30, 20, 5, .5);
  transform: rotate(-2.5deg); animation: land .9s cubic-bezier(.2, .9, .3, 1.2);
  background-image: repeating-linear-gradient(transparent 0 33px, rgba(111, 137, 150, .25) 33px 34px);
}
@keyframes land { from { opacity: 0; transform: rotate(-10deg) scale(.6) translateX(80px); } }
.postcard-msg { font-family: var(--hand); font-size: 2.1rem; line-height: 1.05; margin: 0 110px 18px 0; min-height: 2.2em; word-break: break-word; }
.postmark {
  position: absolute; top: 16px; right: 16px; width: 96px; height: 96px; transform: rotate(14deg);
  color: var(--red); display: grid; place-items: center; text-align: center;
  animation: thump .5s .6s cubic-bezier(.3, 1.6, .5, 1) both;
}
@keyframes thump { from { opacity: 0; transform: rotate(30deg) scale(2); } }
.pm-ring { position: absolute; inset: 0; border: 2px solid currentColor; border-radius: 50%; box-shadow: inset 0 0 0 5px var(--paper), inset 0 0 0 6.5px currentColor; opacity: .85; }
.pm-text { font-family: var(--mono); font-size: 9.5px; line-height: 1.25; letter-spacing: .06em; text-transform: uppercase; padding: 0 12px; }
.postcard-meta { font-family: var(--mono); font-size: 11.5px; line-height: 1.6; color: var(--ink-soft); margin: 0; }
.arrived-back { margin-top: 20px; font-family: var(--hand); font-size: 1.7rem; color: var(--red); line-height: 1.15; }

/* ───────── coda + footer ───────── */
.coda { min-height: 70vh; display: grid; place-content: center; text-align: center; padding: 10vh var(--gutter); }
.coda-line { font-size: clamp(1.8rem, 4.2vw, 4rem); line-height: 1.12; font-weight: 300; letter-spacing: -.02em; margin: 0; font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144; }
.coda-line b { font-weight: 500; font-style: italic; }
.coda-line.small { font-size: clamp(1.1rem, 1.6vw, 1.5rem); margin-top: 1.4em; color: var(--ink-soft); letter-spacing: 0; }
.foot {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6vw; padding: 8vh calc(var(--gutter) + 2vw) 12vh;
  border-top: 1px solid var(--ink-faint); font-size: 15px; color: var(--ink-soft); position: relative; z-index: 41;
  background: var(--paper);
}
.foot-col:first-child { padding-right: 3vw; }
.foot-title { font-family: var(--mono); font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--ink); }
.foot ul { margin: 0; padding: 0; list-style: none; }
.foot li { margin-bottom: .4em; }

/* ───────── small screens ───────── */
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  body { font-size: 16px; }
  .hud { padding: 10px 14px; font-size: 10.5px; grid-template-columns: 1fr auto 1fr; gap: 6px; }
  .hud-place { font-size: 9px; letter-spacing: .1em; }
  .sound span { display: none; }
  .knots { display: none; }
  .beat, .beat.left, .beat.right, .beat.center {
    left: 16px; right: 16px; top: auto; bottom: 5vh; max-width: none; transform: translateY(14px); text-align: left;
  }
  .beat.on, .beat.center.on { transform: none; }
  .beat.center.top { top: auto; bottom: 5vh; }
  .beat h2 { font-size: 2.8rem; }
  .beat .huge { font-size: 2.6rem; }
  .beat.panel::before { inset: -12px -12px; }
  .gauge { bottom: auto; top: 64px; gap: 20px; }
  .gauge > div { min-width: 0; }
  .swimlog { top: 62px; bottom: auto; min-width: 0; width: calc(100% - 32px); }
  .swimlog dl { grid-template-columns: repeat(2, auto); }
  .compass { width: 60px; bottom: auto; top: 70px; }
  .scalebar { bottom: auto; top: 76px; }
  .cover-inner { padding-top: 14vh; }
  .halves { gap: 0; }
  .half { padding: 0 6px; }
  .send-grid { grid-template-columns: 1fr; gap: 8vh; }
  .send-left { order: 2; align-items: flex-start; text-align: left; }
  .send-left, .send-right { padding: 0 20px; }
  .foot { grid-template-columns: 1fr; padding: 6vh 20px 10vh; }
  .note { max-width: 240px; }
}

.flap { animation: flap .45s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes flap { to { transform: scaleY(-.55); } }
@media (prefers-reduced-motion: reduce) {
  .flap, .current, .flake, .star, .cue-arrow, .hot .ring { animation: none !important; }
}

/* village at night: the drawing inverts to moonlit ink */
.village-night .stroke { stroke: rgba(222, 230, 236, .85); }
.village-night .stroke.soft { stroke: rgba(222, 230, 236, .42); }
.village-night .stroke.faint { stroke: rgba(222, 230, 236, .16); }
.village-night .fill-paper { fill: #243241; }
.village-night .stroke.fill-paper { fill: #2b3a4a; }
.village-night [fill="var(--paper-2)"] { fill: #314152; }
.village-night [fill="var(--ice)"] { fill: #3a4a59; }
.village-night .lbl { fill: var(--paper); stroke: #1a2633; }
.snow { fill: var(--sea); opacity: .55; }

/* phones: tomorrow's words sit at the top of the screen, today's at the bottom */
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  .beat.left { top: 12vh; bottom: auto; }
  .scene[data-scene="beringia"] .beat.left { top: 17vh; }
  .scene[data-scene="swim"] .beat.left { top: 25vh; }
  .beat .big { font-size: 1.3rem; }
  .beat p { font-size: 1rem; }
  .beat .big, .beat .huge { font-size: 1.35rem; }
  .beat .huge { font-size: 2.4rem; }
}
/* SVG displacement filters are expensive on phones; keep the ink still there */
@media (pointer: coarse) { .boil, .boil-soft { filter: none; } }

/* ═════════════════════ v2: rail, games, passport, prose ═════════════════════ */

/* chapter rail on the right edge, off the date line */
.knots { display: none; }
.rail {
  position: fixed; right: 14px; top: 50%; transform: translateY(-50%); z-index: 45;
  display: flex; flex-direction: column; gap: 7px; align-items: flex-end;
}
.rail-tick {
  position: relative; display: block; width: 26px; height: 12px; padding: 0; border: 0; background: none; cursor: pointer;
}
.rail-tick::before {
  content: ""; position: absolute; right: 0; top: 5px; height: 1.5px; width: 12px; background: var(--ink-soft);
  transition: width .3s, background .3s;
}
.rail-tick.game::before { width: 6px; background: var(--red); opacity: .7; }
.rail-tick.on::before { width: 24px; background: var(--red); opacity: 1; }
.rail-tick:hover::before, .rail-tick:focus-visible::before { width: 24px; }
.rail-tick span {
  position: absolute; right: 34px; top: -6px; white-space: nowrap; pointer-events: none;
  font-family: var(--hand); font-size: 1.25rem; color: var(--ink); text-shadow: var(--halo);
  opacity: 0; transform: translateX(6px); transition: opacity .2s, transform .2s;
}
.rail-tick:hover span, .rail-tick:focus-visible span { opacity: 1; transform: none; }
.rail-tick:focus-visible { outline: none; }
body.dark .rail-tick::before { background: rgba(207, 221, 230, .5); }
body.dark .rail-tick.on::before { background: #e8735c; }
body.dark .rail-tick span { color: var(--frost); text-shadow: 0 0 8px var(--night); }

.hud-mid { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.travel { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--red); white-space: nowrap; }
.travel b { font-weight: 500; }

/* the cover's personal line and arrival notes */
.cover-you { margin: 2vh auto 0; font-family: var(--hand); font-size: clamp(1.3rem, 1.8vw, 1.7rem); color: var(--ink-soft); max-width: 40ch; }
.arrival {
  position: relative; z-index: 46; margin: 0 auto 5vh; max-width: 560px; padding: 20px 26px 16px;
  background: #f6f1e4; border-radius: 3px 14px 6px 18px / 16px 4px 14px 5px; text-align: left;
  box-shadow: 0 1px 0 var(--ink-faint), 0 22px 44px -24px rgba(30, 20, 5, .45);
  transform: rotate(-1deg); animation: land 1.1s .4s cubic-bezier(.2, .9, .3, 1.2) both;
}
.arrival-kicker { margin: 0 0 6px; font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--red); }
.arrival-body { margin: 0; font-family: var(--hand); font-size: 2rem; line-height: 1.1; word-break: break-word; }
.arrival-meta { margin: 8px 0 0; font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); }

/* prose chapters (no scroll animation, just words) */
.prose { padding: 18vh 0 14vh; }
.prose-inner { max-width: 1240px; margin: 0 auto; padding: 0 calc(var(--gutter) + 2vw); text-align: center; }
.prose-title {
  margin: 0 0 8vh; font-weight: 340; font-size: clamp(2.6rem, 6.4vw, 6.4rem); line-height: .95; letter-spacing: -.02em;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}
.prose-cols { display: grid; grid-template-columns: 1fr 1fr; gap: calc(8vw + 40px); text-align: left; }
.prose-col p { margin: 0 0 1em; }
.prose .year { font-family: var(--mono); font-size: 12px; letter-spacing: .2em; color: var(--red); margin-bottom: .4em; }
.prose .big-hand { margin-top: 1.4em; }
.dates-now { margin-bottom: 2em; padding: 18px 20px; border: 1.5px solid var(--ink); border-radius: 2px 12px 3px 14px / 12px 3px 12px 3px; }
.dates-count { font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1; margin: 0 0 .4em !important; font-weight: 320; }
.dates-count b { color: var(--red); font-weight: 500; }
.dates-list { margin: 0 0 .8em; padding: 0; list-style: none; font-size: .95em; }
.dates-list li { margin: .2em 0; }
.dates-now .fine { margin: 0; }

/* game plates */
.plate-wrap { padding: 10vh 0; }
.plate {
  position: relative; margin: 0 auto; width: calc(100% - 2 * var(--gutter)); max-width: 1400px;
  outline: none;
}
.plate-head { display: grid; grid-template-columns: 1fr 1fr; gap: 6vw; align-items: end; margin-bottom: 18px; }
.plate-head h3 {
  grid-column: 1; margin: 0; font-weight: 340; font-size: clamp(2rem, 4vw, 3.6rem); line-height: 1; letter-spacing: -.02em;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}
.plate-kicker { grid-column: 1 / -1; margin: 0; font-family: var(--mono); font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--red); }
.plate-how { grid-column: 2; grid-row: 2; margin: 0; font-size: .95em; color: var(--ink-soft); }
.plate-stage {
  position: relative; height: min(68vh, 620px); border: 1.5px solid var(--ink);
  border-radius: 3px 16px 5px 20px / 18px 4px 16px 6px; overflow: hidden; background: var(--paper);
  box-shadow: 0 30px 60px -40px rgba(30, 20, 5, .45);
}
.plate-stage.square { height: min(78vh, 760px); }
.plate-stage.tall { height: min(76vh, 720px); }
.plate-stage canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }
.plate:focus-visible .plate-stage { box-shadow: 0 0 0 3px var(--red); }
.plate-hud {
  display: flex; flex-wrap: wrap; gap: 6px 26px; align-items: baseline; margin-top: 14px;
  font-family: var(--mono); font-size: 12px; color: var(--ink-soft); min-height: 3.2em;
}
.plate-hud b { color: var(--ink); font-weight: 500; }
.plate-hud b.red { color: var(--red); }
.plate-msg { flex: 1 1 100%; font-family: var(--hand); font-size: 1.5rem; color: var(--ink); line-height: 1.15; }
.meter { display: inline-block; width: 90px; height: 8px; border: 1px solid var(--ink); vertical-align: middle; border-radius: 2px; }
.meter i { display: block; height: 100%; background: var(--red); transition: width .2s; }
.plate-controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.ctl {
  font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  background: var(--paper); border: 1.5px solid var(--ink); color: var(--ink); padding: 12px 18px; cursor: pointer;
  border-radius: 2px 10px 3px 12px / 10px 3px 10px 3px; user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.ctl:active, .ctl:focus-visible { background: var(--ink); color: var(--paper); outline: none; }
.ctl.big { padding: 18px 30px; min-width: 150px; }
.ctl.link-btn { border: 0; background: none; color: var(--red); }
.ctl-toggle { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; display: flex; gap: 8px; align-items: center; cursor: pointer; }
.ctl-toggle input { accent-color: var(--red); width: 18px; height: 18px; }

/* birthday */
.bday-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.bday-form select {
  font-family: var(--hand); font-size: 1.7rem; color: var(--ink); background: transparent; border: 0;
  border-bottom: 1.5px solid var(--ink); padding: 2px 4px; cursor: pointer;
}
.bday-out { margin-top: 26px; }
.bday-big { font-size: clamp(1.4rem, 2.4vw, 2.2rem); line-height: 1.15; font-weight: 320; margin: 0 0 18px; }
.bday-big b { color: var(--red); font-weight: 500; }
.bday-bars { position: relative; height: 64px; margin-bottom: 14px; }
.bday-bars .bar { position: absolute; height: 26px; border: 1.5px solid var(--ink); border-radius: 2px 9px 3px 10px / 9px 3px 9px 3px; background: var(--paper-2); }
.bday-bars .bar.big { top: 0; }
.bday-bars .bar.little { top: 34px; background: repeating-linear-gradient(-45deg, transparent 0 5px, rgba(27, 36, 48, .14) 5px 6px); }
.bday-bars span { position: absolute; left: 8px; top: 2px; font-family: var(--hand); font-size: 1.1rem; white-space: nowrap; }
.bday-times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 14px; font-family: var(--mono); font-size: 12px; }
.bday-times dt { color: var(--ink-soft); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; }
.bday-times dd { margin: 0; }
.bday-note { font-size: .92em; color: var(--ink-soft); }
.coda-actions { margin-top: 6vh; }
.postcard-actions { display: flex; flex-wrap: wrap; gap: 4px 18px; }

/* passport */
.pp-btn {
  position: fixed; left: 14px; bottom: 14px; z-index: 52; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px 8px 10px; border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer;
  border-radius: 2px 10px 3px 12px / 10px 3px 10px 3px; font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  box-shadow: 0 10px 24px -14px rgba(30, 20, 5, .5);
}
.pp-btn svg { width: 16px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.pp-btn.has { border-color: var(--red); color: var(--red); }
.pp-sheet { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(14, 21, 29, .45); backdrop-filter: blur(3px); }
.pp-sheet[hidden] { display: none; }
.pp-card {
  position: relative; width: min(860px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 34px 34px 26px;
  background: #f4eedf; border-radius: 4px 18px 6px 22px / 20px 5px 18px 6px; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .6);
  animation: land .6s cubic-bezier(.2, .9, .3, 1.2);
}
.pp-close { position: absolute; top: 12px; right: 16px; border: 0; background: none; font-size: 30px; line-height: 1; cursor: pointer; color: var(--ink); }
.pp-kicker { margin: 0; font-family: var(--mono); font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--red); }
.pp-title { margin: 6px 0 4px; font-weight: 340; font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.05; }
.pp-stats { margin: 0 0 20px; font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }
.pp-grid { list-style: none; margin: 0 0 22px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; }
.pp-stamp { display: flex; flex-direction: column; align-items: center; text-align: center; transform: rotate(var(--r)); }
.pp-ring {
  width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 8px;
  border: 1.5px dashed var(--ink-faint); color: var(--ink-faint); font-size: 26px; font-family: var(--hand);
}
.pp-stamp.got .pp-ring { border: 2.5px solid var(--red); color: var(--red); box-shadow: inset 0 0 0 4px #f4eedf, inset 0 0 0 5.5px var(--red); }
.pp-stamp b { font-family: var(--hand); font-size: 1.3rem; line-height: 1; font-weight: 600; }
.pp-stamp.got b { color: var(--red); }
.pp-stamp:not(.got) b { color: var(--ink-faint); }
.pp-stamp small { font-size: 12px; color: var(--ink-soft); margin-top: 4px; line-height: 1.25; }
.pp-actions { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.pp-share { font-family: var(--mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; background: var(--red); color: var(--paper); border: 0; padding: 13px 20px; cursor: pointer; border-radius: 2px 10px 3px 12px / 10px 3px 10px 3px; }
.pp-note { margin: 14px 0 0; font-family: var(--mono); font-size: 11px; color: var(--ink-soft); }
.pp-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 72; transform: translateX(-50%);
  display: flex; gap: 14px; align-items: center; padding: 12px 20px 12px 14px;
  background: var(--paper); border: 1.5px solid var(--red); color: var(--ink);
  border-radius: 3px 14px 6px 18px / 16px 4px 14px 5px; box-shadow: 0 20px 40px -20px rgba(30, 20, 5, .5);
  animation: toast-in .6s cubic-bezier(.3, 1.6, .5, 1);
}
.pp-toast.out { opacity: 0; transform: translate(-50%, 20px); transition: opacity .5s, transform .5s; }
.pp-toast b { display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--red); font-weight: 500; }
.pp-toast span:last-child { font-family: var(--hand); font-size: 1.5rem; line-height: 1.05; }
.pp-toast-ring { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--red); color: var(--red); display: grid; place-items: center; font-size: 20px; transform: rotate(-12deg); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 30px) scale(.8); } }

/* auklets can be caught */
.sky-layer .auklet { pointer-events: all; cursor: pointer; }

@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  .rail { display: none; }
  .prose-cols, .plate-head { grid-template-columns: 1fr; gap: 3vh; }
  .plate-how { grid-column: 1; grid-row: auto; }
  .plate-stage { height: 62vh; }
  .plate-stage.square { height: min(100vw, 70vh); }
  .ctl.big { min-width: 0; flex: 1; }
  .bday-times { grid-template-columns: 1fr; }
  .pp-btn { left: 10px; bottom: 10px; }
  .pp-card { padding: 26px 18px 20px; }
  .pp-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) { .travel { display: none !important; } }

/* ═════════════════════ v3: games inside the story, the auklet, the ending ═════════════════════ */

/* "your turn" scenes: full-bleed, no frame, drawn straight onto the page */
.play .stage { background: transparent; }
.play-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.play-intro {
  position: absolute; z-index: 5; top: 9vh; left: 50%; transform: translateX(-50%); width: min(620px, 88vw);
  text-align: center; pointer-events: none; text-shadow: var(--halo);
}
.play-turn { margin: 0; font-family: var(--hand); font-size: clamp(2.4rem, 5vw, 4rem); line-height: 1; color: var(--red); transform: rotate(-2deg); }
.play-how { margin: .4em 0 0; font-size: clamp(.95rem, 1.2vw, 1.1rem); color: var(--ink-soft); }
.play-foot {
  position: absolute; z-index: 5; bottom: 5vh; left: 50%; transform: translateX(-50%); width: min(760px, 92vw);
  text-align: center; text-shadow: var(--halo); pointer-events: none;
}
.play-score { margin: 0; min-height: 2.6em; }
.play-score .log { display: block; font-family: var(--mono); font-size: 12px; letter-spacing: .06em; color: var(--ink-soft); margin-bottom: 4px; }
.play-score .log b { color: var(--ink); font-weight: 500; }
.play-score .log b.red { color: var(--red); }
.play-score .msg { display: block; font-family: var(--hand); font-size: clamp(1.35rem, 2vw, 1.8rem); line-height: 1.12; color: var(--ink); }
.play-score .meter { display: inline-block; width: 70px; height: 7px; border: 1px solid var(--ink); vertical-align: middle; border-radius: 2px; }
.play-score .meter i { display: block; height: 100%; background: var(--red); }
.play-tools { margin: 8px 0 0; pointer-events: auto; font-family: var(--hand); font-size: 1.35rem; color: var(--ink-soft); }
.ink-link { font: inherit; color: var(--red); background: none; border: 0; padding: 4px 2px; cursor: pointer; text-decoration: underline; text-decoration-style: wavy; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.ink-link:hover, .ink-link:focus-visible { color: var(--ink); outline: none; }
.play[data-scene] .play-intro, .play .play-foot { transition: opacity .5s; }

/* the auklet narrator */
.bird {
  position: fixed; z-index: 56; bottom: 19vh; left: calc(50% + 22px);
  transition: left 1.1s cubic-bezier(.4, 0, .2, 1), bottom 1.1s cubic-bezier(.4, 0, .2, 1), opacity .6s;
}
.bird[data-side="tomorrow"] { left: calc(50% - 22px - 58px); }
.bird.flying .bird-bob { animation: hop .28s ease-in-out infinite alternate; }
.bird.flying .bird-wing { animation: flapw .14s linear infinite alternate; transform-box: fill-box; transform-origin: right center; }
.bird-body { display: block; width: 58px; height: 54px; padding: 0; border: 0; background: none; cursor: pointer; filter: drop-shadow(0 6px 6px rgba(30, 20, 5, .18)); }
.bird-body svg { width: 100%; height: 100%; overflow: visible; }
.bird-body:focus-visible { outline: 2px dashed var(--red); outline-offset: 4px; border-radius: 50%; }
.bird-bob { animation: bob 2.6s ease-in-out infinite; transform-box: fill-box; }
.bird-back { fill: #2a3340; stroke: var(--ink); stroke-width: 1.4; }
.bird-belly { fill: #f4efe2; stroke: var(--ink); stroke-width: 1; }
.bird-wing { fill: #1d252f; stroke: var(--ink); stroke-width: 1; }
.bird-eye { fill: #f4efe2; }
.bird-pupil { fill: var(--ink); animation: blink 5s infinite; transform-box: fill-box; transform-origin: center; }
.bird-plume { stroke: #f4efe2; stroke-width: 1.3; stroke-linecap: round; }
.bird-bill { fill: #d2402a; stroke: var(--ink); stroke-width: .8; stroke-linejoin: round; }
.bird-legs { stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; }
.bird[data-side="tomorrow"] .bird-body svg { transform: scaleX(-1); }
@keyframes hop { to { transform: translateY(-5px); } }
@keyframes flapw { to { transform: scaleY(-.6); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.bird-say {
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-30%) rotate(-1.5deg);
  width: max-content; max-width: min(300px, 70vw); margin: 0; padding: 10px 14px 9px;
  font-family: var(--hand); font-size: 1.35rem; line-height: 1.12; color: var(--ink);
  background: #f8f3e6; border: 1.5px solid var(--ink); border-radius: 14px 18px 16px 12px / 12px 14px 18px 16px;
  box-shadow: 0 12px 26px -16px rgba(30, 20, 5, .5); animation: say-in .35s cubic-bezier(.3, 1.5, .5, 1);
}
.bird-say::after {
  content: ""; position: absolute; top: 100%; left: 28%; width: 12px; height: 12px; margin-top: -6px;
  background: #f8f3e6; border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: rotate(45deg);
}
.bird[data-side="tomorrow"] .bird-say { transform: translateX(-70%) rotate(1.5deg); }
.bird[data-side="tomorrow"] .bird-say::after { left: auto; right: 22%; }
@keyframes say-in { from { opacity: 0; transform: translateX(-30%) translateY(8px) scale(.9); } }
body.dark .bird-say { box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .7); }
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  .bird { bottom: auto; top: 50px; }
  .bird-body { width: 44px; height: 41px; }
  .bird[data-side="tomorrow"] { left: calc(50% - 22px - 44px); }
  .bird-say { bottom: auto; top: calc(100% + 8px); font-size: 1.2rem; }
  .bird-say::after { top: auto; bottom: 100%; margin: 0 0 -6px; transform: rotate(225deg); }
}

/* cover countdown */
.cover-count { margin: 1.2vh auto 0; font-family: var(--mono); font-size: 12.5px; letter-spacing: .08em; color: var(--red); max-width: 52ch; }
.cover-count b { font-weight: 500; font-variant-numeric: tabular-nums; }

/* midnight celebration */
.midnight {
  position: fixed; inset: 0; z-index: 75; display: grid; place-items: center; pointer-events: none; text-align: center; padding: 20px;
}
.midnight p { margin: 0; font-family: var(--display); font-weight: 300; font-size: clamp(2rem, 6vw, 5rem); line-height: 1; text-shadow: var(--halo); animation: rise 1.4s cubic-bezier(.2, .8, .2, 1) both, fade-out 1s 5s forwards; }
.midnight small { display: block; margin-top: .6em; font-family: var(--hand); font-size: clamp(1.3rem, 2.4vw, 2rem); color: var(--red); }
@keyframes fade-out { to { opacity: 0; } }
.spark { position: fixed; z-index: 74; width: 8px; height: 8px; pointer-events: none; color: var(--red); font-size: 18px; line-height: 1; animation: spark 1.8s ease-out forwards; }
@keyframes spark { from { opacity: 1; transform: translate(0, 0) rotate(0); } to { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(200deg); } }

/* map: dragging the line */
.drag-verdict { margin: .3em 0 0; min-height: 1.3em; font-size: 1rem; }
.map.dragging, .map .idl-handle { cursor: ew-resize; }

/* ending: wait for tomorrow */
.chase { padding-bottom: 6vh; }
.chase-lead { max-width: 46ch; margin: -4vh auto 5vh; font-size: clamp(1.05rem, 1.4vw, 1.3rem); }
.clocks { display: flex; justify-content: center; gap: calc(6vw + 80px); margin-bottom: 5vh; }
.clock-fig { margin: 0; text-align: center; }
.clock { width: clamp(130px, 18vw, 220px); height: auto; overflow: visible; }
.clock .face { fill: #f6f1e4; stroke: var(--ink); stroke-width: 1.6; }
.clock .tick { stroke: var(--ink); stroke-width: 1.2; stroke-linecap: round; }
.clock .hour { stroke: var(--ink); stroke-width: 3.4; stroke-linecap: round; }
.clock .min { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.clock .pin { fill: var(--red); }
.clock-fig figcaption { margin-top: 10px; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.clock-fig figcaption b { display: block; margin-top: 4px; font-family: var(--display); font-size: clamp(1.4rem, 2.6vw, 2.2rem); letter-spacing: -.01em; text-transform: none; font-weight: 340; color: var(--ink); font-style: italic; }
.hold-btn {
  display: block; margin: 0 auto; font-family: var(--mono); font-size: 13px; letter-spacing: .2em; text-transform: uppercase;
  padding: 18px 34px; border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer;
  border-radius: 2px 10px 3px 12px / 10px 3px 10px 3px; user-select: none; -webkit-user-select: none; touch-action: none;
  transition: background .2s, color .2s, transform .2s;
}
.hold-btn.holding { background: var(--ink); color: var(--paper); transform: scale(.97); }
.chase-msg { max-width: 40ch; margin: 3vh auto 0; min-height: 3em; font-family: var(--hand); font-size: clamp(1.5rem, 2.4vw, 2.1rem); line-height: 1.12; text-align: center; }
@media (max-width: 760px) { .clocks { gap: 8vw; } .clock { width: 38vw; } }
.map { touch-action: pan-y; }
.thaw-night { position: absolute; inset: 0; z-index: 0; background: var(--night); pointer-events: none; }
.melt { fill: none; stroke: var(--frost); stroke-linecap: round; }
.thaw-dark .beat { color: var(--frost); text-shadow: 0 0 10px var(--night), 0 0 22px var(--night); }
.thaw-dark .chapter-no { color: #e8735c; }
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  .bird-say, .bird[data-side="tomorrow"] .bird-say { left: 50%; transform: translateX(calc(-50% - 22px)); max-width: min(300px, calc(100vw - 32px)); animation: none; }
  .bird[data-side="tomorrow"] .bird-say { transform: translateX(calc(-50% + 22px)); }
  .bird-say::after, .bird[data-side="tomorrow"] .bird-say::after { left: calc(50% + 16px); right: auto; }
  .bird[data-side="tomorrow"] .bird-say::after { left: calc(50% - 28px); }
}
@media (max-width: 760px), (max-aspect-ratio: 1/1) { .play-intro { top: 13vh; } }
/* on wide screens the auklet perches in the margin wherever the middle of the page is busy */
@media (min-width: 761px) and (min-aspect-ratio: 1/1) {
  body:is([data-scene="play"], [data-scene="days"], [data-scene="birthday"], [data-scene="chase"], [data-scene="send"], [data-scene="cover"]) .bird,
  body:is([data-scene="play"], [data-scene="days"], [data-scene="birthday"], [data-scene="chase"], [data-scene="send"], [data-scene="cover"]) .bird[data-side="tomorrow"] { left: 30px; bottom: 86px; }
  body:is([data-scene="play"], [data-scene="days"], [data-scene="birthday"], [data-scene="chase"], [data-scene="send"], [data-scene="cover"]) .bird .bird-say { left: 0; transform: rotate(-1.5deg); animation: none; }
  body:is([data-scene="play"], [data-scene="days"], [data-scene="birthday"], [data-scene="chase"], [data-scene="send"], [data-scene="cover"]) .bird .bird-say::after { left: 22px; right: auto; }
}
@media (prefers-reduced-motion: reduce) { .bird-bob, .bird-pupil, .bird.flying .bird-bob, .bird.flying .bird-wing { animation: none !important; } .bird { transition: none; } }
