:root {
  --ink: #2a1a12;
  --sand: #f6e3be;
  --paper: #fffaf0;
  --rust: #c2452c;
  --gold: #f5c542;
  --river: #2e8fa8;
  --pad: 14px;
  --safeT: env(safe-area-inset-top, 0px);
  --safeB: env(safe-area-inset-bottom, 0px);
  --safeL: env(safe-area-inset-left, 0px);
  --safeR: env(safe-area-inset-right, 0px);
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #0d0a08;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
canvas {
  display: block;
  outline: none;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.display {
  font-family: "Oswald", "Haettenschweiler", "Arial Narrow Bold", Impact,
    sans-serif;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

/* screen-printed decal look: hard offset shadows, no blur, no gradients */
.plate {
  background: var(--sand);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
}

/* ─────────────────────────── HUD ─────────────────────────── */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2;
}
#hud.on {
  opacity: 1;
}
.corner {
  position: absolute;
  padding: 5px 10px 4px;
  will-change: transform;
}
#clock {
  top: calc(var(--pad) + var(--safeT));
  left: calc(var(--pad) + var(--safeL));
}
#clock > b {
  display: block;
  font-size: clamp(24px, 6vw, 34px);
  line-height: 0.95;
}
#gates {
  top: calc(var(--pad) + var(--safeT));
  right: calc(var(--pad) + var(--safeR));
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
#gates > b {
  display: block;
  font-size: clamp(19px, 5vw, 26px);
  line-height: 1;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 0.2em;
  opacity: 0.72;
}
.corner.pop {
  animation: platepop 0.34s ease-out;
}
@keyframes platepop {
  30% {
    transform: scale(1.09) rotate(-1.5deg);
  }
  100% {
    transform: scale(1);
  }
}
#gates.full > b {
  color: var(--rust);
}
/* the adjustment is kept OFF the main clock: one number that both ticks up
   and jumps around is unreadable */
#adj {
  font-size: 14px;
  line-height: 1.1;
  margin-top: 1px;
  color: var(--rust);
  font-weight: 700;
}
#adj.good {
  color: #1f7a4d;
}
#adj.zero {
  opacity: 0.45;
}
#clock.chase #adj {
  display: none;
}

.coins {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 3px;
  border-top: 2px dashed var(--ink);
  padding-top: 3px;
}
.coins b {
  font-size: 15px;
  line-height: 1;
  min-width: 3ch;
  text-align: right;
}
.pip {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--ink);
  flex: none;
}

#speed {
  position: absolute;
  left: calc(var(--pad) + var(--safeL));
  bottom: calc(var(--pad) + 2px + var(--safeB));
  width: 128px;
  padding: 5px 8px 6px;
}
#bar {
  height: 9px;
  border: 2px solid var(--ink);
  margin-top: 4px;
  overflow: hidden;
}
#fill {
  height: 100%;
  width: 0%;
  background: var(--rust);
  transition: width 0.08s linear, background 0.15s;
}
#speed.hot #fill {
  background: var(--gold);
}
.fuellab {
  margin-top: 5px;
}
#fuel {
  height: 7px;
  border: 2px solid var(--ink);
  margin-top: 3px;
  overflow: hidden;
}
#fuelBar {
  height: 100%;
  width: 100%;
  background: var(--gold);
  transition: width 0.1s linear, background 0.2s;
}
#speed.dry #fuelBar {
  background: var(--rust);
}

/* power-up chips + combo */
#powers {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}
.pw {
  display: none;
  align-items: center;
  gap: 5px;
  padding: 2px 5px;
  border: 2px solid var(--ink);
  background: var(--sand);
}
.pw.on {
  display: flex;
}
.pw b {
  font-size: 9px;
  letter-spacing: 0.14em;
}
.pw i {
  display: block;
  flex: 1;
  min-width: 26px;
  height: 5px;
  border: 1px solid var(--ink);
}
.pw u {
  display: block;
  height: 100%;
  width: 100%;
}
.pw.turbo u {
  background: #f05c40;
}
.pw.magnet u {
  background: #9b6bd6;
}
.pw.shield u {
  background: #3fb8c4;
}

