/*! Good Enough Racing Simulator. Copyright (c) 2026 CoRemote OÜ (Estonia, registry code 17085354). All rights reserved. Copying, modifying, reverse engineering or redistributing this code or its assets without written permission is not permitted. */
:root {
  --panel: rgba(18, 20, 24, 0.78);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f1f1ee;
  --dim: rgba(241, 241, 238, 0.66);
  --accent: #e8432e;
  --pick: #1b8fdb;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0c0f; color: var(--text); font: 13px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif; user-select: none; -webkit-user-select: none; }
#game { position: fixed; inset: 0; }
#game canvas { width: 100%; height: 100%; }
[hidden] { display: none !important; }

.ui { position: fixed; inset: 0; pointer-events: none; }
.ui > * { pointer-events: auto; }
.bar { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; pointer-events: none; }
.bar > * { pointer-events: auto; }
.spacer { flex: 1; pointer-events: none !important; }

button { font: inherit; font-weight: 600; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 8px 13px; cursor: pointer; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
button:hover { background: rgba(40, 44, 52, 0.9); }
button:active { transform: translateY(1px); }
button[disabled] { opacity: 0.4; cursor: default; }
button.primary { background: var(--accent); border-color: transparent; padding: 9px 20px; font-size: 14px; }
button.primary:hover { background: #f25540; }
.seg { display: flex; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 9px 0 0 9px; margin-left: 0; }
.seg button:last-child { border-radius: 0 9px 9px 0; }
.seg button.on { background: var(--text); color: #16181c; border-color: var(--text); }
.field { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 6px 12px; font-weight: 600; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.field input { width: 96px; accent-color: var(--text); }
.field span { min-width: 34px; color: var(--dim); font-variant-numeric: tabular-nums; }

/* the editor (src/editor.js), in the menu's language: flat dark blocks with square corners, condensed capitals, the
   chosen tool in paper white, blue for go. Sentences (the hint, warnings) stay in the plain typeface. */
#ui-edit { --glass: rgba(10, 11, 14, 0.82); --paper: #f3f3f0; --ink: #111317; --blue: #1b8fdb; --rule: rgba(255, 255, 255, 0.14); --cond: "Avenir Next Condensed", "DIN Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", sans-serif; }
.edit-top { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 9px; pointer-events: none !important; }
.edit-top > * { pointer-events: auto; }
#ui-edit .bar { position: static; align-self: stretch; gap: 6px; pointer-events: none; }
#ui-edit button, #ui-edit .field, #h-info { font: 600 13px/1 var(--cond); text-transform: uppercase; letter-spacing: 0.05em; }
#ui-edit button { height: 30px; padding: 1px 13px 0; color: var(--paper); background: var(--glass); border: 0; border-radius: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
#ui-edit button:hover { background: rgba(40, 43, 50, 0.92); }
#ui-edit button:active { transform: none; background: rgba(58, 62, 70, 0.92); }
#ui-edit button[disabled], #ui-edit button[disabled]:hover { opacity: 1; color: rgba(243, 243, 240, 0.3); background: var(--glass); }
#ui-edit .seg button { margin-left: 0; border-radius: 0; }
#ui-edit .seg button + button { border-left: 1px solid var(--rule); }
#ui-edit .seg button.on, #ui-edit .seg button.on:hover { position: relative; background: var(--paper); color: var(--ink); border-left-color: transparent; }
#ui-edit .seg button.on::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -5px; border: 5px solid transparent; border-top-color: var(--paper); }
#ui-edit button.primary { padding: 1px 18px 0; font-weight: 700; background: var(--blue); }
#ui-edit button.primary:hover { background: #2ba2f0; }
#ui-edit button.primary[disabled], #ui-edit button.primary[disabled]:hover { background: var(--glass); }
#ui-edit .field { height: 30px; gap: 10px; padding: 1px 12px 0; color: var(--paper); background: var(--glass); border: 0; border-radius: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
#ui-edit .field span { min-width: 30px; color: rgba(243, 243, 240, 0.7); }
#ui-edit .field input { -webkit-appearance: none; appearance: none; width: 84px; height: 14px; margin: 0; background: transparent; cursor: pointer; }
#ui-edit .field input::-webkit-slider-runnable-track { height: 2px; background: rgba(255, 255, 255, 0.3); }
#ui-edit .field input::-webkit-slider-thumb { -webkit-appearance: none; width: 4px; height: 14px; margin-top: -6px; background: var(--paper); border: 0; border-radius: 0; }
#ui-edit .field input::-moz-range-track { height: 2px; background: rgba(255, 255, 255, 0.3); }
#ui-edit .field input::-moz-range-thumb { width: 4px; height: 14px; background: var(--paper); border: 0; border-radius: 0; }

#hint { margin: 0 1px; max-width: min(620px, 100%); font-size: 12px; font-weight: 500; color: rgba(255, 255, 255, 0.94); text-shadow: 0 1px 5px rgba(0, 0, 0, 0.75), 0 0 2px rgba(0, 0, 0, 0.5); pointer-events: none; }
#height-panel { display: flex; align-items: center; flex-wrap: wrap; min-height: 30px; background: var(--glass); }
#height-panel button { background: none; border-left: 1px solid var(--rule); }
#h-info { padding: 1px 14px 0 12px; color: rgba(243, 243, 240, 0.78); font-variant-numeric: tabular-nums; }
.warn { color: #ff8a7a; }

#empty { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); font: 700 24px/1.1 var(--cond); text-transform: uppercase; letter-spacing: 0.04em; color: #fff; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.5); pointer-events: none; text-align: center; }
#flash, #banner { position: absolute; left: 50%; transform: translate(-50%, 8px); background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 10px 16px; font-weight: 600; font-size: 14px; opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none; text-align: center; max-width: calc(100vw - 32px); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
#flash { bottom: 136px; background: var(--glass); border: 0; border-radius: 0; padding: 8px 14px; font-size: 13px; backdrop-filter: none; -webkit-backdrop-filter: none; }
/* driving: what the game says (a lap time, the start's count, Go) as a block of the HUD, between its top corners */
#banner { top: calc(var(--hud) * 3.4); --hud: clamp(9px, min(1.05vw, 1.75vh), 19px); font: 700 calc(var(--hud) * 1.85)/1 "Avenir Next Condensed", "DIN Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", sans-serif; text-transform: uppercase; letter-spacing: 0.03em; font-variant-numeric: tabular-nums; white-space: pre; padding: 0.42em 0.8em 0.34em; background: rgba(20, 23, 28, 0.82); color: #f3f3f0; border: 0; border-radius: 0; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: 0 0.15em 0.9em rgba(0, 0, 0, 0.25); }
#banner.count, #banner.go { font-size: calc(var(--hud) * 5.2); min-width: 1.5em; padding: 0.16em 0.3em 0.1em; transition: opacity 0.12s; }
#banner.go { background: #f3f3f0; color: #14171c; }
#flash.show, #banner.show { opacity: 1; transform: translate(-50%, 0); }

#points, #badges { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.dot { position: absolute; left: -8px; top: -8px; width: 16px; height: 16px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5); cursor: grab; pointer-events: auto; touch-action: none; }
.dot:hover, .dot.on { background: var(--pick); }
/* a circuit drawn in pieces: its points, and the blue dots at its open ends (the canvas finds them, so pointer-blind) */
.dot.piece { pointer-events: none; cursor: default; }
.dot.piece.mid { left: -5px; top: -5px; width: 10px; height: 10px; }
.dot.piece.end { background: var(--pick); border-color: var(--paper); }
.dot.piece.end.pick { outline: 2px solid var(--paper); outline-offset: 3px; }
.dot.piece.end.near { left: -10px; top: -10px; width: 20px; height: 20px; background: #2ba2f0; outline: 2px solid var(--paper); outline-offset: 3px; }
#reach { position: absolute; left: 0; top: 0; height: 0; border-top: 1.5px dashed rgba(255, 255, 255, 0.85); transform-origin: 0 0; pointer-events: none; }
.badge { position: absolute; left: 0; top: 0; margin: -32px 0 0 -110px; width: 220px; text-align: center; background: #c2341f; padding: 5px 8px; font-weight: 600; font-size: 12px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }
#sel-label { position: absolute; left: 0; top: 0; margin: -32px 0 0 -60px; width: 120px; text-align: center; background: var(--paper); color: var(--ink); padding: 4px 8px 3px; font: 700 13px/1.2 var(--cond); letter-spacing: 0.04em; text-transform: uppercase; font-variant-numeric: tabular-nums; pointer-events: none; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); }

#scale { position: absolute; left: 13px; bottom: 124px; pointer-events: none; }
#scale span { display: block; border: 1px solid #fff; border-top: 0; height: 6px; color: #fff; font: 700 11px/0 var(--cond); letter-spacing: 0.06em; text-transform: uppercase; text-align: center; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8); }
#profile-wrap { position: absolute; left: 12px; right: 12px; bottom: 12px; height: 100px; background: var(--glass); }
#profile { width: 100%; height: 100%; display: block; touch-action: none; }

/* driving: the HUD (src/hud.js). Every size is in em of #hud's font size, which follows the window. Its boxes are
   see-through dark glass with white writing, a thin blue edge on the side each faces; the map and the gauge glow */
#hud { position: absolute; inset: 0; pointer-events: none; font-size: clamp(9px, min(1.05vw, 1.75vh), 19px); font-family: "Avenir Next Condensed", "DIN Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", sans-serif; --ink: #14171c; --paper: #f3f3f0; --glass: rgba(10, 11, 14, 0.5); --blue: #3fb4ff; }
.hud-corner { position: absolute; top: 3.4em; display: flex; flex-direction: column; gap: 0.35em; }
.hud-corner.left { left: 3.6em; align-items: flex-start; }
.hud-corner.right { right: 3.6em; align-items: flex-end; }
/* the drive view's menu: a glass square in the corner, and the list it opens (rows as in the main menu's tables) */
#pmenu { position: relative; pointer-events: auto; margin-bottom: 0.2em; }
#pmenu-btn { all: unset; cursor: pointer; display: grid; place-items: center; width: 2.8em; height: 2.8em; border-radius: 0.3em; background: var(--glass); color: #fff; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 0.15em 0.9em rgba(0, 0, 0, 0.2); }
#pmenu-btn svg { width: 1.55em; height: 1.55em; }
#pmenu-btn:hover { background: rgba(40, 44, 52, 0.7); }
#pmenu.open #pmenu-btn { background: #1b8fdb; color: #fff; }
#pmenu-list { position: absolute; left: 0; top: calc(100% + 0.35em); z-index: 6; width: 17.5em; padding-top: 0.18em; background: rgba(8, 9, 12, 0.92); color: var(--paper); box-shadow: 0 0.4em 1.8em rgba(0, 0, 0, 0.45); }
#pmenu-list button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 0.7em; width: 100%; min-height: 2.5em; padding: 0.1em 0.8em 0 0.9em; margin-bottom: 0.18em; background: rgba(255, 255, 255, 0.07); }
#pmenu-list button:hover { background: #1b8fdb; }
#pmenu-list .name { flex: 1; font-size: 1.3em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
#pmenu-list b { font-size: 1.3em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: #f5c84a; }
#pmenu-list button:hover b { color: #fff; }
#pmenu-list kbd { font: inherit; font-size: 0.95em; font-weight: 700; min-width: 1.5em; text-align: center; border: 0.12em solid currentColor; border-radius: 0.2em; padding: 0.1em 0.35em 0; line-height: 1.25; opacity: 0.6; }
.duo { display: flex; border-radius: 0.3em; overflow: hidden; box-shadow: 0 0.15em 0.9em rgba(0, 0, 0, 0.2); }
.cell { padding: 0.35em 0.55em 0.3em; display: flex; flex-direction: column; min-width: 3.3em; }
.duo .cell + .cell { border-left: 1px solid rgba(255, 255, 255, 0.12); }
.cell small, .line small { font-size: 0.82em; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; line-height: 1; color: rgba(255, 255, 255, 0.78); }
.cell b { font-size: 2.3em; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; margin-top: 0.08em; color: #fff; }
#hud .light, #hud .dark { background: var(--glass); color: #fff; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.hud-corner.left .duo { border-left: 0.2em solid var(--blue); }
.hud-corner.right .duo, .line { border-right: 0.2em solid var(--blue); }
.line { padding: 0.4em 0.55em 0.3em; display: flex; flex-direction: column; align-items: flex-end; min-width: 8.6em; border-radius: 0.3em; overflow: hidden; box-shadow: 0 0.15em 0.9em rgba(0, 0, 0, 0.2); }
#hud-fps { display: flex; flex-direction: column; border-radius: 0.3em; overflow: hidden; background: var(--glass); color: #fff; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 0.15em 0.9em rgba(0, 0, 0, 0.2); }
#hud-fps div { display: flex; align-items: baseline; gap: 0.7em; padding: 0.22em 0.55em 0.16em; border-left: 0.3em solid var(--paint, transparent); }
#hud-fps small { flex: 1; font-size: 0.95em; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; max-width: 8em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0.85; }
#hud-fps b { font-size: 1.25em; font-weight: 700; font-variant-numeric: tabular-nums; }
#hud-fps b.slow { color: #ffb24d; }
#hud-fps b.bad { color: #ff6a5a; }
.line b { font-size: 1.85em; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; color: #fff; }
/* the gap to the ghost car: red behind it, green ahead */
#hud-ghost-line[hidden] { display: none; }
#hud-ghost-line b { color: #ff6a5c; }
#hud-ghost-line.ahead b { color: #3ddc84; }
#hud-map { position: absolute; left: 3.6em; bottom: 3em; width: 14.5em; height: 14.5em; }
#hud-tach { position: absolute; right: 3.2em; bottom: 2.6em; width: 15.5em; height: 15.5em; }
/* an endless drive: no laps or lap times; the distance in an LCD box over the map, the seed glowing under it */
#hud.endless .lapped { display: none; }
#hud-km { position: absolute; left: 6.4em; bottom: 17.75em; width: 8.9em; height: 2.9em; display: none; }
#hud-seed { position: absolute; left: 3.6em; width: 14.5em; bottom: 1.35em; display: none; justify-content: center; }
#hud.endless #hud-km { display: block; }
#hud.endless #hud-seed { display: flex; }
#hud-seed span { display: inline-flex; align-items: center; gap: 0.5em; font-size: 0.95em; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: #d6ecff; text-shadow: 0 0 0.5em rgba(120, 190, 255, 0.9), 0 0.05em 0.3em rgba(0, 0, 0, 0.6); }
#hud-seed i { width: 0.55em; height: 0.55em; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0.6em rgb(30, 140, 255); }
#hud-seed b { font-weight: inherit; }
#keys { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); color: #fff; font: 600 13px/1 "Avenir Next Condensed", "DIN Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", sans-serif; text-transform: uppercase; letter-spacing: 0.06em; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.75); white-space: nowrap; pointer-events: none; animation: keys-out 1s ease 9s forwards; }
@keyframes keys-out { to { opacity: 0; } }

/* the main menu (src/menu.js): every size in em of #ui-menu's font size, which follows the window */
#ui-menu { font-size: clamp(7.5px, min(0.84vw, 1.5vh), 18px); font-family: "Avenir Next Condensed", "DIN Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", sans-serif; color: #f3f3f0; --blue: #1b8fdb; --ink: #111317; }
#ui-menu > * { pointer-events: auto; }
.menu-shade { position: absolute; inset: 0; pointer-events: none !important; background: linear-gradient(90deg, rgba(8, 10, 13, 0.62) 0%, rgba(8, 10, 13, 0.34) 46%, rgba(8, 10, 13, 0) 72%), linear-gradient(0deg, rgba(8, 10, 13, 0.45), rgba(8, 10, 13, 0) 30%); }
.menu-top { position: absolute; left: 50%; top: 5.2em; transform: translateX(-50%); display: flex; align-items: center; gap: 0.9em; pointer-events: none !important; }
.menu-logo { width: 4.4em; height: 4.4em; background: #f3f3f0; color: var(--ink); display: grid; place-items: center; }
.menu-logo svg { width: 3.3em; height: 3.3em; }
.menu-id { display: flex; flex-direction: column; text-shadow: 0 0.1em 0.5em rgba(0, 0, 0, 0.6); }
.menu-id b { font-size: 2.1em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; line-height: 1; color: #f5c84a; }
.menu-id span { font-size: 1.45em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
/* the game's logo (assets/brand/logo.png: Good Enough Racing Simulator, see-through), where its name was */
.brand-logo { display: block; height: 4.6em; width: auto; filter: drop-shadow(0 0.1em 0.5em rgba(0, 0, 0, 0.45)); }
.loader .brand-logo { height: 7.5em; }
.menu-tabs { position: absolute; left: 4.5em; top: 12.4em; display: flex; align-items: stretch; background: rgba(10, 11, 14, 0.82); }
.menu-tabs button { all: unset; cursor: pointer; position: relative; min-width: 9.4em; padding: 0.55em 1.4em 0.5em; text-align: center; font-size: 1.55em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; border-right: 1px solid rgba(255, 255, 255, 0.14); }
.menu-tabs button:hover { background: rgba(255, 255, 255, 0.1); }
.menu-tabs button.on { background: #f3f3f0; color: var(--ink); }
.menu-tabs button.on::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -0.45em; border: 0.45em solid transparent; border-top-color: #f3f3f0; }
.menu-tabs kbd { align-self: center; margin: 0 1.1em; }
#ui-menu kbd { font: inherit; font-size: 1.15em; font-weight: 700; border: 0.12em solid currentColor; border-radius: 0.2em; padding: 0.05em 0.42em 0; line-height: 1.25; }
.menu-page { position: absolute; left: 4.5em; top: 17.6em; }
.tiles { display: grid; grid-template-columns: repeat(2, 34.5em); gap: 0.75em; }
.tile { all: unset; cursor: pointer; position: relative; height: 16.8em; overflow: hidden; outline: 0.1em solid rgba(255, 255, 255, 0.75); outline-offset: -0.1em; background: #1a1d22; transition: transform 0.12s ease; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(8, 10, 13, 0.55) 0%, rgba(8, 10, 13, 0) 42%); }
.tile span { position: absolute; left: 0.45em; top: 0.25em; z-index: 1; font-size: 2.45em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; text-shadow: 0 0.06em 0.35em rgba(0, 0, 0, 0.75); }
.tile.on { transform: scale(1.045); z-index: 2; outline: 0.5em solid var(--blue); outline-offset: 0; box-shadow: 0 0.6em 2.4em rgba(0, 0, 0, 0.5); }
/* the action cam and the endless drive (a test): plain bars under the tiles */
.endless-btn { all: unset; cursor: pointer; padding: 0.7em 1em; background: rgba(14, 16, 20, 0.72); outline: 0.1em solid rgba(255, 255, 255, 0.6); outline-offset: -0.1em; font-size: 1.5em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.endless-btn small { font-size: 0.6em; font-weight: 600; opacity: 0.7; margin-left: 0.6em; }
.endless-btn:hover, .endless-btn:focus-visible { outline: 0.25em solid var(--blue); }
.menu-panel { width: 70em; background: rgba(8, 9, 12, 0.9); padding-bottom: 1.2em; }
.menu-panel h2 { margin: 0; padding: 0.7em 0.9em 0.6em; font-size: 2.3em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; display: flex; align-items: center; gap: 0.55em; }
.menu-panel h2 i { font-style: normal; width: 1.5em; height: 1.5em; display: grid; place-items: center; background: #f3f3f0; color: var(--ink); font-size: 0.8em; }
.table { position: relative; }
.table .row { display: grid; grid-template-columns: 1fr 1fr; align-items: center; min-height: 3.05em; margin-bottom: 0.18em; background: rgba(255, 255, 255, 0.07); cursor: default; }
.table .row .name { padding-left: 1.2em; font-size: 1.5em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.table .row .value { display: flex; align-items: center; height: 100%; background: rgba(255, 255, 255, 0.07); clip-path: polygon(0.9em 0, 100% 0, 100% 100%, 0.9em 100%, 0 50%); padding-left: 1.6em; }
.table .row .value b { flex: 1; font-size: 1.5em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.table .row.cap { background: #f3f3f0; color: var(--ink); }
.table .row.cap .value { background: none; clip-path: none; }
.table .row.head { background: none; min-height: 2.5em; margin-top: 0.5em; }
.table .row.head .name { color: #f5c84a; font-size: 1.25em; }
.table .row.head .value { background: none; clip-path: none; }
#menu-options .row { cursor: pointer; }
#menu-options .row.on { background: var(--blue); }
#menu-options .row.on .value { background: rgba(255, 255, 255, 0.1); }
.arrow { all: unset; cursor: pointer; font-size: 2.2em; line-height: 1; padding: 0 0.5em; opacity: 0; }
#menu-options .row.on .arrow { opacity: 1; }
.arrow:hover { color: #f5c84a; }
#menu-help { position: absolute; left: calc(100% + 1.2em); width: 19em; background: #f3f3f0; color: var(--ink); padding: 0.7em 0.9em; font-size: 1.25em; font-weight: 600; line-height: 1.3; }
#menu-help::before { content: ""; position: absolute; right: 100%; top: 0.9em; border: 0.6em solid transparent; border-right-color: #f3f3f0; }
#menu-controls .row { min-height: 2.5em; }
/* the Options and Controls lists scroll inside their panel when the window is too short for them (wheel, trackpad,
   the arrow keys); the panel's heading and the Setting/Choice row stay */
#menu-options, #menu-controls { max-height: calc(100vh - 34em); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(243, 243, 240, 0.45) transparent; }
#menu-options::-webkit-scrollbar, #menu-controls::-webkit-scrollbar { width: 0.5em; }
#menu-options::-webkit-scrollbar-thumb, #menu-controls::-webkit-scrollbar-thumb { background: rgba(243, 243, 240, 0.45); }
/* faded away while the action cam is put on the car (src/placing.js) */
#ui-menu { transition: opacity 0.35s ease; }
#ui-menu.away { opacity: 0; }
#ui-menu.away > * { pointer-events: none !important; }
.menu-keys { position: absolute; right: 4.5em; bottom: 3.2em; display: flex; gap: 2.4em; font-size: 1.2em; font-weight: 600; text-shadow: 0 0.08em 0.4em rgba(0, 0, 0, 0.7); pointer-events: none !important; }
.menu-keys span { display: flex; align-items: center; gap: 0.5em; }
/* putting the action cam on the car (src/placing.js): the menu's look, its sizes in em of the same font size */
#ui-place { font-size: clamp(7.5px, min(0.84vw, 1.5vh), 18px); font-family: "Avenir Next Condensed", "DIN Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", sans-serif; color: #f3f3f0; --blue: #1b8fdb; --ink: #111317; opacity: 0; transition: opacity 0.35s ease; }
#ui-place.in { opacity: 1; }
#ui-place kbd { font: inherit; font-size: 1.15em; font-weight: 700; border: 0.12em solid currentColor; border-radius: 0.2em; padding: 0.05em 0.42em 0; line-height: 1.25; }
.place-top { position: absolute; left: 4.5em; top: 4.2em; display: flex; align-items: center; gap: 0.9em; pointer-events: none !important; }
.place-side { position: absolute; right: 4.5em; top: 4.2em; width: 38.8em; }
.place-head { display: flex; justify-content: space-between; background: #f3f3f0; color: var(--ink); padding: 0.55em 0.9em 0.45em; font-size: 1.35em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.place-head .hint { font-weight: 600; opacity: 0.55; }
.place-shot { aspect-ratio: 16 / 9; cursor: grab; touch-action: none; outline: 0.1em solid rgba(255, 255, 255, 0.6); outline-offset: -0.1em; }
.place-shot.held { cursor: grabbing; }
#place-table { margin-top: 0.8em; background: rgba(8, 9, 12, 0.9); padding: 0 0 0.2em; }
#place-table .row { margin-bottom: 0; border-top: 0.07em solid rgba(255, 255, 255, 0.06); }
#place-table .row.cap { border-top: 0; }
#place-rows .row { cursor: pointer; }
#place-rows .row.on { background: var(--blue); }
#place-rows .row.on .value { background: rgba(255, 255, 255, 0.1); }
#place-rows .row.on .arrow { opacity: 1; }
.place-go { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75em; margin-top: 0.8em; }
.place-go button { all: unset; cursor: pointer; text-align: center; padding: 0.62em 1em 0.52em; font-size: 1.6em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; background: rgba(14, 16, 20, 0.85); outline: 0.1em solid rgba(255, 255, 255, 0.6); outline-offset: -0.1em; }
.place-go button.done { background: #f3f3f0; color: var(--ink); outline: 0; }
.place-go button:hover, .place-go button:focus-visible { outline: 0.25em solid var(--blue); outline-offset: -0.1em; }
.place-views { position: absolute; left: 4.5em; bottom: 3.2em; display: flex; align-items: stretch; background: rgba(10, 11, 14, 0.82); }
.place-views kbd { align-self: center; margin: 0 0.9em; }
.place-views button { all: unset; cursor: pointer; padding: 0.55em 1.4em 0.5em; font-size: 1.45em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.place-views button:hover { background: rgba(255, 255, 255, 0.1); }
.place-views button.on { background: #f3f3f0; color: var(--ink); }
@media (max-width: 760px) { .place-side { left: 2.4em; right: 2.4em; width: auto; } .place-top { display: none; } }

/* the lobby (src/lobby.js) */
.lobby { padding-bottom: 1.6em; }
.lobby button { font: inherit; font-size: 1.35em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: #f3f3f0; background: rgba(255, 255, 255, 0.1); border: 0; border-radius: 0; padding: 0.55em 1.1em; cursor: pointer; backdrop-filter: none; -webkit-backdrop-filter: none; }
.lobby button:hover { background: rgba(255, 255, 255, 0.2); }
.lobby button.go { background: var(--blue); }
.lobby button.go:hover { background: #2ba2f0; }
.lobby input { font: inherit; font-size: 1.5em; font-weight: 600; color: #f3f3f0; background: rgba(255, 255, 255, 0.08); border: 0.12em solid rgba(255, 255, 255, 0.25); padding: 0.4em 0.6em; outline: none; user-select: text; -webkit-user-select: text; min-width: 0; }
.lobby input:focus { border-color: var(--blue); }
.lobby-field { display: flex; align-items: center; gap: 1.2em; padding: 0.4em 1.8em 1.2em; }
.lobby-field span { font-size: 1.5em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.lobby-field input { width: 16em; }
.lobby-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.3em; }
.lobby-card { background: rgba(255, 255, 255, 0.07); padding: 1.4em 1.8em 1.6em; }
.lobby-card h3 { margin: 0; font-size: 2em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.lobby-card p, #lobby-hint { margin: 0.5em 0 1.1em; font-size: 1.3em; font-weight: 500; line-height: 1.35; opacity: 0.85; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.lobby-join { display: flex; gap: 0.4em; }
#lobby-code { width: 6.2em; text-transform: uppercase; letter-spacing: 0.25em; text-align: center; font-weight: 700; }
#lobby-error { min-height: 1.4em; margin: 0.9em 1.8em 0; font-size: 1.3em; font-weight: 600; color: #ff8a7a; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.lobby-top { display: flex; align-items: center; justify-content: space-between; padding: 0 1.8em 1.2em; }
.lobby-code { display: flex; align-items: baseline; gap: 1em; }
.lobby-code small { font-size: 1.4em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.8; }
.lobby-code b { font-size: 4.2em; font-weight: 700; letter-spacing: 0.18em; line-height: 1; color: #f5c84a; user-select: text; -webkit-user-select: text; }
#lobby-players .value i { width: 1.1em; height: 1.1em; border-radius: 50%; margin-right: 0.7em; flex: none; box-shadow: 0 0 0 0.15em rgba(0, 0, 0, 0.35); }
.lobby-set { display: flex; align-items: center; gap: 0.7em; padding: 1em 1.8em 0; }
.lobby-set span { font-size: 1.5em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.lobby-set b { font-size: 2em; font-weight: 700; min-width: 1.6em; text-align: center; }
.lobby-set button { padding: 0.15em 0.6em 0.25em; font-size: 1.8em; }
#lobby-circuit { margin-left: auto; opacity: 0.8; }
#lobby-hint { margin: 1em 1.8em 0; }
.lobby-actions { display: flex; align-items: center; gap: 1em; padding: 1.2em 1.8em 0; }
.lobby-actions #lobby-leave { margin-left: auto; }
#lobby-start { font-size: 1.7em; padding: 0.55em 1.6em; }
#lobby-wait { font-size: 1.5em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: #f5c84a; }
/* in a race: the other drivers' names over their cars, and the finishing order */
#voice { position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 7px; pointer-events: none; z-index: 5; }
#voice-btn { pointer-events: auto; padding: 6px 14px 6px 12px; font-size: 12px; border-radius: 999px; background: rgba(18, 20, 24, 0.6); touch-action: none; }
#voice-btn::before { content: "🎙"; margin-right: 6px; }
#voice-btn:active { transform: none; }
#voice-btn[data-state="live"] { background: #1f9d55; border-color: transparent; box-shadow: 0 0 0 4px rgba(31, 157, 85, 0.3); }
#voice-btn[data-state="blocked"], #voice-btn[data-state="unavailable"] { background: rgba(120, 30, 24, 0.8); }
#voice-who { padding: 4px 12px; font-weight: 700; font-size: 13px; color: #fff; background: rgba(14, 16, 20, 0.72); border-radius: 999px; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
.tag.talking::after { content: " 🔊"; }
#tags { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.tag { position: absolute; left: 0; top: 0; padding: 2px 8px 2px 7px; font: 700 12px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif; color: #fff; background: rgba(14, 16, 20, 0.72); border-left: 4px solid var(--paint, #fff); white-space: nowrap; pointer-events: none; }
#results { position: absolute; left: 50%; top: 150px; transform: translateX(-50%); min-width: 300px; background: rgba(14, 16, 20, 0.82); font-family: "Avenir Next Condensed", "DIN Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", sans-serif; pointer-events: none; }
#results .row { display: grid; grid-template-columns: 3em 1fr auto; gap: 14px; padding: 7px 14px; font-size: 19px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; font-variant-numeric: tabular-nums; border-top: 1px solid rgba(255, 255, 255, 0.1); }
#results .row.me { background: #f3f3f0; color: #14171c; }

/* a window taller than it is wide: one tile to a row, the panels as wide as the window */
@media (max-aspect-ratio: 1/1) {
  #ui-menu { font-size: clamp(8px, 1.45vw, 16px); }
  .menu-tabs, .menu-page { left: 2.4em; }
  .menu-tabs { right: 2.4em; }
  .menu-tabs button { min-width: 0; flex: 1; padding-left: 0.4em; padding-right: 0.4em; }
  .menu-tabs kbd { margin: 0 0.7em; }
  .menu-top { left: 2.4em; transform: none; }
  .tiles { grid-template-columns: 34.5em; }
  .lobby-two { grid-template-columns: 1fr; }
  .lobby-field input { width: auto; flex: 1; }
  .tile { height: 13em; }
  .menu-panel { width: calc(100vw - 4.8em); }
  #menu-help { position: static; width: auto; margin: 0.6em 0 0; }
  #menu-options { max-height: calc(100vh - 40em); }   /* (the help sits under the list here) */
  #menu-help::before { display: none; }
  .menu-keys { right: 2.4em; gap: 1.4em; }
}

/* the loading screens (index.html: #boot before the game opens, src/boot.js; #loading before a drive), in the menu's
   look: its cover picture darkened, its logo and gold name, a white bar on dark glass, its condensed capitals */
.loader { position: fixed; inset: 0; z-index: 1000; overflow: hidden; background: #0b0c0f; color: #f3f3f0; --ink: #111317; font-size: clamp(7.5px, min(0.84vw, 1.5vh), 18px); font-family: "Avenir Next Condensed", "DIN Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", sans-serif; transition: opacity 0.6s ease; }
.loader.out { opacity: 0; pointer-events: none; }
.loader-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.loader-shade { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(8, 10, 13, 0.9) 0%, rgba(8, 10, 13, 0.4) 34%, rgba(8, 10, 13, 0.12) 62%, rgba(8, 10, 13, 0.55) 100%); }
.loader-bar { position: absolute; left: 4.5em; right: 4.5em; bottom: 5.2em; }
.loader-line { display: flex; justify-content: space-between; align-items: baseline; gap: 2em; margin-bottom: 0.6em; font-size: 1.55em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; font-variant-numeric: tabular-nums; text-shadow: 0 0.08em 0.4em rgba(0, 0, 0, 0.7); }
.loader-track { position: relative; height: 0.8em; background: rgba(10, 11, 14, 0.82); overflow: hidden; }
.loader-track i { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--p, 0) * 100%); background: #f3f3f0; transition: width 0.25s ease-out; }
/* busy: no amount known yet (the page before its script has arrived, the drive's own loading). Moved by transform, so
   it keeps moving while the page is busy making the drive's graphics programs (the browser animates it by itself) */
.loader-bar.busy .loader-track i { width: 28%; animation: loader-busy 1.1s ease-in-out infinite; will-change: transform; }
@keyframes loader-busy { from { transform: translateX(-100%); } to { transform: translateX(357%); } }
.loader-start { position: absolute; left: 0; right: 0; bottom: 4.8em; text-align: center; font-size: 2.3em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; text-shadow: 0 0.08em 0.45em rgba(0, 0, 0, 0.8); cursor: pointer; animation: loader-pulse 1.6s ease-in-out infinite; }
.loader-start kbd { font: inherit; border: 0.1em solid currentColor; border-radius: 0.15em; padding: 0.02em 0.38em 0; margin: 0 0.2em; }
@keyframes loader-pulse { 50% { opacity: 0.55; } }
/* whose game it is, small, under the bar */
.loader-legal { position: absolute; left: 4.5em; bottom: 2.2em; font-size: 1.05em; font-weight: 600; letter-spacing: 0.03em; color: rgba(243, 243, 240, 0.55); }

/* a narrow window */
@media (max-width: 900px) {
  #banner { top: 150px; }
  #results { top: 215px; min-width: 260px; }
  #keys { display: none; }
  .hud-corner.left, #hud-map, #hud-seed { left: 1.4em; }
  #hud-km { left: 4.2em; }
  .hud-corner.right { right: 1.4em; }
  #hud-tach { right: 1.2em; }
}
