:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #f1e9da;
  background: #182427;
  --ink: #f1e9da;
  --muted: #a5b1ac;
  --accent: #f0a468;
  --surface: rgba(19, 30, 33, .93);
  --line: rgba(204, 218, 208, .19);
  --edge: clamp(14px, 2.65vw, 42px);
  --edge-top: max(var(--edge), env(safe-area-inset-top));
  --edge-bottom: max(var(--edge), env(safe-area-inset-bottom));
  --edge-left: max(var(--edge), env(safe-area-inset-left));
  --edge-right: max(var(--edge), env(safe-area-inset-right));
}

*, *::before, *::after { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }

body { overscroll-behavior: none; }

button, input, kbd, select { font: inherit; }

button {
  color: inherit;
  cursor: pointer;
  border: 0;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

html:not([data-version="advanced"]) [data-advanced-only],
html[data-version="advanced"] [data-base-only] { display: none; }

.multiplayer-status {
  position: absolute;
  z-index: 3;
  top: var(--edge-top);
  right: var(--edge-right);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: .8rem;
  backdrop-filter: blur(12px);
  pointer-events: none;
}
.multiplayer-indicator { width: 8px; height: 8px; flex: none; border-radius: 50%; background: #d6a05f; box-shadow: 0 0 10px currentColor; }
.multiplayer-status.is-online { color: var(--ink); }
.multiplayer-status.is-online .multiplayer-indicator { background: #77d49a; }
.multiplayer-status.is-offline .multiplayer-indicator { background: #e47a6c; }

.activity-hint {
  position: absolute;
  z-index: 3;
  top: calc(var(--edge-top) + 8px);
  left: 50%;
  max-width: min(38vw, 470px);
  padding: 8px 12px;
  color: var(--muted);
  font-size: .78rem;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.game {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  user-select: none;
}

.game-canvas, .vignette {
  position: absolute;
  display: block;
  inset: 0;
  width: 100%;
  height: 100%;
}

.game-canvas { touch-action: none; }
.game-canvas.is-foot-mode { cursor: crosshair; }

.satellite-world {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}
.satellite-world.is-active { visibility: visible; }
.game-canvas { z-index: 1; }
.vignette { z-index: 2; }
.game-heading, .navigation, .driving-tools, .dashboard, .touch-controls, .ferry-prompt { z-index: 3; }

.vignette {
  pointer-events: none;
  background:
    radial-gradient(ellipse at 0 0, rgba(11, 21, 24, .78), transparent 45%),
    linear-gradient(to top, rgba(11, 19, 22, .55), transparent 23%);
}

.game-heading {
  position: absolute;
  top: var(--edge-top);
  left: var(--edge-left);
  max-width: calc(100% - var(--edge-left) - var(--edge-right));
  pointer-events: none;
  text-shadow: 0 2px 22px rgba(6, 14, 17, .85);
}

.game-mode {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: #ffbb85;
  font-size: .82rem;
  font-weight: 750;
  letter-spacing: .135em;
  text-transform: uppercase;
}

.mode-rule {
  flex: 0 0 24px;
  width: 24px;
  height: 2px;
  background: var(--accent);
}

.game-heading h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.9rem, 4.55vw, 5.1rem);
  font-weight: 400;
  letter-spacing: -.065em;
  line-height: .98;
}

.game-region {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 12px 0 0;
  color: #d3ded6;
  font-size: .875rem;
}

.game-region span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #d3ded6;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(6, 13, 15, .28);
}

.navigation {
  position: absolute;
  top: var(--edge-top);
  right: var(--edge-right);
  width: clamp(170px, 17.4vw, 252px);
  padding: 7px;
}

.mini-map-wrap, .overview-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 5px;
  background: #273b3a;
}

.mini-map-wrap { aspect-ratio: 1.61; }

#miniMap, #overviewCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.map-north {
  position: absolute;
  top: 8px;
  right: 9px;
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 4px 7px;
  border: 1px solid rgba(204, 218, 208, .16);
  border-radius: 4px;
  color: var(--ink);
  background: rgba(15, 26, 30, .88);
  font-size: .73rem;
  font-weight: 750;
  line-height: 1;
  pointer-events: none;
}

.map-north i {
  border-right: 4px solid transparent;
  border-bottom: 7px solid var(--accent);
  border-left: 4px solid transparent;
}

