/* Mattsville overlay UI: a chunky cartoon HUD (brief: docs/plans/2026-10-26-play-ui.md).
   Stickers slapped on the screen: ink outlines, hard shadows, Lilita One for anything shouted,
   Onest for anything read. */
:root {
  --ink: #1E1424;
  --ink-2: #54465A;          /* secondary text on cream: 7.6:1 */
  --yellow: #FFD23F;
  --yellow-soft: #FFE48A;
  --orange: #FF8A1E;
  --cream: #FFF4DC;
  --cream-2: #FBE7BC;        /* tiles and rows sitting on cream */
  --sky: #3FB6FF;
  --red: #E8473A;
  --green: #4CC26B;
  --display: "Lilita One", "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  --sans: "Onest", "Segoe UI", Helvetica, Arial, sans-serif;
  --line: 3px solid var(--ink);
  --sh: 4px 4px 0 var(--ink);
  --sh-press: 2px 2px 0 var(--ink);
  --radius: 16px;
  --radius-card: 20px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --spring: cubic-bezier(0.3, 1.5, 0.55, 1);      /* a small overshoot, then settle */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #cfe8fb; }
body {
  color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
::selection { background: var(--yellow); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
/* Focus: a yellow ring with an ink ring outside it, so it shows on cream, on yellow and on the town. */
:focus-visible {
  outline: 3px solid var(--ink); outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--yellow), var(--sh-current, 0 0 #0000);
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }

/* ---------- Chunky buttons ---------- */
.btn {
  --sh-current: var(--sh);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 50px; padding: 0 22px; border: var(--line); border-radius: 14px;
  background: var(--cream); color: var(--ink); box-shadow: var(--sh);
  font: 400 18px/1 var(--display); letter-spacing: 0.02em; white-space: nowrap; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out), background-color .15s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-icon { display: grid; }
.btn-yellow { background: var(--yellow); }
.btn-cream { background: var(--cream); }
@media (hover: hover) and (pointer: fine) {
  .btn-yellow:hover { background: #ffdb63; }
  .btn-cream:hover { background: #fff9ec; }
}
.btn:active { --sh-current: var(--sh-press); transform: translate(2px, 2px); box-shadow: var(--sh-press); }
.btn-wide { width: 100%; }
.btn-big { min-height: 60px; padding: 0 30px; font-size: 22px; }

kbd {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px;
  border: 2.5px solid var(--ink); border-bottom-width: 5px; border-radius: 9px;
  background: var(--cream); color: var(--ink); font: 400 15px/1 var(--display); letter-spacing: 0.02em;
}
kbd.wide { min-width: 62px; }

/* Round red close button */
.close {
  --sh-current: var(--sh-press);
  flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; padding: 0;
  border: var(--line); background: var(--red); color: #fff; box-shadow: var(--sh-press); cursor: pointer;
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out);
}
.close svg { width: 16px; height: 16px; }
.close:active { --sh-current: 0 0 #0000; transform: translate(2px, 2px); box-shadow: none; }

/* ---------- Title screen ---------- */
.loader {
  position: fixed; inset: 0; z-index: 50;
  display: grid; grid-template-rows: 1fr auto; justify-items: center;
  padding: max(24px, var(--safe-t)) max(16px, var(--safe-r)) max(24px, var(--safe-b)) max(16px, var(--safe-l));
  overflow-y: auto; overscroll-behavior: contain; /* short screens: scroll rather than clip */
  transition: opacity .5s var(--ease-out), visibility 0s linear .5s;
  cursor: default;
}
/* Sky until the town draws, then a soft wash so the logo reads over it. */
.loader::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(#9fd3ff, #cfe8fb 55%, #ffd9b0);
  transition: opacity .9s var(--ease-out);
}
.loader::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0;
  /* A light lift behind the logo only; the top of the frame stays sky blue. */
  background: radial-gradient(70% 55% at 50% 45%, rgba(255,244,220,0.45), transparent 75%),
              linear-gradient(transparent 70%, rgba(30,20,36,0.25));
  transition: opacity .9s var(--ease-out);
}
.loader.is-drawing:not(.is-fallback)::before { opacity: 0; }
.loader.is-drawing:not(.is-fallback)::after { opacity: 1; }
.loader.is-leaving { opacity: 0; visibility: hidden; pointer-events: none; }
.loader.is-ready:not(.is-fallback) { cursor: pointer; }

.loader-card { align-self: center; width: min(100%, 560px); display: grid; justify-items: center; text-align: center; }
.logo { margin: 0; line-height: 1; }
.logo-word {
  display: inline-block; transform: rotate(-3deg);
  /* Width and height both count, so the word fits a 320 px phone and a landscape phone. */
  font: 400 clamp(2.4rem, min(13vw, 18vh), 7.25rem)/0.95 var(--display); letter-spacing: 0.01em; text-transform: uppercase;
  color: var(--yellow);
  -webkit-text-stroke: 0.14em var(--ink); paint-order: stroke fill;
  filter: drop-shadow(0.06em 0.06em 0 var(--ink));
}
.logo-tag {
  margin: 22px 0 0; padding: 7px 16px; transform: rotate(-1.5deg);
  border: var(--line); border-radius: 999px; background: var(--cream); box-shadow: var(--sh-press);
  font: 500 16px/1.3 var(--sans);
}

.loader-progress { margin-top: 44px; display: grid; justify-items: center; align-content: start; gap: 14px; min-height: 104px; }
.fuel { display: flex; align-items: center; gap: 10px; }
.fuel-end { font: 400 18px/1 var(--display); color: var(--ink); width: 14px; }
.fuel-track {
  width: min(260px, 60vw); height: 26px; padding: 3px; border: var(--line); border-radius: 999px;
  background: var(--cream); box-shadow: var(--sh-press); overflow: hidden;
}
.loader-bar {
  display: block; height: 100%; border-radius: 999px; background: var(--orange);
  box-shadow: inset 0 -4px 0 rgba(30,20,36,0.18);
  transform: scaleX(0); transform-origin: left; transition: transform .45s var(--ease-out);
}
.loader-status { margin: 0; font: 400 19px/1.2 var(--display); letter-spacing: 0.03em; color: var(--ink); }
.loader.is-ready .fuel, .loader.is-ready .loader-status {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.loader.is-ready .start { animation: pop .34s var(--spring) backwards, nudge 1.8s ease-in-out .6s infinite; }
@keyframes pop { from { opacity: 0; transform: scale(0.6); } }
@keyframes nudge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.045); } }
.start:active { animation: none; }

.loader-exit {
  --sh-current: var(--sh-press);
  display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; column-gap: 6px;
  max-width: 100%; padding: 9px 16px; margin-top: 12px; text-align: center;
  border: var(--line); border-radius: 22px; background: var(--cream); box-shadow: var(--sh-press);
  font: 400 15px/1.3 var(--sans); color: var(--ink-2); cursor: pointer;
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out);
}
.loader-exit span { color: var(--ink); font-weight: 600; }
.loader-exit:active { transform: translate(2px, 2px); box-shadow: none; }

/* WebGL missing or a boot error: a cream card under the logo */
.fallback {
  margin-top: 34px; display: grid; justify-items: center; gap: 14px; width: min(100%, 440px);
  padding: 26px 24px; border: var(--line); border-radius: var(--radius-card); background: var(--cream); box-shadow: var(--sh);
}
.fallback-title { margin: 0; font: 400 24px/1.15 var(--display); letter-spacing: 0.01em; text-wrap: balance; }
.fallback-text { margin: 0 0 6px; max-width: 36ch; color: var(--ink-2); font-size: 16px; line-height: 1.55; text-wrap: pretty; }
.fallback-or { margin: 10px 0 0; font-size: 14px; color: var(--ink-2); }
.fallback-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.fallback-links a {
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 999px;
  border: 2.5px solid var(--ink); background: var(--cream-2); font: 500 14px/1 var(--sans);
}
.loader.is-fallback .logo-tag, .loader.is-fallback .loader-exit { display: none; }
/* Landscape phones and short windows: tighter spacing so the start button and the way out fit. */
@media (max-height: 500px) {
  .loader { padding-top: max(14px, var(--safe-t)); padding-bottom: max(14px, var(--safe-b)); }
  .logo-tag { margin-top: 12px; padding: 5px 14px; font-size: 15px; }
  .loader-progress { margin-top: 18px; min-height: 64px; }
  .btn-big { min-height: 52px; font-size: 20px; }
  .fallback { margin-top: 16px; padding: 18px 20px; gap: 10px; }
  .loader-exit { margin-top: 8px; }
}

/* ---------- HUD ---------- */
.hud {
  position: fixed; z-index: 20; inset: 0 auto auto 0; width: 100%; pointer-events: none;
  user-select: none; -webkit-user-select: none;
}
.hud-left {
  position: absolute; top: max(16px, var(--safe-t)); left: max(16px, var(--safe-l));
  display: grid; justify-items: start; gap: 12px; pointer-events: none;
}
.hud-left > *, .hud-right > * { pointer-events: auto; }
.hud-badges { display: flex; align-items: center; gap: 10px; }
.badge {
  margin: 0; display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 14px;
  border: var(--line); border-radius: 14px; box-shadow: var(--sh);
  font: 400 20px/1 var(--display); letter-spacing: 0.02em; white-space: nowrap;
}
.badge-logo { background: var(--yellow); text-transform: uppercase; transform: rotate(-3deg); }

/* To-do card */
.todo {
  width: 296px; border: var(--line); border-radius: var(--radius); background: var(--cream); box-shadow: var(--sh);
  overflow: hidden;
}
.todo-head {
  --sh-current: 0 0 #0000;
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 42px; padding: 6px 10px 6px 14px;
  border: 0; background: var(--yellow); text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
/* Switch-row style: an ink ring just inside the edge with a soft inset band (the head is yellow). */
.todo-head:focus-visible { outline-offset: -7px; box-shadow: inset 0 0 0 4px var(--cream); border-radius: 13px 13px 0 0; }
.todo-head[aria-expanded="false"]:focus-visible { border-radius: 13px; }
.todo-title { font: 400 19px/1 var(--display); letter-spacing: 0.04em; text-transform: uppercase; }
.todo-count {
  margin-left: auto; padding: 3px 8px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--cream);
  font: 400 15px/1 var(--display); letter-spacing: 0.02em; font-variant-numeric: tabular-nums;
}
.todo-chev { width: 18px; height: 18px; flex: none; transition: transform .22s var(--ease-out); }
.todo-head[aria-expanded="false"] .todo-chev { transform: rotate(-90deg); }
.todo:has(.todo-head[aria-expanded="false"]) { width: auto; }
.todo:has(.todo-head[aria-expanded="false"]) .todo-head { gap: 10px; }
.todo-list { list-style: none; margin: 0; padding: 8px 12px 12px; border-top: var(--line); display: grid; gap: 4px; }
.todo-head[aria-expanded="false"] + .todo-list { display: none; }
.todo-item { display: flex; align-items: center; gap: 10px; min-height: 30px; font: 500 15px/1.3 var(--sans); }
.todo-box {
  flex: none; width: 24px; height: 24px; border: 2.5px solid var(--ink); border-radius: 8px; background: #fff;
  display: grid; place-items: center; color: var(--ink);
}
.todo-box svg { width: 15px; height: 15px; opacity: 0; transform: scale(0.6); }
.todo-item.is-done .todo-box { background: var(--green); }
.todo-item.is-done .todo-box svg { opacity: 1; transform: none; }
.todo-item.is-done .todo-label { color: var(--ink-2); text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: rgba(30,20,36,0.45); }
.todo-item.is-new .todo-box { animation: tickpop .34s var(--spring); }
.todo-item.is-new .todo-box svg { transition: opacity .1s, transform .34s var(--spring); }
@keyframes tickpop { from { transform: scale(0.6); } }
/* The hidden extras: optional, so set apart under a dashed rule, quieter, with their own count. */
.todo-extra { margin-top: 4px; padding-top: 8px; border-top: 2.5px dashed rgba(30,20,36,0.3); color: var(--ink-2); }
.todo-extra .todo-box { border-style: dashed; background: transparent; }
.todo-extra .todo-box svg { opacity: 1; transform: none; fill: var(--yellow); stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; width: 16px; height: 16px; }
.todo-extra.is-done .todo-box { border-style: solid; background: var(--green); }
.todo-extra.is-done .todo-box svg { fill: none; }
.todo-extra.is-done .todo-label { text-decoration: none; }
.todo-label-short { display: none; }
.todo-extra-count {
  margin-left: auto; padding: 2px 7px; border: 2px dashed rgba(30,20,36,0.45); border-radius: 999px;
  font: 400 13px/1 var(--display); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.todo-extra.is-done .todo-extra-count { border-style: solid; border-color: var(--ink); background: var(--green); color: var(--ink); }

.hud-right {
  position: absolute; top: max(16px, var(--safe-t)); right: max(16px, var(--safe-r));
  display: flex; gap: 10px; align-items: flex-start;
}
.rbtn {
  --sh-current: var(--sh);
  position: relative; width: 52px; height: 52px; padding: 0; border-radius: 50%; display: grid; place-items: center;
  border: var(--line); background: var(--cream); color: var(--ink); box-shadow: var(--sh); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out), background-color .15s;
}
.rbtn svg { width: 24px; height: 24px; }
.rbtn:active { --sh-current: var(--sh-press); transform: translate(2px, 2px); box-shadow: var(--sh-press); }
@media (hover: hover) and (pointer: fine) { .rbtn:hover { background: var(--yellow-soft); } }
.rbtn[aria-expanded="true"] { background: var(--yellow); }
.rbtn-key {
  position: absolute; right: -8px; bottom: -8px; min-width: 22px; height: 22px; padding: 0 5px;
  border-width: 2px 2px 3.5px; border-radius: 7px; font-size: 12px;
}
.rbtn .icon-on { display: none; }
.rbtn.is-on .icon-on { display: block; }
.rbtn.is-on .icon-off { display: none; }

/* Sound menu under the sound button */
.hud-sound { position: relative; display: flex; }
.soundmenu {
  position: absolute; top: calc(100% + 14px); right: -4px; width: 260px; padding: 6px;
  border: var(--line); border-radius: var(--radius); background: var(--cream); box-shadow: var(--sh);
  transform-origin: calc(100% - 30px) 0; opacity: 0; transform: scale(0.85);
  transition: opacity .14s var(--ease-out), transform .24s var(--spring);
}
.soundmenu.is-open { opacity: 1; transform: none; }
.switchrow {
  --sh-current: 0 0 #0000;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%;
  min-height: 56px; padding: 8px 12px 8px 14px; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink); text-align: left; cursor: pointer;
  transition: background-color .15s;
}
@media (hover: hover) and (pointer: fine) { .switchrow:hover { background: var(--cream-2); } }
.switchrow:focus-visible { outline-offset: -3px; box-shadow: inset 0 0 0 6px var(--yellow); }
.switchrow-text { display: grid; gap: 2px; }
.switchrow-name { font: 400 18px/1.15 var(--display); letter-spacing: 0.02em; }
.switchrow-hint { font: 400 13.5px/1.3 var(--sans); color: var(--ink-2); }
.switch {
  position: relative; flex: none; width: 50px; height: 30px; border-radius: 999px;
  border: 2.5px solid var(--ink); background: #e6d6b6; transition: background-color .18s var(--ease-out);
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 21px; height: 21px; border-radius: 50%;
  border: 2.5px solid var(--ink); background: #fff; box-sizing: border-box; transition: transform .26s var(--spring);
}
[aria-checked="true"] > .switch { background: var(--green); }
[aria-checked="true"] > .switch::after { transform: translateX(20px); }