#combo {
  display: none;
  margin-top: 3px;
  padding: 1px 6px 2px;
  background: var(--rust);
  color: var(--sand);
  border: 2px solid var(--ink);
  font-size: 15px;
  line-height: 1.15;
  align-self: flex-end;
  text-align: center;
}
#combo.on {
  display: block;
}
#combo.pop {
  animation: platepop 0.3s ease-out;
}

/* airframe pips — Time trial only */
#hull {
  display: none;
  margin-top: 5px;
  border-top: 2px dashed var(--ink);
  padding-top: 4px;
}
#hull.on {
  display: block;
}
#hull b {
  font-size: 9px;
  letter-spacing: 0.16em;
  display: block;
}
#hull span {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  margin-top: 2px;
}
#hull i {
  width: 12px;
  height: 12px;
  background: var(--rust);
  border: 2px solid var(--ink);
  transition: background 0.2s, transform 0.2s;
}
#hull i.gone {
  background: transparent;
  transform: scale(0.7);
}
#hull.crit i:not(.gone) {
  animation: beat 0.6s ease-in-out infinite;
}
#hull.crit b {
  color: var(--rust);
  opacity: 1;
}

/* close-shave proximity meter — without it the bonus reads as random */
#shave {
  position: absolute;
  left: 50%;
  bottom: calc(var(--pad) + 6px + var(--safeB));
  transform: translateX(-50%) scale(0.94);
  width: 148px;
  padding: 4px 8px 6px;
  background: var(--sand);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  text-align: center;
  opacity: 0;
  transition: opacity 0.16s ease, transform 0.16s ease, background 0.16s;
  pointer-events: none;
}
#shave.on {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
#shave.hot {
  background: var(--gold);
}
#shaveBar {
  height: 8px;
  border: 2px solid var(--ink);
  margin-top: 3px;
  overflow: hidden;
}
#shaveFill {
  height: 100%;
  width: 0%;
  background: var(--rust);
}
#shave.hot #shaveFill {
  background: var(--ink);
}
/* three notches: how close you are, independent of the charge bar */
#shaveTicks {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin-top: 4px;
}
#shaveTicks i {
  width: 16px;
  height: 5px;
  border: 2px solid var(--ink);
}
#shaveTicks i.lit {
  background: var(--rust);
}
#shave.hot #shaveTicks i.lit {
  background: var(--ink);
}
@media (max-height: 460px) {
  #shave {
    bottom: calc(var(--pad) + 2px + var(--safeB));
    width: 128px;
  }
}

/* gamepad presence badge */
#padHint {
  position: absolute;
  left: 50%;
  top: calc(var(--pad) + 62px + var(--safeT));
  transform: translateX(-50%);
  display: none;
  padding: 2px 9px 3px;
  background: var(--ink);
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 0.18em;
}
#padHint.on {
  display: block;
}

/* toast chips — one per event, they stack and clear themselves */
#toasts {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
  width: max-content;
  max-width: 86vw;
}
.toast {
  padding: 5px 15px 6px;
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  background: var(--sand);
  color: var(--ink);
  font-family: "Oswald", "Haettenschweiler", Impact, sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: clamp(19px, 5.2vw, 30px);
  line-height: 1.1;
  white-space: nowrap;
  transform: rotate(-2deg);
  animation: toastpop 1.5s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}
.toast.bad {
  background: var(--rust);
  color: var(--sand);
}
.toast.good {
  background: var(--gold);
}
@keyframes toastpop {
  0% {
    opacity: 0;
    transform: rotate(-2deg) scale(0.55);
  }
  16% {
    opacity: 1;
    transform: rotate(-2deg) scale(1.08);
  }
  26% {
    transform: rotate(-2deg) scale(1);
  }
  74% {
    opacity: 1;
    transform: rotate(-2deg) scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: rotate(-2deg) scale(0.98) translateY(-16px);
  }
}