.map-open {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 6px 2px;
  min-height: 34px;
  border-radius: 4px;
  background: none;
  font-size: .86rem;
  font-weight: 650;
  white-space: nowrap;
  text-align: left;
}

.map-open:hover, .tool-button:hover { color: var(--accent); }

.map-open kbd { margin-left: auto; }

.map-attribution, .version-link {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  color: #bdc8c2;
  font-size: .75rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.map-attribution:hover { color: var(--accent); }
.map-attribution:focus-visible, .version-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.navigation-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0 6px;
  padding-inline: 3px;
}

.navigation-footer .map-attribution { margin-left: auto; }
.version-link { color: #ffc396; }
.version-link:hover { color: #ffe2c9; }

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid rgba(211, 225, 216, .21);
  border-radius: 4px;
  color: var(--ink);
  background: #2a3638;
  font-family: Consolas, "Courier New", monospace;
  font-size: .76rem;
  font-weight: 700;
  white-space: nowrap;
}

.map-icon {
  display: inline-block;
  flex: 0 0 14px;
  width: 14px;
  height: 12px;
  border: 1px solid currentColor;
  background: repeating-linear-gradient(to right, transparent 0 3px, currentColor 3px 4px);
  transform: skewY(-12deg);
}

.driving-tools {
  position: absolute;
  bottom: var(--edge-bottom);
  left: var(--edge-left);
  display: flex;
  align-items: end;
  gap: 7px;
}

.keyboard-guide {
  display: flex;
  gap: 13px;
  padding: 9px 11px;
}

.guide-item {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: .86rem;
  white-space: nowrap;
}

.guide-alternate { color: #a5b1ac; font-size: .75rem; }

.tool-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--ink);
  transition: color .15s ease, background .15s ease;
}

.tool-button:hover, .touch-button:hover { background: #283739; }

.settings-icon { font-size: 1.22rem; line-height: 1; }
.rescue-icon { display: grid; width: 20px; height: 20px; place-items: center; border: 1px solid currentColor; border-radius: 50%; color: #ffc396; font-size: 1.05rem; line-height: 1; }

.reset-icon {
  position: relative;
  width: 14px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  transform: rotate(-30deg);
}

.reset-icon::before {
  position: absolute;
  top: -2px;
  right: -1px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-4deg);
  content: "";
}

.sound-icon {
  position: relative;
  display: block;
  width: 17px;
  height: 16px;
}

.sound-icon i {
  position: absolute;
  inset: 2px auto 2px 0;
  width: 10px;
  background: currentColor;
  clip-path: polygon(0 33%, 42% 33%, 100% 0, 100% 100%, 42% 67%, 0 67%);
}

.sound-icon::before, .sound-icon::after {
  position: absolute;
  top: 7px;
  right: -1px;
  width: 7px;
  height: 1px;
  background: currentColor;
  content: "";
  transform: rotate(45deg);
}

.sound-icon::after { transform: rotate(-45deg); }

#soundButton[aria-pressed="true"] { color: var(--accent); }

#soundButton[aria-pressed="true"] .sound-icon::before {
  top: 3px;
  right: 0;
  width: 5px;
  height: 10px;
  border: 1px solid currentColor;
  border-right-width: 1.5px;
  border-left: 0;
  border-radius: 0 70% 70% 0;
  background: transparent;
  transform: none;
}

#soundButton[aria-pressed="true"] .sound-icon::after { display: none; }

.dashboard {
  position: absolute;
  right: var(--edge-right);
  bottom: var(--edge-bottom);
  width: clamp(218px, 19vw, 277px);
  padding: 13px 14px 12px;
  pointer-events: none;
}

.dashboard-top, .dashboard-middle, .map-dialog-header, .map-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dashboard-top { gap: 7px; }

.current-street {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #d2dbd4;
  font-size: .77rem;
}

#districtValue {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-icon {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border: 1.5px solid var(--accent);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
}

.car-name {
  flex: 0 0 auto;
  color: var(--accent);
  font-family: Consolas, "Courier New", monospace;
  font-size: .77rem;
  font-weight: 700;
  letter-spacing: .03em;
}

.dashboard-middle { margin: 4px 0 7px; }