/* Minimap in a thick frame with an N badge (desktop only) */
.minimap {
  position: fixed; z-index: 10; top: calc(max(16px, var(--safe-t)) + 70px); right: max(16px, var(--safe-r));
  width: 176px; height: 176px; padding: 0; border: var(--line); border-radius: 22px; background: var(--cream);
  box-shadow: var(--sh); display: none;
}
.minimap canvas { display: block; width: 170px; height: 170px; border-radius: 19px; }
.minimap-n {
  position: absolute; top: -10px; left: -10px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; border: var(--line); background: var(--yellow);
  font: 400 15px/1 var(--display); transform: rotate(-6deg);
}
/* Not on short windows: the compact speed badge sits there. Matches MQ_MINIMAP in ui.js. */
@media (min-width: 900px) and (min-height: 501px) and (hover: hover) and (pointer: fine) { .minimap { display: block; } }

/* Back to site pill, bottom left (desktop) */
.backpill {
  --sh-current: var(--sh-press);
  position: fixed; z-index: 20; left: max(16px, var(--safe-l)); bottom: max(16px, var(--safe-b));
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 15px 0 12px;
  border: var(--line); border-radius: 999px; background: var(--cream); box-shadow: var(--sh-press);
  font: 600 14px/1 var(--sans); transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out);
}
.backpill svg { width: 16px; height: 16px; }
.backpill:active { --sh-current: 0 0 #0000; transform: translate(2px, 2px); box-shadow: none; }
@media (hover: hover) and (pointer: fine) { .backpill:hover { background: var(--yellow-soft); } }
.is-touch .backpill { display: none; }

/* ---------- Speedometer ---------- */
.speedo {
  position: fixed; z-index: 12; right: max(18px, var(--safe-r)); bottom: max(18px, var(--safe-b));
  width: 148px; height: 148px; pointer-events: none;
}
.speedo-dial { display: block; width: 100%; height: 100%; filter: drop-shadow(4px 4px 0 var(--ink)); overflow: visible; }
.speedo-face { fill: var(--cream); stroke: var(--ink); stroke-width: 4; }
.speedo-ticks line { stroke: var(--ink); stroke-linecap: round; }
.speedo-ticks text { font: 400 11px var(--display); fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.speedo-ticks .redline { stroke: var(--red); }
.speedo-needle {
  position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible;
  transform: rotate(-120deg); will-change: transform;
}
.speedo-needle path { fill: var(--orange); stroke: var(--ink); stroke-width: 2.4; stroke-linejoin: round; }
.speedo-hub { fill: var(--ink); }
.speedo-read {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); margin: 0;
  display: flex; align-items: baseline; gap: 3px; padding: 2px 9px 3px; border: 2.5px solid var(--ink); border-radius: 10px;
  background: var(--yellow); white-space: nowrap;
}
.speedo-num { font: 400 24px/1 var(--display); font-variant-numeric: tabular-nums; }
.speedo-unit { font: 400 14px/1 var(--display); letter-spacing: 0.04em; text-transform: uppercase; }
/* Touch: a compact badge under the round buttons, top right, clear of the stick, the buttons
   and the banner slot in the middle. */
.is-touch .speedo {
  top: calc(max(16px, var(--safe-t)) + 66px); bottom: auto; right: max(16px, var(--safe-r)); left: auto; transform: rotate(-2deg);
  width: auto; height: auto;
}
.is-touch .speedo-dial, .is-touch .speedo-needle { display: none; }
.is-touch .speedo-read { position: static; transform: none; padding: 5px 11px 6px; border-width: 3px; border-radius: 12px; box-shadow: var(--sh-press); }
.is-touch .speedo-num { font-size: 21px; }
.is-paused .speedo, .is-paused .minimap, .is-paused .tags, .is-paused .hud-right, .is-paused .hud-left { visibility: hidden; }

/* ---------- Arrival banner ---------- */
/* Desktop: in the sky band, top centre between the two HUD clusters, clear of the roof props. */
.banner {
  position: fixed; z-index: 14; left: 50%; top: calc(var(--safe-t) + 14px); translate: -50% 0;
  width: min(500px, calc(100vw - 640px)); min-width: min(400px, calc(100vw - 32px)); pointer-events: none;
  display: grid; justify-items: center; gap: 8px;
}
.banner-name, .banner-line { margin: 0; opacity: 0; transform: translateX(-110vw); }
.banner-name {
  max-width: 100%; padding: 8px 24px 10px; border: var(--line); border-radius: 16px; background: var(--yellow);
  box-shadow: 5px 5px 0 var(--ink); rotate: -3deg;
  font: 400 clamp(30px, 4vw, 46px)/1 var(--display); letter-spacing: 0.02em; text-transform: uppercase; text-align: center;
}
.banner-line {
  max-width: min(460px, 100%); padding: 7px 16px; border: var(--line); border-radius: 14px; background: var(--cream);
  box-shadow: var(--sh); font: 500 15px/1.4 var(--sans); text-align: center; text-wrap: balance;
}
/* In from the left with one fixed, small overshoot; both bands together. */
@keyframes banner-in { 0% { transform: translateX(-110vw); } 70% { transform: translateX(18px); } 100% { transform: none; } }
.banner.is-in .banner-name, .banner.is-in .banner-line {
  opacity: 1; transform: none; animation: banner-in .42s ease-out both;
}
.banner.is-out .banner-name, .banner.is-out .banner-line {
  opacity: 0; transform: translateX(110vw);
  transition: transform .36s cubic-bezier(0.55, 0, 0.75, 0.3), opacity .2s linear .16s;
}

/* ---------- Interact prompt ---------- */
/* Everywhere: the top slot the arrival banner uses, so it never sits over the car. It waits
   for the banner to go, then takes the same place. Desktop: one row. */
.prompt {
  --sh-current: 5px 5px 0 var(--ink);
  position: fixed; z-index: 15; left: 50%; top: calc(var(--safe-t) + 14px); bottom: auto;
  display: grid; grid-auto-flow: column; align-items: center; gap: 16px; padding: 9px 20px 10px; translate: -50% 0;
  border: var(--line); border-radius: 18px; background: var(--yellow); color: var(--ink);
  box-shadow: 5px 5px 0 var(--ink); cursor: pointer; white-space: nowrap;
  rotate: -2deg; opacity: 0; scale: 0.85;
  transition: scale .16s var(--ease-out), opacity .12s linear, box-shadow .12s var(--ease-out), translate .12s var(--ease-out);
}
.prompt:not(.is-shown) { pointer-events: none; }
.prompt.is-shown { opacity: 1; scale: 1; transition: scale .3s var(--spring), opacity .1s linear, box-shadow .12s var(--ease-out), translate .12s var(--ease-out); }
.prompt:active { translate: calc(-50% + 2px) 2px; box-shadow: var(--sh-press); }
.prompt-place { font: 400 26px/1 var(--display); letter-spacing: 0.02em; }
.prompt-act { display: flex; align-items: center; gap: 7px; font: 500 15px/1 var(--sans); }
.prompt kbd { min-width: 30px; height: 30px; }
/* Narrower desktops: a slimmer row, so the longest name clears the open to-do card on the left. */
@media (max-width: 1199px) {
  .prompt { gap: 12px; padding: 8px 16px 9px; }
  .prompt-place { font-size: 23px; }
}

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; z-index: 45; left: 50%; top: calc(max(16px, var(--safe-t)) + 4px); transform: translateX(-50%);
  display: grid; gap: 10px; justify-items: center; width: min(400px, calc(100vw - 28px)); pointer-events: none;
  transition: transform .24s var(--ease-out);
}
/* With a panel open on a wide screen, keep toasts in the space left of it. */
@media (min-width: 720px) {
  body:has(.panel.is-open) .toasts { left: calc((100vw - 500px) / 2); width: min(400px, calc(100vw - 532px)); }
}
.toast {
  display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 12px; width: 100%;
  padding: 10px 16px 11px 10px; border: var(--line); border-radius: var(--radius); background: var(--cream); box-shadow: var(--sh);
  opacity: 0; transform: translateY(-14px) scale(0.8); transform-origin: 50% 0;
  transition: opacity .12s linear, transform .2s var(--ease-out);
}
.toast.is-shown { opacity: 1; transform: none; transition: opacity .12s linear, transform .32s var(--spring); }
.toast-icon {
  grid-row: span 2; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  border: var(--line); background: var(--yellow); color: var(--ink);
}
.toast-icon svg { width: 20px; height: 20px; }
.toast-icon[data-icon="star"] svg { fill: var(--cream); stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; }
.toast-icon[data-icon="tick"], .toast-icon[data-icon="flag"] { background: var(--green); }
.toast-icon[data-icon="alert"] { background: var(--orange); }
.toast strong { font: 400 19px/1.15 var(--display); letter-spacing: 0.02em; }
.toast-text { font: 400 15px/1.4 var(--sans); }