/* ─────────────────────── top bar controls ─────────────────────── */
#topbar {
  position: fixed;
  top: calc(var(--pad) + var(--safeT));
  left: 50%;
  transform: translateX(-50%);
  display: none;
  gap: 10px;
  z-index: 4;
}
#topbar.on {
  display: flex;
}
.tap {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  background: var(--sand);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  padding: 0;
}
.tap:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}
.tap:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
/* icons: inline SVG, so they render identically on every platform.
   The old CSS border-trick glyphs collapsed into unreadable blobs. */
.ic {
  width: 22px;
  height: 22px;
  display: block;
  fill: var(--ink);
  pointer-events: none;
}
.ic.st {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tap .sl {
  display: none;
}
.tap[hidden] {
  display: none;
}
.tap .fso {
  display: none;
}
.tap.on .fsi {
  display: none;
}
.tap.on .fso {
  display: block;
}
.tap.off .wv {
  display: none;
}
.tap.off .sl {
  display: block;
  stroke: var(--rust);
  stroke-width: 2.8;
  stroke-linecap: round;
  fill: none;
}

/* ───────────────────── virtual stick + boost ───────────────────── */
#menubar {
  position: fixed;
  top: calc(var(--pad) + var(--safeT));
  right: calc(var(--pad) + var(--safeR));
  display: none;
  gap: 10px;
  z-index: 7;
}
#menubar.on {
  display: flex;
}

#stick {
  position: fixed;
  width: 116px;
  height: 116px;
  margin: -58px 0 0 -58px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: rgba(246, 227, 190, 0.24);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s ease;
  z-index: 3;
  display: grid;
  place-items: center;
}
#stick.on {
  opacity: 1;
}
#nub {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--sand);
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  will-change: transform;
}
#roll {
  position: fixed;
  right: calc(var(--pad) + 2px + var(--safeR));
  bottom: calc(var(--pad) + 102px + var(--safeB));
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: none;
  place-items: center;
  border: 3px solid var(--ink);
  background: var(--sand);
  color: var(--ink);
  font-size: 13px;
  box-shadow: 4px 4px 0 var(--ink);
  z-index: 3;
  cursor: pointer;
}
#roll.on {
  display: grid;
}
#roll:active,
#roll.held {
  transform: translate(4px, 4px);
  box-shadow: none;
  background: var(--gold);
}
/* dim while the roll is actually in progress, so it reads as unavailable */
#roll.busy {
  opacity: 0.45;
}
/* the right half boosts, but with nothing drawn there it read as dead space.
   This mirrors the thumbstick: a ring appears wherever the thumb lands. */
#bpad {
  position: fixed;
  width: 104px;
  height: 104px;
  margin: -52px 0 0 -52px;
  border: 3px dashed var(--ink);
  border-radius: 50%;
  background: rgba(245, 197, 66, 0.22);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 3;
  display: grid;
  place-items: center;
}
#bpad.on {
  opacity: 1;
  transform: scale(1);
}
#bpad i {
  position: absolute;
  inset: 10px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  opacity: 0.5;
  animation: bpulse 0.9s ease-out infinite;
}
@keyframes bpulse {
  0% {
    transform: scale(0.72);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.12);
    opacity: 0;
  }
}
#bpad b {
  font-size: 13px;
  color: var(--ink);
}

#boost {
  position: fixed;
  right: calc(var(--pad) + 2px + var(--safeR));
  bottom: calc(var(--pad) + 2px + var(--safeB));
  width: 86px;
  height: 86px;
  border-radius: 50%;
  display: none;
  place-items: center;
  border: 3px solid var(--ink);
  color: var(--ink);
  font-size: 15px;
  box-shadow: 4px 4px 0 var(--ink);
  z-index: 3;
  cursor: pointer;
  /* the button IS the fuel gauge: gold fills from the bottom */
  background: linear-gradient(
    to top,
    var(--gold) 0 calc(var(--fuel, 1) * 100%),
    #e6d7b2 calc(var(--fuel, 1) * 100%) 100%
  );
}
#boost span {
  position: relative;
}
#boost.on {
  display: grid;
}
#boost.dry {
  background: linear-gradient(
    to top,
    var(--rust) 0 calc(var(--fuel, 0) * 100%),
    #e6d7b2 calc(var(--fuel, 0) * 100%) 100%
  );
  color: var(--sand);
  animation: shake 0.32s ease-in-out;
}
@keyframes shake {
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}
#boost.held {
  background: var(--rust);
  color: var(--sand);
  transform: translate(4px, 4px);
  box-shadow: none;
}

