:root {
  --yellow: #ffd21f;
  --orange: #ff7a1a;
  --red: #e8322b;
  --green: #5dff6a;
  --blue: #3aa0ff;
  --ink: #120d18;
  --ink-2: #2a2133;
  --paper: #fff6dc;
  --muted: #c9bfd8;
  --font-big: 'Bangers', Impact, 'Arial Black', sans-serif;
  --font-px: 'Press Start 2P', 'Courier New', monospace;
  --ctl: 1; /* touch controls size (settings) */
  --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);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-big);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }

#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.hidden { display: none !important; }

/* =================================================================== HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }

#hud-left {
  position: absolute;
  top: max(8px, var(--safe-t));
  left: max(14px, var(--safe-l));
}
#score {
  font-size: clamp(28px, 6.4vmin, 50px);
  line-height: 1;
  color: var(--yellow);
  letter-spacing: 1px;
  text-shadow: 3px 3px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  font-variant-numeric: tabular-nums;
  transform-origin: left center;
}
#score.bump { animation: bump .35s ease-out; }
@keyframes bump { 30% { transform: scale(1.18); color: #fff; } }

/* special meter: segmented bar, label rides on the right */
#special {
  position: relative;
  width: clamp(120px, 26vmin, 210px);
  height: 14px;
  margin-top: 4px;
  border: 2px solid #000;
  background: rgba(0, 0, 0, .55);
  box-shadow: 2px 2px 0 #000;
}
#special::after { /* segment notches */
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(0,0,0,.65) calc(10% - 2px) 10%);
}
#special-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(180deg, #fff3a0 0, var(--yellow) 45%, #d99a00 100%);
  transition: width .2s;
}
#special-label {
  position: absolute;
  left: calc(100% + 6px); top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-px);
  font-size: 7px;
  color: var(--muted);
  text-shadow: 1px 1px 0 #000;
  white-space: nowrap;
}
#special.gain { animation: gain .3s; }
@keyframes gain { 40% { box-shadow: 0 0 0 2px #fff, 2px 2px 0 #000; } }
#special.full { box-shadow: 0 0 0 2px var(--red), 0 0 10px var(--orange), 2px 2px 0 #000; }
#special.full #special-fill {
  background: linear-gradient(90deg, var(--yellow), var(--orange), var(--red), var(--orange), var(--yellow));
  background-size: 200% 100%;
  animation: flow .6s linear infinite;
}
#special.full #special-label { color: var(--yellow); animation: flash .3s steps(2) infinite; }
@keyframes flow { to { background-position: -200% 0; } }
@keyframes flash { 50% { opacity: .35; } }

#hud-right {
  position: absolute;
  top: max(8px, var(--safe-t));
  right: max(14px, var(--safe-r));
  text-align: right;
}
#timer {
  font-size: clamp(26px, 5.8vmin, 46px);
  line-height: 1;
  text-shadow: 3px 3px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  font-variant-numeric: tabular-nums;
  transform-origin: right center;
}
/* the last 10 seconds: red, a size up, and a pulse each second (the pulse
   settles on the bigger size; transform only, so M-I-R-O under it stays put) */
#timer.low { color: var(--red); transform: scale(1.15); }
#timer.tick { animation: tick .5s ease-out; }
@keyframes tick { 0% { transform: scale(1.45); } }
#letters { margin-top: 4px; }
#letters span {
  display: inline-block;
  font-family: var(--font-px);
  font-size: clamp(10px, 2.4vmin, 14px);
  width: 1.9em; height: 1.9em; line-height: 1.95em;
  text-align: center;
  margin-left: 3px;
  background: rgba(0, 0, 0, .5);
  color: #6b6475;
  border: 2px solid #3a3342;
}
#letters span.got { color: var(--ink); background: var(--yellow); border-color: #000; box-shadow: 2px 2px 0 #000; animation: letter .5s ease-out; }
@keyframes letter { 0% { transform: scale(2.2) rotate(-12deg); } 60% { transform: scale(.9); } }

#pause-btn {
  position: absolute;
  top: max(8px, var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  pointer-events: auto;
  width: 46px; height: 40px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(0, 0, 0, .5);
  border: 2px solid rgba(255, 255, 255, .6);
  border-radius: 8px;
  box-shadow: 2px 2px 0 #000;
  cursor: pointer;
}
#pause-btn span { width: 6px; height: 16px; background: var(--paper); box-shadow: 1px 1px 0 #000; }
#pause-btn:active { transform: translateX(-50%) translateY(2px); }
#pause-btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* ---------- combo readout ---------- */
#combo {
  position: absolute;
  left: 50%;
  top: calc(max(8px, var(--safe-t)) + clamp(58px, 14vmin, 96px));
  transform: translateX(-50%);
  width: min(88vw, 720px);
  text-align: center;
}
#trick-list {
  font-size: clamp(16px, 3.9vmin, 28px);
  color: #fff;
  text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  line-height: 1.12;
  letter-spacing: .5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#trick-list .new { color: var(--yellow); display: inline-block; animation: newtrick .35s ease-out; }
@keyframes newtrick { 0% { transform: scale(1.5); } }
#combo-score {
  display: inline-flex;
  align-items: center;
  gap: .3em;
  margin-top: 2px;
  font-size: clamp(22px, 5.2vmin, 40px);
  line-height: 1;
  color: var(--yellow);
  text-shadow: 3px 3px 0 #000, -1px -1px 0 #000;
  font-variant-numeric: tabular-nums;
}
#combo-x { font-size: .7em; color: #fff; }
#combo-mult {
  display: inline-block;
  min-width: 1.4em;
  padding: .06em .2em 0;
  color: var(--yellow);
  background: var(--red);
  border: 3px solid #000;
  box-shadow: 3px 3px 0 #000;
  transform: rotate(-4deg);
  text-shadow: 2px 2px 0 #000;
}
#combo:not(.on) #combo-x, #combo:not(.on) #combo-mult { display: none; }
#combo-mult.pulse { animation: multpulse .3s ease-out; }
@keyframes multpulse { 0% { transform: rotate(-4deg) scale(1.6); } }
#combo.landed #combo-base { color: var(--green); }
#combo.landed #combo-mult { background: #1e8a2a; }
#combo.bailed { animation: shake .35s; }
#combo.bailed #combo-base, #combo.bailed #trick-list { color: var(--red); text-decoration: line-through; text-decoration-thickness: 3px; }
#combo.bailed #combo-mult { background: #555; color: #bbb; }

/* big slanted callouts: SHAKY, SICK COMBO! */
#callout {
  position: absolute;
  left: 50%; top: 40%;
  transform: translate(-50%, -50%) rotate(-6deg);
  font-size: clamp(28px, 7.5vmin, 58px);
  color: var(--yellow);
  -webkit-text-stroke: 1px #000;
  text-shadow: 3px 3px 0 var(--red), 6px 6px 0 #000;
  white-space: nowrap;
  opacity: 0;
}
#callout.show { animation: slam 1.3s ease-out forwards; }
/* combo callouts land once the banked points have flown up to the score */
#callout.show.late { animation: slam 1.3s .55s ease-out both; }
#callout.sketchy { color: var(--orange); font-size: clamp(22px, 5.5vmin, 40px); text-shadow: 3px 3px 0 #000; top: 56%; }
#callout.sketchy.show { animation: wobble 1s ease-out forwards; }
#callout.big { font-size: clamp(34px, 9vmin, 70px); }
#callout.huge { font-size: clamp(38px, 11vmin, 88px); color: #fff; text-shadow: 3px 3px 0 var(--orange), 6px 6px 0 var(--red), 9px 9px 0 #000; }
/* the finish line's callout (SHINJUKU ARRIVAL!) comes with the arrival's banked combo
   up top: it lands lower down, clear of the combo readout */
#callout.finish { top: 62%; }
/* [GO] the run's GO! (main.js runIntro): the biggest slam there is */
#callout.go { font-size: clamp(64px, 21vmin, 150px); top: 34%; letter-spacing: 2px; }
@keyframes slam {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-6deg) scale(2.4); }
  12% { opacity: 1; transform: translate(-50%, -50%) rotate(-6deg) scale(.92); }
  20% { transform: translate(-50%, -50%) rotate(-6deg) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) rotate(-6deg) scale(1); }
}
@keyframes wobble {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(0); }
  10% { opacity: 1; transform: translate(-50%, -50%) rotate(-10deg); }
  25% { transform: translate(-50%, -50%) rotate(8deg); }
  40% { transform: translate(-50%, -50%) rotate(-5deg); }
  55% { transform: translate(-50%, -50%) rotate(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%); }
}

#popup {
  position: absolute;
  left: 50%; top: 40%;
  transform: translate(-50%, -50%);
  font-size: clamp(30px, 8vmin, 64px);
  color: var(--green);
  text-shadow: 4px 4px 0 #000, -1px -1px 0 #000;
  opacity: 0;
  white-space: nowrap;
}
#popup.show { animation: pop 1.1s ease-out forwards; }
#popup.show.bank { animation: bank 1.15s ease-in forwards; }
#popup.bail { color: var(--red); }
#popup.special { color: var(--yellow); font-size: clamp(38px, 11vmin, 88px); text-shadow: 4px 4px 0 var(--red), 7px 7px 0 #000; }
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  30% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(1); }
}
/* banked points fly up into the score */
@keyframes bank {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  22% { transform: translate(-50%, -50%) scale(1); }
  55% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% - 36vw), calc(-50% - 34vh)) scale(.35); }
}

#message {
  position: absolute;
  left: 50%; bottom: calc(max(10px, var(--safe-b)) + 6px);
  transform: translateX(-50%);
  max-width: 52vw;
  font-family: var(--font-px);
  font-size: clamp(9px, 2.4vmin, 14px);
  line-height: 1.5;
  color: var(--yellow);
  text-shadow: 2px 2px 0 #000;
  text-align: center;
  opacity: 0;
  transition: opacity .3s;
}
#message.show { opacity: 1; }

/* ---------- balance meter (grind: horizontal, manual: vertical) ---------- */
#balance {
  --bal: 0;
  position: absolute;
  left: 50%; top: 42%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
}
#balance-track {
  position: relative;
  width: clamp(150px, 34vmin, 250px);
  height: 16px;
  background: linear-gradient(90deg, var(--red) 0 12%, var(--yellow) 12% 30%, var(--green) 30% 70%, var(--yellow) 70% 88%, var(--red) 88%);
  border: 3px solid #000;
  box-shadow: 0 0 0 2px rgba(255,255,255,.45), 3px 3px 0 2px #000;
}
#balance-needle {
  position: absolute;
  top: -9px; left: calc(50% + var(--bal) * 50%);
  width: 8px; height: 28px;
  margin-left: -4px;
  background: #fff;
  border: 2px solid #000;
}
.bal-arrow {
  font-size: clamp(18px, 4.4vmin, 28px);
  line-height: 1;
  color: rgba(255, 255, 255, .28);
  filter: drop-shadow(2px 2px 0 #000);
  width: 1em; text-align: center;
}
/* CSS triangles, never glyphs (iOS draws those as a missing-glyph box) */
.bal-arrow::before { content: ''; display: inline-block; vertical-align: middle; border: .4em solid transparent; }
.bal-lo::before { border-right: .55em solid currentColor; border-left-width: 0; }
.bal-hi::before { border-left: .55em solid currentColor; border-right-width: 0; }
#balance.hint-lo .bal-lo, #balance.hint-hi .bal-hi { color: var(--yellow); animation: flash .25s steps(2) infinite; }
#balance.warn #balance-track { box-shadow: 0 0 0 2px var(--red), 3px 3px 0 2px #000; }
#balance.vert {
  flex-direction: column-reverse;
  left: 23%; top: 50%;
  transform: translate(-50%, -50%);
}
#balance.vert #balance-track {
  width: 16px;
  height: clamp(120px, 32vmin, 220px);
  background: linear-gradient(0deg, var(--red) 0 12%, var(--yellow) 12% 30%, var(--green) 30% 70%, var(--yellow) 70% 88%, var(--red) 88%);
}
#balance.vert #balance-needle { top: auto; left: -9px; bottom: calc(50% + var(--bal) * 50%); width: 28px; height: 8px; margin: 0 0 -4px; }
#balance.vert .bal-lo::before { border: .4em solid transparent; border-top: .55em solid currentColor; border-bottom-width: 0; }
#balance.vert .bal-hi::before { border: .4em solid transparent; border-bottom: .55em solid currentColor; border-top-width: 0; }