/* ---------- Floating sign labels and speech bubbles ---------- */
.tags { position: fixed; inset: 0; z-index: 8; pointer-events: none; overflow: hidden; }
.tag { position: absolute; left: 0; top: 0; will-change: transform; }
.tag-card {
  max-width: 232px; padding: 8px 14px 9px; border-radius: 14px; text-align: center; text-wrap: balance;
  font: 500 15px/1.35 var(--sans); transform: translate(-50%, -100%); transform-origin: 50% 100%;
  opacity: 0; transition: opacity .2s var(--ease-out), scale .24s var(--spring); scale: 0.85;
  border: var(--line); background: var(--cream); color: var(--ink); box-shadow: var(--sh-press);
}
.tag.is-shown .tag-card { opacity: 1; scale: 1; }
.tag-sign .tag-card { background: var(--yellow); font: 400 17px/1.2 var(--display); letter-spacing: 0.02em; }
.tag-say .tag-card { border-radius: 16px; }
.tag-say .tag-card::after {
  content: ""; position: absolute; left: calc(50% + var(--tail, 0px)); bottom: -9px; width: 14px; height: 14px; margin-left: -7px;
  background: var(--cream); border: solid var(--ink); border-width: 0 3px 3px 0; transform: rotate(45deg); border-radius: 0 0 3px 0;
}
.tag-say.is-oi .tag-card { font: 400 22px/1 var(--display); padding: 8px 14px 9px; }
@media (max-width: 719px) { .tag-card { max-width: 200px; font-size: 14px; } }