/* ─────────────────────── screen effects ─────────────────────── */
#flash {
  position: fixed;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
  z-index: 1;
  background: radial-gradient(
    ellipse 74% 68% at 50% 50%,
    transparent 42%,
    rgba(194, 69, 44, 0.62) 88%,
    rgba(148, 42, 24, 0.85) 100%
  );
}
/* damage tint: permanent, deepens with every clip, impossible to forget */
#hurt {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.5s ease;
  background: radial-gradient(
    ellipse 66% 62% at 50% 50%,
    transparent 46%,
    rgba(150, 30, 18, 0.55) 100%
  );
}
#vig.shave {
  background: radial-gradient(
    ellipse 60% 56% at 50% 50%,
    transparent 50%,
    rgba(245, 197, 66, 0.42) 100%
  );
}
#vig {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.25s ease;
  background: radial-gradient(
    ellipse 62% 58% at 50% 50%,
    transparent 55%,
    rgba(42, 26, 18, 0.5) 100%
  );
}
/* Ridgeback's own beat: an amber scan sweeps the frame on a threaded arch */
#scan {
  position: fixed;
  left: 0;
  right: 0;
  height: 17%;
  top: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(245, 197, 66, 0.1) 42%,
    rgba(255, 246, 214, 0.36) 50%,
    rgba(245, 197, 66, 0.1) 58%,
    transparent 100%
  );
}
#scan.go {
  animation: sweep 0.5s cubic-bezier(0.3, 0.7, 0.4, 1);
}
@keyframes sweep {
  0% {
    opacity: 0;
    transform: translateY(-40%);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(400%);
  }
}
/* ─────────────────────────── countdown ─────────────────────────── */
#count {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
}
#count.on {
  opacity: 1;
}
#count span {
  font-family: "Oswald", "Haettenschweiler", Impact, sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  font-size: clamp(96px, 26vw, 200px);
  line-height: 0.85;
  color: var(--sand);
  -webkit-text-stroke: 4px var(--ink);
  text-shadow: 9px 9px 0 var(--ink);
  transform: rotate(-3deg);
}
#count.go span {
  color: var(--gold);
}
#count span.tick {
  animation: countpop 0.6s cubic-bezier(0.15, 0.9, 0.25, 1);
}
@keyframes countpop {
  0% {
    opacity: 0;
    transform: rotate(-3deg) scale(1.7);
  }
  22% {
    opacity: 1;
    transform: rotate(-3deg) scale(1);
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotate(-3deg) scale(0.94);
  }
}