/* =================================================================== touch controls */
#stick-zone {
  position: absolute;
  left: 0; bottom: 0;
  width: 50%; height: 72%;
  pointer-events: auto;
  touch-action: none;
}
#stick-base {
  position: absolute;
  left: max(22px, calc(var(--safe-l) + 8px));
  bottom: max(22px, calc(var(--safe-b) + 8px));
  width: 128px; height: 128px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,0,0,.18) 0 55%, rgba(0,0,0,.34) 56%);
  border: 3px solid rgba(255, 255, 255, .38);
  box-shadow: 0 3px 0 rgba(0,0,0,.35);
  transform: scale(var(--ctl));
  transform-origin: 0 100%;
  transition: border-color .1s;
}
#stick-base.active { border-color: rgba(255, 210, 31, .85); }
#stick-base.floating { translate: var(--float-x, 0) var(--float-y, 0); }
/* the stick's direction arrows (scoped: #timer.tick is the clock's pulse) */
#stick-base .tick {
  position: absolute;
  width: 0; height: 0;
  border: 7px solid transparent;
  opacity: .45;
}
#stick-base .tick.up { left: 50%; top: 5px; margin-left: -7px; border-bottom-color: #fff; border-top-width: 0; }
#stick-base .tick.down { left: 50%; bottom: 5px; margin-left: -7px; border-top-color: #fff; border-bottom-width: 0; }
#stick-base .tick.left { top: 50%; left: 5px; margin-top: -7px; border-right-color: #fff; border-left-width: 0; }
#stick-base .tick.right { top: 50%; right: 5px; margin-top: -7px; border-left-color: #fff; border-right-width: 0; }
#stick-base .tick.on { opacity: 1; filter: drop-shadow(0 0 3px var(--yellow)); }
#stick-base .tick.up.on { border-bottom-color: var(--yellow); }
#stick-base .tick.down.on { border-top-color: var(--yellow); }
#stick-base .tick.left.on { border-right-color: var(--yellow); }
#stick-base .tick.right.on { border-left-color: var(--yellow); }
#stick-knob {
  position: absolute;
  left: 50%; top: 50%;
  width: 58px; height: 58px;
  margin: -29px 0 0 -29px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f0f0f0, #8a8a8a 60%, #555);
  border: 3px solid rgba(0, 0, 0, .7);
  box-shadow: 0 3px 0 rgba(0,0,0,.4);
}
#stick-base.active #stick-knob { background: radial-gradient(circle at 35% 30%, #fff8cc, var(--yellow) 60%, #b88a00); }

/* PS1-style diamond: GRIND top, FLIP left, GRAB right, OLLIE bottom, SPECIAL pill */
#buttons {
  position: absolute;
  right: max(12px, calc(var(--safe-r) + 6px));
  bottom: max(12px, calc(var(--safe-b) + 6px));
  width: 204px; height: 204px;
  pointer-events: auto;
  touch-action: none;
  transform: scale(var(--ctl));
  transform-origin: 100% 100%;
}
.btn {
  position: absolute;
  width: 66px; height: 66px;
  margin: -33px 0 0 -33px;
  padding: 0;
  border-radius: 50%;
  pointer-events: none; /* the #buttons zone does hit testing */
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff;
  --bc: #3b3542;
  background: radial-gradient(circle at 38% 28%, rgba(255,255,255,.45), rgba(255,255,255,0) 45%), var(--bc);
  border: 3px solid #000;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.35), 0 4px 0 rgba(0,0,0,.45);
  opacity: .92;
}
.btn b {
  font-family: var(--font-big);
  font-weight: normal;
  font-size: 17px;
  letter-spacing: .5px;
  line-height: 1;
  margin-top: 2px;
  text-shadow: 1px 1px 0 #000;
}
.btn.down { transform: translateY(3px) scale(.92); box-shadow: inset 0 3px 0 rgba(0,0,0,.35); opacity: 1; filter: brightness(1.35); }
.btn.down::after { /* press ring */
  content: '';
  position: absolute; inset: -8px;
  border-radius: inherit;
  border: 3px solid rgba(255, 255, 255, .7);
  animation: ring .25s ease-out forwards;
}
@keyframes ring { from { transform: scale(.8); opacity: 1; } to { transform: scale(1.15); opacity: 0; } }
/* the original cheerful N64 colours */
#btn-grind { left: 102px; top: 38px;  --bc: #e0a800; }
#btn-flip  { left: 36px;  top: 104px; --bc: #1c6fd1; }
#btn-grab  { left: 168px; top: 104px; --bc: #2f9e44; }
#btn-jump  { left: 102px; top: 168px; width: 72px; height: 72px; margin: -36px 0 0 -36px; --bc: #d63a2f; }
#btn-jump b { font-size: 20px; }

#btn-special {
  left: 26px; top: 176px;
  width: 58px; height: 34px;
  margin: -17px 0 0 -29px;
  border-radius: 10px;
  background: #3b3342;
  color: #9a90a6;
}
#btn-special b { font-size: 12px; white-space: nowrap; letter-spacing: 0; color: inherit; }
#btn-special.ready {
  background: var(--yellow);
  color: var(--ink);
  box-shadow: 0 0 0 3px var(--red), 0 0 14px var(--orange), 0 4px 0 rgba(0,0,0,.45);
  animation: ready .6s ease-in-out infinite alternate;
}
#btn-special.ready b { text-shadow: none; }
@keyframes ready { to { filter: brightness(1.25); } }

/* left-handed: stick right, buttons left */
body.lefty #stick-zone { left: auto; right: 0; }
body.lefty #stick-base { left: auto; right: max(22px, calc(var(--safe-r) + 8px)); transform-origin: 100% 100%; }
body.lefty #buttons { right: auto; left: max(12px, calc(var(--safe-l) + 6px)); transform-origin: 0 100%; }
body.lefty #btn-special { left: 178px; }

/* hide touch controls on devices without touch */
@media (hover: hover) and (pointer: fine) {
  body:not(.touch) #stick-zone, body:not(.touch) #buttons { display: none; }
}

/* ---------- first-run coach marks ---------- */
#coach-ring {
  position: absolute;
  border: 4px solid var(--yellow);
  border-radius: 50%;
  box-shadow: 0 0 0 3px #000, 0 0 18px var(--yellow);
  animation: coachring 1s ease-in-out infinite;
}
#coach-ring.bar { border-radius: 8px; }
@keyframes coachring { 50% { transform: scale(1.1); opacity: .6; } }
#coach-card {
  position: absolute;
  left: 50%;
  top: calc(max(8px, var(--safe-t)) + clamp(58px, 14vmin, 90px));
  transform: translateX(-50%);
  width: min(430px, calc(100vw - 32px));
  padding: 10px 14px 12px;
  background: rgba(18, 13, 24, .9);
  border: 3px solid #000;
  box-shadow: 0 0 0 2px var(--yellow), 5px 5px 0 2px #000;
  text-align: center;
  pointer-events: auto;
}
#coach-step { font-family: var(--font-px); font-size: 7px; color: var(--muted); letter-spacing: 1px; }
#coach-title { font-size: clamp(26px, 6vmin, 38px); line-height: 1.05; color: var(--yellow); text-shadow: 3px 3px 0 var(--red), 5px 5px 0 #000; margin: 2px 0 4px; }
#coach.nice #coach-title { color: var(--green); animation: newtrick .35s ease-out; }
#coach-text { font-family: var(--font-px); font-size: clamp(8px, 2.2vmin, 10px); line-height: 1.7; color: var(--paper); text-shadow: 1px 1px 0 #000; }
#coach-text b { color: var(--yellow); font-weight: normal; white-space: nowrap; }
.coach-actions { display: flex; justify-content: center; gap: 10px; margin-top: 8px; }
body[data-screen="pause"] #coach, body[data-screen="settings"] #coach { display: none; }

/* =================================================================== menus */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: max(16px, var(--safe-t)) max(16px, var(--safe-r)) max(16px, var(--safe-b)) max(16px, var(--safe-l));
  text-align: center;
}
#loading { background: var(--ink); font-family: var(--font-px); font-size: 14px; color: var(--yellow); z-index: 10; }