/* ---------- Touch controls ---------- */
.touch { position: fixed; inset: 0; z-index: 15; pointer-events: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: opacity .2s; }
.is-paused .touch { opacity: 0; }
.stick {
  position: absolute; left: max(20px, calc(var(--safe-l) + 12px)); bottom: max(24px, calc(var(--safe-b) + 16px));
  width: 136px; height: 136px; border-radius: 50%; display: grid; place-items: center;
  border: var(--line); background: rgba(255,244,220,0.55); box-shadow: var(--sh);
  pointer-events: auto; touch-action: none;
}
.stick::before { content: ""; position: absolute; inset: 26px; border-radius: 50%; border: 2.5px dashed rgba(30,20,36,0.35); }
.stick-knob {
  width: 62px; height: 62px; border-radius: 50%; background: var(--cream); border: var(--line);
  box-shadow: 3px 3px 0 var(--ink); transition: transform .3s var(--spring);
}
.stick.is-active .stick-knob { transition: none; background: var(--yellow); }
.touch-buttons {
  position: absolute; right: max(20px, calc(var(--safe-r) + 12px)); bottom: max(24px, calc(var(--safe-b) + 16px));
  display: flex; align-items: flex-end; gap: 14px;
}
.tbtn {
  display: grid; place-items: center; border-radius: 50%; padding: 0; cursor: pointer;
  border: var(--line); background: var(--cream); color: var(--ink); box-shadow: var(--sh);
  pointer-events: auto; touch-action: none; -webkit-tap-highlight-color: transparent;
  transition: transform .1s var(--ease-out), box-shadow .1s var(--ease-out), background-color .2s, opacity .2s;
}
.tbtn svg { width: 28px; height: 28px; }
.tbtn.is-pressed { transform: translate(2px, 2px); box-shadow: var(--sh-press); }
.tbtn-horn { width: 64px; height: 64px; margin-bottom: 54px; }
.tbtn-go { width: 88px; height: 88px; background: rgba(255,244,220,0.7); color: rgba(30,20,36,0.45); }
.tbtn-go svg { width: 38px; height: 38px; }
.tbtn-go.is-lit { background: var(--yellow); color: var(--ink); animation: litpop .34s var(--spring); }
@keyframes litpop { from { scale: 0.8; } }

