/* Downhill: the interactive drive. Colours come from the world itself: the night, the
   car's cream stripe, reflector amber, chevron red and sodium lamps. Square corners and
   pixel type, like a late-90s racer's menus. */
@font-face { font-family: "Jersey 10"; src: url("/drive/font/jersey-10-latin-400.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "DotGothic16"; src: url("/drive/font/dotgothic16-latin-400.woff2") format("woff2"); font-display: swap; }
/* the Japanese on course v2's signs: only their own characters (game/signlines.js), fetched only when one is drawn */
@font-face { font-family: "DotGothic16"; src: url("/drive/font/dotgothic16-signs-ja-400.woff2") format("woff2"); font-display: swap; unicode-range: U+3000-30FF, U+4E00-9FFF; }

:root {
  --deep: #05070b; --night: #0c1220; --panel: #0a0f1a; --cream: #e9dfc4; --dim: #a9a593;
  --amber: #ffab3d; --red: #b3241c; --teal: #1f6f6a; --steel: #9aa0a6;
  --display: "Jersey 10", "Arial Narrow", sans-serif;
  --text: "DotGothic16", "MS Gothic", ui-monospace, monospace;
  --gp: 2px; /* one game pixel, set from the script */
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--deep); color: var(--cream); }
body { font: 16px/1.5 var(--text); overflow: hidden; -webkit-tap-highlight-color: transparent; }
/* a quick second tap on a key (the picker's next paint, say) is a tap, never a zoom; pinching still zooms */
body, .panel, .corner { touch-action: manipulation; }
a { color: var(--amber); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
kbd { font: inherit; display: inline-block; min-width: 1.7em; padding: 0 0.35em; border: 2px solid var(--cream); box-shadow: 2px 2px 0 #000; text-align: center; line-height: 1.3; }
[hidden] { display: none !important; }

/* ---- the picture ---- */
.stage { position: fixed; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.screen { position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: #070a12; }
.screen canvas { display: block; width: 100%; height: 100%; }
/* the light quality tier: the canvas is the picture's own 480x270, and the browser scales it
   to the screen with sharp pixels (quality.js) */
.screen canvas.lo { image-rendering: crisp-edges; image-rendering: pixelated; }

/* ---- HUD: sized in game pixels so it sits on the picture's own grid ---- */
/* the HUD, card and music player fade rather than pop as the camera hands over */
.hud, .card { transition: opacity 0.35s ease, visibility 0s; }
.hud.off, .card.off { opacity: 0; visibility: hidden; transition: opacity 0.35s ease, visibility 0s 0.35s; }
.player:not([hidden]) { animation: ui-in 0.4s ease-out; }
@keyframes ui-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hud, .card, .hud.off, .card.off { transition-duration: 0.1s; } .player:not([hidden]) { animation: none; } }
.hud { position: absolute; inset: 0; pointer-events: none; font-family: var(--display); line-height: 1; color: var(--cream);
  text-shadow: var(--gp) 0 0 #000, calc(var(--gp) * -1) 0 0 #000, 0 var(--gp) 0 #000, 0 calc(var(--gp) * -1) 0 #000, var(--gp) var(--gp) 0 #000; }
.hud p { margin: 0; position: absolute; }
/* --hlx: on a phone on its side whose picture reaches the pause key, the left column and the card keep
   right of it (main.js, placeRear) */
/* online, how many are in the room (#room) takes the time's place, in its digits, with the line
   under it in words; the drift meter under them makes way (main.js, updateHud) */
.hud-time, .hud-room { left: calc(var(--gp) * 10 + var(--hlx, 0px)); top: calc(var(--gp) * 8); font-size: max(20px, calc(var(--gp) * 18)); }
.hud-time small, .hud-room small { display: block; margin-top: 0.25em; font-size: max(14px, calc(var(--gp) * 10)); color: var(--dim); }
.hud-time small span { color: var(--cream); }
.hud.online .hud-drift { visibility: hidden; }
.hud-speed { right: calc(var(--gp) * 9 + var(--tach)); bottom: calc(var(--gp) * 7); font-size: max(30px, calc(var(--gp) * 30)); }
.hud-speed b { font-weight: 400; }
.hud-speed small { font-size: max(13px, calc(var(--gp) * 11)); color: var(--dim); }

/* ---- the rev counter, bottom right (game/tach.js): a round 90s tach face in flat colours,
   numbers in thousands, the car's own red band, an amber needle, the gear in an LCD window
   like the stereo's, and a shift lamp off its top left corner. Vector, so it stays crisp
   over the dithered picture; sized in game pixels like the rest of the HUD ---- */
/* its colours: a black gauge face, the stereo's greys for the bezel and the lamp's pod, the
   tail lights' red for the red line and the lit lamp, and a dark red lens when it's off */
.hud { --tach: max(108px, calc(var(--gp) * 74)); --face: #0b0d12; --redline: #e2402c; --lens: #2a0e0a; }
.hud-tach { position: absolute; right: calc(var(--gp) * 7); bottom: calc(var(--gp) * 5); width: var(--tach); height: var(--tach); text-shadow: none; }
.hud-tach svg { display: block; width: 100%; height: 100%; overflow: visible; }
.tach-back { fill: #000; }
.tach-face { fill: var(--face); stroke: #3b3e46; stroke-width: 2.4; }
.tach-red { fill: none; stroke: var(--redline); stroke-width: 4.6; }
.tach-tick { stroke: var(--cream); stroke-width: 1.1; }
.tach-tick.major { stroke-width: 2; }
.tach-num { fill: var(--cream); font-family: var(--display); text-anchor: middle; }
.tach-num.red { fill: var(--redline); }
.tach-unit { fill: var(--dim); font-family: var(--display); text-anchor: middle; }
.tach-lcd { fill: #1d1206; stroke: #000; stroke-width: 1.2; }
.tach-gear { fill: var(--amber); font-family: var(--display); text-anchor: middle; }
.tach-boost path { fill: none; stroke: #3d2a12; stroke-width: 3.4; }
.tach-boost path.on { stroke: var(--amber); }
.tach-needle { fill: var(--amber); stroke: #000; stroke-width: 0.8; stroke-linejoin: round; }
.tach-cap { fill: #15171c; stroke: #5d616a; stroke-width: 1.4; }
.tach-pod { fill: #15171c; stroke: #3b3e46; stroke-width: 2; }
.tach-lamp { fill: var(--lens); stroke: #000; stroke-width: 1; }
.tach-lamp.on { fill: var(--redline); }
/* past the line, the cup holder at the dial's bottom left: the last can, in its own colour (tach.js) */
.tach-can { stroke: #000; stroke-width: 0.8; }
.tach-lid { fill: var(--steel); }
/* ---- the minimap (game/minimap.js): bare lines, no face or frame, drawn in the picture's own pixels
   (whole device pixels each, scaled up sharp); main.js places and sizes it (placeMap) ---- */
.hud-map { position: absolute; display: flex; align-items: center; justify-content: center; text-shadow: none; }
.hud-map canvas { display: block; flex: none; image-rendering: crisp-edges; image-rendering: pixelated; }
/* ---- online (game/ghosts.js): another player's name over their car, outlined black like the
   map's lines; under the HUD, over the picture ---- */
.ghost-names { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: hidden; }
.ghost-name { font-family: var(--display); font-size: max(15px, calc(var(--gp) * 9)); fill: var(--cream); text-anchor: middle;
  stroke: #000; stroke-width: 3px; stroke-linejoin: round; paint-order: stroke; }
/* the gear and revs in words, for screen readers only */
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.hud-note { left: 50%; top: 32%; transform: translateX(-50%); font-size: max(22px, calc(var(--gp) * 22)); color: var(--amber); white-space: nowrap; }
.hud-note.small { font-size: max(15px, calc(var(--gp) * 11)); color: var(--cream); top: 18%; }
/* ---- the rear view, top centre while reversing (drawn into the picture by ps1.js, bezel and
   all): the small notes and the drift points keep below it while it's up ---- */
.hud.rear .hud-note.small { top: calc(var(--rearb, 30%) + 6px); }
.hud.rear .hud-pops { top: max(34%, calc(var(--rearb, 30%) + 8px)); }

/* ---- the drift meter (game/scorehud.js): the car's angle, amber once it counts as a drift;
   below it, how much of the corner under way has been drifted; the run's points; and while a
   corner is under way, its name and the speed it was entered at ---- */
.hud-drift { position: absolute; left: calc(var(--gp) * 10 + var(--hlx, 0px)); top: calc(var(--gp) * 8 + max(20px, calc(var(--gp) * 18)) + max(14px, calc(var(--gp) * 10)) * 1.25 + max(10px, calc(var(--gp) * 7)));
  width: max(132px, calc(var(--gp) * 92)); opacity: 0.55; transition: opacity 0.25s ease; }
.hud-drift.live { opacity: 1; }
/* past the line the corners are done, and the chip that brings the results back sits where
   the meter is: the meter makes way (its total is in the results) */
#resultsBtn:not([hidden]) ~ .hud-drift { visibility: hidden; }
.hud-drift i { position: absolute; display: block; }
.dm-bar { position: relative; height: max(10px, calc(var(--gp) * 7)); background: rgba(5, 7, 11, 0.7); border: 2px solid #000; box-shadow: 0 0 0 1px var(--dim); }
/* the band: 10 degrees and up (a drift) on a scale of 0 to 60 */
.dm-band { top: 0; bottom: 0; left: 16.7%; right: 0; background: #5a3a12; }
.hud-drift.in .dm-band { background: var(--amber); }
.dm-needle { top: -3px; bottom: -3px; width: max(3px, calc(var(--gp) * 2)); margin-left: max(-1.5px, calc(var(--gp) * -1)); left: 0; background: var(--cream); box-shadow: 1px 0 0 #000, -1px 0 0 #000; }
.dm-hold { position: relative; height: max(5px, calc(var(--gp) * 3)); margin-top: max(3px, calc(var(--gp) * 2)); background: rgba(5, 7, 11, 0.7); box-shadow: 0 0 0 1px #000; }
.dm-fill { top: 0; bottom: 0; left: 0; width: 0; background: var(--cream); }
.hud-drift.in .dm-fill { background: var(--amber); }
.dm-score { margin-top: max(4px, calc(var(--gp) * 3)); font-size: max(18px, calc(var(--gp) * 14)); white-space: nowrap; }
.dm-score b { font-weight: 400; }
.dm-corner { margin-top: max(2px, calc(var(--gp) * 1)); font-size: max(14px, calc(var(--gp) * 9)); white-space: nowrap; }
.dm-in { margin-left: 0.25em; color: var(--amber); }
/* each corner as it's scored: name, grade and points, then the four things it was scored on;
   above the car, rising a little and fading */
.hud-pops { position: absolute; left: 50%; top: 30%; width: 0; }
/* an upright phone: the picture is small, so what comes and goes takes the empty band under it,
   each in a place of its own, one under the other: the card's strip, a note, the corner's popup.
   Nothing then sits on the rev counter, the drift meter or the rear view */
.stage.portrait .hud-note, .stage.portrait .hud-note.small, .stage.portrait .hud.rear .hud-note.small { top: calc(100% + 60px); }
.stage.portrait .hud-pops, .stage.portrait .hud.rear .hud-pops { left: 50%; top: calc(100% + 100px); }
/* a short upright phone, where the band's rev counter comes up to the popup's place: the popup keeps
   left of the rev counter, wrapping if it must (main.js sets pops-left) */
.stage.portrait.pops-left .hud-pops, .stage.portrait.pops-left .hud.rear .hud-pops { left: calc((100vw - var(--tach) - max(16px, env(safe-area-inset-right)) - 8px) / 2); }
.stage.portrait.pops-left .pop { white-space: normal; width: max-content; max-width: calc(100vw - var(--tach) - max(16px, env(safe-area-inset-right)) - 24px); }
/* a phone on its side: the top holds the time, the meter, the card and the corner, so a note
   goes low in the middle instead, between the pads (wrapping if it must) */
.touch .stage:not(.portrait) .hud-note, .touch .stage:not(.portrait) .hud.rear .hud-note.small {
  top: auto; bottom: calc(max(14px, env(safe-area-inset-bottom)) - (var(--vh, 100vh) - var(--sy, 0px) - var(--sh, 100vh)));
  width: max-content; max-width: calc(100vw - 2 * (max(16px, env(safe-area-inset-left)) + 2 * var(--pw) + var(--pg) + 20px)); white-space: normal; text-align: center; }
.pop { position: absolute; left: 0; top: 0; transform: translateX(-50%); margin: 0; white-space: nowrap; text-align: center; font-size: max(20px, calc(var(--gp) * 15)); color: var(--cream); animation: pop-up 2.5s ease-out forwards; }
.pop-head { display: block; }
.pop.good .pop-head { color: var(--amber); }
.pop-grade { display: inline-block; min-width: 1em; margin: 0 0.12em; padding: 0 0.15em; font-weight: 400; color: var(--deep); background: var(--amber); text-shadow: none; }
.pop-grade.g-C, .pop-grade.g-D { background: var(--cream); }
.pop small { display: block; margin-top: 0.15em; font-size: max(13px, calc(var(--gp) * 8.5)); color: var(--cream); }
@keyframes pop-up { 0% { opacity: 0; transform: translate(-50%, 8px); } 8% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, calc(var(--gp) * -10)); } }
@media (prefers-reduced-motion: reduce) { .pop { animation: pop-fade 2.5s linear forwards; } }
@keyframes pop-fade { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }

/* ---- the billboard card: a small prompt, a board's name and Read more, only while the car goes
   slowly by a board it can see (game/prompt.js), the rest in its panel. Up in the sky, level with
   the time and just right of the drift meter: clear of the car, the road, the boards themselves,
   the rev counter and the top right corner (--cardmax, from the script). It steps aside while
   the rear view is up. An upright phone has a slim strip under the picture instead (below) ---- */
.card { position: absolute; left: calc(var(--gp) * 10 + var(--hlx, 0px) + max(132px, var(--gp) * 92) + 10px); top: var(--cardtop, calc(var(--gp) * 8)); width: max-content; max-width: min(25%, var(--cardmax, 25%)); padding: calc(var(--gp) * 2.5) calc(var(--gp) * 4) calc(var(--gp) * 3);
  background: rgba(5, 7, 11, 0.86); border: 2px solid var(--cream); box-shadow: 3px 3px 0 #000; font-size: max(12px, calc(var(--gp) * 5)); line-height: 1.3; }
.card p { margin: 0; }
.card-title { font: max(18px, calc(var(--gp) * 10)) / 1 var(--display); color: var(--amber); }
.card-open { display: inline-block; margin-top: 0.35em; color: var(--cream); text-decoration: none; }
@media (hover: hover) { .card-open:hover { color: var(--amber); } }
.hud.rear ~ .card { opacity: 0; visibility: hidden; transition: opacity 0.2s ease, visibility 0s 0.2s; }
.card-open kbd { margin-right: 0.3em; }
.card-more { font: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
/* online (16.6): someone else's wash: In use, no key, nothing to press; asking the server: held down */
.card.busy .card-open { color: var(--dim, #8a8578); cursor: default; }
.card.busy .card-open kbd { display: none; }
.card.asking .card-open { color: var(--amber); }
/* past the line, by one of the city's Easter eggs: only Look (or Back), no name of its own */
.card.egg .card-open { margin-top: 0; }
/* parked in a coin bay: its line (how straight) and, under it in the body's own letters, the
   visit's best; with nothing else in reach, no button */
.card .card-sub { margin-top: 0.3em; color: var(--dim); }
/* a fortune's slip, drawn at the shrine's torii: its grade as the title, its lines under it one to
   a row in the body's own letters at full strength (they are what it says), and on a bad one the
   note that it may be tied to a branch and left behind, dimmer, under them; Back last */
.card.slip { max-width: min(36%, var(--cardmax, 36%)); } /* (its longest line on one row: 54 letters) */
.card.slip .card-sub { margin-top: 0.4em; color: var(--cream); white-space: pre-line; }
.card .card-note { display: block; margin-top: 0.4em; color: var(--dim); }
/* the whole card is the way in: a tap or click anywhere on it, not only on its small last line */
.card-open::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
/* it comes up quickly rather than popping */
.card:not([hidden]) { animation: ui-in 0.2s ease-out; }
@media (prefers-reduced-motion: reduce) { .card:not([hidden]) { animation: none; } }
/* ---- an overheard conversation's line (main.js's listen): a plain dark slip over whoever says it, as
   the card is, placed each frame from their head on the screen (its left and top from the script) */
.talk-line { position: absolute; left: 0; top: 0; margin: 0; width: max-content; max-width: min(46%, calc(var(--gp) * 170));
  padding: calc(var(--gp) * 1.5) calc(var(--gp) * 3) calc(var(--gp) * 2); background: rgba(5, 7, 11, 0.86); box-shadow: 2px 2px 0 #000;
  color: var(--cream); font-size: max(13px, calc(var(--gp) * 5.5)); line-height: 1.3; pointer-events: none; }
/* the finish: time, splits and the leaderboard */
.splits { list-style: none; padding: 0; margin: 0 0 0.8em; display: grid; gap: 2px; max-width: 22em; }
.splits li { display: flex; justify-content: space-between; gap: 1em; color: var(--dim); }
.splits li:last-child { color: var(--cream); }
.splits li span:last-child, .board-list .tm { font-family: var(--display); font-size: 1.2em; color: var(--amber); }
.board-rank { color: var(--amber); margin: 0.2em 0 0.6em; }
.board-form label { display: block; margin-bottom: 4px; }
.board-row { display: flex; flex-wrap: wrap; gap: 8px; }
.board-row input { font: 24px/1 var(--display); width: 10em; max-width: 100%; padding: 6px 10px; color: var(--cream); background: #0c0e14; border: 2px solid var(--cream); }
.board-row input:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.board-row button, .tabs button { font: 22px/1 var(--display); padding: 8px 12px; color: var(--deep); background: var(--amber); border: 2px solid var(--amber); cursor: pointer; }
.board-row button:disabled { opacity: 0.6; cursor: progress; }
.board-msg { min-height: 1.4em; margin: 4px 0 0; color: var(--amber); }
.board-why, .board-note { color: var(--dim); }
/* the drift score at the finish: the total, the best corner, then every corner in two columns */
.drift-end { margin: 0 0 0.8em; max-width: 28em; }
.drift-end p { margin: 0; }
.drift-total { display: flex; justify-content: space-between; gap: 1em; max-width: 22em; }
.drift-total b { font: 400 1.2em/1 var(--display); color: var(--amber); }
.drift-best { color: var(--dim); }
/* the results on a phone: tighter type, the menu in a row and the splits in two columns, so
   the time, the menu, the splits and the drift score take one look */
html.touch #end { font-size: 14px; }
html.touch #end h2 { font-size: 48px; }
html.touch #end .lead { margin: 0.2em 0 0.4em; }
html.touch #end .menu { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0.4em 0 0.6em; }
html.touch #end .menu a, html.touch #end .menu button { font-size: 22px; min-height: 44px; padding: 10px 12px 10px 28px; }
html.touch #end .menu a::before, html.touch #end .menu button::before { left: 9px; }
html.touch #end .splits { grid-template-columns: 1fr 1fr; column-gap: 1.4em; max-width: 30em; margin-bottom: 0.5em; }
html.touch #end .drift-total { justify-content: flex-start; gap: 0.8em; }
/* the long lists at the finish (every corner, everything you drove past) start folded */
#end .fold { margin: 0.2em 0 0.6em; max-width: 28em; }
#end .fold summary { padding: 4px 0; }
#end .fold .projects { margin-top: 0.3em; }
.corner-list { list-style: none; padding: 0; margin: 0.35em 0 0; columns: 2; column-gap: 1.4em; font-size: 0.9em; }
.corner-list li { display: grid; grid-template-columns: minmax(0, 1fr) 1.3em auto; gap: 0.4em; align-items: baseline; break-inside: avoid; color: var(--dim); }
.corner-list .cn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.corner-list .cg { font-family: var(--display); font-size: 1.2em; text-align: center; color: var(--cream); }
.corner-list .cp { font-family: var(--display); font-size: 1.2em; text-align: right; color: var(--amber); }
.corner-list .cx { grid-column: 1 / -1; margin: -0.1em 0 0.35em; font-size: 0.85em; color: var(--dim); }
/* past the line, with the results put away: a chip to bring them back */
.hud-results { position: absolute; left: calc(var(--gp) * 10 + var(--hlx, 0px)); top: calc(var(--gp) * 58); pointer-events: auto; cursor: pointer;
  font: 20px/1 var(--display); color: var(--cream); background: rgba(5, 7, 11, 0.7); border: 2px solid var(--cream); padding: 6px 10px; }
.hud-results kbd { font-size: 14px; margin-left: 4px; }
.touch .hud-results kbd { display: none; }
.board { margin: 0.8em 0; max-width: 28em; }
.tabs { display: flex; gap: 6px; margin-bottom: 6px; }
.tabs button { color: var(--cream); background: transparent; border-color: var(--cream); }
.tabs button[aria-pressed="true"] { color: var(--deep); background: var(--cream); }
.tabs button:focus-visible, .board-row button:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.board-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1px; }
.board-list li { display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto auto auto; gap: 10px; align-items: baseline; padding: 3px 6px; background: rgba(255, 255, 255, 0.04); }
.board-list li.me { background: var(--amber); color: var(--deep); }
.board-list li.me .tm, .board-list li.me .cr, .board-list li.me .sc { color: var(--deep); }
.board-list .rk { color: var(--dim); text-align: right; }
.board-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list .cr, .board-list .sc { color: var(--dim); font-size: 0.85em; }
.board-list .sc { text-align: right; font-variant-numeric: tabular-nums; }
/* the board by car: All, or one car's times, stepped through
   with the picker's own keys either side of the name. A fixed width, so the keys never move as the
   names go by; one car's board leaves out the car column (every row is that car) */
.board-car { display: flex; align-items: center; gap: 6px; width: 248px; max-width: 100%; margin: 0 0 6px; }
.board-car .pk { height: 40px; }
.board-car-name { flex: 1; min-width: 0; margin: 0; text-align: center; font: 22px/1 var(--display); color: var(--cream); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-car-name span { color: var(--dim); font-size: 0.75em; }
.board-car-name b { font-weight: 400; color: var(--amber); }
.hint.board-pad { margin: -2px 0 6px; }
.board-list.by-car li { grid-template-columns: 2.2em minmax(0, 1fr) auto auto; }
#end.see-through { background: linear-gradient(90deg, rgba(5, 7, 11, 0.94) 0, rgba(5, 7, 11, 0.88) var(--colr), rgba(5, 7, 11, 0) calc(var(--colr) + 12vw)); }
html.portrait #end { padding-top: calc(var(--sy) + var(--sh) + 14px); background: linear-gradient(180deg, transparent calc(var(--sy) + var(--sh) + 4px), rgba(5, 7, 11, 0.94) calc(var(--sy) + var(--sh) + 4px)); }

/* the guide map, read (main.js's openGuide, game/guidemap.js): the map in a frame filling what the
   heading and the buttons under it leave, its pixels whole device pixels and sharp (guidemap.js
   sizes the canvas). The heading shares its row with the music's corner, top right, and the frame
   starts under the corner (--cb: the corner's foot, as the upright phone's clip-path has it); on an
   upright phone or a narrow window, where the corner takes the whole width, the heading goes under it. The buttons in
   a row, the key beside or under them; on a short screen everything smaller */
#guideMap { --cb: calc(max(10px, env(safe-area-inset-top)) + 39px * var(--ui, 1) + 14px); display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto; overflow: hidden; background: var(--deep); }
.touch #guideMap { --cb: calc(max(10px, env(safe-area-inset-top)) + 39px * var(--tu, 1) + 12px); }
html #guideMap.panel { padding-top: 0; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
#guideMap h2 { box-sizing: border-box; height: var(--cb); display: flex; align-items: flex-end; margin: 0; padding-bottom: 8px; font-size: clamp(34px, 7vh, 60px); }
html.portrait #guideMap h2 { height: auto; margin-top: var(--cb); }
@media (max-width: 640px) { #guideMap h2 { height: auto; margin-top: var(--cb); } } /* (the corner as wide as the screen: about 505 px of it) */
.guide-frame { position: relative; min-height: 120px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #0b0e14; border: 2px solid var(--cream); box-shadow: 3px 3px 0 #000; }
.guide-frame canvas { display: block; flex: none; image-rendering: crisp-edges; image-rendering: pixelated; touch-action: none; cursor: grab; }
.guide-frame canvas.held { cursor: grabbing; }
.guide-north { position: absolute; top: 8px; left: 10px; font: 22px/1 var(--display); color: var(--cream); text-shadow: 2px 2px 0 #000; pointer-events: none; }
.guide-north::before { content: ""; display: block; width: 10px; height: 10px; margin: 0 auto 3px; background: var(--cream); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.guide-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 28px; margin-top: 6px; }
#guideMap .guide-menu { display: flex; flex-wrap: wrap; gap: 2px 4px; margin: 0; }
#guideMap .guide-menu button { font-size: 24px; }
.guide-key { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; margin: 0; padding: 0; color: var(--dim); }
.guide-key li { display: flex; align-items: center; gap: 7px; }
.guide-key i { flex: none; display: block; width: 8px; height: 8px; border: 2px solid #000; }
.guide-key .gk-car { width: 12px; height: 12px; border: 0; background: var(--amber); clip-path: polygon(50% 0, 100% 100%, 50% 75%, 0 100%); }
.guide-key .gk-race { width: 16px; height: 3px; border-width: 1px; background: var(--cream); }
.guide-key canvas { flex: none; display: block; image-rendering: crisp-edges; image-rendering: pixelated; } /* (the map's own glyph, two CSS pixels a map pixel: guidemap.js paints and sizes it) */
.guide-hint { margin: 4px 0 0; }
@media (max-height: 520px) {
  #guideMap h2 { font-size: 34px; padding-bottom: 6px; }
  #guideMap .guide-menu button { font-size: 20px; }
  html.touch #guideMap .guide-menu button { min-height: 44px; padding-top: 8px; padding-bottom: 8px; }
  .guide-key, .guide-hint { font-size: 13px; }
}

/* a board's panel (main.js, openInfo): everything its face leaves out */
#info { background: rgba(5, 7, 11, 0.9); }
#info .panel-in { max-width: 40em; }
#info h2 { font-size: clamp(44px, 7vw, 76px); }
.info-meta { color: var(--amber); margin: 0 0 1em; }
.info-points { margin: 0.6em 0 1.2em; padding-left: 1.2em; display: grid; gap: 0.6em; max-width: 38em; }
.info-points li::marker { color: var(--amber); }
/* a phone: one slim line, its name and Read more at the end. Upright, just under the
   picture; held sideways, along the top between the time and the player */
.touch .card { display: flex; align-items: baseline; gap: 0.6em; white-space: nowrap; padding: 5px 10px 6px; font-size: 13px; line-height: 1.2; }
/* the whole strip is its link: 44px tall wherever there's the height for it (not a 320px-tall phone on
   its side, where the corner's popup needs the room under it) */
@media (orientation: portrait), (min-height: 350px) {
  .touch .card { padding: 9px 12px 10px; }
  /* (a card that's only its key, a machine's Buy a drink or a wash's Wash: 44px too, its words a
     size bigger) */
  .touch .card.egg { min-height: 44px; align-items: center; font-size: 16px; }
  /* (and the strip answers a tap over its border and a little past, as the pads do, not only
     inside it, 4px shorter) */
  .touch .card-open::after { top: -4px; bottom: -4px; left: -2px; right: -2px; }
}
.touch .card-title { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 21px; }
.touch .card-open { flex: none; margin: 0 0 0 auto; }
/* (a coin bay's line is longer than a board's name, and has its best under it: it wraps rather
   than losing its end) */
.touch .card.line { flex-wrap: wrap; white-space: normal; row-gap: 0.2em; }
.touch .card.line .card-title { flex: 1 1 100%; overflow: visible; font-size: 18px; }
.touch .card.line .card-sub { flex: 1 1 auto; margin: 0; }
/* (a fortune's slip wraps too: its grade, then its lines (and a bad one's note) a row of their own,
   Back at the end of the last) */
.touch .card.slip { flex-wrap: wrap; white-space: normal; row-gap: 0.2em; }
.touch .card.slip .card-title { flex: 1 1 100%; overflow: visible; font-size: 18px; }
.touch .card.slip .card-sub { flex: 1 1 100%; margin: 0; }
.card.portrait { left: 12px; right: 12px; bottom: auto; width: auto; max-width: none; }
.touch .stage:not(.portrait) .card { max-width: var(--cardmax, 40%); }

/* ---- touch pads ---- */
.pads { position: absolute; inset: 0; pointer-events: none; }
.pad { pointer-events: auto; position: absolute; border: 2px solid rgba(233, 223, 196, 0.75); background: rgba(5, 7, 11, 0.42); color: var(--cream);
  font: 20px/1 var(--display); letter-spacing: 0.04em; touch-action: none; display: flex; align-items: center; justify-content: center; }
.pad.on { background: rgba(255, 171, 61, 0.55); color: var(--deep); border-color: var(--amber); }
/* the pads stand on one grid: one key (--pw by --ph) and one gap (--pg), sized from the screen
   (below; 76px square where nothing says otherwise). Bottom left, the steering pair; bottom right,
   Gas, the largest key, two keys tall at the edge under the thumb, with Hand beside it (the thumb
   rolls left onto it) and Brake above Hand (up and in), so the two clusters share their bottom
   edge, their margins and their gap */
.stage { --pw: 76px; --ph: 76px; --pg: 12px; }
/* held sideways, a key is a quarter of the screen's height (its visible height, --vh, which a phone's
   browser bar takes from), from 76 to 104px: 86px on a 360px-tall phone, 94 at 390, 103 at 430 */
.touch .stage:not(.portrait) { --pw: clamp(76px, calc(var(--vh, 100vh) * 0.24), 104px); --ph: var(--pw); }
.pads-steer .pad { width: var(--pw); height: var(--ph); bottom: max(16px, env(safe-area-inset-bottom)); }
.pad-left { left: max(16px, env(safe-area-inset-left)); }
.pad-right { left: calc(max(16px, env(safe-area-inset-left)) + var(--pw) + var(--pg)); }
.pad span { width: 20px; height: 28px; background: currentColor; }
.pad-left span { clip-path: polygon(100% 0, 0 50%, 100% 100%); }
.pad-right span { clip-path: polygon(0 0, 100% 50%, 0 100%); }
.pads-pedals .pad { right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); width: var(--pw); height: var(--ph); }
.pads-pedals .pad-gas { height: calc(2 * var(--ph) + var(--pg)); }
.pads-pedals .pad-hand, .pads-pedals .pad-brake { right: calc(max(16px, env(safe-area-inset-right)) + var(--pw) + var(--pg)); }
.pads-pedals .pad-brake { bottom: calc(max(16px, env(safe-area-inset-bottom)) + var(--ph) + var(--pg)); }
.pad-pause { top: max(10px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); width: 48px; height: 44px; font-size: 18px; }
.stage.portrait .pad-pause { top: max(14px, env(safe-area-inset-top)); width: calc(48px * var(--tu, 1)); height: calc(44px * var(--tu, 1)); }
.touch .stage:not(.portrait) .pad-pause { width: clamp(48px, calc(var(--vh, 100vh) * 0.14), 60px); height: clamp(44px, calc(var(--vh, 100vh) * 0.125), 56px); font-size: 20px; }
/* each driving pad answers a little beyond its square: half of each gap to its neighbours, a
   little more above, and out to the screen's edges, so a thumb a few pixels off still counts (the
   pause key answers only on its square) */
.pads-steer .pad::before, .pads-pedals .pad::before { content: ""; position: absolute; top: -14px; right: -6px; bottom: -6px; left: -6px; }
.pads-steer .pad::before, .pads-pedals .pad-gas::before, .pads-pedals .pad-hand::before { bottom: calc(-2px - max(16px, env(safe-area-inset-bottom))); }
.pads-steer .pad-left::before, .pads-steer .pad-drag::before { left: calc(-2px - max(16px, env(safe-area-inset-left))); }
.pads-pedals .pad-gas::before { right: calc(-2px - max(16px, env(safe-area-inset-right))); }
.pads-pedals .pad-hand::before { top: -6px; }
/* Drag to steer: one strip where the two steering pads were, a block that follows the thumb */
.pads-steer .pad-drag { width: calc(2 * var(--pw) + var(--pg)); left: max(16px, env(safe-area-inset-left)); }
.pad-drag i { display: block; width: 22px; height: 60%; background: currentColor; pointer-events: none; }
.pad-drag::after { content: ""; position: absolute; left: 50%; top: 18%; bottom: 18%; width: 2px; margin-left: -1px; background: rgba(233, 223, 196, 0.35); pointer-events: none; }
/* upright, the same grid: as wide as four keys fit with their gaps (up to 100px), and as tall as the
   screen's height allows with the band above them still clear of the picture (14% of it less 21px,
   66 to 112px: 69px on a 640px-tall phone, 97 at 844, 110 at 932); the steering pair as tall as Gas,
   so the two clusters mirror each other whole (the band starts at Brake's top, main.js's bandTop) */
.stage.portrait { --pw: clamp(58px, calc((100vw - 2 * max(16px, env(safe-area-inset-left)) - 36px) / 4), 100px); --ph: clamp(66px, calc(var(--vh, 100vh) * 0.14 - 21px), 112px); }
.stage.portrait .pads-steer .pad { height: calc(2 * var(--ph) + var(--pg)); }

/* ---- top right, where the site's own Drive button sits: the music player (from the first Drive
   on), its settings cog, and the way back, anchored where it always was. On a big screen they
   all grow with it (--ui, from the script: 1 up to 1440x810, then with the window, to 1.34 at
   1920x1080 and beyond; always 1 on a touch screen), so they stay easy to read and to hit ---- */
.corner { --u: var(--ui, 1); position: fixed; z-index: 5; top: max(10px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); display: flex; align-items: flex-start; gap: calc(8px * var(--u)); }
.back { flex: none; display: block; padding: calc(8px * var(--u)) calc(12px * var(--u)) calc(9px * var(--u)); font: calc(22px * var(--u))/1 var(--display); color: var(--cream); background: rgba(5, 7, 11, 0.78); border: 2px solid var(--cream); text-decoration: none; }
.back:focus-visible { background: var(--amber); color: var(--deep); border-color: var(--amber); outline: none; }
@media (hover: hover) { .back:hover { background: var(--amber); color: var(--deep); border-color: var(--amber); outline: none; } }
.playing .back { opacity: 0.72; }

/* ---- the music player: an 80s car stereo's faceplate, one row the height of the way back:
   the song, previous, play or pause, next, and the cog ---- */
.player { display: flex; align-items: center; gap: calc(4px * var(--u)); height: calc(39px * var(--u) + 4px); padding: calc(3px * var(--u)); background: #15171c; border: 2px solid #3b3e46; box-shadow: 3px 3px 0 #000;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.player > .pk { width: calc(36px * var(--u)); height: calc(33px * var(--u)); }
.player > .pk span { width: calc(14px * var(--u)); height: calc(14px * var(--u)); }
.player-lcd { display: flex; gap: 8px; margin: 0; padding: 3px 7px 4px; background: #1d1206; border: 2px solid #000; color: var(--amber); font: 18px/1 var(--display); white-space: nowrap; }
.player > .player-lcd { flex: none; width: calc(178px * var(--u)); height: calc(33px * var(--u)); align-items: center; font-size: calc(18px * var(--u)); padding: 0 calc(7px * var(--u)); gap: calc(8px * var(--u)); }
.player > .player-lcd .player-by { display: none; }
.player-no { color: #b8742a; }
.player-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* a title longer than the display scrolls across, waits, and comes back (main.js's lcdTitle) */
.player-title.scroll { text-overflow: clip; }
.player-title.scroll > span { display: inline-block; animation: lcd-scroll var(--dur, 8s) linear infinite; }
@keyframes lcd-scroll { 0%, 18% { transform: translateX(0); } 62%, 80% { transform: translateX(var(--scroll)); } 100% { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .player-title.scroll > span { display: inline; animation: none; } .player-title.scroll { text-overflow: ellipsis; } }
.player-by { flex: none; align-self: center; font: 13px/1 var(--text); color: #c0802c; }
.player-by:empty { display: none; }
.pk-cog svg { display: block; width: var(--cog, 14px); height: var(--cog, 14px); fill: currentColor; }
.pk-cog[aria-expanded="true"] { color: var(--amber); border-color: #0c0d10 #5d616a #5d616a #0c0d10; background: #23262c; }
/* a phone: play or pause, next and the cog; the song's name is in the settings */
.touch .player > .player-lcd, .touch .player > .pk-prev { display: none; }
.touch .player > .pk { width: calc(42px * var(--u)); }
/* a touch screen's corner (the player, the cog, the way back and the settings under it), the upright
   phone's pause key and the sideways menus' room beside the corner grow in steps with the screen
   (--tu): a sideways phone from 350px tall; an upright one 700px tall or more under 380px wide (where
   the player keeps to play and the cog) or from 410px wide and 780px tall (between, at 390px, the
   corner already fills the row beside the pause key); a tablet the most */
html.touch { --tu: 1; }
html.touch .corner { --u: var(--tu, 1); }
@media (orientation: landscape) and (min-height: 350px) { html.touch { --tu: 1.1; } }
@media (orientation: landscape) and (min-height: 385px) { html.touch { --tu: 1.18; } }
@media (orientation: landscape) and (min-height: 410px) { html.touch { --tu: 1.25; } }
@media (orientation: portrait) and (max-width: 379px) and (min-height: 700px) { html.touch { --tu: 1.1; } }
@media (orientation: portrait) and (min-width: 410px) and (min-height: 780px) { html.touch { --tu: 1.08; } }
@media (orientation: portrait) and (min-width: 428px) and (min-height: 780px) { html.touch { --tu: 1.14; } }
@media (min-width: 600px) and (min-height: 600px) { html.touch { --tu: 1.3; } }
@media (max-width: 379px) { .touch .player > .pk-next { display: none; } }
/* the narrowest phones: the corner keeps clear of the pause key at the top left */
@media (max-width: 359px) { .touch .player > .pk { width: 36px; } .touch .corner { gap: 6px; } .touch .back { padding-left: 9px; padding-right: 9px; } }

/* ---- the settings, under the cog: the song, the music and the sound effects (each a volume and
   on or off), Keep balance, and which playlist it is. Driving waits while it's
   open; Esc, B or a click elsewhere closes it ---- */
.settings { position: absolute; top: calc(100% + 8px * var(--u)); right: 0; width: calc(312px * var(--u)); max-width: calc(100vw - 24px);
  max-height: calc(var(--vh, 100vh) - max(10px, env(safe-area-inset-top)) - (51px + 16px) * var(--u)); overflow-y: auto; overscroll-behavior: contain; display: grid; gap: calc(8px * var(--u)); padding: calc(8px * var(--u)) calc(8px * var(--u)) calc(10px * var(--u));
  background: #15171c; border: 2px solid #3b3e46; box-shadow: 3px 3px 0 #000; cursor: default; }
.settings-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0; font: calc(24px * var(--u))/1 var(--display); color: var(--cream); }
.settings-hint { font: calc(13px * var(--u))/1 var(--text); color: var(--dim); }
.settings .player-lcd { font-size: calc(18px * var(--u)); }
.settings .player-by, .settings .player-note { font-size: calc(13px * var(--u)); }
.settings .pk, .settings .pk-vol { height: calc(36px * var(--u)); }
.settings .player-lists button { min-width: calc(44px * var(--u)); height: calc(28px * var(--u)); font-size: calc(18px * var(--u)); }
.settings-hint kbd { min-width: 0; border-width: 1px; box-shadow: none; padding: 0 0.3em; }
.settings-lcd { white-space: normal; flex-wrap: wrap; align-items: baseline; row-gap: 2px; }
.settings-row { display: flex; align-items: center; gap: calc(6px * var(--u)); }
.settings-name { flex: none; width: 3.6em; font: calc(20px * var(--u))/1 var(--display); color: var(--cream); }
.settings .pk-word { width: calc(52px * var(--u)); font-size: calc(18px * var(--u)); }
.settings .pk-wide { width: auto; flex: none; padding: 0 calc(10px * var(--u)); }
.settings-why { font: calc(13px * var(--u))/1.3 var(--text); color: var(--dim); }
.settings :focus { outline: 3px solid var(--amber); outline-offset: 2px; }
.pk-word { font: 18px/1 var(--display); color: var(--dim); }
.pk-word[aria-pressed="true"], .pk-word[aria-checked="true"] { color: var(--amber); }
/* a latched key (Keep balance on) sits pressed in, like the cog when it's open, so its state isn't
   told by colour alone */
.pk[aria-pressed="true"] { border-color: #0c0d10 #5d616a #5d616a #0c0d10; background: #23262c; }
/* which playlist, and what it is: its name and note */
.player-src { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.player-src[hidden] { display: none; }
.player-lists { display: flex; flex: none; }
.player-lists:empty { display: none; }
.player-lists button { min-width: 44px; height: 28px; padding: 0 8px; margin: 0; cursor: pointer; font: 18px/1 var(--display); color: var(--dim); background: #1b1d22;
  border: 2px solid; border-color: #4a4e57 #0c0d10 #0c0d10 #4a4e57; border-radius: 0; }
.player-lists button + button { margin-left: -2px; }
.player-lists button[aria-pressed="true"] { color: var(--deep); background: var(--amber); border-color: #0c0d10 #ffd08a #ffd08a #0c0d10; }
.player-lists button:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; position: relative; }
.player-note { flex: 1 1 auto; min-width: 0; margin: 0; font: 13px/1.3 var(--text); color: var(--dim); }
.pk { flex: none; width: 44px; height: 36px; display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; color: var(--cream);
  background: #2b2e35; border: 2px solid; border-color: #5d616a #0c0d10 #0c0d10 #5d616a; }
.pk:active { border-color: #0c0d10 #5d616a #5d616a #0c0d10; background: #23262c; }
.pk:focus-visible, .pk-vol:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.pk span { display: block; width: 14px; height: 14px; background: currentColor; }
.pk-prev span { clip-path: polygon(0 0, 3px 0, 3px 50%, 100% 0, 100% 100%, 3px 50%, 3px 100%, 0 100%); }
.pk-next span { clip-path: polygon(0 0, 0 0, calc(100% - 3px) 50%, calc(100% - 3px) 0, 100% 0, 100% 100%, calc(100% - 3px) 100%, calc(100% - 3px) 50%, 0 100%); }
.pk-play span { clip-path: polygon(0 0, 38% 0, 38% 100%, 0 100%, 0 0, 62% 0, 100% 0, 100% 100%, 62% 100%, 62% 0); }
.pk-play.paused span { clip-path: polygon(10% 0, 100% 50%, 10% 100%); color: var(--amber); }
.pk-play.paused { color: var(--amber); }
.pk-vol { flex: 1; min-width: 56px; height: 36px; margin: 0; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none; --v: 25%; }
.pk-vol::-webkit-slider-runnable-track { height: 12px; border: 2px solid #000; background: linear-gradient(90deg, var(--amber) var(--v), #3d2a12 var(--v)); }
.pk-vol::-moz-range-track { height: 8px; border: 2px solid #000; background: linear-gradient(90deg, var(--amber) var(--v), #3d2a12 var(--v)); }
.pk-vol::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 10px; height: 24px; margin-top: -8px; background: var(--cream); border: 2px solid #000; }
.pk-vol::-moz-range-thumb { width: 6px; height: 20px; background: var(--cream); border: 2px solid #000; border-radius: 0; }
/* an upright phone: the rev counter and the speed in the band under the picture, just above the
   pedals (--bandy, main.js's bandTop), so nothing of the HUD but the time and the drift meter lies
   on the picture (where there's room: main.js sets band) */
.stage.portrait.band .hud-tach { right: max(16px, env(safe-area-inset-right)); bottom: auto; top: calc(var(--bandy, 100%) - var(--sy, 0px)); }
.stage.portrait.band .hud-speed { right: calc(max(16px, env(safe-area-inset-right)) + var(--tach) + 8px); bottom: calc(var(--sy, 0px) + var(--sh, 0px) - var(--bandy, 100%) - var(--tach) + 4px); }
/* a phone held sideways: the pads take the bottom corners and the top right is the player and the
   way back, so the rev counter sits low on the left, just above the steering pads (mostly over
   the black beside the picture), with the speed beside it */
.touch .stage:not(.portrait) .hud-tach { right: auto; left: calc(max(16px, env(safe-area-inset-left)) - var(--sx, 0px));
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + var(--ph) + var(--pg) - (var(--vh, 100vh) - var(--sy, 0px) - var(--sh, 100vh))); }
.touch .stage:not(.portrait) .hud-speed { right: auto; left: calc(max(16px, env(safe-area-inset-left)) - var(--sx, 0px) + var(--tach) + 6px);
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + var(--ph) + var(--pg) - (var(--vh, 100vh) - var(--sy, 0px) - var(--sh, 100vh))); font-size: 30px; }
.touch .stage:not(.portrait) .hud-speed small { font-size: 13px; }
/* paused or finished: the menus keep clear of the top right corner */
html:not(.touch).mode-pause .panel, html:not(.touch).mode-end .panel { padding-top: max(72px, calc(var(--sy, 0px) + 24px)); }
@media (orientation: landscape) {
  /* a sideways phone: the menu keeps left of the top right corner (player and way back) */
  /* (the column's room: the screen less the corner, 301px at its size as made and --tu times that,
     its margin, the column's own left edge and a gap) */
  .touch .panel { --colw: calc(100vw - 301px * var(--tu, 1) - max(12px, env(safe-area-inset-right)) - max(16px, env(safe-area-inset-left)) - max(0px, 8vw - 16px) - 8px); }
  .touch #pause, .touch #end { --colr: calc(max(16px, env(safe-area-inset-left)) + max(0px, 8vw - 16px) + var(--colw)); }
  .touch.mode-pause .panel-in, .touch.mode-end .panel-in, .touch #pause .panel-in, .touch #end .panel-in { max-width: var(--colw); }
}
/* an upright phone: a menu scrolled up goes under an edge just below the top right corner,
   never under the player or the way back */
html.portrait.touch .panel { clip-path: inset(calc(max(10px, env(safe-area-inset-top)) + 39px * var(--tu, 1) + 12px) 0 0 0); }
html.portrait.touch #start, html.portrait.touch #pause, html.portrait.touch #garage, html.portrait.touch #end { clip-path: inset(calc(var(--sy) + var(--sh)) 0 0 0); }
/* paused upright, the heading and the menu stay put just under the picture while the rest (the
   picker, the apps) scrolls under them: Carry on is always in reach, and nothing scrolls up under
   the top right corner at the end of a scroll (the short phones' heading is for screen readers
   only, below, and their menu scrolls with the rest). The picture's room is the column's own
   padding here, not the panel's, so the block's place is measured from the screen's top in every
   browser */
@media (min-height: 701px) {
  html.portrait.touch #pause { padding-top: 0; }
  html.portrait.touch #pause .panel-in { padding-top: calc(var(--sy) + var(--sh) + 14px); }
  html.portrait.touch #pause .pause-head { position: sticky; top: calc(var(--sy) + var(--sh)); z-index: 1; margin: -14px -16px 0; padding: 18px 16px 2px; background: var(--deep); border-bottom: 2px solid #3b3e46; }
}
@media (orientation: portrait) and (max-height: 700px) {
  /* short upright phones: a shorter card */
  .card.portrait { font-size: 13px; }
  .card.portrait .card-title { font-size: 20px; }
  /* paused on a short upright phone: a tighter menu, and the heading kept for screen readers
     only, so the menu and the paint picker fit */
  html.portrait #pause h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  html.portrait #pause .menu { gap: 2px; margin: 0.4em 0; }
  html.portrait #pause .menu a, html.portrait #pause .menu button { font-size: 24px; padding-top: 5px; padding-bottom: 5px; }
}

/* ---- the paint picker (the car itself is the real one, in the view behind) ---- */
.skins { display: inline-grid; gap: 6px; padding: 6px; margin: 2px 0 14px; background: #15171c; border: 2px solid #3b3e46; box-shadow: 3px 3px 0 #000; min-width: 272px; max-width: 100%; }
.skins-row { display: flex; align-items: center; gap: 6px; }
.skins-name { flex: 1; min-width: 0; margin: 0; text-align: center; font: 22px/1 var(--display); color: var(--cream); }
.skins-name span { color: var(--dim); font-size: 0.75em; }
.skins-name b { font-weight: 400; color: var(--amber); }
/* a fixed size, so the keys never move while you click through the cars and paints: wide
   enough for the longest ("Paint Deep Blue, Gold Wheels 7/12") on one line, the same for both
   rows, the counter in a fixed width; on a phone too narrow for that the name wraps onto a
   second line, whose height every name keeps */
.skins { width: 372px; max-width: 100%; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.skins-row { min-width: 0; }
.skins-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skins-no { display: inline-block; min-width: 2.4em; text-align: left; font-variant-numeric: tabular-nums; }
/* (narrower than that: an upright phone up to 404px wide, the 372px and the panel's margins; and a
   short sideways phone's title column, min(30em, 100vw - 320px), under 692px wide) */
@media (max-width: 404px), (orientation: landscape) and (max-height: 520px) and (max-width: 691px) {
  /* two lines of their own, the same height for every name: "Paint 1/12" over the name (cut
     short with an ellipsis if it must be) */
  .skins-name { display: grid; grid-template-columns: auto auto; justify-content: center; align-content: center; column-gap: 0.3em; height: 2.1em; }
  .skins-name b { grid-column: 1 / -1; grid-row: 2; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
}
/* ---- the car's card, the picker's third part (main.js showCar): four bars in the stereo's LCD,
   each twenty of the loading bar's cells lit amber from the left, the car's figure over the best
   car's, with the figure itself beside; then what it's like to drive. Its size is set here, never by
   what's in it: each bar 178px (7px cells, 2px apart: whole pixels, so every cell is drawn the same),
   the figure column the rest (at least the longest figure, "front-drive", 4.1em), and the eight
   cars' words in one grid cell (only the car's own shown), the longest setting the height; so
   nothing moves as the cars go by, or when the page is ready and fills it in. Nothing in it moves or
   fades: a bar's cells change in one frame ---- */
.car-card { display: grid; gap: 7px; }
.cc-lcd { display: grid; grid-template-columns: auto 178px minmax(4.1em, 1fr); align-items: center; gap: 5px 8px; margin: 0; padding: 6px 8px; background: #1d1206; border: 2px solid #000; font: 18px/1 var(--display); color: var(--amber); }
.cc-k { color: #b8742a; white-space: nowrap; }
.cc-v { font-weight: 400; text-align: right; white-space: nowrap; }
.cc-bar { display: flex; gap: 2px; min-width: 0; }
.cc-bar i { flex: 1 1 0; min-width: 0; height: 12px; background: #3d2a12; }
.cc-bar i.on { background: var(--amber); }
.cc-about { display: grid; font-size: 14px; line-height: 1.4; color: var(--cream); }
.cc-about p { grid-area: 1 / 1; margin: 0; visibility: hidden; }
.cc-about p.on { visibility: visible; }
/* (narrow: an upright phone, a short sideways phone's column) a smaller LCD, the figure column just
   the longest figure, the cells 1px apart and 7px wide (159px) where there's room, narrower where
   there isn't: 3.1px in the narrowest, a 568x320 phone's 248px column */
@media (max-width: 404px), (orientation: landscape) and (max-height: 520px) and (max-width: 691px) {
  .cc-lcd { grid-template-columns: auto minmax(0, 1fr) 4.1em; font-size: 16px; gap: 5px; padding: 5px 6px; }
  .cc-bar { gap: 1px; max-width: 159px; }
  .cc-bar i { height: 10px; }
  .cc-about { font-size: 13px; }
}
/* a sideways touch screen's pause column keeps left of the top right corner (100vw - 400px, 267px on
   a 667px phone), but the picker sits well below the corner, so it keeps its own width, one line */
@media (orientation: landscape) {
  .touch #pause .skins { max-width: calc(100vw - 2 * max(16px, env(safe-area-inset-left)) - max(0px, 8vw - 16px)); }
}
/* the garage (the tuning shop's, past the line): the car picker without its paint row (the paint is
   the body shop's booth's), the car in the bay behind it, as the pause's column is laid out */
#garage #paintRow { display: none; }
@media (orientation: landscape) and (max-height: 520px) {
  /* short, wide screens (a phone held sideways): the words keep to the left, the car shows on the right */
  #start .panel-in, #pause .panel-in, #garage .panel-in { max-width: min(30em, calc(100vw - 320px)); }
  #start, #pause, #garage { --colr: calc(max(16px, 8vw) + min(30em, 100vw - 320px)); }
  #start, #pause, #garage { padding-top: 16px; }
  /* (the garage's: its heading smaller, the car's words left out and its two buttons side by side,
     so Back is on the screen without a scroll on a 390px-tall phone; the bars are all there) */
  #garage h2 { font-size: 44px; }
  #garage .cc-about { display: none; }
  #garage .menu { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0.2em 0; }
  #garage .menu button { font-size: 26px; padding-top: 4px; padding-bottom: 4px; }
  #start h1 { font-size: 52px; }
  #start .lead { margin: 0.3em 0 0.5em; font-size: 0.95em; }
  #start .menu { display: flex; flex-wrap: wrap; gap: 6px; }
  #start .menu, #pause .menu { margin: 0.5em 0; }
  #pause .menu a, #pause .menu button { font-size: 26px; padding-top: 4px; padding-bottom: 4px; }
}

/* ---- panels: title, pause, finish, no WebGL ---- */
.panel { position: fixed; inset: 0; overflow-y: auto; background: rgba(5, 7, 11, 0.8); padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left)); }
/* the road shows through to the right, but never under the menu's own column: the dark holds
   out to the column's right edge (--colr) and fades after it, so small text never sits on the
   road's lines or the headlights' pool */
.panel { --colr: calc(max(16px, 8vw) + 34em); }
.panel.see-through { background: linear-gradient(90deg, rgba(5, 7, 11, 0.92) 0, rgba(5, 7, 11, 0.86) var(--colr), rgba(5, 7, 11, 0) calc(var(--colr) + 12vw)); }
/* the title and pause panels fade in, and fade and slide away while the camera moves */
/* once faded out a panel is gone for the keyboard and screen readers too (the results put away past
   the line stay faded out, not hidden, until the next change of screen) */
.panel { transition: opacity 0.55s ease, transform 0.55s ease, visibility 0s; }
.panel.leaving { opacity: 0; transform: translateX(-28px); pointer-events: none; visibility: hidden; transition: opacity 0.55s ease, transform 0.55s ease, visibility 0s 0.55s; }
.panel.arriving { opacity: 0; transform: translateX(-16px); }
@media (prefers-reduced-motion: reduce) { .panel { transition: opacity 0.15s linear, visibility 0s; } .panel.leaving { transition: opacity 0.15s linear, visibility 0s 0.15s; } .panel.leaving, .panel.arriving { transform: none; } }
/* an upright phone: the picture stays clear at the top and the panel starts below it */
html.portrait #start, html.portrait #pause, html.portrait #garage { padding-top: calc(var(--sy) + var(--sh) + 14px);
  background: linear-gradient(180deg, transparent calc(var(--sy) + var(--sh) + 4px), rgba(5, 7, 11, 0.94) calc(var(--sy) + var(--sh) + 4px)); }
.panel-in { max-width: 34em; margin-left: max(0px, calc(8vw - 16px)); }
h1, h2 { font-family: var(--display); font-weight: 400; line-height: 0.82; margin: 0 0 0.12em; color: var(--cream); text-shadow: 0.05em 0.05em 0 var(--red); }
h1 { font-size: clamp(76px, 15vw, 150px); }
h2 { font-size: clamp(54px, 10vw, 96px); }
.lead { font-size: 1.12em; max-width: 30em; margin: 0.6em 0 1em; }
.small { font-size: 0.88em; }
.hint { color: var(--dim); margin: 0.6em 0 1.2em; }
.menu { display: grid; justify-items: start; gap: 6px; margin: 1em 0; }
.menu a, .menu button { position: relative; font: 32px/1 var(--display); color: var(--cream); background: none; border: 0; padding: 6px 14px 6px 34px; text-align: left; text-decoration: none; cursor: pointer; }
/* a heading focus is moved to (the results as they come up) needs no ring */
h2[tabindex="-1"]:focus { outline: none; }
/* the menu cursor: a small triangle beside the item you're on */
.menu a::before, .menu button::before { content: ""; position: absolute; left: 10px; top: 50%; margin-top: -7px; width: 11px; height: 14px; background: var(--amber); clip-path: polygon(0 0, 100% 50%, 0 100%); opacity: 0; }
/* (hover only where there is one, a mouse: a key tapped on a touch screen kept its hover look after
   the finger left, so the wrong item looked picked; a touch screen shows the press instead, below) */
.menu .go::before, .menu a:focus-visible::before, .menu button:focus-visible::before { opacity: 1; }
.menu a:focus-visible, .menu button:focus-visible { background: var(--amber); color: var(--deep); outline: none; }
.menu a:focus-visible::before, .menu button:focus-visible::before { background: var(--deep); }
/* (a touch screen's pause opens with nothing lit: the focus is on Carry on, shown once a key or a
   pad is used; main.js unlit) */
html.unlit.mode-pause :focus-visible { outline: none; }
html.unlit.mode-pause .menu a:focus-visible:not(:active), html.unlit.mode-pause .menu button:focus-visible:not(:active) { background: none; color: var(--cream); }
html.unlit.mode-pause .menu a:focus-visible:not(:active)::before, html.unlit.mode-pause .menu button:focus-visible:not(:active)::before { opacity: 0; }
html.unlit.mode-pause .back:focus-visible:not(:active) { color: var(--cream); background: rgba(5, 7, 11, 0.78); border-color: var(--cream); }
@media (hover: hover) {
  .menu a:hover::before, .menu button:hover::before { opacity: 1; }
  .menu a:hover, .menu button:hover { background: var(--amber); color: var(--deep); outline: none; }
  .menu a:hover::before, .menu button:hover::before { background: var(--deep); }
}
.menu button:disabled { color: var(--dim); cursor: progress; background: none; }
/* ---- the loading bar (game/compat.js): in Drive's place until Drive can be pressed, the two in
   one grid cell so nothing moves when one gives way to the other (the bar first, so the button
   after it can hide while it shows). The stereo's LCD in the drift meter's frame, its cells lit
   amber from the left, the percentage, and what's under way. Shown (.shown) only once loading has
   taken a quarter of a second, so a fast machine never sees it flash; until then the button
   says "Loading the mountain". Nothing in it moves but the cells and the words ---- */
.menu-slot { display: grid; justify-items: start; align-items: center; }
.menu-slot > * { grid-area: 1 / 1; }
.load { visibility: hidden; padding: 2px 0 0 34px; font: 13px/1.2 var(--text); color: var(--dim); contain: layout paint; }
.booting .load.shown { visibility: visible; }
.booting .load.shown + .go { visibility: hidden; }
.load-row { display: flex; align-items: center; gap: 10px; }
.load-bar { display: flex; gap: 2px; padding: 2px; background: #1d1206; border: 2px solid #000; box-shadow: 0 0 0 1px var(--dim); }
.load-bar i { display: block; width: 8px; height: 12px; background: #3d2a12; }
.load-bar i.on { background: var(--amber); }
.load-pc { min-width: 2.2em; font: 20px/1 var(--display); color: var(--amber); }
.load-what { display: block; margin-top: 2px; white-space: nowrap; }
.keys { border-collapse: collapse; margin: 0.4em 0 1em; font-size: 0.9em; }
.keys th { text-align: left; font-weight: 400; color: var(--dim); padding: 4px 18px 4px 0; vertical-align: top; }
.keys td { padding: 4px 0; }
.keys kbd { margin: 1px 0; }
.list summary { cursor: pointer; color: var(--amber); padding: 6px 0; }
.projects { list-style: none; padding: 0; margin: 0.6em 0 1em; display: grid; gap: 10px; }
.projects li { max-width: 34em; }
.projects a { font: 24px/1 var(--display); }
.panel h2 + .menu { margin-top: 0.6em; }

/* a touch screen's keys in the menus, the picker, the results and the card: big enough for a thumb
   (48px tall, the picker's keys 52 by 44, the card's strip 44); a mouse keeps the sizes above */
html.touch .menu a, html.touch .menu button { min-height: 48px; padding-top: 10px; padding-bottom: 10px; }
html.touch #end .menu a, html.touch #end .menu button { min-height: 48px; }
html.touch .tabs button, html.touch .board-row button { min-height: 48px; padding: 12px 16px; }
html.touch .board-row input { min-height: 48px; font-size: 26px; }
html.touch .skins .pk, html.touch .board-car .pk { width: 52px; height: 44px; }
html.touch .skins-name { display: grid; grid-template-columns: auto auto; justify-content: center; align-content: center; column-gap: 0.3em; height: 2.1em; }
html.touch .skins-name b { grid-column: 1 / -1; grid-row: 2; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
html.touch .list summary, html.touch #end .fold summary { padding: 12px 0; }
/* (and the apps' links in the lists, 44px tall where they were a line of 24px; a short name answers
   44px across too, past the word's edges, so nothing after it moves) */
html.touch .projects a { display: inline-block; position: relative; padding: 10px 0; }
html.touch .projects a::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: max(100%, 44px); transform: translateX(-50%); }
.touch .hud-results { min-height: 44px; padding: 10px 14px; }
/* the settings' keys 44px tall on a touch screen (they were 28 and 36), the volumes' handles a size
   bigger, and a row of choices wraps rather than squeezing its keys (a why beside its key stays
   beside it, on two lines as before) */
html.touch .settings .pk, html.touch .settings .pk-vol { height: calc(44px * var(--u)); }
html.touch .settings .player-lists button { height: calc(44px * var(--u)); min-width: calc(52px * var(--u)); }
html.touch #qualityRow, html.touch #mapRow, html.touch #steerRow { flex-wrap: wrap; row-gap: 4px; }
html.touch .pk-vol::-webkit-slider-thumb { width: 14px; height: 32px; margin-top: -12px; }
html.touch .pk-vol::-moz-range-thumb { width: 10px; height: 28px; }
/* the top right corner's keys (33px tall in a row 43px tall) answer out to the row's edges and a
   little past them, half of each gap between them, and the first and last out to the row's ends,
   so a thumb a few pixels off still counts; nothing moves. (An ::after is placed from inside the
   key's 2px border) */
.touch .player > .pk, .touch .back { position: relative; }
.touch .player > .pk::after { content: ""; position: absolute; top: calc(-5px * var(--u) - 5px); bottom: calc(-5px * var(--u) - 5px); left: calc(-2px * var(--u) - 2px); right: calc(-2px * var(--u) - 2px); }
.touch .player > .pk-play::after { left: calc(-7px * var(--u) - 2px); }
.touch .player > .pk-cog::after { right: calc(-7px * var(--u) - 2px); }
.touch .back::after { content: ""; position: absolute; top: -3px; bottom: -3px; left: calc(-3px * var(--u)); right: -3px; }
/* pressed: on a touch screen the keys light while a finger holds them, as a pad does (the hover
   look is a mouse's only, above); iOS Safari shows :active once the page listens for touches
   (phone.js) */
html.touch .menu a:active, html.touch .menu button:active:not(:disabled), html.touch .back:active { background: var(--amber); color: var(--deep); border-color: var(--amber); }
html.touch .menu a:active::before, html.touch .menu button:active:not(:disabled)::before { opacity: 1; background: var(--deep); }
html.touch .tabs button:active, html.touch .board-row button:active:not(:disabled), html.touch .hud-results:active { color: var(--deep); background: var(--amber); border-color: var(--amber); }
html.touch .card:active { border-color: var(--amber); }
html.touch .card:active .card-open { color: var(--amber); }
html.touch .player-lists button:active { border-color: #0c0d10 #4a4e57 #4a4e57 #0c0d10; background: #23262c; color: var(--cream); }
html.touch .list summary:active { color: var(--cream); }
/* on a phone or a tablet, no pull to refresh, rubber band or swipe through the history from the
   page itself (a finger dragged down a menu at its top could pull the page to refresh, and the
   run with it), and a menu scrolled to its end doesn't drag the page; no callout on a long press
   of the picture, a pad or the corner. (A computer keeps its touchpad's swipe back: its main pointer
   isn't coarse) */
@media (pointer: coarse) {
  html, body { overscroll-behavior: none; }
  .panel { overscroll-behavior: contain; }
  .stage, .corner { -webkit-touch-callout: none; }
}
/* touch devices see the pads instead of the key table */
.touch .key-only { display: none !important; }
.touch-only { display: none; }
.touch .touch-only { display: block; }
/* while a gamepad is the one being played with (main.js usePad), its own words and buttons in
   place of the keys' (and the pads' on a touch screen); the keys' again from a key or the mouse */
html:not(.gamepad) .pad-only,
.gamepad .key-only,
.gamepad .touch-only { display: none !important; }
/* before the script has laid the page out (seconds, on a slow connection): a touch screen already
   shows its own words, and an upright phone keeps the picture's place at the top, so nothing jumps
   when the mountain is ready (compat.js lays an upright phone's title out exactly as main.js will,
   html.portrait; this is the near enough place if it can't) */
@media (pointer: coarse) {
  html:not(.laid) .key-only { display: none !important; }
  html:not(.laid) .touch-only { display: block; }
}
@media (pointer: coarse) and (orientation: portrait) {
  html:not(.laid):not(.portrait) #start { padding-top: calc(max(10px, env(safe-area-inset-top)) + 51px + 56.25vw + 14px); }
}

@media (max-width: 700px) {
  .panel { padding-top: max(72px, calc(env(safe-area-inset-top) + 60px)); }
  .menu a, .menu button { font-size: 28px; }
  .panel-in { margin-left: 0; }
  .panel { --colr: calc(16px + min(34em, 100vw - 32px)); }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ---- older browsers: Safari before 14.1 has no `inset` ---- */
@supports not (inset: 0) {
  .stage, .hud, .pads, .panel { top: 0; right: 0; bottom: 0; left: 0; }
}