.nitro-readout {
  display: grid;
  grid-template-columns: auto minmax(42px, 1fr) auto;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  color: #a8dce4;
  font: 700 .68rem Consolas, "Courier New", monospace;
}
.nitro-meter { height: 5px; overflow: hidden; border-radius: 3px; background: #425354; }
#nitroFill { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4ac9db, #b2f6ff); transition: width .1s linear; }
.nitro-readout.is-active #nitroFill { box-shadow: 0 0 10px #4ac9db; }
.nitro-readout.is-empty { color: #879394; }

.speed-readout {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

#speedValue {
  min-width: 1ch;
  font-size: 3.45rem;
  font-weight: 650;
  letter-spacing: -.075em;
  line-height: 1.03;
}

.speed-unit, .gear-readout > span:last-child {
  color: var(--muted);
  font-size: .76rem;
}

.gear-readout {
  display: grid;
  justify-items: end;
  gap: 1px;
}

#gearValue {
  color: var(--accent);
  font-family: Consolas, "Courier New", monospace;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
}

.speed-scale {
  position: relative;
  height: 5px;
  overflow: hidden;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, #435050 0 calc(7.14% - 2px), transparent calc(7.14% - 2px) 7.14%);
}

.speed-fill {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, var(--accent) 0 calc(7.14% - 2px), transparent calc(7.14% - 2px) 7.14%);
  clip-path: inset(0 calc(100% - var(--speed-progress, 0%)) 0 0);
}

.touch-controls { display: none; }

.ferry-prompt {
  position: absolute;
  bottom: calc(var(--edge-bottom) + 92px);
  left: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100% - var(--edge-left) - var(--edge-right));
  padding: 7px 8px 7px 12px;
  color: var(--ink);
  font-size: .88rem;
  transform: translateX(-50%);
}

.ferry-prompt[hidden] { display: none; }

.map-overlay {
  position: fixed;
  z-index: 4;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border: none;
  padding: var(--edge-top) var(--edge-right) var(--edge-bottom) var(--edge-left);
  color: var(--ink);
  background: rgba(7, 15, 18, .77);
}

.map-overlay::backdrop { background: transparent; }
.map-overlay[hidden] { display: none; }

.map-dialog {
  display: flex;
  flex-direction: column;
  width: min(100%, 1080px);
  height: min(calc(100dvh - var(--edge-top) - var(--edge-bottom)), 760px);
  padding: clamp(10px, 2vw, 21px);
  gap: 10px;
  overflow: hidden;
}

.map-dialog h2 {
  margin: 0;
  font: 400 clamp(1.45rem, 3vw, 2.5rem)/1 Georgia, "Times New Roman", serif;
  letter-spacing: -.04em;
}

.map-dialog-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .86rem;
}

#closeMapButton {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  font-size: 1.6rem;
}

.overview-wrap { flex: 1; min-height: 0; }

#overviewCanvas {
  touch-action: none;
  cursor: grab;
}

#overviewCanvas:active { cursor: grabbing; }

#overviewCanvas:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.map-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: 7px 12px;
}

.travel-controls { flex: 1 1 400px; min-width: 0; }

.travel-row {
  display: grid;
  grid-template-columns: auto minmax(0, 275px) auto;
  align-items: center;
  justify-content: start;
  gap: 8px;
}

.travel-row label {
  margin-right: 3px;
  color: var(--muted);
  font-size: .86rem;
}

.destination-picker {
  position: relative;
  min-width: 0;
}

.destination-picker::after {
  position: absolute;
  inset: 50% 13px auto auto;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-73%) rotate(45deg);
  pointer-events: none;
  content: "";
}

#destinationSelect {
  appearance: none;
  width: 100%;
  min-height: 42px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: #243232;
  font-size: .9rem;
  text-overflow: ellipsis;
}

.action-button {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  color: #1e2422;
  background: var(--accent);
  font-size: .86rem;
  font-weight: 700;
  white-space: nowrap;
}

.action-button:not(:disabled):hover { background: #ffc396; }

.action-button:disabled {
  opacity: .53;
  cursor: default;
}

.travel-status {
  margin: 5px 0 0;
  color: #ffbc8b;
  font-size: .83rem;
}

.travel-status:empty { margin: 0; }

.spawn-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-left: auto;
}

#spawnStatus {
  margin: 0;
  color: var(--muted);
  font-size: .84rem;
}

.settings-dialog {
  width: min(100%, 420px);
  max-height: 100%;
  padding: clamp(12px, 4vw, 22px);
  overflow: auto;
}

.settings-header, .setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.settings-header { margin-bottom: 5px; }

.settings-header h2 {
  margin: 0;
  font: 400 clamp(1.45rem, 5.2vw, 2rem)/1.05 Georgia, "Times New Roman", serif;
}