/* ---------- Scrim ---------- */
.scrim { position: fixed; inset: 0; z-index: 30; opacity: 0; transition: opacity .2s var(--ease-out); }
.scrim.is-open { opacity: 1; }
.scrim-dim { background: rgba(30,20,36,0.5); }
.scrim-pause { background: rgba(30,20,36,0.45); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.scrim-panel { background: linear-gradient(to right, transparent 40%, rgba(30,20,36,0.3)); }

/* ---------- Dialog frame shared by the panel, map, pause and how-to ---------- */
.panel, .mapdlg, .pause, .howto {
  position: fixed; z-index: 40; color: var(--ink);
  background: var(--cream); border: var(--line); border-radius: var(--radius-card); box-shadow: 6px 6px 0 var(--ink);
}
.panel:focus, .mapdlg:focus, .pause:focus, .howto:focus { outline: none; box-shadow: 6px 6px 0 var(--ink); }
.dlg-head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 14px 14px 24px; background: var(--yellow); border-bottom: var(--line);
}
.dlg-title { margin: 0; font: 400 28px/1.05 var(--display); letter-spacing: 0.03em; text-transform: uppercase; }

/* ---------- Place panel: right-side card on desktop ---------- */
.panel {
  top: max(16px, var(--safe-t)); right: max(20px, var(--safe-r));
  max-height: calc(100svh - max(16px, var(--safe-t)) - max(22px, var(--safe-b)));
  width: min(460px, calc(100vw - 36px)); display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateX(40px);
  transition: transform .2s var(--ease-out), opacity .14s linear;
}
.panel.is-open { opacity: 1; transform: none; transition: transform .38s var(--spring), opacity .12s linear; }
/* Header band: kind label and a sticker title on yellow. It sits outside the scroller. */
.panel-bar {
  flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; column-gap: 12px;
  padding: 14px 14px 16px 24px; background: var(--yellow); border-bottom: var(--line);
}
.panel-grab { display: none; }
.panel-heading { min-width: 0; padding-top: 2px; }
.panel-kind {
  display: inline-block; margin: 0 0 8px; padding: 4px 9px 3px; border: 2.5px solid var(--ink); border-radius: 8px;
  background: var(--cream); font: 400 14px/1 var(--display); letter-spacing: 0.04em; text-transform: uppercase;
}
.panel[data-kind="project"] .panel-kind { background: var(--sky); }
.panel[data-kind="about"] .panel-kind { background: var(--cream); }
.panel[data-kind="contact"] .panel-kind { background: var(--orange); }
.panel[data-kind="soon"] .panel-kind { background: var(--cream-2); }
.panel-title {
  margin: 0; font: 400 36px/1.02 var(--display); letter-spacing: 0.01em; text-wrap: balance;
  transform: rotate(-2deg); transform-origin: 0 50%;
}
.panel-scroll {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px 26px 26px;
  scrollbar-width: thin; scrollbar-color: var(--ink) transparent;
}
.panel-tagline { margin: 0; color: var(--ink); font: 500 17.5px/1.5 var(--sans); text-wrap: pretty; }