.logo { transform: rotate(-4deg); cursor: default; }
.logo.tap { animation: logotap .18s; }
@keyframes logotap { 50% { transform: rotate(-4deg) scale(.96); } }
.logo-small {
  font-size: clamp(26px, 7vmin, 52px);
  color: #fff;
  text-shadow: 3px 3px 0 #000;
  margin-bottom: -.35em;
  text-align: left;
  padding-left: .4em;
  white-space: nowrap;
}
.logo-big, .screen-title {
  font-size: clamp(48px, 13vmin, 110px);
  line-height: 1;
  color: var(--yellow);
  -webkit-text-stroke: 2px #000;
  text-shadow: 5px 5px 0 var(--red), 9px 9px 0 #000;
  letter-spacing: 2px;
  white-space: nowrap;
}
.screen-title { font-size: clamp(34px, 9vmin, 64px); transform: rotate(-3deg); -webkit-text-stroke: 1.5px #000; text-shadow: 4px 4px 0 var(--red), 7px 7px 0 #000; }
.screen-title.big { font-size: clamp(42px, 12vmin, 90px); }
/* REALTIME over BOARD, both in the same yellow THPS treatment: REALTIME is set
   smaller (0.64x) so the two words come out about the same width, and the
   logo reads as one name rather than a big BOARD with a caption */
.logo .logo-small { font-size: clamp(51px, 14.7vmin, 115px); letter-spacing: 3px; color: var(--yellow); -webkit-text-stroke: 2px #000; text-shadow: 5px 5px 0 var(--red), 9px 9px 0 #000; text-align: center; padding-left: 0; margin-bottom: -.08em; }
.logo .logo-big { font-size: clamp(80px, 23vmin, 180px); letter-spacing: 4px; -webkit-text-stroke: 2.5px #000; text-shadow: 6px 6px 0 var(--red), 11px 11px 0 #000; padding-right: 11px; }
.menu { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.menu.row, .row { flex-direction: row; flex-wrap: wrap; justify-content: center; }
.menu-btn {
  position: relative;
  font-family: var(--font-px);
  font-size: clamp(11px, 3vmin, 15px);
  min-width: 230px;
  min-height: 44px;
  padding: 12px 18px;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid #000;
  box-shadow: 5px 5px 0 #000;
  cursor: pointer;
  text-shadow: none;
}
.menu-btn:focus-visible { background: var(--yellow); outline: none; box-shadow: 0 0 0 3px #fff, 5px 5px 0 3px #000; }
/* hover only where there's a real pointer (it sticks after a tap on phones) */
@media (hover: hover) {
  .menu-btn:hover { background: var(--yellow); }
  .menu-btn.go:hover, #title .main-menu #start-career:hover, #title .main-menu #start-free:hover { background: #fff; }
  .menu-btn.create-btn:hover { background: var(--yellow); color: var(--ink); }
}
/* THPS selection cursor, on the vertical menus */
.menu:not(.row) > .menu-btn:focus-visible::before {
  content: '\25B6';
  position: absolute;
  left: -26px; top: 50%;
  transform: translateY(-50%);
  color: var(--yellow);
  font-size: 16px;
  text-shadow: 2px 2px 0 #000;
  animation: nudge .5s ease-in-out infinite alternate;
}
@keyframes nudge { to { transform: translate(5px, -50%); } }
.menu-btn:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 #000; }
.menu-btn.small { font-size: 10px; min-width: 0; min-height: 38px; padding: 9px 12px; }
.menu-btn.go { background: var(--yellow); font-size: clamp(14px, 3.6vmin, 18px); }
.menu-btn.go:focus-visible { background: #fff; }
.menu-btn.danger.armed { background: var(--red); color: #fff; }
.menu-btn.create-btn { background: var(--ink-2); color: var(--yellow); }
.menu-btn.create-btn:focus-visible { background: var(--yellow); color: var(--ink); }
.menu-btn:disabled { opacity: .7; cursor: default; }

.best { font-family: var(--font-px); font-size: 10px; color: var(--yellow); text-shadow: 2px 2px 0 #000; }

/* ---------- pickers (select + settings) ---------- */
.picker {
  display: flex;
  align-items: stretch;
  min-width: 230px;
  min-height: 44px;
  background: rgba(18, 13, 24, .8);
  border: 3px solid #000;
  box-shadow: 4px 4px 0 #000;
  outline: none;
}
.picker:focus-visible { box-shadow: 0 0 0 3px var(--yellow), 4px 4px 0 3px #000; background: rgba(60, 40, 10, .9); }
.picker:focus-visible .pick-label { color: #fff; }
.pick-btn {
  width: 44px;
  flex: none;
  font-size: 14px;
  color: var(--ink);
  background: var(--yellow);
  border: 0;
  cursor: pointer;
}
.pick-btn:active { background: #fff; }
.picker.single .pick-btn { background: #5a5163; color: #2a2330; cursor: default; }
.pick-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 4px 8px; }
.pick-label { font-family: var(--font-px); font-size: 8px; line-height: 1.5; color: var(--yellow); letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-value { font-size: 20px; line-height: 1.1; letter-spacing: 1px; color: #fff; text-shadow: 2px 2px 0 #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-value.long { font-size: 17px; letter-spacing: .5px; }
/* the C-H-O-W level picker's city (LEVEL · EVERYONE · LONDON over CITY CENTRE) */
.pick-city { font-weight: normal; color: #fff; }
.picker.nudge-l .pick-value { animation: nudgel .18s ease-out; }
.picker.nudge-r .pick-value { animation: nudger .18s ease-out; }
@keyframes nudgel { from { transform: translateX(14px); opacity: .3; } }
@keyframes nudger { from { transform: translateX(-14px); opacity: .3; } }

/* ---------- main menu ---------- */
#title { justify-content: space-between; background: linear-gradient(180deg, rgba(18,13,24,.55), transparent 35%, transparent 55%, rgba(18,13,24,.82)); }
.main-menu { width: min(100%, 420px); }
.main-menu .menu-btn { width: 100%; }
#title .main-menu #start-career, #title .main-menu #start-free { background: var(--yellow); }
#title .main-menu #start-career:focus-visible, #title .main-menu #start-free:focus-visible { background: #fff; }

/* ---------- select ---------- */
#select { justify-content: space-between; background: linear-gradient(180deg, rgba(18,13,24,.6), transparent 26%, transparent 45%, rgba(18,13,24,.85)); }
/* the mode tag on its own line, then the skater picker as wide as it gets */
.sel-head { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; text-align: left; align-self: stretch; transform: rotate(-2deg); transform-origin: left top; }
.sel-mode {
  display: inline-block;
  font-family: var(--font-px);
  font-size: 9px;
  color: var(--ink);
  background: var(--yellow);
  border: 2px solid #000;
  box-shadow: 3px 3px 0 #000;
  padding: 4px 7px;
}
/* the skater picker doubles as the big name */
.picker.hero {
  display: flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  margin-top: 6px;
  background: none;
  border: 0;
  box-shadow: none;
}
.picker.hero:focus-visible { box-shadow: none; background: none; outline: 3px dashed var(--yellow); outline-offset: 2px; }
/* the name shrinks to fit the room it has (main.js fitSelect), it never clips */
.picker.hero .pick-body { flex: 0 1 auto; min-width: 0; padding: 0 4px; }
.picker.hero .pick-label { display: none; }
.picker.hero .pick-value {
  font-size: clamp(40px, 11vmin, 80px);
  line-height: 1.02;
  max-width: 100%;
  padding: 0 .22em 4px 2px; /* room for the slant and the offset shadows */
  text-overflow: clip;
  color: #fff;
  -webkit-text-stroke: 1.5px #000;
  text-shadow: 4px 4px 0 var(--red), 7px 7px 0 #000;
  letter-spacing: 1px;
}
.picker.hero .pick-value.long { font-size: clamp(34px, 9.5vmin, 66px); }
.picker.hero .pick-value.xlong { font-size: clamp(30px, 8.5vmin, 58px); }
.picker.hero .pick-btn {
  width: 40px; height: 44px;
  font-size: 18px;
  background: var(--yellow);
  border: 3px solid #000;
  box-shadow: 3px 3px 0 #000;
}
.picker.hero.single .pick-btn { visibility: hidden; width: 0; border: 0; }
.picker.hero .pick-body { align-items: flex-start; }
/* <NAME> / PRO SKATER: the title logo's yellow line under the big name */
.picker.hero .pick-pro {
  font-size: clamp(22px, 6vmin, 40px);
  line-height: 1;
  margin: -2px 0 0 10px;
  padding: 0 8px 4px 0;
  color: var(--yellow);
  -webkit-text-stroke: 1px #000;
  text-shadow: 3px 3px 0 var(--red), 5px 5px 0 #000;
  letter-spacing: 1px;
  white-space: nowrap;
  max-width: calc(100% - 10px);
  overflow: hidden;
}
.skater-tools { margin-top: 8px; }
.sel-panel > * { flex-shrink: 0; }
.sel-panel {
  width: min(100%, 440px);
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 3px 8px 8px 3px; /* room for hard shadows / focus rings */
  margin: -3px -8px -8px -3px;
  scrollbar-width: none;
}
.sel-panel::-webkit-scrollbar { display: none; }
.sel-panel .picker { min-width: 0; }
.skater-tools { display: flex; gap: 8px; justify-content: flex-start; flex-wrap: wrap; }
.skater-tools:not(:has(button:not(.hidden))) { display: none; }
.skater-tools .menu-btn { min-height: 34px; padding: 7px 10px; font-size: 9px; box-shadow: 3px 3px 0 #000; }
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  padding: 6px 9px;
  background: rgba(0, 0, 0, .55);
  border: 2px solid #000;
}
.stat { display: flex; align-items: center; gap: 6px; }
.stat-k { font-family: var(--font-px); font-size: 7px; color: var(--muted); width: 7.3em; text-align: left; flex: none; }
.stat-bar { flex: 1; display: flex; gap: 2px; }
.stat-bar i { flex: 1; height: 9px; background: #3a3342; border: 1px solid #000; transform: skewX(-12deg); }
.stat-bar i.on { background: var(--yellow); }
.stat-bar i.on:nth-child(n+8) { background: var(--orange); }
.stat-bar i.on:nth-child(10) { background: var(--red); }
/* a long name gets a smaller font, not a shorter picker (nothing below it moves) */
.sel-panel .pick-value { line-height: 22px; }
.sel-actions { display: flex; gap: 10px; margin-top: 2px; }
.sel-actions .back { flex: none; }
.sel-actions .go { flex: 1; min-width: 0; }
/* the big button: the ride's word (SKATE!, BIKE!, DRIVE!...), a padlock when it's locked */
#select-go { display: flex; align-items: center; justify-content: center; gap: 9px; }
#select-go .go-label { white-space: nowrap; }
#select-go .go-lock { display: none; flex: none; width: 13px; height: 15px; margin-top: -3px; }
#select-go.locked .go-lock { display: block; }

/* why a ride is locked: a yellow speech box over SKATE! (or the ride picker), main.js showRidePop() */
.ride-pop { position: fixed; left: 0; top: 0; z-index: 7; pointer-events: none; }
.ride-pop.show {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: max-content;
  max-width: min(330px, calc(100vw - 32px));
  padding: 9px 12px 8px;
  font-family: var(--font-px);
  text-align: left;
  color: var(--ink);
  background: var(--yellow);
  border: 3px solid #000;
  box-shadow: 4px 4px 0 #000;
  transform: rotate(-1.5deg);
  animation: ridepop .22s cubic-bezier(.2, 1.6, .4, 1) both;
}
.ride-pop .rp-main { font-weight: normal; font-size: 9px; line-height: 1.6; }
.ride-pop .rp-sub { font-size: 8px; line-height: 1.5; color: var(--red); }
/* the tail, pointing down at the button (up at the picker when it sits below it):
   a yellow triangle over a bigger black one, for the outline */
.ride-pop.show::before, .ride-pop.show::after {
  content: '';
  position: absolute;
  left: var(--tail, 50%);
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 13px solid #000;
  margin-left: -11px;
  bottom: -16px;
}
.ride-pop.show::after { border-width: 8px 7px 0; border-top-color: var(--yellow); margin-left: -7px; bottom: -9px; }
.ride-pop.show.below::before { bottom: auto; top: -16px; border-top: 0; border-bottom: 13px solid #000; }
.ride-pop.show.below::after { bottom: auto; top: -9px; border-width: 0 7px 8px; border-bottom: 8px solid var(--yellow); }
@keyframes ridepop { 0% { transform: rotate(-1.5deg) scale(.6); opacity: 0; } 100% { transform: rotate(-1.5deg); opacity: 1; } }

/* ---------- settings ---------- */
#settings, #howto, #scores { background: rgba(18, 13, 24, .9); }
#pause, #end { background: rgba(18, 13, 24, .74); }
body[data-screen="settings"].in-run #settings { background: rgba(18, 13, 24, .6); }
.settings-list {
  width: min(100%, 460px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 0;
  padding: 3px 8px 8px 3px;
  margin: -3px -8px -8px -3px;
  touch-action: pan-y;
}
.pick-value.vol { display: flex; align-items: center; justify-content: center; gap: 3px; padding: 3px 0 2px; }
.pick-value.vol i { width: 9px; height: 16px; background: #3a3342; border: 1px solid #000; transform: skewX(-12deg); }
.pick-value.vol i.on { background: var(--yellow); }
.pick-value.vol b { font-family: var(--font-px); font-weight: normal; font-size: 9px; margin-left: 8px; color: var(--yellow); }
.setting .pick-value { font-size: 18px; }

/* ---------- how to ---------- */
.howto-list {
  width: min(100%, 600px);
  min-height: 0;
  overflow-y: auto;
  touch-action: pan-y;
  text-align: left;
  background: rgba(0, 0, 0, .55);
  border: 3px solid #000;
  box-shadow: 5px 5px 0 #000;
  padding: 6px 10px;
  outline: none;
}
.howto-list:focus-visible { box-shadow: 0 0 0 3px var(--yellow), 5px 5px 0 3px #000; }
.how-row { display: flex; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px dashed rgba(255,255,255,.12); }
.how-row:last-child { border-bottom: 0; }
.how-start { padding: 4px 6px 10px 0; }
.how-start .menu-btn { width: 100%; min-width: 0; }
.how-row p { margin: 0; font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 13px; line-height: 1.4; color: #f1ead8; }
.how-row b { color: var(--yellow); }
/* the KEYBOARD row only where the keyboard legend shows (see "desktop" below) */
.how-row.how-keys { display: none; }
@media (hover: hover) and (pointer: fine) { body:not(.touch) .how-row.how-keys { display: flex; } }
/* a ◀ / ▶ in a label (BACK, VIEW, NEXT ROUND), drawn in CSS: the glyphs show as a box on iOS */
.tri { display: inline-block; width: 0; height: 0; vertical-align: middle; border-top: .42em solid transparent; border-bottom: .42em solid transparent; }
.tri.l { border-right: .6em solid currentColor; margin-right: .6em; }
.tri.r { border-left: .6em solid currentColor; margin-left: .6em; }
.chip {
  flex: none;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #6d6676, #3b3542 65%);
  border: 3px solid #000;
  font-size: 15px;
  color: #fff;
}
.chip.stick { background: radial-gradient(circle, #aaa 0 30%, #3b3542 32%); }
.chip.combo { background: var(--red); color: var(--yellow); border-radius: 6px; }
.chip.special { background: var(--yellow); color: var(--ink); border-radius: 8px; }
.chip.letters { background: var(--yellow); color: var(--ink); border-radius: 4px; font-family: var(--font-px); font-size: 14px; }
.chip.keys { border-radius: 6px; font-family: var(--font-px); font-size: 8px; }

/* ---------- pause ---------- */
.pause-info { font-family: var(--font-px); font-size: 9px; color: var(--muted); text-shadow: 2px 2px 0 #000; }
/* where the run was: LONDON · CITY CENTRE, tucked under the end title */
.end-level { position: relative; z-index: 1; font-family: var(--font-px); font-size: 9px; letter-spacing: 1px; color: var(--yellow); text-shadow: 2px 2px 0 #000; margin: -6px 0 0; }
.end-level:empty { display: none; }
#pause .menu-btn { min-width: 240px; }

/* ---------- end of run ---------- */
.results {
  min-width: min(100%, 330px);
  padding: 8px 14px;
  background: rgba(0, 0, 0, .55);
  border: 3px solid #000;
  box-shadow: 5px 5px 0 #000;
  cursor: pointer;
}
.res-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; font-family: var(--font-px); font-size: clamp(10px, 2.6vmin, 14px); line-height: 2.1; text-shadow: 2px 2px 0 #000; }
.res-k { color: var(--muted); }
.res-v { color: var(--yellow); font-variant-numeric: tabular-nums; }
#res-score .res-v { font-family: var(--font-big); font-size: clamp(24px, 6vmin, 38px); line-height: 1.2; letter-spacing: 1px; }
#end.counting #res-score .res-v { color: #fff; }
#final-letters { display: inline-flex; gap: 3px; }
#final-letters i {
  font-style: normal;
  width: 1.8em; height: 1.8em; line-height: 1.85em;
  text-align: center;
  font-size: .85em;
  color: #6b6475;
  background: rgba(0,0,0,.5);
  border: 2px solid #3a3342;
  text-shadow: none;
}
#final-letters i.got { color: var(--ink); background: var(--yellow); border-color: #000; animation: letter .45s ease-out; }
#new-best {
  margin: 12px -4px 4px;
  padding: 7px 10px 6px;
  font-family: var(--font-big);
  font-size: clamp(20px, 5vmin, 30px);
  letter-spacing: 1px;
  color: var(--ink);
  background: var(--yellow);
  border: 3px solid #000;
  box-shadow: 4px 4px 0 var(--red), 7px 7px 0 #000;
  transform: rotate(-3deg);
  animation: stamp .45s cubic-bezier(.2, 1.6, .4, 1) both, glow 1s .45s ease-in-out infinite alternate;
  white-space: nowrap;
}
@keyframes stamp { 0% { transform: rotate(-12deg) scale(2.6); opacity: 0; } 100% { transform: rotate(-3deg) scale(1); opacity: 1; } }
@keyframes glow { to { box-shadow: 4px 4px 0 var(--red), 7px 7px 0 #000, 0 0 22px var(--yellow); } }
#end.record .screen-title { animation: rainbow .6s steps(3) infinite; }
@keyframes rainbow { 33% { color: #fff; } 66% { color: var(--orange); } }

/* arcade initials */
#score-entry { display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: auto; }
.entry-label { font-family: var(--font-px); font-size: 9px; color: var(--yellow); text-shadow: 2px 2px 0 #000; }
.entry-row { display: flex; align-items: center; gap: 12px; }
.initials { display: flex; gap: 6px; }
.initials.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.ini-slot { display: flex; flex-direction: column; align-items: center; }
.ini-up, .ini-down {
  width: 44px; height: 24px;
  padding: 0;
  font-size: 12px;
  line-height: 1;
  color: var(--yellow);
  background: none;
  border: 0;
  text-shadow: 2px 2px 0 #000;
  cursor: pointer;
  touch-action: manipulation;
}
.ini-up::before, .ini-down::before { content: ''; display: inline-block; vertical-align: middle; border: 7px solid transparent; filter: drop-shadow(2px 2px 0 #000); }
.ini-up::before { border-bottom: 9px solid currentColor; border-top-width: 0; }
.ini-down::before { border-top: 9px solid currentColor; border-bottom-width: 0; }
.ini-up:active, .ini-down:active { color: #fff; transform: scale(1.2); }
.ini-slot:not(.on) .ini-up, .ini-slot:not(.on) .ini-down { opacity: .45; }
.ini-char {
  width: 44px; height: 44px;
  padding: 0;
  font-family: var(--font-px);
  font-size: 20px;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid #000;
  box-shadow: 3px 3px 0 #000;
  cursor: pointer;
  outline: none;
}
.ini-char.empty { color: #9a8f86; }
.ini-slot.on .ini-char { background: var(--yellow); box-shadow: 0 0 0 2px var(--red), 3px 3px 0 2px #000; }
.ini-char:focus-visible { box-shadow: 0 0 0 3px #fff, 3px 3px 0 3px #000; }
#score-rank { font-family: var(--font-px); text-shadow: 2px 2px 0 #000; }
#score-rank .rank-line { font-size: clamp(12px, 3vmin, 16px); color: var(--green); animation: flash .5s steps(2) 4; }
#score-rank .rank-note { font-size: 8px; line-height: 1.6; color: var(--muted); max-width: 380px; margin-top: 6px; }

#replay-box { max-width: min(420px, 90vw); text-shadow: 2px 2px 0 #000; }
#replay-label { font-family: var(--font-px); font-size: 10px; color: var(--red); animation: flash .8s steps(2) infinite; }
#replay-label::before { content: ''; display: inline-block; width: .7em; height: .7em; margin-right: .8em; border-radius: 50%; background: currentColor; vertical-align: -.05em; }
#replay-tricks {
  font-size: clamp(14px, 3.4vmin, 20px);
  line-height: 1.1;
  color: #fff;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#replay-score { font-size: clamp(18px, 4.4vmin, 30px); color: var(--yellow); text-shadow: 3px 3px 0 #000; }
#end .menu { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: stretch; }
#end .menu .menu-btn:not(.small) { min-width: 0; }

/* while the replay runs, keep the panel out of the rider's way */
#end.replaying { background: linear-gradient(180deg, rgba(18,13,24,.88) 0, rgba(18,13,24,.35) 42%, rgba(18,13,24,.15) 60%, rgba(18,13,24,.88) 100%); justify-content: flex-start; gap: 10px; }
#end.replaying #replay-box { margin-top: auto; }

/* ---------- high scores ---------- */
#scores { gap: 10px; }
#score-list {
  list-style: none;
  font-family: var(--font-px);
  font-size: clamp(10px, 2.8vmin, 14px);
  margin: 0;
  padding: 6px;
  width: min(560px, 100%);
  text-align: left;
  flex: 0 1 auto;
  min-height: 0;
  max-height: 55vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  pointer-events: auto;
  background: rgba(0, 0, 0, .55);
  border: 3px solid #000;
  box-shadow: 5px 5px 0 #000;
  font-variant-numeric: tabular-nums;
}
#score-list li {
  display: grid;
  grid-template-columns: 2.4em 4.2em 1fr;
  grid-template-areas: "rank ini pts" "rank meta meta";
  column-gap: .6em;
  align-items: baseline;
  padding: .55em .5em .45em;
  text-shadow: 2px 2px 0 #000;
}
#score-list li:nth-child(even) { background: rgba(255, 255, 255, .05); }
#score-list .rank { grid-area: rank; color: var(--yellow); text-align: right; }
#score-list .ini { grid-area: ini; color: #fff; }
#score-list .pts { grid-area: pts; color: var(--yellow); text-align: right; }
#score-list .meta { grid-area: meta; font-size: .72em; color: #b8aec8; margin-top: .45em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#score-list li:first-child .rank, #score-list li:first-child .pts { color: var(--orange); }
#score-list li.me { background: var(--yellow); box-shadow: inset 0 0 0 2px #000, 3px 3px 0 var(--red); text-shadow: none; }
#score-list li.me .rank, #score-list li.me .pts, #score-list li.me .ini { color: var(--ink); }
#score-list li.me .meta { color: #5a3a00; }
#score-list li.empty { display: block; text-align: center; color: #b8aec8; padding: 1.5em .5em; }
#score-note {
  font-family: var(--font-px);
  font-size: 8px;
  line-height: 1.6;
  max-width: min(560px, 100%);
  color: #b8aec8;
  text-shadow: 1px 1px 0 #000;
}
#score-note.shared { color: var(--green); }

/* Secret unlock toast */
#secret-toast {
  position: fixed;
  left: 50%; top: 42%;
  transform: translateX(-50%);
  z-index: 20;
  max-width: calc(100vw - 32px);
  font-family: var(--font-px);
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--yellow);
  border: 3px solid #000;
  box-shadow: 5px 5px 0 #000;
  padding: 12px 16px;
  text-align: center;
  animation: flash .3s steps(2) 6;
}

/* =================================================================== goals + unlocks */
/* THPS "GOAL COMPLETE!" banner: a slanted yellow kicker over a red ribbon */
#goal-banner, #menu-banner {
  position: absolute;
  left: 50%; top: 52%;
  transform: translate(-50%, -50%);
  z-index: 3;
  width: max-content;
  max-width: calc(100vw - 32px);
  text-align: center;
  opacity: 0;
  pointer-events: none;
}
/* (its twin over the menus: a GENERAL achievement earned outside a run) */
#menu-banner { position: fixed; z-index: 30; }
:is(#goal-banner, #menu-banner) .gb-top {
  font-size: clamp(30px, 8.5vmin, 64px);
  line-height: 1;
  color: var(--yellow);
  -webkit-text-stroke: 1.5px #000;
  text-shadow: 3px 3px 0 var(--red), 6px 6px 0 #000;
  transform: rotate(-4deg);
  white-space: nowrap;
}
:is(#goal-banner, #menu-banner) .gb-name {
  display: inline-block;
  margin-top: 6px;
  padding: 6px 14px 5px;
  font-family: var(--font-px);
  font-size: clamp(10px, 2.8vmin, 15px);
  line-height: 1.4;
  color: #fff;
  background: var(--red);
  border: 3px solid #000;
  box-shadow: 4px 4px 0 #000;
  transform: rotate(-2deg);
  text-shadow: 2px 2px 0 #000;
  max-width: 100%;
}
:is(#goal-banner, #menu-banner) .gb-sub {
  margin-top: 8px;
  font-family: var(--font-px);
  font-size: clamp(7px, 2vmin, 10px);
  line-height: 1.6;
  color: var(--paper);
  text-shadow: 2px 2px 0 #000;
}
:is(#goal-banner, #menu-banner).unlock .gb-top { color: var(--green); text-shadow: 3px 3px 0 #1a5a22, 6px 6px 0 #000; }
:is(#goal-banner, #menu-banner).unlock .gb-name { background: var(--yellow); color: var(--ink); text-shadow: none; font-size: clamp(12px, 3.4vmin, 18px); }
:is(#goal-banner, #menu-banner).show { animation: goalin 2.3s ease-out forwards; }
:is(#goal-banner, #menu-banner).show.unlock { animation-duration: 3.2s; }
/* paused: the banner holds where it is (its timer runs on game time, goals-ui.js update()) */
body.in-run #goal-banner.show { animation-play-state: paused; }
@keyframes goalin {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(2.2); }
  9% { opacity: 1; transform: translate(-50%, -50%) scale(.94); }
  15% { transform: translate(-50%, -50%) scale(1); }
  85% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(1); }
}

/* count readout under the letters: STICKY NOTES 3/5 */
#goal-progress {
  margin-top: 6px;
  display: inline-block;
  font-family: var(--font-px);
  font-size: clamp(8px, 2vmin, 11px);
  line-height: 1.4;
  padding: 4px 6px 3px;
  color: var(--ink);
  background: var(--yellow);
  border: 2px solid #000;
  box-shadow: 2px 2px 0 #000;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .3s;
}
#goal-progress.show { opacity: 1; animation: letter .45s ease-out; }
#goal-progress:empty { display: none; }

/* goal lists */
.goal-list { list-style: none; margin: 0; padding: 0; text-align: left; }
.goal-row { display: flex; align-items: flex-start; gap: 8px; padding: 5px 2px; border-bottom: 1px dashed rgba(255, 255, 255, .12); }
.goal-row:last-child { border-bottom: 0; }
.goal-check {
  flex: none;
  width: 18px; height: 18px;
  margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-px);
  font-size: 11px;
  line-height: 1;
  color: var(--ink);
  background: rgba(0, 0, 0, .5);
  border: 2px solid #5a5163;
}
.goal-row.done .goal-check { background: var(--yellow); border-color: #000; box-shadow: 2px 2px 0 #000; }
/* the tick, drawn (the pixel font has no check mark) */
.goal-row.done .goal-check::after { content: ''; width: 35%; height: 60%; margin-top: -12%; border: solid var(--ink); border-width: 0 3px 3px 0; transform: rotate(45deg); }
.ticked::before { content: ''; display: inline-block; width: .35em; height: .7em; margin: 0 .55em .1em .1em; border: solid currentColor; border-width: 0 .18em .18em 0; transform: rotate(45deg); vertical-align: middle; }
.goal-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.goal-name { font-family: var(--font-px); font-size: 9px; line-height: 1.4; color: #fff; text-shadow: 1px 1px 0 #000; }
.goal-row.done .goal-name { color: var(--yellow); }
.goal-prog { font-style: normal; color: var(--green); }
.goal-desc { font-family: var(--font-px); font-size: 7px; line-height: 1.5; color: var(--muted); text-shadow: 1px 1px 0 #000; }

/* GOALS screen */
#goals { background: rgba(18, 13, 24, .9); gap: 10px; }
.goals-total { font-family: var(--font-px); font-size: 10px; color: var(--yellow); text-shadow: 2px 2px 0 #000; }
.goals-body {
  width: min(100%, 640px);
  min-height: 0;
  flex: 0 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 8px 10px;
  background: rgba(0, 0, 0, .55);
  border: 3px solid #000;
  box-shadow: 5px 5px 0 #000;
  outline: none;
}
.goals-body:focus-visible { box-shadow: 0 0 0 3px var(--yellow), 5px 5px 0 3px #000; }
.goal-level { margin-top: 10px; }
/* GENERAL first, then the ladder under it */
.goal-level.goal-general { margin-top: 0; }
.goal-general + .unlock-ladder { margin-top: 12px; }
.gl-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  margin: 0 0 4px;
  padding: 4px 8px 3px;
  font-family: var(--font-big);
  font-weight: normal;
  font-size: 22px;
  letter-spacing: 1px;
  color: var(--ink);
  background: var(--yellow);
  border: 2px solid #000;
  box-shadow: 3px 3px 0 var(--red);
  transform: rotate(-1deg);
}
.gl-head b { font-family: var(--font-px); font-weight: normal; font-size: 10px; }
.unlock-ladder { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.unlock-ladder li {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 5px 3px 4px;
  font-family: var(--font-px);
  font-size: 7px;
  line-height: 1.3;
  color: var(--muted);
  background: rgba(255, 255, 255, .06);
  border: 2px solid #3a3342;
  text-align: center;
}
.unlock-ladder li b { font-family: var(--font-big); font-weight: normal; font-size: 18px; line-height: 1; color: #6b6475; }
.unlock-ladder li.got { color: var(--ink); background: var(--green); border-color: #000; box-shadow: 2px 2px 0 #000; }
.unlock-ladder li.got b { color: var(--ink); }
/* SECRETS under the ladder: what each one gave you, or the city it's in */
.secrets-head { margin-top: 12px; }
.secret-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px 8px; }
.secret-list li {
  display: flex; align-items: baseline; gap: 8px;
  padding: 5px 8px 4px;
  font-family: var(--font-px);
  font-size: 7px;
  line-height: 1.5;
  color: var(--muted);
  background: rgba(255, 255, 255, .06);
  border: 2px solid #3a3342;
}
.secret-list li b { flex: none; font-weight: normal; color: #6b6475; }
.secret-list li.got { color: var(--ink); background: var(--yellow); border-color: #000; box-shadow: 2px 2px 0 #000; }
.secret-list li.got b { color: var(--red); }

/* select screen chip: GOALS 3/10  VIEW > */
.goals-chip {
  display: flex; align-items: center; gap: 8px;
  min-height: 34px;
  padding: 6px 10px;
  font-family: var(--font-px);
  font-size: 9px;
  color: var(--yellow);
  background: rgba(0, 0, 0, .55);
  border: 2px solid #000;
  box-shadow: 3px 3px 0 #000;
  cursor: pointer;
  text-align: left;
}
.goals-chip b { font-weight: normal; color: #fff; }
.goals-chip.all b { color: var(--green); }
.goals-chip .sg-view { margin-left: auto; color: var(--muted); }
.goals-chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--yellow), 3px 3px 0 3px #000; }
.goals-chip:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }
@media (hover: hover) { .goals-chip:hover .sg-view { color: var(--yellow); } }

/* pause menu: this level's goals */
.pause-goals {
  width: min(100%, 560px);
  padding: 6px 10px 4px;
  background: rgba(0, 0, 0, .55);
  border: 3px solid #000;
  box-shadow: 4px 4px 0 #000;
}
.pg-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-family: var(--font-px); font-size: 9px; color: var(--muted); text-shadow: 1px 1px 0 #000; margin-bottom: 3px; }
.pg-head b { font-weight: normal; color: var(--yellow); }
.pg-head .pg-note { color: var(--orange); font-size: 7px; }
.goal-list.compact { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
.goal-list.compact .goal-row { padding: 3px 0; align-items: center; gap: 6px; border-bottom: 0; }
.goal-list.compact .goal-check { width: 14px; height: 14px; font-size: 8px; margin: 0; }
.goal-list.compact .goal-name { font-size: 7px; }
/* what an unfinished goal asks for, where there's room (tall portrait, desktop): the names alone are in-jokes */
.goal-list.compact .goal-desc { display: none; }
@media (orientation: portrait) and (min-height: 740px), (min-width: 1000px) and (min-height: 700px) {
  .goal-list.compact .goal-row:not(.done) { align-items: flex-start; }
  .goal-list.compact .goal-row:not(.done) .goal-desc { display: block; font-size: 6px; }
}

/* end screen: goals this run */
.res-goals { margin-top: 2px; padding-top: 4px; border-top: 1px dashed rgba(255, 255, 255, .18); text-align: left; }
.eg-head { display: flex; align-items: center; gap: 12px; font-family: var(--font-px); font-size: clamp(10px, 2.6vmin, 14px); line-height: 2; text-shadow: 2px 2px 0 #000; }
.eg-head .res-v { color: var(--green); }
.eg-head .eg-count { margin-left: auto; color: var(--muted); font-size: .8em; }
.eg-names { display: flex; flex-wrap: wrap; gap: 3px 10px; max-width: 420px; font-family: var(--font-px); font-size: 8px; line-height: 1.5; color: var(--yellow); text-shadow: 1px 1px 0 #000; padding-bottom: 3px; }

/* [UNLOCKS-END] end screen: what this run unlocked, stamped on last (main.js revealResults) */
.res-unlocks { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; margin-top: 6px; padding-top: 6px; border-top: 1px dashed rgba(255, 255, 255, .18); text-align: left; cursor: default; }
.eu-stamp {
  font-family: var(--font-big);
  font-size: clamp(20px, 5vmin, 28px);
  line-height: 1;
  letter-spacing: 1px;
  color: var(--green);
  -webkit-text-stroke: 1px #000;
  text-shadow: 2px 2px 0 #1a5a22, 4px 4px 0 #000;
  transform: rotate(-4deg);
  white-space: nowrap;
}
.res-unlocks.stamped .eu-stamp { animation: stamp .45s cubic-bezier(.2, 1.6, .4, 1) both; }
.eu-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; flex: 1 1 auto; min-width: 0; }
.eu-item { display: flex; align-items: center; gap: 10px; }
.eu-name {
  font-family: var(--font-px);
  font-size: clamp(8px, 2.2vmin, 11px);
  line-height: 1.5;
  color: var(--ink);
  background: var(--yellow);
  border: 2px solid #000;
  box-shadow: 2px 2px 0 #000;
  padding: 3px 6px 2px;
}
.eu-try.menu-btn.small { min-height: 30px; padding: 6px 10px; font-size: 9px; margin-left: auto; }

/* MIRROR MODE (Settings > CHEATS): the whole picture flipped, in a run */
body.mirror #game { transform: scaleX(-1); }

/* settings: CHEATS */
.cheats-head {
  margin-top: 6px;
  font-family: var(--font-big);
  font-size: 24px;
  line-height: 1;
  letter-spacing: 1px;
  color: var(--green);
  text-shadow: 2px 2px 0 #000;
  text-align: left;
  transform: rotate(-2deg);
}
/* a ride that isn't unlocked yet: shown as a teaser, greyed, can't be skated */
#pick-vehicle.ride-locked .pick-value { color: #8d8399; }
#pick-vehicle.ride-locked .pick-label { color: var(--yellow); }
#select-go.locked { background: #5a5163; color: #c4bad0; box-shadow: 5px 5px 0 rgba(0, 0, 0, .55); cursor: help; }
#select-go.locked:focus-visible { box-shadow: 0 0 0 3px #fff, 5px 5px 0 3px #000; }
/* the locked ride's name says why when tapped, like SKATE! does */
#pick-vehicle.ride-locked .pick-body { cursor: help; }
.picker.locked .pick-btn { background: #5a5163; color: #2a2330; cursor: default; }
.picker.locked .pick-value { color: #8d8399; font-family: var(--font-px); font-size: 9px; line-height: 2; }

/* title: MIRONEER trophy (every goal done) */
#chow-master {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 8px;
  background: rgba(18, 13, 24, .82);
  border: 3px solid #000;
  box-shadow: 0 0 0 2px var(--yellow), 4px 4px 0 2px #000;
  transform: rotate(-3deg);
  text-align: left;
}
#chow-master .trophy { width: 40px; height: 45px; flex: none; animation: trophy 1.6s ease-in-out infinite alternate; }
@keyframes trophy { to { transform: rotate(6deg) scale(1.06); filter: drop-shadow(0 0 6px var(--yellow)); } }
.cm-title { font-size: 26px; line-height: 1; color: var(--yellow); -webkit-text-stroke: 1px #000; text-shadow: 3px 3px 0 var(--red); letter-spacing: 1px; }
.cm-hint { font-family: var(--font-px); font-size: 7px; line-height: 1.5; color: var(--paper); margin-top: 4px; max-width: 250px; }

.chip.goals { background: var(--green); color: var(--ink); border-radius: 6px; font-size: 18px; }

/* =================================================================== portrait */
@media (orientation: portrait) {
  /* smaller than landscape so the stack sits above the rider, not over him */
  #title { justify-content: flex-start; }
  #title .logo { margin-top: 1vh; }
  #title .logo .logo-big { font-size: min(17vw, 150px); }
  #title .logo .logo-small { font-size: min(10.9vw, 96px); }
  .main-menu {
    margin-top: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }
  .main-menu .menu-btn { min-width: 0; padding: 12px 6px; }
  #start-career, #start-free { min-height: 56px; }
  #title #chow-master { margin-top: 4px; }
  #title .best { order: -1; align-self: center; text-align: center; margin-bottom: -6px; }

  .sel-head { align-items: center; text-align: center; transform: rotate(-2deg); transform-origin: center; }
  /* the skater picker spans the screen: arrows at the edges, the name centred between them */
  .picker.hero { align-self: stretch; justify-content: space-between; }
  /* each line centred on its own: a short name (a custom skater's) doesn't hug the left of PRO SKATER */
  .picker.hero .pick-body { flex: 1 1 auto; align-items: center; }
  .picker.hero .pick-value { padding-left: .22em; }
  .picker.hero .pick-pro { margin-left: 0; padding-left: 8px; }
  .skater-tools { justify-content: center; }
  .sel-panel { gap: 6px; }
  .sel-panel .picker { min-height: 42px; }
  #message { bottom: auto; top: max(24vh, calc(var(--safe-t) + 150px)); max-width: 86vw; }
  #special-label { left: 0; top: calc(100% + 4px); transform: none; } /* clear of the pause button */
  /* end screen: results up top, then the rider, then replay caption, initials and buttons */
  #end.replaying .results { order: 1; }
  #end.replaying #replay-box { order: 2; }
  #end.replaying #score-entry, #end.replaying #score-rank { order: 3; }
  #end.replaying .menu { order: 4; }

  #score-list { max-height: calc(100vh - 260px); max-height: calc(100dvh - 260px); }
  .howto-list { max-height: calc(100dvh - 190px); }
  #balance.vert { left: 16%; }
  #goal-banner { top: 50%; }
  /* the combo readout spans the width up top: the count readout goes under it */
  #goal-progress {
    position: fixed;
    left: 0; right: 0;
    margin: 0 auto;
    width: max-content;
    top: calc(max(8px, var(--safe-t)) + clamp(58px, 14vmin, 96px) + 74px);
  }
  .goal-list.compact { grid-template-columns: 1fr; }
  .goal-list.compact .goal-name { font-size: 8px; }
  .goals-body { max-height: calc(100dvh - 170px); }
  .unlock-ladder { grid-template-columns: repeat(2, 1fr); }
  .secret-list { grid-template-columns: 1fr; }
}

/* =================================================================== landscape */
@media (orientation: landscape) {
  /* [UNLOCKS-END] the UNLOCKED box docks top right, over the replay side,
     so it never pushes the results column off a short screen */
  #end .res-unlocks {
    position: absolute;
    top: max(14px, var(--safe-t));
    right: max(18px, calc(var(--safe-r) + 6px));
    z-index: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    max-width: min(42vw, 360px);
    margin: 0;
    padding: 8px 12px 10px;
    background: rgba(0, 0, 0, .62);
    border: 3px solid #000;
    box-shadow: 5px 5px 0 #000;
  }
  #end .res-unlocks .eu-list { align-self: stretch; }
  /* rider stands left of centre: menus live in a right-hand column */
  #title {
    display: grid;
    grid-template-columns: 1fr minmax(240px, 34vw);
    grid-template-rows: auto 1fr auto;
    align-items: start;
    column-gap: 24px;
    padding-left: max(24px, calc(var(--safe-l) + 8px));
    padding-right: max(28px, calc(var(--safe-r) + 12px));
  }
  #title .logo { grid-column: 1; grid-row: 1; justify-self: start; margin-top: 8px; transform: rotate(-4deg) scale(.8); transform-origin: left top; }
  .sel-head { padding-top: 12px; justify-self: stretch; }
  #message { max-width: 42vw; }
  /* coach card sits top-left, clear of the rider in the middle and the pads below */
  #coach-card {
    left: max(12px, calc(var(--safe-l) + 4px));
    top: calc(max(8px, var(--safe-t)) + clamp(68px, 19vmin, 92px));
    transform: none;
    width: min(330px, 40vw);
  }
  body.lefty #coach-card { left: auto; right: max(12px, calc(var(--safe-r) + 4px)); }
  #coach-card .coach-actions .menu-btn { padding: 7px 9px; font-size: 9px; min-height: 34px; }
  #title .main-menu { grid-column: 2; grid-row: 1 / 4; align-self: center; width: 100%; gap: 9px; }
  #title .best { grid-column: 1; grid-row: 3; justify-self: start; align-self: end; }
  #title #chow-master { grid-column: 1; grid-row: 2; justify-self: start; align-self: end; margin-bottom: 4px; }
  #title .best, #title #chow-master { margin-left: 58px; }

  #select {
    display: grid;
    grid-template-columns: 1fr min(360px, 46vw);
    grid-template-rows: auto 1fr;
    column-gap: 20px;
    align-items: start;
    padding-left: max(22px, calc(var(--safe-l) + 8px));
    padding-right: max(26px, calc(var(--safe-r) + 12px));
    background: linear-gradient(90deg, rgba(18,13,24,.45), transparent 30%, transparent 48%, rgba(18,13,24,.8) 62%);
  }
  .sel-head { grid-column: 1; grid-row: 1; }
  .sel-panel { grid-column: 2; grid-row: 1 / 3; align-self: center; width: 100%; max-height: 100%; }

  #end.replaying {
    background: linear-gradient(90deg, rgba(18,13,24,.92) 0, rgba(18,13,24,.78) 34%, rgba(18,13,24,0) 56%);
    align-items: flex-start;
    justify-content: center;
    text-align: left;
    padding-left: max(24px, calc(var(--safe-l) + 8px));
  }
  #end.replaying .menu { justify-content: flex-start; }
  #end.replaying #replay-box {
    position: absolute;
    right: max(18px, calc(var(--safe-r) + 6px));
    bottom: max(14px, var(--safe-b));
    margin: 0;
    max-width: 40vw;
    text-align: right;
  }
}

/* short landscape phones: compact everything */
@media (orientation: landscape) and (max-height: 500px) {
  .screen { gap: 8px; padding-top: max(10px, var(--safe-t)); padding-bottom: max(10px, var(--safe-b)); }
  .menu-btn { min-height: 38px; padding: 9px 14px; }
  .menu-btn.small { min-height: 34px; padding: 7px 10px; }
  .screen-title { font-size: 40px; }
  .screen-title.big { font-size: 48px; }
  #title .main-menu .menu-btn { min-height: 40px; padding: 9px 10px; }
  #title .logo { transform: rotate(-4deg) scale(.66); }
  .picker { min-height: 38px; box-shadow: 3px 3px 0 #000; }
  .pick-btn { width: 38px; }
  .pick-body { padding: 2px 8px; }
  .pick-value { font-size: 17px; }
  .pick-value.long { font-size: 15px; }
  .pick-label { font-size: 7px; }
  .sel-panel { gap: 5px; }
  .picker.hero .pick-value { font-size: clamp(34px, 11vh, 54px); }
  .picker.hero .pick-value.long { font-size: clamp(30px, 9.5vh, 48px); }
  .picker.hero .pick-value.xlong { font-size: clamp(28px, 8.5vh, 44px); }
  .picker.hero .pick-btn { width: 36px; height: 40px; }
  .stats { padding: 4px 8px; gap: 3px 10px; }
  .sel-panel .pick-value { line-height: 19px; }
  .sel-actions .menu-btn { min-height: 38px; }
  .settings-list { gap: 5px; }
  .setting .pick-value { font-size: 16px; }
  .howto-list { max-height: calc(100dvh - 130px); }
  .how-row { padding: 4px 0; }
  .how-row p { font-size: 12px; }
  .chip { width: 34px; height: 34px; }
  #pause .menu { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  #pause .menu-btn { min-width: 190px; }
  #pause { gap: 6px; }
  .pause-goals { padding: 4px 8px 2px; }
  .goal-list.compact .goal-row { padding: 1px 0; }
  .goals-body { max-height: calc(100dvh - 118px); }
  #goals .screen-title { font-size: 34px; }
  .goal-row { padding: 3px 2px; }
  .gl-head { font-size: 19px; }
  .eg-head { line-height: 1.7; font-size: 10px; }
  .cheats-head { font-size: 20px; }
  #end { gap: 6px; }
  #end .screen-title { font-size: 40px; }
  #end .end-level { font-size: 8px; margin: -4px 0 -3px; }
  .results { padding: 4px 12px; }
  .res-row { line-height: 1.9; font-size: 10px; }
  #res-score .res-v { font-size: 26px; line-height: 1.1; }
  #new-best { font-size: 18px; padding: 5px 8px 4px; margin-top: 9px; }
  .ini-up, .ini-down { height: 20px; }
  .ini-char { width: 40px; height: 38px; font-size: 18px; }
  #scores .screen-title { font-size: 40px; }
  #score-list { max-height: calc(100vh - 140px); max-height: calc(100dvh - 140px); }
  #buttons { transform: scale(calc(var(--ctl) * .86)); }
  #stick-base { transform: scale(calc(var(--ctl) * .9)); }
  #coach-card { padding: 6px 10px 8px; }
  #coach-title { font-size: 24px; }
  #coach-text { font-size: 8px; line-height: 1.6; }
  .coach-actions { margin-top: 6px; }
}

/* =================================================================== reduced motion */
body.reduce-motion #special.full #special-label,
body.reduce-motion #replay-label,
body.reduce-motion #balance.hint-lo .bal-lo, body.reduce-motion #balance.hint-hi .bal-hi,
body.reduce-motion #btn-special.ready,
body.reduce-motion #special.full #special-fill,
body.reduce-motion #coach-ring,
body.reduce-motion .menu-btn:focus-visible::before,
body.reduce-motion #secret-toast,
body.reduce-motion #score-rank .rank-line,
body.reduce-motion #end.record .screen-title,
body.reduce-motion #chow-master .trophy, body.reduce-motion #goal-progress.show, body.reduce-motion .ride-pop.show { animation: none; }
body.reduce-motion #score.bump, body.reduce-motion #timer.tick, body.reduce-motion #special.gain,
body.reduce-motion #letters span.got, body.reduce-motion #final-letters i.got,
body.reduce-motion #trick-list .new, body.reduce-motion #combo-mult.pulse, body.reduce-motion #combo.bailed,
body.reduce-motion .picker .pick-value, body.reduce-motion .logo.tap, body.reduce-motion .btn.down::after,
body.reduce-motion #coach.nice #coach-title, body.reduce-motion .initials.shake { animation: none; }
body.reduce-motion #new-best { animation: none; transform: rotate(-3deg); }
body.reduce-motion .res-unlocks.stamped .eu-stamp { animation: none; }
/* popups and callouts still appear, they just fade instead of flying/slamming */
body.reduce-motion #popup.show, body.reduce-motion #popup.show.bank,
body.reduce-motion #callout.show, body.reduce-motion #callout.sketchy.show { animation: fade 1.2s linear forwards; }
body.reduce-motion :is(#goal-banner, #menu-banner).show { animation: gfade 2.3s linear forwards; }
body.reduce-motion :is(#goal-banner, #menu-banner).show.unlock { animation-duration: 3.2s; }
@keyframes gfade { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
body.reduce-motion #callout.show.late { animation: fadelate 1.2s .55s linear both; }
@keyframes fadelate { 0% { opacity: 0; } 1%, 80% { opacity: 1; } 100% { opacity: 0; } }

/* How-to chips: plain colour swatches that match the action buttons */
.chip.act-jump { background: #d63a2f; }
.chip.act-flip { background: #1c6fd1; }
.chip.act-grab { background: #2f9e44; }
.chip.act-grind { background: #e0a800; }

/* Founder Mode: the special bar turns gold and burns down */
#special.founder #special-fill { background: linear-gradient(90deg, #ffb300, #fff3a0, #ffb300); background-size: 200% 100%; animation: founder-burn .6s linear infinite; }
#special.founder #special-label { color: #fff3a0; }
@keyframes founder-burn { to { background-position: -200% 0; } }
body.reduce-motion #special.founder #special-fill { animation: none; }

/* =================================================================== soundtrack */
/* NOW PLAYING toast (js/music/player.js): slides in at the start of a run and
   on a new song. Bottom-centre between the stick and the buttons in landscape,
   just above the button cluster in portrait: clear of the HUD and the combo. */
#now-playing {
  position: fixed;
  z-index: 3;
  left: 50%;
  bottom: calc(max(10px, var(--safe-b)) + 34px);
  max-width: min(440px, calc(100vw - 2 * (40px + 190px * var(--ctl))));
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 12px 7px;
  background: rgba(10, 7, 14, .82);
  border: 2px solid #000;
  border-left: 5px solid var(--yellow);
  box-shadow: 3px 3px 0 #000;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%);
}
#now-playing.show { visibility: visible; animation: np-in 4.2s ease-out forwards; }
#now-playing .np-k { font-family: var(--font-px); font-size: 7px; letter-spacing: 1px; color: var(--yellow); }
#now-playing .np-v { font-size: clamp(14px, 3.6vmin, 19px); line-height: 1.1; letter-spacing: .5px; color: #fff; text-shadow: 2px 2px 0 #000; }
@keyframes np-in {
  0% { opacity: 0; transform: translateX(calc(-50% - 40px)); }
  8% { opacity: 1; transform: translateX(-50%); }
  88% { opacity: 1; transform: translateX(-50%); }
  100% { opacity: 0; transform: translateX(-50%); }
}
@media (orientation: portrait) {
  #now-playing { bottom: calc(max(12px, var(--safe-b)) + 18px + 204px * var(--ctl)); max-width: calc(100vw - 32px); }
}
body.reduce-motion #now-playing.show { animation-name: np-fade; }
@keyframes np-fade { 0%, 88% { opacity: 1; } 100% { opacity: 0; } }

/* SOUNDTRACK block in settings (js/ui/settings.js buildSoundtrack) */
.st-head {
  font-family: var(--font-px);
  font-size: 10px;
  color: var(--yellow);
  text-shadow: 2px 2px 0 #000;
  letter-spacing: 1px;
  margin-top: 8px;
}
.st-now { display: flex; align-items: center; gap: 8px; }
.st-np {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 4px 8px;
  background: rgba(0, 0, 0, .5);
  border: 2px solid #000;
}
.st-np-v { font-size: 16px; color: #fff; text-shadow: 2px 2px 0 #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-now .menu-btn { flex: none; }
.st-track .pick-value { display: flex; align-items: baseline; gap: 8px; font-size: 17px; }
.st-track .pick-body { cursor: pointer; }
.st-track .st-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.st-onoff { font-family: var(--font-px); font-weight: normal; font-size: 8px; color: var(--green); flex: none; margin-left: auto; }
.st-track.off .st-title { color: #8a8196; text-decoration: line-through; }
.st-track.off .st-onoff { color: var(--red); }
.st-track.playing .pick-label::before { content: ''; display: inline-block; width: .5em; height: .5em; margin-right: .5em; background: #fff; border-radius: 50%; box-shadow: 0 0 0 .15em rgba(255, 255, 255, .35); vertical-align: middle; }   /* (a dot: the pixel font has no note glyph) */

/* CREATE-A-SKATER (js/create-skater.js injects its own CSS: these win by specificity): the crew's names sit centred, not packed left */
.cas .cas-crew-list { justify-content: center; }

/* ---------- desktop: show the controls as a keyboard hint ---------- */
.key-hint, #key-stick { display: none; }
@media (hover: hover) and (pointer: fine) {
  /* same diamond as on phones, as a see-through legend with keycaps */
  body:not(.touch) #buttons { display: block; opacity: .78; }
  body:not(.touch) #buttons .btn { opacity: 1; }
  body:not(.touch) .key-hint {
    display: block;
    position: absolute;
    right: -4px; top: -6px;
    min-width: 22px; height: 22px;
    padding: 0 5px;
    font-family: var(--font-px);
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    color: var(--ink);
    background: var(--paper);
    border: 2px solid #000;
    border-radius: 5px;
    box-shadow: 0 2px 0 #000;
    text-shadow: none;
  }
  body:not(.touch) #stick-zone { display: block; pointer-events: none; }
  body:not(.touch) #stick-base { display: none; }
  body:not(.touch) #key-stick {
    display: grid;
    position: absolute;
    left: max(28px, calc(var(--safe-l, 0px) + 14px));
    bottom: max(24px, calc(var(--safe-b, 0px) + 10px));
    grid-template-columns: repeat(3, 38px);
    grid-template-rows: 38px 38px auto;
    gap: 5px;
    opacity: .85;
  }
  body:not(.touch) #key-stick kbd {
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-px); font-size: 13px;
    color: var(--ink); background: var(--paper);
    border: 3px solid #000; border-radius: 7px;
    box-shadow: 0 4px 0 #000;
  }
  body:not(.touch) #key-stick kbd.on { background: var(--yellow); transform: translateY(3px); box-shadow: 0 1px 0 #000; }
  #key-stick [data-dir="up"] { grid-column: 2; grid-row: 1; }
  #key-stick [data-dir="left"] { grid-column: 1; grid-row: 2; }
  #key-stick [data-dir="down"] { grid-column: 2; grid-row: 2; }
  #key-stick [data-dir="right"] { grid-column: 3; grid-row: 2; }
  .key-stick-label { grid-column: 1 / -1; font-family: var(--font-px); font-size: 7px; color: var(--paper); text-shadow: 1px 1px 0 #000; text-align: center; letter-spacing: 1px; }
  body.lefty:not(.touch) #key-stick { left: auto; right: max(28px, calc(var(--safe-r, 0px) + 14px)); }
}
@media (hover: hover) and (pointer: fine) {
  body:not(.touch) #btn-special .key-hint { right: auto; left: -10px; top: -10px; }
}

/* =================================================================== C-H-O-W */
/* Pass-the-phone HORSE (js/modes/chow.js, screens built by js/ui/chow-ui.js). */
#title .main-menu #start-chow { background: var(--orange); }
#title .main-menu #start-chow:focus-visible { background: #fff; }
@media (hover: hover) { #title .main-menu #start-chow:hover { background: #fff; } }
.cw-menu-sub { font-size: .72em; opacity: .8; white-space: nowrap; }

/* C H O W letter boxes (HUD, pass card, tables) */
.cw-letters { display: inline-flex; gap: 3px; flex: none; }
.cw-letters i {
  font-style: normal;
  font-family: var(--font-px);
  font-size: 10px;
  width: 2em; height: 2em; line-height: 2.05em;
  text-align: center;
  color: #6b6475;
  background: rgba(0, 0, 0, .5);
  border: 2px solid #3a3342;
  text-shadow: none;
}
.cw-letters i.got { color: #fff; background: var(--red); border-color: #000; box-shadow: 2px 2px 0 #000; }
.cw-letters i.new { animation: cwletter .6s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes cwletter { 0% { transform: scale(3) rotate(-18deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.cw-letters.big i { font-size: clamp(13px, 3.6vmin, 18px); }

/* ---------- setup ---------- */
#cw-setup { justify-content: space-between; background: linear-gradient(180deg, rgba(18,13,24,.62), transparent 28%, transparent 42%, rgba(18,13,24,.86)); }
.cw-head { align-self: stretch; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cw-head .sel-mode { transform: rotate(-2deg); }
.cw-tabs { display: flex; gap: 6px; max-width: 100%; }
.cw-tab {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 110px;
  min-height: 40px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px;
  padding: 4px 8px;
  color: var(--paper);
  background: rgba(18, 13, 24, .82);
  border: 2px solid #000;
  box-shadow: 3px 3px 0 #000;
  cursor: pointer;
  text-align: left;
}
.cw-tab b { font-family: var(--font-px); font-size: 7px; font-weight: normal; color: var(--yellow); }
.cw-tab span { font-size: 15px; line-height: 1; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; text-shadow: 1px 1px 0 #000; }
.cw-tab.on { color: var(--ink); background: var(--yellow); transform: translateY(-2px); }
.cw-tab.on b { color: var(--red); }
.cw-tab.on span { text-shadow: none; }
.cw-tab:focus-visible { outline: 3px solid #fff; outline-offset: 1px; }
.cw-name { display: flex; flex-direction: column; align-items: stretch; gap: 3px; width: min(100%, 420px); }
.cw-name .pick-label { text-align: center; text-shadow: 1px 1px 0 #000; }
#cw-name {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 2px 10px 0;
  font-family: var(--font-big);
  font-size: clamp(32px, 8.5vmin, 56px);
  line-height: 1.15;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
  color: #fff;
  -webkit-text-stroke: 1px #000;
  text-shadow: 3px 3px 0 var(--red), 5px 5px 0 #000;
  background: rgba(0, 0, 0, .5);
  border: 3px solid #000;
  border-radius: 0;
  box-shadow: 4px 4px 0 #000;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  user-select: text;
  -webkit-user-select: text;
  touch-action: manipulation;
}
#cw-name::placeholder { color: rgba(255, 246, 220, .35); -webkit-text-stroke: 0; text-shadow: none; }
#cw-name:focus { border-color: var(--yellow); box-shadow: 0 0 0 2px #000, 4px 4px 0 2px #000; }
.cw-panel .create-btn { align-self: flex-start; min-height: 32px; padding: 6px 10px; font-size: 9px; box-shadow: 3px 3px 0 #000; }
.cw-rules {
  font-family: var(--font-px);
  font-size: 7px;
  line-height: 1.7;
  color: var(--muted);
  text-shadow: 1px 1px 0 #000;
  text-align: left;
  padding: 0 2px;
}
.cw-rules b { color: var(--yellow); font-weight: normal; }

/* ---------- pass the phone ---------- */
#cw-pass { justify-content: flex-end; background: linear-gradient(180deg, rgba(18,13,24,.5), transparent 26%, transparent 40%, rgba(18,13,24,.9) 62%); }
.cw-card {
  width: min(100%, 420px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 16px 14px;
  background: rgba(18, 13, 24, .9);
  border: 3px solid #000;
  box-shadow: 0 0 0 2px var(--yellow), 6px 6px 0 2px #000;
}
.cw-pass-card .sel-mode { transform: rotate(-2deg); }
.cw-pass-k { font-family: var(--font-px); font-size: 11px; letter-spacing: 3px; color: var(--yellow); text-shadow: 2px 2px 0 #000; margin-bottom: -4px; }
.cw-pass-name {
  max-width: 100%;
  padding: 0 12px 6px 4px;
  font-size: clamp(50px, 14vmin, 96px);
  line-height: 1;
  letter-spacing: 1px;
  color: #fff;
  -webkit-text-stroke: 1.5px #000;
  text-shadow: 4px 4px 0 var(--red), 7px 7px 0 #000;
  transform: rotate(-3deg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: cwname .5s cubic-bezier(.2, 1.5, .4, 1) both;
}
.cw-pass-name.long { font-size: clamp(38px, 10vmin, 70px); }
@keyframes cwname { 0% { transform: rotate(-10deg) scale(1.8); opacity: 0; } 100% { transform: rotate(-3deg); opacity: 1; } }
.cw-pass-sub { font-family: var(--font-px); font-size: 8px; line-height: 1.6; color: var(--muted); text-shadow: 1px 1px 0 #000; }
.cw-pass-low { font-family: var(--font-px); font-size: 8px; line-height: 1.6; color: var(--paper); text-shadow: 1px 1px 0 #000; }
.menu-btn.cw-ready { width: 100%; min-height: 62px; font-size: clamp(16px, 4.6vmin, 22px); animation: cwready 1s ease-in-out infinite alternate; }
@keyframes cwready { to { box-shadow: 5px 5px 0 #000, 0 0 18px var(--yellow); } }
.cw-pass-foot { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cw-pass-foot .cw-rules { font-size: 7px; }

/* ---------- in the run ---------- */
body.chow-match #letters, body.chow-match #goal-progress { display: none !important; }
body.cw-idle #buttons, body.cw-idle #stick-zone { opacity: .3; transition: opacity .2s; }
#cw-hud { display: none; margin-top: 4px; }
body.chow-match #cw-hud { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.cw-hud-name { font-size: clamp(14px, 3.4vmin, 20px); line-height: 1; letter-spacing: .5px; color: #fff; text-shadow: 2px 2px 0 #000; max-width: 40vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cw-hud .cw-letters i { font-size: clamp(9px, 2.2vmin, 12px); }

#cw-count {
  position: absolute;
  left: 50%; top: 38%;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-align: center;
  pointer-events: none;
}
.cw-count-top { font-family: var(--font-px); font-size: 9px; color: var(--yellow); text-shadow: 2px 2px 0 #000; }
.cw-count-who { font-size: clamp(26px, 7vmin, 48px); line-height: 1.05; color: #fff; -webkit-text-stroke: 1px #000; text-shadow: 3px 3px 0 #000; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-count-big {
  font-size: clamp(48px, 14vmin, 110px);
  line-height: 1;
  padding: 0 10px 6px 0;
  color: var(--yellow);
  -webkit-text-stroke: 2px #000;
  text-shadow: 5px 5px 0 var(--red), 9px 9px 0 #000;
  transform: rotate(-4deg);
  white-space: nowrap;
}
#cw-count[data-step="0"] .cw-count-big { font-size: clamp(38px, 10vmin, 76px); }
.cw-count-big.pop { animation: cwpop .45s cubic-bezier(.2, 1.6, .4, 1) both; }
#cw-count.go .cw-count-big { color: var(--green); }
#cw-count.go { animation: cwgo .8s ease-in forwards; }
@keyframes cwpop { 0% { transform: rotate(-4deg) scale(2.2); opacity: 0; } 100% { transform: rotate(-4deg) scale(1); opacity: 1; } }
@keyframes cwgo { 0%, 55% { opacity: 1; } 100% { opacity: 0; } }

#cw-turnend {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(-2deg);
  width: min(420px, calc(100vw - 32px));
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 14px 12px;
  text-align: center;
  background: rgba(18, 13, 24, .9);
  border: 3px solid #000;
  box-shadow: 0 0 0 2px var(--yellow), 6px 6px 0 2px #000;
  pointer-events: auto;
  cursor: pointer;
  z-index: 2;
  animation: cwcard .4s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes cwcard { 0% { transform: translate(-50%, -50%) rotate(-8deg) scale(1.6); opacity: 0; } 100% { transform: translate(-50%, -50%) rotate(-2deg); opacity: 1; } }
.cw-te-who { font-family: var(--font-px); font-size: 9px; color: var(--yellow); text-shadow: 2px 2px 0 #000; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-te-v { font-size: clamp(44px, 12vmin, 80px); line-height: 1; color: var(--green); -webkit-text-stroke: 1.5px #000; text-shadow: 4px 4px 0 #000; font-variant-numeric: tabular-nums; }
#cw-turnend.bail .cw-te-v, #cw-turnend.time .cw-te-v { color: var(--red); }
#cw-turnend.bail { box-shadow: 0 0 0 2px var(--red), 6px 6px 0 2px #000; }
.cw-te-tricks { font-size: clamp(14px, 3.4vmin, 19px); line-height: 1.15; color: #fff; text-shadow: 2px 2px 0 #000; max-width: 100%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cw-te-tricks:empty { display: none; }
.cw-te-next { font-family: var(--font-px); font-size: 8px; color: var(--muted); margin-top: 4px; animation: flash 1s steps(2) infinite; }

/* ---------- round summary ---------- */
#cw-summary { justify-content: center; background: rgba(18, 13, 24, .78); }
#cw-summary.replaying { justify-content: flex-start; background: linear-gradient(180deg, rgba(18,13,24,.9) 0, rgba(18,13,24,.62) 50%, rgba(18,13,24,.2) 70%, rgba(18,13,24,.88) 100%); }
.cw-sum-main { width: min(100%, 460px); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cw-table {
  width: 100%;
  display: flex; flex-direction: column;
  padding: 4px 10px;
  background: rgba(0, 0, 0, .6);
  border: 3px solid #000;
  box-shadow: 5px 5px 0 #000;
  text-align: left;
}
.cw-tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 5px 2px; border-bottom: 1px dashed rgba(255,255,255,.14); }
.cw-tr:last-child { border-bottom: 0; }
.cw-th { font-family: var(--font-px); font-size: 7px; color: var(--muted); padding: 3px 2px; }
.cw-th span:nth-child(2) { text-align: right; }
.cw-who { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 6px; align-items: baseline; min-width: 0; }
.cw-who i { font-style: normal; font-family: var(--font-px); font-size: 7px; color: var(--yellow); }
.cw-who b { font-weight: normal; font-size: clamp(17px, 4.2vmin, 22px); line-height: 1.05; color: #fff; text-shadow: 2px 2px 0 #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-who small { grid-column: 2; font-family: var(--font-px); font-size: 6px; line-height: 1.5; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-sc { font-family: var(--font-px); font-size: clamp(10px, 2.6vmin, 13px); color: var(--yellow); text-shadow: 2px 2px 0 #000; text-align: right; font-variant-numeric: tabular-nums; }
.cw-sc.bad { color: var(--red); }
.cw-tr .cw-letters i { font-size: 8px; }
.cw-tr.idle { opacity: .6; }
.cw-tr.out { opacity: .45; }
.cw-tr.out .cw-who b { text-decoration: line-through; text-decoration-thickness: 3px; text-decoration-color: var(--red); }
.cw-tr.hit { background: rgba(232, 50, 43, .28); box-shadow: inset 4px 0 0 var(--red); }
.cw-tr.hit.out { opacity: 1; }
.cw-tr.tied { background: rgba(255, 210, 31, .16); box-shadow: inset 4px 0 0 var(--yellow); }
.cw-stamp {
  max-width: 100%;
  padding: 7px 12px 6px;
  color: var(--ink);
  background: var(--yellow);
  border: 3px solid #000;
  box-shadow: 4px 4px 0 var(--red), 7px 7px 0 #000;
  transform: rotate(-3deg);
  animation: stamp .45s cubic-bezier(.2, 1.6, .4, 1) both;
}
.cw-stamp-main { font-size: clamp(24px, 6.4vmin, 40px); line-height: 1.1; letter-spacing: 1px; white-space: nowrap; overflow: hidden; max-width: 100%; }
#cw-sum-title, .cw-win-title { max-width: 100%; overflow: hidden; padding: 0 12px 8px 4px; }
.cw-stamp-sub { font-family: var(--font-px); font-size: 8px; line-height: 1.6; margin-top: 3px; }
.cw-stamp.elim { color: #fff; background: var(--red); box-shadow: 4px 4px 0 #000, 7px 7px 0 var(--yellow); }
.cw-stamp.tie { background: var(--orange); }
.cw-sum-actions .menu-btn.go { min-width: 200px; }
#cw-replay { max-width: min(420px, 90vw); text-shadow: 2px 2px 0 #000; margin-top: auto; }
.cw-replay-label { font-family: var(--font-px); font-size: 9px; color: var(--red); animation: flash .8s steps(2) infinite; }
.cw-replay-label::before { content: ''; display: inline-block; width: .7em; height: .7em; margin-right: .8em; border-radius: 50%; background: currentColor; vertical-align: -.05em; }
.cw-replay-tricks { font-size: clamp(14px, 3.4vmin, 19px); line-height: 1.1; color: #fff; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cw-replay-score { font-size: clamp(18px, 4.4vmin, 28px); color: var(--yellow); text-shadow: 3px 3px 0 #000; }

/* ---------- winner ---------- */
#cw-winner { justify-content: space-between; background: linear-gradient(180deg, rgba(18,13,24,.7), transparent 34%, transparent 46%, rgba(18,13,24,.9) 66%); }
.cw-win-head { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cw-rays {
  position: absolute; left: 50%; top: 32%;
  width: 150vmax; height: 150vmax;
  margin: -75vmax 0 0 -75vmax;
  background: repeating-conic-gradient(rgba(255, 210, 31, .22) 0 8deg, transparent 8deg 22deg);
  -webkit-mask-image: radial-gradient(circle, #000 0, transparent 34%);
  mask-image: radial-gradient(circle, #000 0, transparent 34%);
  animation: cwrays 14s linear infinite;
  pointer-events: none;
  z-index: -1;
}
@keyframes cwrays { to { transform: rotate(1turn); } }
.cw-trophy { width: clamp(56px, 13vmin, 96px); height: auto; filter: drop-shadow(4px 4px 0 #000); }
#cw-winner.show .cw-trophy { animation: cwtrophy .9s cubic-bezier(.2, 1.4, .4, 1) both, trophy 1.6s .9s ease-in-out infinite alternate; }
@keyframes cwtrophy { 0% { transform: translateY(-40vh) rotate(-40deg) scale(.4); } 70% { transform: translateY(0) rotate(8deg) scale(1.15); } 100% { transform: none; } }
.cw-win-title { padding-right: 12px; }
#cw-winner.show .cw-win-title { animation: stamp .5s .45s cubic-bezier(.2, 1.6, .4, 1) both, rainbow .6s 1s steps(3) 6; }
.cw-win-body { width: min(100%, 420px); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cw-win-name { max-width: 100%; padding: 0 10px 6px 0; font-size: clamp(44px, 12vmin, 84px); line-height: 1; color: #fff; -webkit-text-stroke: 1.5px #000; text-shadow: 4px 4px 0 var(--red), 7px 7px 0 #000; transform: rotate(-3deg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-win-name.long { font-size: clamp(34px, 9vmin, 64px); }
.cw-win-sub { font-family: var(--font-px); font-size: 8px; line-height: 1.6; color: var(--yellow); text-shadow: 2px 2px 0 #000; }
.cw-standings {
  list-style: none;
  margin: 0;
  width: 100%;
  padding: 4px 10px;
  background: rgba(0, 0, 0, .6);
  border: 3px solid #000;
  box-shadow: 5px 5px 0 #000;
}
.cw-standings li { display: grid; grid-template-columns: 3.4em minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 3px 0; text-align: left; }
.cw-standings .rk { font-family: var(--font-px); font-size: 8px; color: var(--muted); }
.cw-standings b { font-weight: normal; font-size: clamp(16px, 4vmin, 21px); color: #fff; text-shadow: 2px 2px 0 #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-standings li.champ .rk, .cw-standings li.champ b { color: var(--yellow); }
.cw-standings .cw-letters i { font-size: 8px; }
#cw-winner .menu .menu-btn { min-width: 150px; }

/* ---------- quit dialog ---------- */
#cw-confirm { z-index: 6; background: rgba(8, 5, 12, .8); }
#cw-confirm .cw-card { gap: 12px; padding: 16px; }
.cw-confirm-p { margin: 0; font-family: var(--font-px); font-size: 9px; line-height: 1.6; color: var(--paper); }
#cw-confirm .menu-btn { min-width: 150px; }

@media (orientation: portrait) {
  #title .main-menu #start-chow { grid-column: 1 / -1; }
  #cw-setup .cw-head { gap: 6px; }
  #cw-winner .cw-win-head { margin-top: 2vh; }
}
@media (orientation: landscape) {
  /* setup: tabs + name on the left, the pickers in the right-hand column (like the select screen) */
  #cw-setup {
    display: grid;
    grid-template-columns: 1fr min(360px, 46vw);
    grid-template-rows: auto 1fr;
    column-gap: 20px;
    align-items: start;
    padding-left: max(22px, calc(var(--safe-l) + 8px));
    padding-right: max(26px, calc(var(--safe-r) + 12px));
    background: linear-gradient(90deg, rgba(18,13,24,.5), transparent 30%, transparent 48%, rgba(18,13,24,.82) 62%);
  }
  #cw-setup .cw-head { grid-column: 1; grid-row: 1; align-items: flex-start; padding-top: 6px; }
  #cw-setup .cw-name { width: min(100%, 360px); }
  #cw-setup .cw-panel { grid-column: 2; grid-row: 1 / 3; align-self: center; width: 100%; max-height: 100%; }
  /* cards and results sit in the right-hand column; the rider stands left of centre */
  #cw-pass { justify-content: center; align-items: flex-end; padding-right: max(26px, calc(var(--safe-r) + 12px)); background: linear-gradient(90deg, rgba(18,13,24,.35), transparent 30%, transparent 44%, rgba(18,13,24,.85) 60%); }
  #cw-pass .cw-card { width: min(400px, 48vw); }
  #cw-winner {
    display: grid;
    grid-template-columns: 1fr min(400px, 48vw);
    grid-template-rows: 1fr;
    column-gap: 20px;
    align-items: center;
    padding-right: max(26px, calc(var(--safe-r) + 12px));
    background: linear-gradient(90deg, rgba(18,13,24,.35), transparent 30%, transparent 44%, rgba(18,13,24,.85) 60%);
  }
  #cw-winner .cw-win-head { grid-column: 2; grid-row: 1; align-self: start; }
  #cw-winner .cw-win-body { grid-column: 2; grid-row: 1; align-self: end; width: 100%; }
  /* summary replay: the table goes left (the replay camera frames the rider on the right) */
  #cw-summary.replaying {
    align-items: flex-start;
    justify-content: center;
    padding-left: max(24px, calc(var(--safe-l) + 8px));
    background: linear-gradient(90deg, rgba(18,13,24,.92) 0, rgba(18,13,24,.78) 40%, rgba(18,13,24,0) 60%);
  }
  #cw-summary.replaying .cw-sum-main { width: min(460px, 52vw); }
  #cw-summary.replaying #cw-replay {
    position: absolute;
    right: max(18px, calc(var(--safe-r) + 6px));
    bottom: max(14px, var(--safe-b));
    margin: 0;
    max-width: 38vw;
    text-align: right;
  }
  #cw-count { top: 42%; }
}
@media (orientation: landscape) and (max-height: 500px) {
  #title .main-menu { gap: 7px; }
  #title .main-menu .menu-btn { min-height: 36px; padding: 7px 10px; }
  .cw-tab { min-height: 34px; padding: 3px 7px; }
  .cw-tab span { font-size: 13px; }
  #cw-name { font-size: 32px; }
  .cw-panel .create-btn { min-height: 30px; padding: 5px 9px; }
  .cw-rules { font-size: 6px; line-height: 1.6; }
  .cw-card { gap: 5px; padding: 8px 12px 10px; }
  .cw-pass-name { font-size: 48px; }
  .cw-pass-name.long { font-size: 38px; }
  .menu-btn.cw-ready { min-height: 48px; }
  .cw-tr { padding: 2px 2px; }
  .cw-who b { font-size: 16px; }
  .cw-stamp { padding: 4px 10px 4px; }
  .cw-stamp-main { font-size: 24px; }
  #cw-summary .screen-title { font-size: 34px; }
  .cw-sum-main { gap: 6px; }
  .cw-trophy { width: 48px; }
  #cw-winner .cw-win-title { font-size: 40px; }
  .cw-win-name { font-size: 40px; }
  .cw-win-name.long { font-size: 32px; }
  .cw-win-body { gap: 5px; }
  .cw-standings li { padding: 1px 0; }
  .cw-te-v { font-size: 48px; }
}
body.reduce-motion .cw-letters i.new, body.reduce-motion .cw-pass-name, body.reduce-motion .menu-btn.cw-ready,
body.reduce-motion .cw-count-big.pop, body.reduce-motion #cw-turnend, body.reduce-motion .cw-te-next,
body.reduce-motion .cw-replay-label, body.reduce-motion .cw-rays,
body.reduce-motion #cw-winner.show .cw-trophy, body.reduce-motion #cw-winner.show .cw-win-title { animation: none; }
body.reduce-motion .cw-stamp { animation: none; transform: rotate(-3deg); }

/* ◀ ▶ on the picker buttons, drawn in CSS: the glyphs aren't in the game's
   fonts, and iOS's fallback for them (in the app) showed as a missing-glyph
   box. The text stays in the markup for screen readers; it's just not drawn. */
.pick-btn, .picker .pick-btn, .picker.hero .pick-btn { font-size: 0; line-height: 0; --tri: 7px; }
.picker.hero .pick-btn { --tri: 9px; }
.pick-btn::before {
  content: '';
  display: inline-block;
  vertical-align: middle;
  border-top: var(--tri) solid transparent;
  border-bottom: var(--tri) solid transparent;
}
.pick-btn[data-dir="-1"]::before { border-right: calc(var(--tri) * 1.3) solid currentColor; }
.pick-btn[data-dir="1"]::before { border-left: calc(var(--tri) * 1.3) solid currentColor; }

/* ---- Create-a-Skater: desktop webcam capture (photo step) ---- */
.cas .cas-cam{position:absolute;inset:0;z-index:3;background:#0b0810;overflow:hidden}
.cas .cas-cam-v{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;transform:scaleX(-1);background:#0b0810}
.cas .cas-cam-oval{position:absolute;left:50%;top:46%;height:72%;aspect-ratio:.8;transform:translate(-50%,-50%);border-radius:50%;border:4px dashed var(--y);box-shadow:0 0 0 999px rgba(11,8,16,.35);pointer-events:none}
.cas .cas-cam-t{position:absolute;left:8px;right:8px;top:8px;text-align:center;font-family:var(--px);font-size:9px;line-height:1.5;color:var(--y);text-shadow:2px 2px 0 #000;pointer-events:none}
.cas .cas-cam-bar{position:absolute;left:10px;right:10px;bottom:10px;display:flex;align-items:center;justify-content:space-between;gap:10px}
.cas .cas-shutter{width:68px;height:68px;border-radius:50%;padding:0;background:var(--paper);border:4px solid #000;box-shadow:4px 4px 0 #000;display:flex;align-items:center;justify-content:center}
.cas .cas-shutter i{display:block;width:44px;height:44px;border-radius:50%;background:var(--r);border:3px solid #000}
.cas .cas-shutter:active:not(:disabled){transform:translate(3px,3px);box-shadow:1px 1px 0 #000}
.cas .cas-shutter:disabled{opacity:.45;cursor:default}
.cas .cas-filebtn{align-self:flex-start}