/* ──────────────────────── sheets / panels ──────────────────────── */
.sheet {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(72px + var(--safeT)) calc(16px + var(--safeR))
    calc(16px + var(--safeB)) calc(16px + var(--safeL));
  background: rgba(20, 12, 8, 0.46);
  z-index: 6;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet.gone {
  display: none;
}
/* the manual is opened from the menu, so it has to sit above it */
#infocard {
  z-index: 9;
}
.sheet:not(.gone) {
  animation: fadein 0.28s ease-out;
}
@keyframes fadein {
  from {
    opacity: 0;
  }
}
.panel {
  max-width: 400px;
  width: 100%;
  padding: 20px 20px 16px;
  transform: rotate(-1deg);
  margin: auto;
}
.sheet:not(.gone) .panel > * {
  animation: cardin 0.34s cubic-bezier(0.2, 0.9, 0.3, 1) backwards;
}
.sheet:not(.gone) .panel > :nth-child(2) {
  animation-delay: 0.05s;
}
.sheet:not(.gone) .panel > :nth-child(3) {
  animation-delay: 0.1s;
}
.sheet:not(.gone) .panel > :nth-child(4) {
  animation-delay: 0.15s;
}
.sheet:not(.gone) .panel > :nth-child(5) {
  animation-delay: 0.2s;
}
.sheet:not(.gone) .panel > :nth-child(6) {
  animation-delay: 0.25s;
}
@keyframes cardin {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
.panel h1 {
  font-size: clamp(42px, 13vw, 68px);
  line-height: 0.84;
  margin-bottom: 4px;
}
.panel h1 span {
  display: block;
  color: var(--rust);
}
#kicker:empty {
  display: none;
}
.kicker {
  font-size: 11px;
  letter-spacing: 0.26em;
  margin-bottom: 12px;
}
.panel p {
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 14px;
  max-width: 34ch;
}
.keys.hide {
  display: none;
}
.keys {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}
/* the pad legend only appears once a controller is actually seen */
.padkeys {
  display: none;
}
body.pad .padkeys {
  display: flex;
}
body.pad #keys {
  display: none;
}
/* keyboard chips are noise on a phone; the tip and How to play cover it */
body.touch:not(.pad) #keys {
  display: none;
}
.padkeys .key b {
  background: var(--ink);
  color: var(--gold);
  padding: 1px 5px;
  margin-right: 4px;
  display: inline-block;
}
.key {
  border: 2px solid var(--ink);
  padding: 3px 7px;
  font-size: 10px;
  letter-spacing: 0.1em;
}
.go {
  width: 100%;
  border: 3px solid var(--ink);
  background: var(--rust);
  color: var(--sand);
  padding: 12px;
  font-size: clamp(19px, 5vw, 24px);
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
  min-height: 48px;
}
.go + .go {
  margin-top: 9px;
}
.go.ghost {
  background: var(--sand);
  color: var(--ink);
  font-size: 15px;
  padding: 9px;
}
.go:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}
.go:focus-visible,
.go:focus {
  outline: 5px solid var(--gold);
  outline-offset: 4px;
}

.modes {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 12px;
}
.mode {
  display: block;
  width: 100%;
  text-align: left;
  border: 3px solid var(--ink);
  background: var(--rust);
  color: var(--sand);
  padding: 9px 12px 10px;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
  font: inherit;
  min-height: 48px;
}
.mode.alt {
  background: var(--gold);
  color: var(--ink);
}
.mode b {
  display: block;
  font-size: clamp(17px, 4.6vw, 21px);
  line-height: 1.1;
}
.mode span {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  line-height: 1.35;
  opacity: 0.88;
}
.mode:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}
.mode:focus-visible,
.mode:focus {
  outline: 5px solid var(--gold);
  outline-offset: 4px;
}
.mode.alt:focus-visible {
  outline-color: var(--rust);
}

/* countdown mode: the clock plate is the health bar */
#clock.low {
  background: var(--rust);
  color: var(--sand);
}
#clock.low .eyebrow {
  opacity: 0.9;
}
#clock.crit {
  animation: beat 0.6s ease-in-out infinite;
}
@keyframes beat {
  50% {
    transform: scale(1.07) rotate(-1.5deg);
  }
}

.rank {
  float: right;
  margin: -4px 0 0 10px;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 34px;
  line-height: 1;
}
.rank.s {
  background: var(--rust);
  color: var(--sand);
}

/* a tip under the mode buttons, mobile only */
#tip {
  display: none;
  align-items: center;
  gap: 9px;
  margin: 2px 0 0;
  padding: 8px 10px;
  border: 2px dashed var(--ink);
  font-size: 12px;
  line-height: 1.35;
  max-width: none;
}
body.touch.portrait #tip {
  display: flex;
}
.tip-ico {
  flex: none;
  width: 15px;
  height: 22px;
  border: 3px solid var(--ink);
  border-radius: 3px;
}
.tip-ico {
  animation: tip 2.6s ease-in-out infinite;
}
@keyframes tip {
  0%, 45% { transform: rotate(0deg); }
  60%, 100% { transform: rotate(90deg); }
}
@media (prefers-reduced-motion: reduce) {
  .tip-ico { animation: none !important; }
}