#closeSettingsButton { flex: 0 0 auto; font-size: 1.6rem; }

.settings-dialog > .setting-row, .setting-slider {
  padding-block: 12px;
  border-top: 1px solid var(--line);
}

.settings-dialog input { accent-color: var(--accent); cursor: pointer; }
.car-model-row { border-top: 1px solid var(--line); padding-block: 12px; }
#carModel { max-width: 64%; min-height: 38px; padding: 0 26px 0 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: #243232; font-size: .82rem; }

#carColor {
  width: 55px;
  height: 40px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #2a3638;
}

#trafficDensity {
  display: block;
  width: 100%;
  margin: 10px 0 0;
}

#trafficDensityValue { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.setting-toggle { cursor: pointer; }
.setting-label { display: grid; gap: 3px; }
.setting-label small { color: var(--muted); font-size: .79rem; }
#satelliteToggle { width: 20px; height: 20px; margin: 0 2px 0 0; }

.world-satellite-settings { padding-top: 8px; border-top: 1px solid var(--line); }
.world-satellite-settings .setting-row { padding-block: 8px; }
#worldSatelliteToggle { width: 20px; height: 20px; margin: 0 2px 0 0; }
#worldSatelliteKey {
  display: block;
  width: 100%;
  min-height: 40px;
  margin-top: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: #243232;
  font-size: .82rem;
}
.world-satellite-status { display: block; min-height: 1.3em; margin-top: 6px; color: var(--muted); font-size: .76rem; line-height: 1.4; }

.satellite-overlay-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 12px 0 0;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.satellite-overlay-settings legend { padding: 8px 0 2px; color: var(--muted); font-size: .78rem; }
.satellite-overlay-settings label { display: flex; align-items: center; gap: 7px; color: #d4ded7; font-size: .82rem; cursor: pointer; }
.satellite-overlay-settings input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }

.map-view-tools {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  align-items: stretch;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #182628f2;
}

.map-view-tools button {
  min-height: 40px;
  border-radius: 3px;
  background: #2a3838;
}

.map-view-tools button:not(:disabled):hover { color: var(--accent); }
.map-view-tools button:disabled { opacity: .55; cursor: default; }
.map-view-tools button:focus-visible { outline-offset: -3px; }
.map-fit { padding: 0 9px; font-size: .78rem; }
.map-zoom { min-width: 40px; padding: 0; font-size: 1.22rem; line-height: 1; }

.map-dialog-header, .map-dialog-footer { gap: 8px; }

.map-source-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 0 12px;
  margin-left: auto;
}

.player-key {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d4ded7;
  font-size: .86rem;
}

.player-key i {
  width: 8px;
  height: 8px;
  border: 1px solid #ffd0ac;
  border-radius: 50%;
  background: var(--accent);
}
.remote-player-key i { border-color: #eaf5ff; background: #6dbfe2; }

.map-sources-page { overflow-y: auto; }

.map-sources {
  width: min(100% - 28px, 680px);
  margin: clamp(18px, 7vh, 80px) auto;
  padding: clamp(16px, 4vw, 32px);
}

.map-sources h1, .map-sources h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}