.media { margin: 22px -26px 0; }
.gallery {
  display: flex; gap: 12px; margin: 0; padding: 0 26px 10px; list-style: none;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding: 0 26px;
  scrollbar-width: thin; scrollbar-color: var(--ink) transparent;
}
.gallery:focus-visible { outline-offset: -3px; box-shadow: none; border-radius: 16px; }
.gallery li { flex: none; scroll-snap-align: start; padding: 0 4px 4px 0; }
.gallery img { display: block; height: 250px; width: auto; border-radius: 14px; border: var(--line); background: var(--cream-2); box-shadow: var(--sh-press); }
.media-video {
  display: block; width: calc(100% - 52px); margin: 0 26px; aspect-ratio: 16 / 9;
  border-radius: 14px; border: var(--line); background: #000; box-shadow: var(--sh-press);
}
.media-video-own { width: min(272px, calc(100% - 52px)); height: auto; margin-inline: auto; }
.yt-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 26px; }
.yt { aspect-ratio: 9 / 16; border-radius: 14px; overflow: hidden; border: var(--line); background: #000; box-shadow: var(--sh-press); }
.yt iframe { display: block; width: 100%; height: 100%; border: 0; }
.yt:focus { outline: none; }
.yt-thumb { position: relative; display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.yt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-thumb:focus-visible { outline-offset: -6px; box-shadow: none; border-radius: 12px; }
.yt-play {
  position: absolute; inset: 0; margin: auto; width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center; background: var(--yellow); color: var(--ink); border: var(--line);
  box-shadow: var(--sh-press); transition: transform .14s var(--ease-out);
}
.yt-play svg { width: 22px; height: 22px; margin-left: 3px; }
@media (hover: hover) and (pointer: fine) { .yt-thumb:hover .yt-play { transform: scale(1.08); } }
.yt-thumb:active .yt-play { transform: scale(0.94); }
.media-note { margin: 10px 0 0; padding: 0 26px; font-size: 13.5px; color: var(--ink-2); }

.panel-copy p { margin: 16px 0 0; font-size: 16.5px; line-height: 1.68; text-wrap: pretty; max-width: 62ch; }
.panel-copy p:first-child { margin-top: 22px; }
.panel-scroll > .panel-copy:first-child > p:first-child { margin-top: 0; }

.stats { margin: 26px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stats div {
  display: grid; align-content: start; gap: 6px; padding: 12px 14px 14px;
  border: var(--line); border-radius: 14px; background: var(--cream-2); box-shadow: var(--sh-press);
}
.stats dt { font: 400 32px/1 var(--display); letter-spacing: 0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; rotate: -2deg; transform-origin: 0 50%; }
.stats dd { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.4; }

.email { margin-top: 24px; }
.email-label { margin: 0 0 8px; font: 400 15px/1.2 var(--display); letter-spacing: 0.02em; }
.email-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 16px;
  border: var(--line); border-radius: 14px; background: #fff; box-shadow: var(--sh-press);
}
.email-text { flex: 1; min-width: 0; font: 600 16px/1.3 var(--sans); overflow-wrap: normal; user-select: all; -webkit-user-select: all; }
.email-copy {
  --sh-current: var(--sh-press);
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 44px; padding: 0 14px 0 12px;
  border: 2.5px solid var(--ink); border-radius: 11px; background: var(--yellow); color: var(--ink); box-shadow: var(--sh-press);
  font: 400 16px/1 var(--display); letter-spacing: 0.03em; cursor: pointer;
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out), background-color .15s;
}
.email-copy:active { --sh-current: 0 0 #0000; transform: translate(2px, 2px); box-shadow: none; }
.email-copy.is-done { background: var(--green); }
.email-icon { display: grid; }
.email-icon svg { width: 16px; height: 16px; }
/* Phones: the button shrinks to its icon (the aria-label still says what it does) so the address fits on one line. */
@media (max-width: 400px) {
  .email-copy { width: 44px; padding: 0; justify-content: center; }
  .email-copy-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .email-icon svg { width: 18px; height: 18px; }
  .email-text { font-size: 15px; }
}

.links { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 12px; }
.links .btn { min-height: 48px; padding: 0 18px; font-size: 17px; }
.links .btn svg { width: 15px; height: 15px; }
.panel-scroll { container-type: inline-size; }
@container (max-width: 479px) {
  .links .btn { flex: 1 1 100%; justify-content: space-between; }
}

/* Not a button: a dashed "work in progress" pill, flat, so it never reads as something to press. */
.panel-status {
  display: inline-flex; align-items: center; gap: 10px; margin: 26px 0 0; padding: 10px 18px 10px 14px;
  border: 3px dashed var(--ink); border-radius: 999px; background: var(--cream-2);
  font: 400 17px/1.2 var(--display); letter-spacing: 0.02em;
}
.panel-status-dot { width: 12px; height: 12px; flex: none; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--orange); }
.tech { margin-top: 26px; }
.tech-label { margin: 0 0 10px; font: 400 15px/1.2 var(--display); letter-spacing: 0.02em; }
.tech ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tech li { padding: 5px 11px; border-radius: 999px; border: 2.5px solid var(--ink); background: #fff; font: 500 13.5px/1.2 var(--sans); }
.panel-hint { margin: 26px 0 0; font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.panel-hint kbd { height: 26px; min-width: 0; font-size: 13px; border-bottom-width: 4px; }
.is-touch .panel-hint, .is-touch .rbtn-key { display: none; }

/* ---------- Map and fast travel ---------- */
.mapdlg, .pause, .howto {
  left: 50%; top: 50%; opacity: 0; translate: -50% -50%; scale: 0.85;
  transition: opacity .12s linear, scale .18s var(--ease-out);
}
.mapdlg.is-open, .pause.is-open, .howto.is-open { opacity: 1; scale: 1; transition: opacity .12s linear, scale .34s var(--spring); }
/* Pause and the map are opened from the keyboard often: quick and plain, no bounce. */
.mapdlg.is-open, .pause.is-open { transition: opacity .12s linear, scale .18s var(--ease-out); }
.mapdlg { width: min(880px, calc(100vw - 36px)); max-height: calc(100svh - 36px); display: flex; flex-direction: column; overflow: hidden; }
.mapdlg-body {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start;
  padding: 22px 24px 26px; overflow-y: auto; min-height: 0; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--ink) transparent;
}
.mapdlg-paper {
  justify-self: center; width: 100%; max-width: 480px; border: var(--line); border-radius: 18px; overflow: hidden;
  box-shadow: var(--sh); rotate: -0.6deg; background: #f6e7c4;
}
.mapdlg-canvas { display: block; width: 100%; aspect-ratio: 1; cursor: pointer; }
.mapdlg-hint { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.mapdlg-list { display: grid; gap: 10px; margin: 0; padding: 0 4px 4px 0; list-style: none; }
.map-item {
  --sh-current: var(--sh-press);
  display: grid; grid-template-columns: 30px 1fr 22px; grid-template-rows: auto auto; column-gap: 12px; row-gap: 3px; align-items: center;
  width: 100%; padding: 9px 12px 10px 10px; text-align: left; cursor: pointer;
  border: var(--line); border-radius: 14px; background: #fff; color: var(--ink); box-shadow: var(--sh-press);
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out), background-color .15s;
}
@media (hover: hover) and (pointer: fine) { .map-item:hover { background: var(--yellow-soft); } }
.map-item:active { --sh-current: 0 0 #0000; transform: translate(2px, 2px); box-shadow: none; }
.map-dot { grid-row: 1 / 3; width: 28px; height: 28px; border-radius: 50%; background: var(--c); border: 2.5px solid var(--ink); }
.map-name { font: 400 19px/1.1 var(--display); letter-spacing: 0.02em; }
.map-meta { grid-column: 2; font-size: 13.5px; line-height: 1.2; color: var(--ink-2); }
.map-tick {
  grid-row: 1 / 3; grid-column: 3; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  border: 2.5px solid var(--ink); background: #fff;
}
.map-tick svg { width: 13px; height: 13px; opacity: 0; }
.map-item.is-seen .map-tick { background: var(--green); }
.map-item.is-seen .map-tick svg { opacity: 1; }

/* ---------- Pause menu ---------- */
.pause { width: min(380px, calc(100vw - 36px)); padding: 0 22px 22px; }
.pause-title {
  width: fit-content; margin: -2px auto 18px; padding: 10px 26px 12px; transform: rotate(-3deg) translateY(-12px);
  border: var(--line); border-radius: 16px; background: var(--yellow); box-shadow: var(--sh);
  font: 400 40px/1 var(--display); letter-spacing: 0.04em; text-transform: uppercase;
}
.pause { margin-top: 12px; }
/* Short screens: keep the whole card reachable. */
@media (max-height: 600px) {
  .pause { max-height: calc(100svh - 24px); overflow-y: auto; margin-top: 0; }
  .pause-title { transform: rotate(-3deg); margin-top: 16px; }
}
.pause-actions { display: grid; gap: 12px; }
.pause-actions .btn { justify-content: flex-start; padding-left: 18px; }
.pause-sound { margin-top: 18px; padding: 4px; border: var(--line); border-radius: 14px; background: #fff; }
.pause-sound-label { margin: 8px 12px 0; font: 400 15px/1.2 var(--display); letter-spacing: 0.02em; color: var(--ink-2); }
.pause-exit {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: 16px auto 0; padding: 10px 14px; width: fit-content;
  border-radius: 10px; font: 600 15px/1.2 var(--sans); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px;
}
.pause-exit svg { width: 16px; height: 16px; }

/* ---------- How to play ---------- */
.howto { width: min(440px, calc(100vw - 36px)); max-height: calc(100svh - 36px); display: flex; flex-direction: column; overflow: hidden; }
.howto-body { padding: 18px 24px 22px; overflow-y: auto; }
.howto-lead { margin: 0 0 14px; font-size: 16px; line-height: 1.5; text-wrap: pretty; }
.howto-keys { margin: 0; display: grid; gap: 8px; }
.howto-keys div {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; padding: 6px 10px 6px 14px;
  border-radius: 12px; background: var(--cream-2);
}
.howto-keys dt { font: 500 15.5px/1.3 var(--sans); }
.howto-keys dd { margin: 0; display: flex; align-items: center; justify-content: flex-end; gap: 5px; color: var(--ink-2); font-size: 14px; text-align: right; line-height: 1.35; }
.howto-keys .or { margin: 0 3px 0 4px; }
.howto[data-mode="touch"] [data-for="keys"], .howto:not([data-mode="touch"]) [data-for="touch"] { display: none; }
.howto-go { margin-top: 20px; min-height: 56px; font-size: 21px; }
.howto-any { margin: 12px 0 0; text-align: center; font-size: 13.5px; color: var(--ink-2); }
/* Landscape phones: two columns of controls, so "Let's drive" is in view without scrolling. */
@media (max-height: 500px) and (min-width: 600px) {
  .howto { width: min(720px, calc(100vw - 36px)); }
  .howto .dlg-head { padding-top: 10px; padding-bottom: 10px; }
  .howto .dlg-title { font-size: 24px; }
  .howto-body { padding: 12px 20px 16px; }
  .howto-lead { margin-bottom: 10px; font-size: 15px; }
  .howto-keys { grid-template-columns: 1fr 1fr; gap: 6px; }
  .howto-keys div { min-height: 40px; padding: 4px 10px 4px 12px; }
  .howto-keys dd { font-size: 13.5px; }
  .howto-go { margin-top: 12px; min-height: 48px; font-size: 19px; }
  .howto-any { margin-top: 8px; }
}

/* ---------- Compact HUD: phones either way up, and any short window ----------
   The top strip holds the HUD rows; under them sits one slot shared by the arrival banner
   (name only) and the prompt (which waits for the banner to go). Toasts stack under that slot. */
@media (max-width: 719px), (max-height: 500px) {
  :root { --slot-top: calc(max(12px, var(--safe-t)) + 96px); }
  .hud-left { top: max(12px, var(--safe-t)); left: max(12px, var(--safe-l)); gap: 10px; }
  .hud-right { top: max(12px, var(--safe-t)); right: max(12px, var(--safe-r)); gap: 8px; }
  .hud-badges { display: none; }
  .speedo, .is-touch .speedo {
    top: calc(max(12px, var(--safe-t)) + 54px); bottom: auto; left: auto; right: max(12px, var(--safe-r));
    width: auto; height: auto; transform: rotate(-2deg);
  }
  .speedo-dial, .speedo-needle { display: none; }
  .speedo-read, .is-touch .speedo-read { position: static; transform: none; padding: 4px 9px 5px; border-width: 3px; border-radius: 12px; box-shadow: var(--sh-press); }
  .speedo-num, .is-touch .speedo-num { font-size: 19px; }
  .rbtn { width: 42px; height: 42px; box-shadow: var(--sh-press); }
  .rbtn svg { width: 20px; height: 20px; }
  /* The head stays a chip in the top row; open, the list drops below it as its own card,
     clear of the round buttons and narrow enough to leave the speed badge on the right alone. */
  .todo, .todo:has(.todo-head[aria-expanded="false"]) { position: relative; width: auto; overflow: visible; box-shadow: var(--sh-press); }
  .todo-head { min-height: 36px; padding: 4px 8px 4px 11px; border-radius: 13px; }
  .todo-head:focus-visible { border-radius: 13px; }
  .todo-list {
    position: absolute; top: calc(100% + 10px); left: -3px;
    width: min(256px, calc(100vw - max(12px, var(--safe-l)) - max(12px, var(--safe-r)) - 104px));
    border: var(--line); border-radius: var(--radius); background: var(--cream); box-shadow: var(--sh-press);
  }
  .todo-title { font-size: 16px; }
  .todo-count { font-size: 13px; }
  .todo-item { font-size: 14.5px; }

  .banner { top: var(--slot-top); width: calc(100vw - 32px); min-width: 0; }
  .banner-line { display: none; }
  .banner-name { padding: 6px 18px 8px; font-size: clamp(24px, 8vw, 30px); box-shadow: var(--sh); }
  .prompt, .is-touch .prompt {
    top: var(--slot-top); bottom: auto; grid-auto-flow: row; justify-items: center; gap: 5px;
    width: max-content; max-width: calc(100vw - 32px); padding: 8px 18px 10px; white-space: normal; text-align: center;
  }
  .prompt-place { font-size: 24px; }
  .prompt-act { font-size: 14.5px; }
  .toasts { top: var(--slot-top); }
  /* With a sheet open, sit in the strip above it rather than over its header. */
  .is-paused .toasts { top: max(6px, var(--safe-t)); }
  .is-paused .toast { padding: 6px 12px 6px 8px; }
  .is-paused .toast-icon { width: 30px; height: 30px; }
  .is-paused .toast-icon svg { width: 15px; height: 15px; }
}
/* Landscape phones: the slot moves up into the gap between the two HUD clusters. */
@media (max-height: 500px) and (min-width: 720px) {
  :root { --slot-top: calc(max(8px, var(--safe-t)) + 4px); }
  .banner { width: min(400px, calc(100vw - 420px)); }
  .toasts { width: min(340px, calc(100vw - 480px)); }
  /* Title only, so a toast stays a strip and the place ahead stays in view; the line is still
     read out by the live region. */
  .toast { width: auto; max-width: 100%; padding: 5px 14px 5px 6px; column-gap: 9px; }
  .toast-icon { grid-row: auto; width: 30px; height: 30px; }
  .toast-icon svg { width: 15px; height: 15px; }
  .toast strong { font-size: 17px; }
  .toast:has(strong) .toast-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  /* Short screens: a smaller stick and a tighter to-do, so the open card clears the stick. */
  .stick { width: 112px; height: 112px; }
  .stick::before { inset: 20px; }
  .stick-knob { width: 52px; height: 52px; }
  /* The list ends above the stick's top edge (stick 112 + 24 from the bottom). */
  .todo-list {
    width: 288px; gap: 2px; padding: 6px 12px 8px; overflow-y: auto;
    max-height: calc(100svh - max(12px, var(--safe-t)) - 54px - 112px - max(24px, calc(var(--safe-b) + 16px)));
  }
  .todo-item { min-height: 24px; }
  .todo-box { width: 22px; height: 22px; }
  .todo-extra { margin-top: 2px; padding-top: 5px; }
}

/* The narrowest phones: a smaller stick and horn so the two sides never meet. */
@media (max-width: 359px) {
  .stick { width: 112px; height: 112px; }
  .stick::before { inset: 20px; }
  .stick-knob { width: 52px; height: 52px; }
  .tbtn-horn { width: 56px; height: 56px; }
  .touch-buttons { gap: 10px; }
  .hud-right { gap: 6px; }
  .todo-head { gap: 6px; padding-left: 9px; }
  .todo-label-long { display: none; }
  .todo-label-short { display: inline; }
  /* The count drops under the label, lined up with it, so the label keeps one line. */
  .todo-extra { flex-wrap: wrap; row-gap: 4px; }
  .todo-extra .todo-label { flex: 1 1 calc(100% - 34px); }
  .todo-extra-count { margin-left: 34px; }
}

/* ---------- Phones (portrait): bottom sheets ---------- */
@media (max-width: 719px) {
  .panel, .mapdlg {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; translate: none; scale: none;
    max-height: calc(100svh - max(24px, var(--safe-t)) - 28px);
    border-radius: var(--radius-card) var(--radius-card) 0 0; border-bottom: 0; box-shadow: 0 -4px 0 rgba(30,20,36,0.25);
    opacity: 1; transform: translateY(100%);
    transition: transform .22s var(--ease-out);
  }
  .panel.is-open, .mapdlg.is-open { transform: none; scale: none; transition: transform .38s var(--ease-drawer); }
  .panel:focus, .mapdlg:focus { box-shadow: 0 -4px 0 rgba(30,20,36,0.25); }
  .panel.is-dragging { transition: none; }
  .panel-bar { padding: 0 12px 14px 18px; }
  .panel-grab {
    grid-column: 1 / -1; display: flex; justify-content: center; align-items: center;
    height: 22px; margin: 0 -12px 0 -18px; touch-action: none; cursor: grab;
  }
  .panel-grab span { width: 44px; height: 6px; border-radius: 3px; background: var(--ink); opacity: 0.55; }
  .panel-scroll { padding: 20px 18px calc(24px + var(--safe-b)); }
  .panel-title { font-size: 30px; }
  .panel-tagline { font-size: 16.5px; }
  .media { margin: 20px -18px 0; }
  .gallery { padding: 0 18px 10px; scroll-padding: 0 18px; }
  .gallery img { height: 210px; }
  .media-video { width: calc(100% - 36px); margin: 0 18px; }
  .media-video-own { width: min(240px, calc(100% - 36px)); }
  .yt-row, .media-note { padding: 0 18px; }
  .panel-copy p { font-size: 16px; }
  .stats dt { font-size: 28px; }
  .scrim-panel { background: rgba(30,20,36,0.4); }

  .dlg-head { padding: 12px 12px 12px 18px; }
  .dlg-title { font-size: 24px; }
  .mapdlg-body { display: flex; flex-direction: column; align-items: stretch; gap: 16px; padding: 16px 18px calc(24px + var(--safe-b)); }
  .mapdlg-body > * { flex: none; }
  .mapdlg-paper { align-self: center; }
  /* A definite width, so the grid row knows the square canvas's height. */
  .mapdlg-paper { width: min(330px, calc(100vw - 42px)); }
}

/* ---------- Reduced motion: opacity only, no overshoot, no slides; tilts stay ---------- */
@media (prefers-reduced-motion: reduce) {
  .loader, .loader::before, .loader::after, .loader-bar { transition: opacity .2s linear; }
  .loader.is-ready .start { animation: none; }
  .btn, .rbtn, .close, .backpill, .loader-exit, .email-copy, .map-item, .tbtn, .prompt, .prompt.is-shown, .stick-knob, .touch,
  .soundmenu, .soundmenu.is-open, .switch, .switch::after, .todo-chev, .scrim, .toast, .toast.is-shown, .tag-card, .tag.is-shown .tag-card {
    transition: opacity .15s linear;
  }
  .btn:active, .rbtn:active, .close:active, .backpill:active, .loader-exit:active, .email-copy:active, .map-item:active, .tbtn.is-pressed { transform: none; }
  .prompt, .prompt.is-shown { scale: 1; }
  .prompt:active { translate: -50% 0; }
  .toast, .toast.is-shown { transform: none; }
  .soundmenu, .soundmenu.is-open { transform: none; }
  .tag-card, .tag.is-shown .tag-card { scale: 1; }
  .todo-item.is-new .todo-box, .tbtn-go.is-lit { animation: none; }
  .todo-item .todo-box svg, .todo-item.is-new .todo-box svg { transform: none; transition: opacity .15s linear; }
  .banner-name, .banner-line, .banner.is-in .banner-name, .banner.is-in .banner-line,
  .banner.is-out .banner-name, .banner.is-out .banner-line { transform: none; animation: none; transition: opacity .2s linear; }
  .toasts { transition: none; }
  .panel, .panel.is-open, .mapdlg, .mapdlg.is-open, .pause, .pause.is-open, .howto, .howto.is-open { transform: none; scale: 1; transition: opacity .15s linear; }
  @media (max-width: 719px) {
    .panel:not(.is-open), .mapdlg:not(.is-open) { opacity: 0; }
  }
}

/* ---------- Focus rings ----------
   Components set their own box-shadow, which beats the plain :focus-visible rule above. This
   later, more specific rule puts the brief's ring back: yellow, an ink ring outside it, and the
   component's own hard shadow underneath. */
:is(.btn, .rbtn, .close, .map-item, .email-copy, .backpill, .loader-exit, .prompt):focus-visible {
  outline: 3px solid var(--ink); outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--yellow), var(--sh-current, 0 0 #0000);
}
.gallery:focus-visible { outline-offset: -3px; box-shadow: inset 0 0 0 6px var(--yellow); border-radius: 16px; }
/* The prompt is yellow, so the yellow ring would vanish into it: an ink ring inside the card
   and a yellow ring outside it, over the hard shadow. */
.prompt:focus-visible {
  outline: 3px solid var(--ink); outline-offset: -9px;
  box-shadow: 0 0 0 4px var(--yellow), 0 0 0 7px var(--ink), var(--sh-current);
}