#stats:empty {
  display: none;
}
.stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  border-top: 2px dashed var(--ink);
  padding: 6px 0;
  font-size: 12px;
  letter-spacing: 0.13em;
}
.stat > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
}
.stat .num {
  flex: 0 0 auto;
  white-space: nowrap;
}
.stat b {
  font-size: 28px;
}
@media (max-width: 460px) {
  .stat {
    font-size: 11px;
    letter-spacing: 0.08em;
  }
}
.stat.win b {
  color: var(--rust);
}
#stats {
  margin-bottom: 14px;
}

.how {
  margin-bottom: 14px;
}
.how .hd {
  font-size: 10px;
  letter-spacing: 0.22em;
  margin: 12px 0 2px;
  opacity: 0.62;
}
.how .hd:first-child {
  margin-top: 0;
}
.how .row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  border-top: 2px dashed var(--ink);
  padding: 6px 0;
  font-size: 13px;
  line-height: 1.35;
}
.how b {
  flex: 0 0 62px;
  font-size: 11px;
  letter-spacing: 0.14em;
}

/* ───────────────────── responsive / a11y ───────────────────── */
/* landscape phones: the panel must never outgrow the viewport */
@media (max-height: 460px) {
  /* landscape phones: the icon bar reserve at the top costs real estate the
     card needs, and the blurb repeats what the mode buttons already say */
  .sheet {
    padding-top: calc(58px + var(--safeT));
  }
  .panel p#blurb {
    display: none;
  }
  .mode span {
    font-size: 10.5px;
  }
  .mode {
    padding: 6px 10px 7px;
    min-height: 44px;
  }
  .panel {
    max-width: 520px;
    padding: 14px 16px 12px;
  }
  .panel h1 {
    font-size: clamp(30px, 7vh, 44px);
  }
  .panel p {
    font-size: 12px;
    margin-bottom: 9px;
  }
  .kicker {
    margin-bottom: 7px;
  }
  .stat b {
    font-size: 21px;
  }
  .how .hd {
  font-size: 10px;
  letter-spacing: 0.22em;
  margin: 12px 0 2px;
  opacity: 0.62;
}
.how .hd:first-child {
  margin-top: 0;
}
.how .row {
    padding: 4px 0;
    font-size: 11.5px;
  }
  /* Landscape phones: lay the chips out in a ROW rather than a column. The
     canyon channel runs down the middle of the frame, so a vertical stack
     sits exactly where you are looking; a single thin band across the top
     lands over the walls instead. */
  #toasts {
    top: 17%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    max-width: 92vw;
  }
  .toast {
    padding: 3px 9px 4px;
    border-width: 2px;
    box-shadow: 3px 3px 0 var(--ink);
    font-size: clamp(13px, 3.6vmin, 18px);
  }
}
/* Portrait phones cannot fit clock + four buttons + arches across the top.
   Info and mute drop out of the in-game bar; they stay one tap away on the
   pause sheet, where the icon bar is always shown. */
@media (max-width: 560px) {
  #topbar #info,
  #topbar #mute,
  #topbar #fs {
    display: none;
  }
  #clock b {
    font-size: 22px;
  }
  #gates b {
    font-size: 18px;
  }
  .corner {
    padding: 4px 8px 3px;
  }
}

@media (pointer: coarse) {
  #speed {
    width: 106px;
  }
  /* keep the airspeed plate clear of the thumb-stick zone */
  #speed {
    bottom: calc(var(--pad) + 2px + var(--safeB));
  }
}
@media (prefers-reduced-motion: reduce) {
  #scan {
    display: none;
  }
  .toast,
  #count span.tick,
  .corner.pop,
  .sheet:not(.gone) .panel > *,
  .sheet:not(.gone) {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .toast {
    animation: toastfade 1.5s linear forwards;
  }
  @keyframes toastfade {
    0%,
    74% {
      opacity: 1;
    }
    100% {
      opacity: 0;
    }
  }
}