.map-sources h1 { font-size: clamp(2rem, 6vw, 3.25rem); }
.map-sources h2 { font-size: 1.5rem; }
.map-sources section { margin-top: 23px; }
.map-sources p { margin: 9px 0; color: #d4ded7; line-height: 1.55; }
.map-sources a { color: #ffc396; }
.map-sources a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.source-notice {
  margin-top: 12px;
  padding: 4px 12px;
  border-left: 2px solid var(--line);
}

.source-documents { display: flex; flex-wrap: wrap; gap: 6px 15px; }

@media (max-width: 630px) {
  .game-heading h1 { font-size: clamp(1.55rem, 6.9vw, 2.75rem); }
  .game-mode { margin-bottom: 7px; font-size: .75rem; }
  .game-region { margin-top: 8px; font-size: .78rem; }
  .navigation { top: calc(var(--edge-top) + 104px); width: 137px; padding: 5px; }
  .map-open { gap: 6px; padding: 4px 2px 0; min-height: 29px; font-size: .75rem; }
  .map-open kbd { display: none; }
  .map-north { top: 4px; right: 4px; padding: 3px 5px; }
  .dashboard { width: 183px; padding: 8px 9px; }
  .dashboard-middle { margin-block: 3px 5px; }
  .nitro-readout { margin-bottom: 5px; }
  #speedValue { font-size: 2.65rem; }
  .keyboard-guide { flex-direction: column; gap: 3px; padding: 5px 6px; }
  .guide-item { gap: 4px; font-size: .75rem; }
  .guide-item kbd { min-width: 20px; height: 19px; padding-inline: 3px; font-size: .65rem; }
  .driving-tools { flex-wrap: wrap; width: 176px; gap: 4px; }
  .tool-button { width: 38px; height: 38px; }
  .map-dialog { height: min(calc(100dvh - var(--edge-top) - var(--edge-bottom)), calc(87vw + 160px)); }
  .travel-row { grid-template-columns: minmax(0, 1fr) auto; gap: 5px 7px; }
  .travel-row label { grid-column: 1 / -1; font-size: .79rem; }
  #destinationSelect { padding-left: 7px; font-size: .86rem; }
  .action-button { padding-inline: 8px; font-size: .8rem; }
  .spawn-controls { flex-basis: 100%; justify-content: space-between; margin-left: 0; }
  #spawnStatus { font-size: .79rem; }
  .map-view-tools { right: 5px; bottom: 5px; }
  .map-source-links { column-gap: 10px; }
  .map-dialog-footer .player-key { font-size: .75rem; white-space: nowrap; }
  .map-dialog-footer kbd { display: none; }
}

@media (max-width: 367px) {
  .driving-tools { width: 146px; gap: 3px; }
  .driving-tools .tool-button { width: 34px; }
  .guide-driving-label { display: none; }
}

@media (pointer: coarse) {
  .map-view-tools button, #destinationSelect, .action-button { min-height: 44px; }
  .map-zoom { min-width: 44px; }
  .game { --touch-size: clamp(44px, 9vw, 62px); --touch-gap: 5px; }
  .touch-controls {
    position: absolute;
    right: var(--edge-right);
    bottom: var(--edge-bottom);
    left: var(--edge-left);
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: var(--touch-gap);
    pointer-events: none;
  }
  .touch-fire {
    position: absolute;
    bottom: calc(var(--touch-size) + var(--touch-gap));
    left: 50%;
    width: auto;
    min-width: 64px;
    padding-inline: 8px;
    transform: translateX(-50%);
    pointer-events: auto;
  }
  .touch-group { display: flex; gap: var(--touch-gap); }
  .touch-button {
    display: grid;
    place-items: center;
    width: var(--touch-size);
    height: var(--touch-size);
    padding: 0;
    pointer-events: auto;
    touch-action: none;
  }
  .touch-button:active, .touch-button.is-pressed { border-color: var(--accent); background: #584034; }
  .touch-gas { color: #182022; background: var(--accent); }
  .touch-nitro { color: #a8f2fa; font-size: .7rem; font-weight: 750; }
  .touch-brake { width: auto; min-width: 60px; padding-inline: 7px; font-size: .76rem; }
  .dashboard, .driving-tools { bottom: calc(var(--edge-bottom) + var(--touch-size) + 7px); }
  .ferry-prompt { bottom: calc(var(--edge-bottom) + var(--touch-size) + 92px); }
  .activity-hint { top: calc(var(--edge-top) + 8px); max-width: min(43vw, 340px); font-size: .7rem; }
  .keyboard-guide, .map-open kbd, .map-dialog-footer kbd { display: none; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .game-heading h1 { font-size: clamp(1.75rem, 5vw, 3rem); }
  .game-region { margin-top: 7px; }
  .game-mode { margin-bottom: 6px; }
  .navigation { top: var(--edge-top); width: 151px; }
  .dashboard { width: 188px; padding: 7px 9px 8px; }
  #speedValue { font-size: 2.6rem; }
}

@media (max-height: 470px) and (min-width: 640px) {
  .map-dialog {
    display: grid;
    grid-template: "header header" auto "map actions" minmax(0, 1fr) "footer footer" auto / minmax(0, 1fr) minmax(210px, 28%);
  }

  .map-dialog-header { grid-area: header; }
  .overview-wrap { grid-area: map; }
  .map-dialog-footer { grid-area: footer; }

  .map-actions {
    grid-area: actions;
    align-content: start;
    overflow-y: auto;
    padding: 3px;
  }

  .travel-controls { flex-basis: 100%; }
  .travel-row { grid-template-columns: minmax(0, 1fr); }
  .spawn-controls { flex-basis: 100%; flex-wrap: wrap; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tool-button { transition: none; }
}
