/* Hatchr — v4_2 "The world asks" (from option 4, "One little world").
   One pixel landscape you walk through. Sizes come from --u (one art pixel: 2px on phones, 3px on big screens),
   so the scenery, the sprites and the outlines share a single pixel grid. */

@font-face {
  font-family: "Jersey 15";
  src: url("../fonts/Jersey15-Regular.ttf") format("truetype");
  font-display: block; /* preloaded; never swap fonts mid-read (the text would jump) */
}

:root {
  --ink: #100603;
  --white: #ffffff;
  --sky: #DAF1FE;
  --grass: #B7D887;
  --meadow: #80BC91;
  --sand: #F8E5B8;
  --reef-sand: #FFF3CF;
  --night: #17244D;
  --night-low: #3F4687;
  --water: #76CDCC;
  --water-deep: #36A5B7;
  --pellet: #FE801F;
  --done: #8FFFA0;
  --blush: #FC8C92;
  --gold: #F2BE1C;

  --u: 2px;                 /* one art pixel */
  --s: calc(var(--u) * 64); /* a pet sprite */
  --p: 64px;                /* a prop sprite (pieces, chests) */
  --line: 2px;              /* the app's 2pt outline */
  --gutter: 16px;
  --hud: 64px;

  /* the app's design tokens (Hatchr/Sources/DesignSystem/Tokens.swift): use these, never one-off values */
  --r-xs: 4px;              /* wooden signs, tiny swatches */
  --r-sm: 8px;              /* small tiles: icons, meters */
  --r-md: 12px;             /* cards, buttons, bubbles, fields */
  --r-lg: 16px;             /* big panels: menu, naming, legal text */
  --r-pill: 999px;          /* chips and tags */
  --d-card: 5px;            /* the solid ink drop under cards and buttons; they press down by exactly this */
  --d-ctl: 3px;             /* the smaller drop under bubbles, signs and tags (header controls have none, like the app) */
  --ctl: 40px;              /* every header control (ControlSize.header); hit areas grow to --tap */
  --tap: 44px;
  --t-xs: 1.125rem;
  --t-sm: 1.375rem;
  --t-md: 1.5rem;
  --t-lg: 2rem;
  --wood: #C98B52;
  --wood-dark: #A46A3A;
  --pressed: #F3F3F3;       /* a white control while it's held down */
  --over: 0px;              /* how far the pixel canvas runs past the right edge */
  --base: 130px;            /* ground line, measured up from the bottom of a stop */

  --t-hero: clamp(3.25rem, 2.2rem + 5vw, 6.5rem);
  --t-head: clamp(2.5rem, 1.9rem + 2.8vw, 4.25rem);
  --t-body: clamp(1.375rem, 1.2rem + .6vw, 1.75rem);
  --t-small: var(--t-sm);
}
@media (min-width: 900px) {
  :root { --u: 3px; --p: 128px; --gutter: max(48px, 6vw); --hud: 76px; }
}
/* phones on their side: the world draws at one CSS px per art px (world.js) and the words shrink to fit above it */
@media (max-height: 500px) {
  :root {
    --u: 1px; --p: 48px; --hud: 56px;
    --t-hero: 2.25rem; --t-head: 2rem; --t-body: 1.125rem;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; overscroll-behavior-x: none; }
html:has(dialog[open]) { overflow: hidden; } /* the world doesn't scroll behind the menu */
body {
  margin: 0;
  font-family: "Jersey 15", ui-rounded, system-ui, sans-serif;
  font-size: var(--t-body);
  line-height: 1.1;
  color: var(--ink);
  background: var(--reef-sand);
  -webkit-font-smoothing: antialiased;
}
img { image-rendering: pixelated; image-rendering: crisp-edges; -webkit-user-drag: none; }
body {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
input, .panel { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
h1, h2, p { margin: 0; font-weight: 400; }
a { color: inherit; }
button { font: inherit; color: inherit; }

.skip {
  position: absolute; left: 12px; top: -80px; z-index: 50;
  background: var(--white); border: var(--line) solid var(--ink); border-radius: var(--r-md); padding: 8px 12px; text-decoration: none;
}
.skip:focus { top: 12px; }

:focus-visible { outline: none; }
/* (the focus ring itself is the last rule in this file, so it wins over every component's drop) */
:is(.pet, .nib, .piece, .chest, .gold-chest, .cloud, .star, .egg-btn, .sign, .sunk-sign):focus-visible { border-radius: var(--r-md); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- HUD: always on top, like the app's header ---------- */

.hud {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  height: calc(var(--hud) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) var(--gutter) 0;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  margin-right: auto; text-decoration: none;
  font-size: var(--t-lg); line-height: 1;
  transition: color .2s steps(2);
}
.brand img { width: var(--ctl); height: var(--ctl); border: var(--line) solid var(--ink); border-radius: var(--r-sm); }
html[data-tod="night"] .brand { color: var(--white); }
html[data-tod="night"] .brand img { border-color: var(--white); }

.wallet {
  cursor: pointer; font-family: inherit; color: var(--ink); -webkit-tap-highlight-color: transparent;
  position: relative; display: inline-flex; align-items: center; gap: 4px; flex: none;
  height: var(--ctl); padding: 0 8px; margin: 0;
  background: var(--white); border: var(--line) solid var(--ink); border-radius: var(--r-pill);
  font-size: var(--t-md); line-height: 1;
}
/* header controls are --ctl tall but take a --tap hit, like the app's CircleIconButton */
.wallet::before, .menu-btn::before, .get-btn.small::before { content: ""; position: absolute; inset: calc((var(--ctl) - var(--tap)) / 2 - var(--line)); }
.wallet img { width: 22px; height: 20px; }
.wallet.bump { animation: bump .28s steps(3); }
.wallet.shake { animation: shake .36s steps(6); }
@keyframes bump { 40% { transform: translateY(-4px); } }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.hud-badge { transition: transform .18s steps(3), opacity .18s steps(3); }
.hud-badge[data-hidden] { display: none; } /* takes no room, so the wallet sits right next to the pause button */

/* ---------- text that lives in the sky ---------- */

.say { max-width: 560px; }
.say h1 { font-size: var(--t-hero); line-height: .86; letter-spacing: .005em; }
.say h2 { font-size: var(--t-head); line-height: .9; }
.say p { margin-top: 12px; max-width: 22em; }
.say .fine { margin-top: 8px; font-size: var(--t-small); }
.say .aside { margin-top: 16px; font-size: var(--t-small); max-width: 20em; opacity: .85; }
/* Get Hatchr: the app's PrimaryButton (pellet fill, 2pt ink outline, solid ink drop it presses down into) */
.get-btn {
  --depth: var(--d-card); --drop: var(--depth);
  display: inline-flex; align-items: center; gap: 12px; margin: 24px 0 var(--depth);
  min-height: 60px; padding: 8px 16px 8px 8px;
  color: var(--ink); text-decoration: none; background: var(--pellet);
  border: var(--line) solid var(--ink); border-radius: var(--r-md); box-shadow: 0 var(--depth) 0 var(--ink);
  transition: transform .06s steps(1), box-shadow .06s steps(1);
}
.get-btn:active { transform: translateY(var(--depth)); box-shadow: 0 0 0 var(--ink); }
.get-btn img { width: 40px; height: 40px; flex: none; border: var(--line) solid var(--ink); border-radius: var(--r-sm); }
.get-btn span { display: grid; gap: 2px; }
.get-btn b { font-weight: 400; font-size: var(--t-lg); line-height: .85; }
.get-btn small { font-size: var(--t-xs); line-height: 1; }
/* in the header it's one more --ctl-tall pill, flat like the wallet beside it */
.get-btn.small {
  --depth: 0px; position: relative; flex: none; height: var(--ctl); min-height: 0; margin: 0; padding: 0 12px;
  border-radius: var(--r-pill); font-size: var(--t-md); line-height: 1; white-space: nowrap;
}
.get-btn.small:active { transform: none; background: #E8701A; }
@media (max-height: 500px) {
  .get-btn { min-height: 48px; margin-top: 12px; padding: 4px 12px 4px 4px; }
  .get-btn img { width: 32px; height: 32px; }
  .get-btn b { font-size: var(--t-md); }
}
@media (min-width: 900px) {
  .say p { margin-top: 16px; }
  .get-btn { min-height: 66px; }
  .get-btn b { font-size: 2.25rem; }
}
.stop-night .say { color: var(--white); }

/* ---------- things you can tap ---------- */

.pet, .piece, .chest, .nib, .sign {
  display: block; padding: 0; margin: 0; border: 0; background: none; cursor: pointer;
  position: relative; line-height: 0; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.pet img, .nib img { width: var(--s); height: var(--s); display: block; }
.piece img, .chest img { width: var(--p); height: var(--p); display: block; }
.hop img { animation: hop .32s steps(4); }
@keyframes hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(calc(var(--u) * -10)); } }
.dart img { animation: dart .5s steps(5); }
@keyframes dart { 30% { transform: translateX(calc(var(--u) * -8)); } 60% { transform: translateX(calc(var(--u) * 6)); } }
.chomp img { animation: chomp .3s steps(3); }
@keyframes chomp { 50% { transform: translateY(calc(var(--u) * 3)); } }

/* little popups above whatever was tapped */
.pop {
  position: absolute; left: 50%; bottom: 100%; z-index: 5; pointer-events: none;
  transform: translateX(-50%);
  animation: rise .9s steps(9) forwards;
}
.pop.heart { width: calc(var(--u) * 16); height: calc(var(--u) * 16); }
@keyframes rise { 0% { transform: translate(-50%, 0); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(-50%, calc(var(--u) * -24)); opacity: 0; } }

.bubble {
  position: absolute; left: 50%; bottom: calc(100% + var(--u) * 4); z-index: 6;
  transform: translateX(-50%);
  white-space: nowrap; pointer-events: none;
  padding: 4px 12px; font-size: var(--t-sm); line-height: 1; color: var(--ink);
  background: var(--white); border: var(--line) solid var(--ink); border-radius: var(--r-md);
  box-shadow: 0 var(--d-ctl) 0 var(--ink);
  animation: popin .16s steps(2);
}
.bubble::after {
  content: ""; position: absolute; left: 50%; top: 100%; width: 10px; height: 10px; margin: -4px 0 0 -5px;
  background: var(--white); border: solid var(--ink); border-width: 0 var(--line) var(--line) 0; transform: rotate(45deg);
}
.bubble.big { font-size: var(--t-lg); padding: 8px 16px; }
.bubble.end { left: auto; right: 0; transform: none; animation-name: popin-end; }
.bubble.end::after { left: auto; right: 24px; }
@keyframes popin-end { from { transform: translateY(6px); opacity: 0; } }
@keyframes popin { from { transform: translate(-50%, 6px); opacity: 0; } }

.flyer {
  position: fixed; z-index: 30; pointer-events: none; left: 0; top: 0;
  image-rendering: pixelated;
}

.bubbles { position: absolute; left: 50%; top: 20%; pointer-events: none; }
.bubbles i {
  position: absolute; width: calc(var(--u) * 4); height: calc(var(--u) * 4);
  border: var(--u) solid #E6FFFC; border-radius: var(--u);
  animation: bubble 1s steps(10) forwards;
}
@keyframes bubble { to { transform: translateY(calc(var(--u) * -50)); opacity: 0; } }

/* habit signposts: a habit card on a post, Due → Completed like the app */
.sign { display: flex; flex-direction: column; align-items: center; }
.sign .board {
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  width: calc(var(--u) * 72); min-height: calc(var(--u) * 44);
  padding: 8px 12px; text-align: left; line-height: 1;
  background: var(--white); border: var(--line) solid var(--ink); border-radius: var(--r-md);
  box-shadow: 0 var(--d-ctl) 0 var(--ink);
  transition: background-color .12s steps(2);
}
.sign b { font-weight: 400; font-size: var(--t-sm); }
.sign .row { display: flex; justify-content: space-between; align-items: center; font-size: var(--t-xs); }
.sign .pay { display: inline-flex; align-items: center; gap: 4px; }
.sign .pay img { width: 22px; height: 20px; }
.sign .post {
  display: block; width: calc(var(--u) * 5); height: calc(var(--u) * 60);
  background: var(--wood-dark); border: var(--line) solid var(--ink); border-top: 0;
}
.sign.mid .post { height: calc(var(--u) * 52); }
.sign.short .post { height: calc(var(--u) * 24); }
.sign:active .board { transform: translateY(var(--d-ctl)); box-shadow: 0 0 0 var(--ink); }
.sign.checking .board { background: var(--pressed); }
.sign.done .board { background: var(--done); }
.sign.snap .board { outline: 3px dashed var(--ink); outline-offset: 8px; }
@media (min-width: 900px) {
  .sign b { font-size: var(--t-md); }
  .sign .row { font-size: var(--t-sm); }
}

.flash { position: absolute; inset: 0; background: var(--white); opacity: 0; pointer-events: none; z-index: 8; }
.flash.on { animation: flash .22s steps(3); }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }

/* feeding */
.feeder { position: relative; }
.level {
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); z-index: 2;
  display: flex; align-items: stretch; gap: 8px; white-space: nowrap;
}
.lv {
  display: inline-block; padding: 4px 8px; font-size: var(--t-sm); line-height: 1;
  background: #EACBEC; border: var(--line) solid var(--ink); border-radius: var(--r-pill);
}
.bar { display: inline-flex; align-items: stretch; gap: 4px; padding: 4px; background: var(--white); border: var(--line) solid var(--ink); border-radius: var(--r-pill); }
.bar i { width: 14px; background: #E4E4E4; border-radius: var(--r-pill); transition: background-color .1s steps(2); }
.bar i.on { background: var(--pellet); }
.burst {
  position: absolute; left: 50%; top: 50%; width: calc(var(--s) * 2.4); aspect-ratio: 1; z-index: -1;
  transform: translate(-50%, -50%); pointer-events: none; opacity: 0;
  background: repeating-conic-gradient(var(--pellet) 0 12deg, transparent 12deg 30deg);
  -webkit-mask: radial-gradient(closest-side, #000 55%, transparent 56%);
  mask: radial-gradient(closest-side, #000 55%, transparent 56%);
}
.burst.on { opacity: 1; animation: spin 2.4s steps(24) forwards; }
@keyframes spin { from { transform: translate(-50%, -50%) rotate(0); } to { transform: translate(-50%, -50%) rotate(90deg); opacity: 0; } }
.chest { animation: drop .45s steps(5); }
.chest[hidden] { display: none; }
@keyframes drop { 0% { transform: translateY(calc(var(--u) * -60)); } 70% { transform: translateY(0); } 85% { transform: translateY(calc(var(--u) * -6)); } }

/* night: animals you haven't met yet are grey stamps, like the collection book */
.pet.shadow img { filter: brightness(0) invert(.82); transition: filter .2s steps(3); }
.pet.shadow.found img { filter: none; }
.name {
  position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); white-space: nowrap;
  padding: 4px 8px; font-size: var(--t-sm); line-height: 1; color: var(--ink);
  background: var(--white); border: var(--line) solid var(--ink); border-radius: var(--r-pill);
  animation: popin .16s steps(2);
}

/* ---------- Nib ---------- */
.nib { z-index: 4; }
.nib img { pointer-events: none; }

/* =====================================================================
   Stacked layout: no JS, or reduced motion. Same places, one after another.
   ===================================================================== */
html:not(.travel) .scene, html:not(.travel) .flash { display: none; }
html:not(.travel) .hud { position: sticky; top: 0; background: var(--white); border-bottom: var(--line) solid var(--ink); }
html:not(.travel) html[data-tod] .brand { color: var(--ink); }
html:not(.travel) .stop {
  position: relative; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 0 8px;
  padding: 48px var(--gutter) 64px;
  background:
    linear-gradient(to top, var(--sand) 0 36px, var(--grass) 36px 96px, transparent 96px),
    var(--sky);
}
html:not(.travel) .say { flex: 1 1 100%; margin-bottom: 48px; max-width: none; }
html:not(.travel) .cast { display: flex; align-items: flex-end; gap: 8px; }
html:not(.travel) .stop-meadow { flex-wrap: wrap; gap: 0; }
html:not(.travel) .stop-meadow .say { margin-bottom: 40px; }
html:not(.travel) .stop-meadow .pet, html:not(.travel) .nib-slot { margin: 0 -12px; }
html:not(.travel) .cloud, html:not(.travel) .star { display: none; }
html:not(.travel) .stop-feed { --sky: #CBE7FB; }
html:not(.travel) .stop-egg { --sky: #FFE0A8; --grass: #DCC98C; --sand: #F7D6A6; }
html:not(.travel) .stop-night { --sky: var(--night); --grass: #3A4A86; --sand: #59619C; }
html:not(.travel) .stop-reef { --sky: var(--water); --grass: var(--water-deep); --sand: var(--reef-sand); }
html:not(.travel) .stop-night .say { color: var(--white); }
html:not(.travel) .pet.back { display: none; }
html:not(.travel) .feeder { margin-top: 48px; }
html:not(.travel) .stop { overflow-x: clip; } /* the hatch sunburst is wider than a phone */
html:not(.travel) .stop-egg .say { margin-bottom: 132px; } /* room for "It's a Chick!" over the nest */
html:not(.travel) .nib-slot .nib { display: block; }
html:not(.travel) .stage > .nib { display: none; }
html.no-js .nib { display: none; }
@media (max-width: 899px) { .wide-only { display: none; } }

/* =====================================================================
   Travel: a sticky stage; scrolling walks the camera through the world.
   ===================================================================== */
html.travel .journey { position: relative; }
html.travel .stage { position: fixed; left: 0; top: 0; width: 100%; height: 100vh; height: 100lvh; overflow: hidden; overflow: clip; background: var(--sky); }
html.travel { overscroll-behavior-y: none; } /* no pull-to-refresh: it would wipe the walk */
html.travel .scene {
  position: absolute; left: 0; top: 0;
  image-rendering: pixelated; image-rendering: crisp-edges;
}
html.travel .world { position: absolute; left: 0; top: 0; will-change: transform; }
html.travel .stop { position: absolute; top: 0; height: 100vh; }
/* Every place's words sit in the same spot under the HUD: pinned there (world.js cancels the camera), they
   cross-fade in pixel steps as you walk from one place to the next. */
html.travel .say {
  position: absolute; left: var(--gutter); right: calc(var(--over) + var(--gutter));
  top: calc(var(--hud) + env(safe-area-inset-top) + 3vh); z-index: 5;
}
@media (max-height: 500px) {
  html.travel .say { top: calc(var(--hud) + env(safe-area-inset-top)); max-width: 40%; }
  html.travel .say p:not(.fine) { display: none; } /* headings only: the world needs the height */
  html.travel .stop-night .s1 { top: 30%; }
  html.travel .stop-night .s2 { top: 36%; }
  .sign .board { width: 132px; min-height: 0; padding: 4px 8px; gap: 4px; }
  .sign b { font-size: var(--t-xs); }
}
html.travel .say { pointer-events: none; } /* the words never steal a tap from the world under them */
html.travel .say a { pointer-events: auto; }
html.travel .say.away a { pointer-events: none; }
/* first frame: nothing in the world shows until it's laid out */
html.travel:not(.ready) .stage > * { visibility: hidden; }
html:not(.no-js):not(.fonts) .hud > *, html:not(.no-js):not(.fonts) .panel { visibility: hidden; }
html.no-js .hud-badge[data-hidden] { opacity: 1; transform: none; pointer-events: auto; visibility: visible; }
html.travel .cast {
  position: absolute; bottom: var(--base);
  display: flex; align-items: flex-end;
}
html.travel .cast.left { right: calc(50% + var(--s) * .5 - var(--u) * 10); }
html.travel .cast.right { left: calc(50% + var(--s) * .5 - var(--u) * 10); }
html.travel .pet.back { margin-bottom: calc(var(--u) * 14); z-index: -1; }
html.travel .stop-meadow .cast { z-index: 0; } /* its own layer, so the pets standing behind stay tappable */
html.travel .cast.left .pet.back { margin-right: calc(var(--s) * -.5); }
html.travel .cast.right .pet.back { margin-left: calc(var(--s) * -.5); }
@media (min-width: 900px) {
  html.travel .cast.left .pet.back { margin-right: calc(var(--s) * -.2); }
  html.travel .cast.right .pet.back { margin-left: calc(var(--s) * -.2); }
}
html.travel .stage > .nib { position: absolute; left: 0; top: 0; will-change: transform; }
/* sideways swipes are ours (world.js walks a place at a time); up and down scroll the page as usual */
html.travel .stage { touch-action: pan-y pinch-zoom; }
.scroll-cue { display: none; }
html.travel .scroll-cue {
  position: absolute; left: 50%; bottom: calc(100lvh - 100svh + 12px + env(safe-area-inset-bottom)); z-index: 6;
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 4px 12px 6px; pointer-events: none;
  font-size: var(--t-sm); line-height: 1; white-space: nowrap;
  background: var(--white); border: var(--line) solid var(--ink); border-radius: var(--r-pill); box-shadow: 0 var(--d-ctl) 0 var(--ink);
  transform: translateX(-50%); opacity: 0; visibility: hidden; transition: opacity .2s steps(2), visibility 0s .2s;
}
html.travel .scroll-cue.on { opacity: 1; visibility: visible; transition: opacity .2s steps(2); }
@media (pointer: coarse) { html .scroll-cue svg { display: none; } } /* a swipe goes either way; the arrow is for scroll wheels */
.scroll-cue svg { display: block; width: 14px; height: 10px; fill: var(--ink); animation: cue-bob 1s steps(1) infinite; }
@keyframes cue-bob { 50% { transform: translateY(3px); } }

html.travel .stop-habits .cast { gap: calc(var(--u) * 12); }
html.travel .stop-habits .cast.left { right: calc(50% + var(--s) * .08); }
html.travel .stop-habits .cast.right { left: calc(50% + var(--s) * .08); }
html.travel .stop-habits .cast.left .sign { margin-bottom: calc(var(--u) * 2); }
html.travel .stop-feed .cast.right { left: calc(50% + var(--s) * .3); }
html.travel .stop-feed .cast.left { right: calc(50% + var(--s) * .45); }
html.travel .stop-egg .cast.left { right: calc(50% + var(--s) * .5 + var(--u) * 2); } /* clear of Nib, so every piece takes its tap */
html.travel .stop-egg .cast.right { left: calc(50% + var(--s) * .4); }
html.travel .stop-night .cast { gap: calc(var(--u) * 8); }
html.travel .stop-night .cast.left { right: calc(50% + var(--s) * .45); }
html.travel .stop-night .cast.right { left: calc(50% + var(--s) * .45); }
html.travel .stop-reef .cast { gap: calc(var(--u) * 10); }
html.travel .stop-reef .cast { position: static; }
html.travel .stop-reef .float { position: absolute; }
html.travel .stop-reef .f1 { left: calc(50% - var(--s) * 1.5); bottom: calc(var(--base) + var(--u) * 44); }
html.travel .stop-reef .f4 { left: calc(50% + var(--s) * .2); bottom: calc(var(--base) - var(--u) * 34); }
html.travel .stop-reef .f2 { left: calc(50% + var(--s) * .45); bottom: calc(var(--base) + var(--u) * 52); }
html.travel .stop-reef .f3 { left: calc(50% + var(--s) * 1.5); bottom: calc(var(--base) - var(--u) * 18); }
html.travel .stop-reef .float img { animation: drift 3.2s steps(4) infinite; }
html.travel .stop-reef .f2 img { animation-delay: -1.1s; }
html.travel .stop-reef .f4 img { animation-delay: -2s; }
@keyframes drift { 50% { transform: translateY(calc(var(--u) * -4)); } }
html.travel .stop-reef .float.dart img { animation: dart .5s steps(5); }
html.travel .stop-reef .float.hop img { animation: hop .32s steps(4); }
@media (min-width: 900px) {
  html.travel .say { max-width: 640px; }
  html.travel .stop-meadow .say { max-width: 760px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* =====================================================================
   v4_2 additions. Each block is one separable part (see NOTES.md).
   ===================================================================== */

/* ---------- HUD: pause button (Footer part) ---------- */
.menu-btn {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: var(--ctl); height: var(--ctl); padding: 0; margin: 0; cursor: pointer;
  background: var(--white); border: var(--line) solid var(--ink); border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}
.menu-btn:active, .wallet:active { background: var(--pressed); }
.pause-bars { display: flex; gap: 4px; }
.pause-bars i { width: 4px; height: 14px; background: var(--ink); }
/* phones: once the HUD badge is up, the brand keeps only its icon */
@media (max-width: 480px) { html.badge-up .brand span { display: none; } }

/* ---------- Hints: the world asks ---------- */
.ask-bubble {
  position: absolute; left: 50%; bottom: calc(100% + var(--u) * 5); z-index: 7;
  transform: translateX(-50%);
  white-space: nowrap; pointer-events: none;
  padding: 4px 12px; font-size: var(--t-sm); line-height: 1; color: var(--ink);
  background: var(--white); border: var(--line) solid var(--ink); border-radius: var(--r-md);
  box-shadow: 0 var(--d-ctl) 0 var(--ink);
  animation: ask-in .2s steps(2), ask-bob 1.2s steps(1) .2s infinite;
}
.ask-bubble::after {
  content: ""; position: absolute; left: calc(50% + var(--tail, 0px)); top: 100%; width: 10px; height: 10px; margin: -4px 0 0 -5px;
  background: inherit; border: solid var(--ink); border-width: 0 var(--line) var(--line) 0; transform: rotate(45deg);
}
.ask-bubble.happy { background: var(--done); animation: ask-in .16s steps(2); }
@keyframes ask-in { from { transform: translate(-50%, 8px) scale(.6); opacity: 0; } }
@keyframes ask-bob { 0% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, calc(var(--u) * -2)); } }
.sign .ask-bubble { bottom: calc(100% - var(--u) * 2); }
.nib[data-nudge-at="1"] > .ask-bubble { bottom: auto; top: calc(100% + var(--u) * 3); }
.nib[data-nudge-at="1"] > .ask-bubble::after { top: auto; bottom: 100%; margin: 0 0 -4px -5px; border-width: var(--line) 0 0 var(--line); }
.sign .board { position: relative; }
.pile .ask-bubble { bottom: calc(100% + var(--u) * 2); }

/* what's asking wiggles every couple of seconds, like it can't wait */
.asking > img, .asking > .board, .pile.asking .piece:not(.gone), .nest.asking > img.whole {
  animation: wiggle 2.4s infinite; transform-origin: 50% 100%;
}
.pile.asking .piece:nth-child(2n) { animation-delay: .12s; }
@keyframes wiggle {
  0%, 30%, 100% { transform: none; }
  4% { transform: rotate(-7deg); }
  8% { transform: rotate(6deg); }
  12% { transform: rotate(-4deg); }
  16% { transform: translateY(calc(var(--u) * -5)); }
  22% { transform: none; }
}

/* reaction bubbles from the HUD hang below it */
.bubble.below { bottom: auto; top: calc(100% + 8px); }
.bubble.below::after { top: auto; bottom: 100%; margin: 0 0 -4px -5px; border-width: var(--line) 0 0 var(--line); }

/* ---------- Egg & hatch: pieces and the nest ---------- */
.pile { position: relative; width: calc(var(--u) * 76); height: calc(var(--u) * 40); }
.piece {
  position: absolute; display: block; padding: 0; border: 0; background-color: transparent;
  width: calc(var(--u) * var(--bw, 20)); height: calc(var(--u) * var(--bh, 20));
  background-repeat: no-repeat; background-size: calc(var(--u) * 64) calc(var(--u) * 64);
  background-position: calc(var(--u) * var(--bx, 0) * -1) calc(var(--u) * var(--by, 0) * -1);
  image-rendering: pixelated; cursor: pointer; transform: rotate(calc(var(--tilt) * 1deg));
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.piece.flying { cursor: default; pointer-events: none; transform: none; }
.pile .piece[data-shard="4"] { --tilt: -8; left: 0; bottom: 0; }
.pile .piece[data-shard="5"] { --tilt: 6; left: 32%; bottom: 0; z-index: 1; }
.pile .piece[data-shard="3"] { --tilt: -4; left: 62%; bottom: 0; }
.pile .piece[data-shard="1"] { --tilt: 14; left: 12%; bottom: 40%; }
.pile .piece[data-shard="2"] { --tilt: -12; left: 46%; bottom: 44%; z-index: 2; }
.piece.gone { visibility: hidden; }
.pile.asked-done { visibility: hidden; }
.pile.asked-done .ask-bubble { visibility: visible; }

.nest { position: relative; width: var(--s); height: var(--s); }
.nest .rays {
  position: absolute; left: 50%; top: 50%; width: calc(var(--s) * 2.1875); height: calc(var(--s) * 2.1875);
  transform: translate(-50%, -50%); z-index: -1; opacity: 0; pointer-events: none; image-rendering: pixelated;
}
.egg-btn {
  position: absolute; inset: 0; display: block; padding: 0; margin: 0; border: 0; background: none; line-height: 0;
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.egg-btn:disabled { cursor: default; }
.egg-btn:not(:disabled):active .shell { scale: .94 .94; }
.shell { position: absolute; inset: 0; transform-origin: 50% 100%; }
.shell img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.shell .ghost { filter: brightness(0); opacity: .14; }
.shell .shard, .shell .whole, .shell .crack { visibility: hidden; }
.shell .shard.placed { visibility: visible; }
.shell .shard.lock { animation: lock .3s steps(3); }
@keyframes lock { 0% { transform: scale(1.18); filter: brightness(2.2); } 60% { transform: scale(.96); filter: none; } }
.nest.whole .shell .shard, .nest.whole .shell .ghost { visibility: hidden; }
.nest.whole .shell .whole { visibility: visible; }
.nest.whole .shell .crack.on { visibility: visible; }
.nest.broken .shell .whole, .nest.broken .shell .crack, .nest.broken .shell .ghost { visibility: hidden; }
.nest.broken .shell .shard { visibility: visible; animation: none; }
.nest.gone .egg-btn { visibility: hidden; }
.nest .hatched { position: absolute; inset: 0; visibility: hidden; transform: scale(var(--pop, 0)); }
.nest.out .hatched { visibility: visible; }

/* the egg calls out each beat of the hatch in its own bubble (HatchSequenceView's prompts), punching on each tap */
.hatch-say.ask-bubble { font-size: var(--t-lg); padding: 8px 16px; transform: translateX(-50%) scale(var(--k, 1)); transform-origin: 50% 100%; animation: none; }
.hatch-say[hidden], .hatch-title[hidden] { display: none; }
@media (min-width: 900px) { .hatch-say.ask-bubble { font-size: 2.25rem; } }
/* "It's a Chick!" slams in over the new animal, then bobs (LevelUpMotion) */
.hatch-title {
  position: absolute; left: 50%; bottom: calc(100% + var(--u) * 26); z-index: 6;
  white-space: nowrap; font-size: 2.75rem; line-height: 1; pointer-events: none;
  text-shadow: 0 3px 0 var(--white);
  transform: translateX(-50%) scale(var(--k, 1)); transform-origin: 50% 100%;
}
.hatch-title.bob { animation: title-bob .8s steps(1) infinite; }
@keyframes title-bob { 0% { translate: 0 calc(var(--u) * -2); } 50% { translate: 0 0; } }
@media (min-width: 900px) { .hatch-title { font-size: 4rem; } }

.fx { position: fixed; left: 0; top: 0; z-index: 25; pointer-events: none; image-rendering: pixelated; }
.whiteout { position: fixed; inset: 0; z-index: 26; background: var(--white); opacity: 0; pointer-events: none; }

/* ---------- Surprises ---------- */
.cloud {
  position: absolute; z-index: 2; padding: 10px; border: 0; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cloud .glyph { display: block; position: relative; width: calc(var(--u) * 30); height: calc(var(--u) * 6); margin-top: calc(var(--u) * 6); background: var(--white); }
.cloud .glyph::before { content: ""; position: absolute; left: calc(var(--u) * 7); bottom: 100%; width: calc(var(--u) * 14); height: calc(var(--u) * 6); background: var(--white); }
.cloud.puff .glyph { animation: puff .4s steps(4); }
@keyframes puff { 50% { transform: scale(1.2, .8); } }
.drop-freeze {
  position: absolute; left: 50%; top: 60%; width: calc(var(--u) * 16); height: calc(var(--u) * 16); margin-left: calc(var(--u) * -8);
  pointer-events: none; animation: snowfall .85s steps(8) forwards;
}
@keyframes snowfall { 0% { transform: translateY(0); } 80% { opacity: 1; } 100% { transform: translateY(calc(var(--u) * 40)); opacity: 0; } }
html.travel .stop-meadow .cloud { right: calc(var(--over) + var(--gutter)); top: 52%; }
@media (min-width: 900px) { html.travel .stop-meadow .cloud { right: calc(var(--over) + 18%); top: 46%; } }

.star {
  position: absolute; z-index: 2; width: 44px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer;
  display: grid; place-items: center; -webkit-tap-highlight-color: transparent;
}
.star .glyph { position: relative; width: calc(var(--u) * 3); height: calc(var(--u) * 3); background: #FFE7A3; animation: twinkle 1.8s steps(1) infinite; }
.star .glyph::before, .star .glyph::after { content: ""; position: absolute; background: #FFE7A3; }
.star .glyph::before { left: 0; top: calc(var(--u) * -3); width: 100%; height: calc(var(--u) * 9); }
.star .glyph::after { top: 0; left: calc(var(--u) * -3); height: 100%; width: calc(var(--u) * 9); }
.star.s2 .glyph { animation-delay: -.9s; }
@keyframes twinkle { 50% { transform: scale(.6); } }
.star.shoot .glyph { animation: shoot .6s steps(8) forwards; box-shadow: calc(var(--u) * 4) calc(var(--u) * -2) 0 #FFE7A3, calc(var(--u) * 8) calc(var(--u) * -4) 0 rgba(255, 231, 163, .5); }
@keyframes shoot { to { transform: translate(calc(var(--u) * -60), calc(var(--u) * 30)); opacity: 0; } }
html.travel .stop-night .s1 { left: calc(50% + var(--s) * .9); top: 50%; }
html.travel .stop-night .s2 { left: calc(50% - var(--s) * 1.2); top: 56%; }

/* ---------- Footer: the reef floor ---------- */
.seabed { position: absolute; left: 0; right: var(--over); bottom: calc(var(--u) * 8); height: 0; }
.gold-chest {
  position: absolute; right: calc(50% - var(--u) * 4); bottom: 0; padding: 0; border: 0; background: none; line-height: 0;
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.gold-chest img { width: var(--p); height: var(--p); }
.gold-chest > .ask-bubble { margin-left: 32px; --tail: -32px; }
.gold-chest.open img { animation: hop .32s steps(4); }
.sunk-sign {
  position: absolute; right: calc(50% + var(--u) * 2 + var(--p)); bottom: 0;
  display: flex; flex-direction: column; align-items: flex-start; text-decoration: none; color: var(--ink);
  transform: rotate(4deg); transform-origin: 20% 100%;
}
.sunk-sign .plank {
  position: relative; z-index: 1; padding: 4px 8px; font-size: var(--t-xs); line-height: .95;
  background: var(--wood); border: var(--line) solid var(--ink); border-radius: var(--r-xs); box-shadow: 0 var(--d-ctl) 0 var(--ink);
}
.sunk-sign .plank.arrow { margin-top: 4px; margin-left: 10px; padding-right: 18px; clip-path: polygon(0 0, 86% 0, 100% 50%, 86% 100%, 0 100%); box-shadow: none; transform: rotate(-12deg); }
.sunk-sign .stick { width: calc(var(--u) * 4); height: calc(var(--u) * 14); margin-left: 16px; background: var(--wood-dark); border: var(--line) solid var(--ink); border-top: 0; }
@media (min-width: 900px) { .sunk-sign .plank { font-size: var(--t-sm); } }
html:not(.travel) .seabed { position: relative; flex: 1 1 100%; height: calc(var(--p) + 8px); margin-top: 24px; }

/* the menu itself: one card, two ways in */
.menu {
  width: min(calc(100vw - var(--gutter) * 2), 440px); max-height: 92svh; padding: 0; border: 0; background: none; overflow: visible; color: var(--ink);
}
.menu-card:focus { outline: none; }
.menu::backdrop { background: rgba(16, 6, 3, .45); }
.menu-card {
  position: relative; padding: 24px 16px 16px; overflow: auto; overscroll-behavior: contain; max-height: calc(92svh - var(--d-card));
  background: var(--white); border: var(--line) solid var(--ink); border-radius: var(--r-lg); box-shadow: 0 var(--d-card) 0 var(--ink);
}
.menu[data-mode="pause"][open] .menu-card { animation: menu-drop .26s steps(4); }
.menu[data-mode="chest"][open] .menu-card {
  animation: menu-rise .36s steps(6);
  background: linear-gradient(var(--white), var(--white)) padding-box, var(--white);
}
.menu[data-mode="chest"] .menu-card { border-color: var(--ink); box-shadow: 0 var(--d-card) 0 var(--ink), 0 0 0 6px var(--gold) inset; }
@keyframes menu-drop { from { transform: translateY(-60vh); } 75% { transform: translateY(10px); } }
@keyframes menu-rise {
  from { transform: translate(calc(var(--ox, 50vw) - 50vw), calc(var(--oy, 80vh) - 50vh)) scale(.12); }
  80% { transform: translateY(-8px) scale(1.03); }
}
.menu-title { font-size: var(--t-head); line-height: .9; }
.menu-sub { margin-top: 8px; font-size: var(--t-sm); }
.menu-spots { display: grid; gap: 12px; margin-top: 16px; }
.menu-spots a, .chunky { --drop: var(--d-card); }
.menu-spots a {
  display: flex; align-items: center; gap: 12px; margin-bottom: var(--d-card); padding: 0 12px 0 0; text-decoration: none; color: var(--ink);
  background: var(--white); border: var(--line) solid var(--ink); border-radius: var(--r-md); box-shadow: 0 var(--d-card) 0 var(--ink);
  transition: transform .08s steps(2), box-shadow .08s steps(2);
}
.menu-spots a:nth-child(1) { background: #DAF1FE; }
.menu-spots a:nth-child(2) { background: #E6F4D7; }
.menu-spots a:nth-child(3) { background: #FFF0C6; }
.menu-spots a:active { transform: translateY(var(--d-card)); box-shadow: 0 0 0 var(--ink); }
.menu-spots img { width: 64px; height: 64px; flex: none; } /* whole multiples of the pixel art, never blurred */
.menu-spots span { display: flex; flex-direction: column; font-size: var(--t-xs); line-height: 1; }
.menu-spots b { font-weight: 400; font-size: var(--t-lg); }
.menu-socials { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.menu-socials a {
  flex: 1 1 0; min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center; padding: 0 12px;
  font-size: var(--t-sm); text-decoration: none; color: var(--ink); border: var(--line) solid var(--ink); border-radius: var(--r-pill);
}
.menu-actions { display: grid; gap: 12px; margin-top: 16px; }
.menu-legal { margin-top: 16px; font-size: var(--t-xs); text-align: center; opacity: .75; }
html.paused .world *, html.paused .nib { animation-play-state: paused !important; }
html.no-js .menu { display: block; position: static; width: auto; max-height: none; margin: 0; padding: 24px var(--gutter) 40px; background: var(--reef-sand); }
html.no-js .menu-actions, html.no-js .menu-sub { display: none; }
@media (max-height: 700px) { .menu-sub, .menu-legal { display: none; } } /* small phones: Resume stays in view */
/* phones on their side: the three spots sit in a row so Resume stays in view */
@media (max-height: 500px) {
  .menu { width: min(calc(100vw - var(--gutter) * 2), 640px); }
  .menu-card { padding-top: 16px; }
  .menu-sub, .menu-legal, .menu-spots span > :not(b) { display: none; }
  .menu-spots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .menu-spots img { width: 32px; height: 32px; }
  .menu-spots b { font-size: var(--t-md); }
  .menu-actions { grid-template-columns: 1fr 1fr; }
}

.chunky {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 50px; margin: 0 0 var(--d-card); padding: 0 16px;
  text-align: center; text-decoration: none; cursor: pointer;
  font: inherit; font-size: var(--t-md); line-height: 1; color: var(--white);
  background: var(--ink); border: var(--line) solid var(--ink); border-radius: var(--r-md); box-shadow: 0 var(--d-card) 0 #5a4a44;
  transition: transform .08s steps(2), box-shadow .08s steps(2);
}
.chunky:active { transform: translateY(var(--d-card)); box-shadow: 0 0 0 var(--ink); }
.chunky.ghost-btn { background: var(--white); color: var(--ink); box-shadow: 0 var(--d-card) 0 var(--ink); }
.chunky.orange { background: var(--pellet); color: var(--ink); box-shadow: 0 var(--d-card) 0 var(--ink); }

/* ---------- Egg & hatch: naming, on the path under the new animal (HatchNaming) ---------- */
.naming {
  position: absolute; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 8;
  width: min(calc(100vw - var(--gutter) * 2), 440px); display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px;
  background: var(--white); border: var(--line) solid var(--ink); border-radius: var(--r-lg); box-shadow: 0 var(--d-card) 0 var(--ink);
  transform: translateX(-50%) scale(var(--k, 1)); transform-origin: 50% 100%;
}
.naming[hidden] { display: none; }
.naming label { font-size: var(--t-sm); line-height: 1; }
.naming-row { display: flex; gap: 8px; min-width: 0; }
.naming input {
  flex: 1 1 0; min-width: 0; height: 50px; margin: 0; font: inherit; font-size: var(--t-md); padding: 0 12px 2px; color: var(--ink);
  background: var(--white); border: var(--line) solid var(--ink); border-radius: var(--r-md);
  -webkit-appearance: none; appearance: none;
}
.naming .chunky { width: auto; flex: none; }
html:not(.travel) .naming { position: relative; left: auto; bottom: auto; transform: none; flex: 1 1 100%; margin-top: 24px; }
#feeder-pet .ask-bubble, #feeder-pet .bubble { bottom: calc(100% + 48px); } /* above the Lv tag and its bar */

/* ---------- Legal pages: three cozy spots in the same world ---------- */
.spot-page { --path: #F8E5B8; --trail-ink: var(--ink); background: var(--path); }
.spot-page[data-spot="privacy"] { --path: #F7D6A6; }
.spot-page[data-spot="terms"] { --path: #59619C; --trail-ink: var(--white); }
.spot-page[data-spot="terms"] .brand { color: var(--white); }
.spot-page[data-spot="terms"] .brand img { border-color: var(--white); }
html body.spot-page .hud { position: fixed; background: none; border-bottom: 0; transition: background-color .12s steps(2); }
html body.spot-page .hud.solid { background: var(--path); border-bottom: var(--line) solid var(--ink); }
.panel { scroll-margin-top: calc(var(--hud) + 24px); }
.spot-scene { position: relative; overflow: hidden; --u: 2px; height: 316px; } /* legal.js paints 158 art px tall; reserved so the text never jumps */
@media (min-width: 900px) { .spot-scene { height: 396px; } } /* 132 art px at 3px */
html:not(.no-js) .spot-scene:not(.drawn) > :not(canvas) { visibility: hidden; } /* props wait for their places */
.spot-scene canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
.spot-nib, .spot-prop {
  position: absolute; padding: 0; border: 0; background: none; cursor: pointer; line-height: 0;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.spot-nib img { width: calc(var(--u) * 64); height: calc(var(--u) * 64); }
.spot-nib.hop img { animation: hop .32s steps(4); }
.spot-prop::before { content: ""; position: absolute; inset: -12px; }
.spot-prop > .art { position: absolute; left: 0; bottom: 0; display: block; }
.spot-prop.jiggle > .art { animation: jiggle .4s steps(4); transform-origin: 50% 0; }
@keyframes jiggle { 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
.spot-prop.asking > .art { animation: wiggle 2.4s infinite; }

/* padlock on the shed door */
.lock { width: calc(var(--u) * 12); height: calc(var(--u) * 14); }
.lock > .art { width: calc(var(--u) * 12); height: calc(var(--u) * 9); background: var(--gold); border: var(--u) solid var(--ink); }
.lock > .art::before {
  content: ""; position: absolute; left: calc(var(--u) * 1.5); bottom: 100%; width: calc(var(--u) * 7); height: calc(var(--u) * 5);
  border: var(--u) solid var(--ink); border-bottom: 0; border-radius: calc(var(--u) * 3) calc(var(--u) * 3) 0 0;
}
.lock > .art::after { content: ""; position: absolute; left: calc(var(--u) * 4); top: calc(var(--u) * 2); width: calc(var(--u) * 2); height: calc(var(--u) * 3); background: var(--ink); }

/* the help hut's bell and sign */
.bell { width: calc(var(--u) * 10); height: calc(var(--u) * 13); }
.bell > .art {
  width: calc(var(--u) * 10); height: calc(var(--u) * 9); background: var(--gold); border: var(--u) solid var(--ink);
  border-radius: calc(var(--u) * 5) calc(var(--u) * 5) var(--u) var(--u);
}
.bell > .art::before { content: ""; position: absolute; left: calc(var(--u) * 3); top: 100%; width: calc(var(--u) * 2); height: calc(var(--u) * 2); background: var(--ink); }
.bell > .art::after { content: ""; position: absolute; left: calc(var(--u) * 3); bottom: 100%; width: calc(var(--u) * 2); height: calc(var(--u) * 3); background: var(--ink); }
.spot-sign {
  position: absolute; z-index: 1; padding: 2px 10px 4px; font-size: var(--t-md); line-height: 1; color: var(--ink);
  background: var(--wood); border: var(--line) solid var(--ink); border-radius: var(--r-xs); box-shadow: 0 var(--d-ctl) 0 var(--ink); transform: rotate(-4deg);
}

/* the scroll on the stump */
.scroll-roll { width: calc(var(--u) * 34); height: calc(var(--u) * 12); }
.scroll-roll > .art {
  left: calc(var(--u) * 2); width: calc(var(--u) * 30); height: calc(var(--u) * 10); border: var(--u) solid var(--ink); border-radius: calc(var(--u) * 3);
  background: linear-gradient(90deg, #FFF0C6 0 44%, #FB7171 44% 56%, #FFF0C6 56%);
}
.scroll-roll > .art::before, .scroll-roll > .art::after {
  content: ""; position: absolute; top: calc(var(--u) * -2); width: calc(var(--u) * 3); height: calc(var(--u) * 12);
  background: #E9D29E; border: var(--u) solid var(--ink); border-radius: var(--u);
}
.scroll-roll > .art::before { left: calc(var(--u) * -3); }
.scroll-roll > .art::after { right: calc(var(--u) * -3); }

/* the text panel standing on the path */
.panel {
  position: relative; z-index: 2; width: calc(100% - var(--gutter) * 2); max-width: 720px; margin: -44px auto 0;
  padding: 24px 16px 24px; font-size: var(--t-sm); line-height: 1.22;
  background: var(--white); border: var(--line) solid var(--ink); border-radius: var(--r-lg); box-shadow: 0 var(--d-card) 0 var(--ink);
}
.panel:focus { outline: none; }
.panel-title { font-size: var(--t-head); line-height: .92; margin: 0 0 12px; font-weight: 400; }
.panel h2 { font-size: var(--t-lg); line-height: 1; margin: 24px 0 8px; }
.panel p { max-width: 34em; margin: 0 0 12px; }
.panel > :last-child { margin-bottom: 0; }
.panel a { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 3px; }
@media (min-width: 900px) { .panel { padding: 32px; font-size: var(--t-md); margin-top: -60px; } }
.spot-page[data-spot="terms"] .panel { background: #FFF6DC; border-radius: var(--r-xs); margin-top: -30px; }
.spot-page[data-spot="terms"] .panel::before, .spot-page[data-spot="terms"] .panel::after {
  content: ""; position: absolute; left: -12px; right: -12px; height: 18px;
  background: #E9D29E; border: var(--line) solid var(--ink); border-radius: var(--r-pill); box-shadow: 0 var(--d-ctl) 0 var(--ink);
}
.spot-page[data-spot="terms"] .panel::before { top: -12px; }
.spot-page[data-spot="terms"] .panel::after { bottom: -12px; }
.spot-page[data-spot="terms"] .panel.unroll { animation: unroll .6s steps(8); }
@keyframes unroll { from { clip-path: inset(-20px -20px 100% -20px); } to { clip-path: inset(-20px -20px -20px -20px); } }

/* the path carries on past the panel: a signpost to the other spots */
.trail {
  width: calc(100% - var(--gutter) * 2); max-width: 720px; margin: 32px auto 0; padding-bottom: calc(32px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: flex-start; gap: 16px; color: var(--trail-ink);
}
.trail-post { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.trail .plank {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 2px 30px 4px 14px; font-size: var(--t-md); line-height: 1;
  color: var(--ink); text-decoration: none; background: var(--wood); border: var(--line) solid var(--ink);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%);
  transition: transform .08s steps(2);
}
.trail .plank:nth-child(2) { transform: rotate(-2deg); margin-left: 6px; }
.trail .plank:nth-child(3) { transform: rotate(2deg); margin-left: 3px; }
.trail .plank:active { transform: translateY(2px); }
.trail .stick { width: 10px; height: 32px; margin-left: 24px; margin-top: -8px; background: var(--wood-dark); border: var(--line) solid var(--ink); border-top: 0; }
.trail-socials { display: flex; flex-wrap: wrap; gap: 8px; }
.trail-socials a {
  min-height: var(--tap); display: inline-flex; align-items: center; padding: 0 12px 2px; font-size: var(--t-sm); text-decoration: none;
  color: var(--trail-ink); border: var(--line) solid currentColor; border-radius: var(--r-pill);
}
.trail-legal { font-size: var(--t-xs); }
.trail .plank:focus-visible { clip-path: none; } /* the arrow cut would hide the focus ring */

/* Focus: one ring everywhere, drawn around each control's own drop (--drop) so nothing looks pressed while focused.
   Last in the file so it beats every component's box-shadow. */
:is(a, button, input, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: none;
  box-shadow: 0 var(--drop, 0px) 0 var(--ink), 0 0 0 3px var(--white), 0 0 0 6px var(--ink);
}
