/* css/style.css */
/* NYC HUD design system: quiet graphite glass in the corners of the screen, taxi yellow for whatever is active,
   NYC DOT green for street names, so that the city itself stays the star */

:root {
  /* Surfaces */
  --glass: rgba(18, 19, 22, 0.62);
  --glass-strong: rgba(16, 17, 20, 0.88);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-highlight: rgba(255, 255, 255, 0.08);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.045 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --hover: rgba(255, 255, 255, 0.08);
  --divider: rgba(255, 255, 255, 0.1);

  /* Text */
  --text: #f6f5f2;
  --text-2: rgba(246, 245, 242, 0.68);
  --text-3: rgba(246, 245, 242, 0.44);

  /* Accents */
  --taxi: #ffc21a;
  --taxi-ink: #17140a;
  --golden-gate: #c0482f; /* International Orange: the brand bullet and the loading bar */
  --sign-green: #0b6a46;
  --highway: #c08a3e;
  --ok: #5ee08f;
  --warn: #ffc857;
  --bad: #ff7a6b;

  /* Shape & motion */
  --edge: 20px;
  --bar-h: 50px;
  --r-panel: 16px;
  --r-ctl: 10px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.2);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --font-sign: 'Overpass', 'Inter', 'Helvetica Neue', Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0a0b0d;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  overscroll-behavior: none;
}

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

:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sm {
  width: 14px;
  height: 14px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 5px;
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

#canvas-container {
  position: fixed;
  inset: 0;
  width: auto;
  height: auto;
  z-index: 1;
  cursor: grab;
}

#canvas-container canvas { display: block; width: 100%; height: 100%; touch-action: none; }

#canvas-container:active {
  cursor: grabbing;
}

/* Soft scrims behind the HUD: keep small type legible over a bright midday street */
body::before,
body::after {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

body::before {
  top: 0;
  height: 120px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0));
}

body::after {
  bottom: 0;
  height: 210px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.36), rgba(0, 0, 0, 0));
}

/* ------------------------------------------------------------------------------------------------------------------
   Glass panel
   ------------------------------------------------------------------------------------------------------------------ */
.panel {
  background: var(--grain), var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-panel);
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--shadow);
}

/* ------------------------------------------------------------------------------------------------------------------
   Loading screen
   ------------------------------------------------------------------------------------------------------------------ */
/* San Francisco at dusk: a sky going from night to the last light over the Golden Gate, the city in silhouette, fog
   drifting in from the ocean */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: start center;
  align-content: safe center;
  overflow-y: auto;
  background:
    radial-gradient(70% 45% at 30% 78%, rgba(232, 112, 64, 0.38) 0%, rgba(232, 112, 64, 0) 70%),
    linear-gradient(180deg, #070a14 0%, #121a30 42%, #2a2c45 64%, #6b4a4e 80%, #a8664e 92%);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader-skyline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 46vh;
}
.loader-skyline .far { fill: #1c2438; }
.loader-skyline .water { fill: #0c1222; }
.loader-skyline .bridge { fill: #11182a; }
.loader-skyline .cable { fill: none; stroke: #11182a; stroke-width: 2.2; }
.loader-skyline .near { fill: #0a0f1c; }

.loader-fog {
  position: absolute;
  inset: auto 0 14vh 0;
  height: 22vh;
  pointer-events: none;
}
.loader-fog span {
  position: absolute;
  inset: 0 -30%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(214, 222, 236, 0.16) 0%, rgba(214, 222, 236, 0) 70%);
  filter: blur(12px);
  animation: fog-drift 26s ease-in-out infinite alternate;
}
.loader-fog span + span {
  top: 30%;
  animation-duration: 34s;
  animation-direction: alternate-reverse;
  opacity: 0.7;
}
@keyframes fog-drift {
  from { transform: translateX(-12%); }
  to { transform: translateX(12%); }
}

#loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 18vh;
  animation: rise-in 0.8s var(--ease-out) both;
}

.loader-return {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 12px;
  color: var(--text);
  text-decoration: underline;
}
.loader-return:focus-visible { outline: 2px solid var(--taxi); outline-offset: 2px; }

.mta-bullet.loader-bullet {
  width: 56px;
  height: 56px;
  margin-bottom: 22px;
  font-size: 21px;
  box-shadow: 0 0 0 6px rgba(192, 72, 47, 0.18), 0 10px 30px -8px rgba(192, 72, 47, 0.7);
}

.loader-title {
  font-size: 40px;
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1.1;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}

.loader-tagline {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 560;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-2);
}

.loader-track {
  position: relative;
  width: 240px;
  height: 3px;
  margin: 26px 0 14px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.loader-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--golden-gate);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

/* While the city is being built (main thread busy) the bar sweeps on the compositor; it fills once shaders compile */
.loader-track.is-indeterminate .loader-fill {
  width: 35%;
  transform: translateX(-100%);
  transition: none;
  animation: loader-sweep 1.5s cubic-bezier(0.45, 0, 0.25, 1) infinite;
  will-change: transform;
}

#loading-status {
  font-size: 12.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* Previous attempt's last stage (boot.js breadcrumb), shown only after an attempt ended without an error */
#loading-crumb {
  max-width: min(320px, 86vw);
  margin-top: 8px;
  font-size: 11.5px;
  line-height: 1.4;
  text-align: center;
  color: var(--text-3);
  opacity: 0.85;
}
#loading-crumb[hidden] { display: none; }

@keyframes loader-sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(290%); }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------------------------------------------------------
   HUD layout: four corners plus the bottom centre, the middle of the screen stays clear
   ------------------------------------------------------------------------------------------------------------------ */
.hud {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.4s var(--ease-out);
}

.hud > * {
  pointer-events: auto;
}

.hud-topbar {
  position: fixed;
  z-index: 10;
  top: max(var(--edge), env(safe-area-inset-top));
  left: max(var(--edge), env(safe-area-inset-left));
  right: max(var(--edge), env(safe-area-inset-right));
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 16px;
  pointer-events: none;
}
.hud-topbar > .hud { position: static; min-width: 0; max-width: 100%; }
.hud-top-right { margin-left: auto; }

.hud-bottom-left {
  left: var(--edge);
  bottom: var(--edge);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.hud-bottom-center {
  left: 50%;
  bottom: var(--edge);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.hud-bottom-right {
  right: var(--edge);
  bottom: var(--edge);
}

/* Clean view [H]: everything but the toggle itself steps out of the way */
body.hud-minimized::before,
body.hud-minimized::after {
  opacity: 0;
}

body.hud-minimized .hud:not(.hud-top-right) {
  opacity: 0;
  visibility: hidden;
}

body.hud-minimized .hud:not(.hud-top-right),
body.hud-minimized .hud:not(.hud-top-right) > * {
  pointer-events: none;
}

body.hud-minimized .hud-top-left { transform: translateY(-10px); }
body.hud-minimized .hud-bottom-left,
body.hud-minimized .hud-bottom-right { transform: translateY(12px); }
body.hud-minimized .hud-bottom-center { transform: translate(-50%, 12px); }

body.hud-minimized .toolbar > :not(#btn-toggle-hud) {
  display: none;
}

/* ------------------------------------------------------------------------------------------------------------------
   Top left: brand
   ------------------------------------------------------------------------------------------------------------------ */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  max-width: 100%;
  height: var(--bar-h);
  padding: 0 18px 0 9px;
}

.mta-bullet {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--golden-gate);
  color: #fff7f2;
  font-weight: 800;
  font-size: 12.5px;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

.brand-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-titles h1 {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.repo-link,
.brand-heading .website-link {
  flex: none;
  padding: 3px 0;
  color: var(--text-2);
  font-size: 11px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.repo-link:hover,
.repo-link:focus-visible,
.brand-heading .website-link:hover,
.brand-heading .website-link:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.brand-subtitle {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#hud-fps {
  font-weight: 650;
  color: var(--text-2);
}

#hud-fps.fps-ok { color: var(--ok); }
#hud-fps.fps-warn { color: var(--warn); }
#hud-fps.fps-bad { color: var(--bad); }

/* ------------------------------------------------------------------------------------------------------------------
   Top right: toolbar (time of day, teleport, map, clean view)
   ------------------------------------------------------------------------------------------------------------------ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: var(--bar-h);
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 5px;
}

.toolbar-divider {
  flex: none;
  width: 1px;
  height: 20px;
  margin: 0 5px;
  background: var(--divider);
}

.time-switch {
  display: flex;
  gap: 2px;
}

.time-btn {
  height: 36px;
  padding: 0 9px;
  border-radius: var(--r-ctl);
  display: inline-flex;
  align-items: center;
  gap: 0;
  color: var(--text-2);
  transition: background-color 0.2s ease, color 0.2s ease, gap 0.35s var(--ease-out), padding 0.35s var(--ease-out);
}

.time-btn:hover {
  color: var(--text);
  background: var(--hover);
}

/* The active time of day spells out its name */
.time-btn .seg-label {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  transition: max-width 0.4s var(--ease-out), opacity 0.25s ease;
}

.time-btn.active,
.time-btn.active:hover {
  gap: 7px;
  padding: 0 12px 0 10px;
  background: var(--text);
  color: #121314;
}

.time-btn.active .seg-label {
  max-width: 120px;
  opacity: 1;
}

.tool-btn {
  height: 36px;
  padding: 0 11px;
  border-radius: var(--r-ctl);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
  transition: background-color 0.2s ease;
}

.tool-btn:hover,
.tool-btn.is-open {
  background: var(--hover);
}

.tool-btn .icon-sm {
  margin-left: -2px;
  color: var(--text-3);
  transition: transform 0.3s var(--ease-out);
}

.tool-btn.is-open .icon-sm {
  transform: rotate(180deg);
}

.tool-btn.icon-only {
  width: 36px;
  padding: 0;
  justify-content: center;
}

.icon-show {
  display: none;
}

body.hud-minimized .icon-hide {
  display: none;
}

body.hud-minimized .icon-show {
  display: block;
}

.tool-btn:active,
.time-btn:active,
.icon-btn:active,
.mode-btn:active,
.camera-current:active,
.pop-item:active {
  transform: scale(0.97);
}

/* ------------------------------------------------------------------------------------------------------------------
   Popovers (teleport destinations, cameras)
   ------------------------------------------------------------------------------------------------------------------ */
.popover {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 6px;
  min-width: 264px;
  max-height: calc(100vh - 2 * var(--edge) - 64px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  color: var(--text);
  background: var(--grain), var(--glass-strong);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
  backdrop-filter: blur(26px) saturate(170%);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 var(--glass-highlight), 0 28px 60px -22px rgba(0, 0, 0, 0.8), 0 4px 14px rgba(0, 0, 0, 0.3);
  transform-origin: top right;
  transition: opacity 0.18s ease, transform 0.26s var(--ease-out), overlay 0.26s allow-discrete, display 0.26s allow-discrete;
}

.popover[data-side='above'] {
  transform-origin: bottom right;
}

.popover:not(:popover-open) {
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
}

.popover[data-side='above']:not(:popover-open) {
  transform: translateY(4px) scale(0.98);
}

@starting-style {
  .popover:popover-open {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }

  .popover[data-side='above']:popover-open {
    transform: translateY(4px) scale(0.98);
  }
}

.pop-title {
  padding: 9px 10px 6px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.pop-title:not(:first-child) {
  margin-top: 5px;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
}

.pop-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px;
  border-radius: 9px;
  text-align: left;
  font-size: 13px;
  font-weight: 550;
  color: var(--text);
  transition: background-color 0.15s ease;
}

.pop-item:hover {
  background: var(--hover);
}

.pop-item.active,
.pop-item.active:hover {
  background: var(--text);
  color: #121314;
}

.pop-item.active kbd {
  color: rgba(0, 0, 0, 0.55);
  background: rgba(0, 0, 0, 0.08);
  box-shadow: none;
}

.tp-btn {
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.pop-sub {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-3);
}

/* ------------------------------------------------------------------------------------------------------------------
   Bottom left: NYC street-name signs over the GPS radar
   ------------------------------------------------------------------------------------------------------------------ */
.location {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  pointer-events: none;
}

.location-place {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7), 0 0 14px rgba(0, 0, 0, 0.4);
  animation: rise-in 0.4s var(--ease-out) both;
}

.location-signs {
  display: flex;
  align-items: center;
  gap: 6px;
  animation: rise-in 0.4s var(--ease-out) both;
}

.location-near {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

/* Green blade, white inset border, Highway Gothic lettering: the sign on every Manhattan corner */
.street-sign {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 9px 13px 7px;
  font-family: var(--font-sign);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: #ffffff;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 55%), var(--sign-green);
  border-radius: 6px;
  outline: 1.5px solid rgba(255, 255, 255, 0.92);
  outline-offset: -4px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35), 0 10px 22px -10px rgba(0, 0, 0, 0.75);
}

.radar {
  position: relative;
  width: 288px;
  height: 184px;
  overflow: hidden;
  border-radius: 18px;
  background: #0a1118;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  cursor: pointer;
  transition: transform 0.35s var(--ease-out);
}

.radar:hover {
  transform: translateY(-2px);
}

/* Inner rim: a soft vignette so the map sinks into the frame */
.radar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 0 30px rgba(0, 0, 0, 0.55);
}

#minimap-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.radar-north {
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  color: #ffffff;
  background: rgba(10, 12, 15, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  pointer-events: none;
}

.radar-key {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 1;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(10, 12, 15, 0.6);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.radar:hover .radar-key {
  color: var(--taxi-ink);
  background: var(--taxi);
  box-shadow: none;
}

/* ------------------------------------------------------------------------------------------------------------------
   Bottom centre: travel mode switcher & keyboard guide
   ------------------------------------------------------------------------------------------------------------------ */
.controls-hint {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  max-width: 600px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
  pointer-events: none;
}

.hint {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  animation: rise-in 0.35s var(--ease-out) both;
}

.hint kbd {
  color: #ffffff;
  background: rgba(12, 13, 15, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  text-shadow: none;
}

.hint-label {
  margin-left: 4px;
}

/* Standard-pad face caps follow active input, including pads used on touch-capable devices. */
.hint kbd[data-pad='A'], .hint kbd[data-pad='B'], .hint kbd[data-pad='X'], .hint kbd[data-pad='Y'] {
  width: 19px; padding: 0; border-radius: 50%; font-weight: 800;
}
.hint kbd[data-pad='A'] { color: #7ee07e; }
.hint kbd[data-pad='B'] { color: #ff7a6e; }
.hint kbd[data-pad='X'] { color: #6eb5ff; }
.hint kbd[data-pad='Y'] { color: #ffd34d; }

.mode-switch {
  position: relative;
  display: flex;
  gap: 2px;
  padding: 5px;
}

/* The taxi-yellow pill glides to the selected mode (positioned by main.js) */
.mode-indicator {
  position: absolute;
  z-index: 0;
  top: 5px;
  bottom: 5px;
  left: 0;
  width: var(--ind-w, 0px);
  transform: translateX(var(--ind-x, 0px));
  border-radius: 12px;
  background: var(--taxi);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(0, 0, 0, 0.12), 0 4px 12px -4px rgba(0, 0, 0, 0.5);
  transition: transform 0.45s var(--ease-out), width 0.45s var(--ease-out);
}

.mode-switch.no-anim .mode-indicator {
  transition: none;
}

.mode-btn {
  position: relative;
  z-index: 1;
  height: 42px;
  padding: 0 12px 0 11px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-2);
  transition: color 0.25s ease, background-color 0.2s ease;
}

.mode-btn:hover {
  color: var(--text);
  background: var(--hover);
}

.mode-btn.active,
.mode-btn.active:hover {
  color: var(--taxi-ink);
  background: transparent;
}

.mode-btn .icon {
  width: 20px;
  height: 20px;
  stroke-width: 1.7;
}

.mode-btn kbd {
  margin-left: 2px;
  transition: color 0.25s ease, background-color 0.25s ease;
}

.mode-btn.active kbd {
  color: rgba(23, 20, 10, 0.62);
  background: rgba(23, 20, 10, 0.1);
  box-shadow: none;
}

/* ------------------------------------------------------------------------------------------------------------------
   Bottom right: speed cluster & camera switcher
   ------------------------------------------------------------------------------------------------------------------ */
.cluster {
  width: 272px;
  overflow: hidden;
}

.gauge {
  padding: 13px 16px 15px;
}

.gauge-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.gauge-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* NYC's simultaneous speed units: km/h is telemetry, never a flight-only altitude field. */
.gauge-alt {
  flex: none;
  margin-left: auto;
  align-self: baseline;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-3);
}

#hud-speed-kmh {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}

.gauge-speed {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 5px;
}

#hud-speed {
  font-size: 42px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.gauge-unit {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.gauge-meter {
  position: relative;
  height: 4px;
  margin-top: 12px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

/* Speed as a share of the wheel's top speed; it turns taxi yellow while overspeed beeps sound. */
#hud-speed-meter {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--text);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.25s linear, background-color 0.2s ease;
}

.camera-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-top: 1px solid var(--divider);
}

.icon-btn {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--r-ctl);
  display: inline-grid;
  place-items: center;
  color: var(--text-2);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--hover);
}

.camera-current {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 8px;
  border-radius: var(--r-ctl);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: background-color 0.15s ease;
}

.camera-current:hover,
.camera-current.is-open {
  background: var(--hover);
}

.camera-current .icon {
  color: var(--text-3);
}

#hud-active-camera {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------------------------------------------------------------
   Full-screen interactive street map ([M])
   ------------------------------------------------------------------------------------------------------------------ */
.fullmap-modal {
  margin: 0; padding: 0; border: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; overflow: hidden; color: inherit;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #0a1118;
  transition: opacity 0.25s ease;
}

.fullmap-modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.fullmap-canvas-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: crosshair;
}

.fullmap-canvas-wrap.is-panning {
  cursor: grabbing;
}

#fullmap-canvas {
  touch-action: none;
  display: block;
  width: 100%;
  height: 100%;
}

.fullmap-header {
  position: absolute;
  top: var(--safe-top);
  left: var(--safe-left);
  right: var(--safe-right);
  display: flex;
  align-items: stretch;
  gap: 10px;
  pointer-events: none;
}

.fullmap-header > * {
  pointer-events: auto;
}

.fullmap-modal:not(.hidden) .fullmap-header,
.fullmap-modal:not(.hidden) .map-controls,
.fullmap-modal:not(.hidden) .fullmap-footer {
  animation: rise-in 0.45s var(--ease-out) both;
}

.fullmap-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 9px 20px 9px 11px;
}

.fullmap-title h2 {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.2;
  white-space: nowrap;
}

.fullmap-subtitle {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fullmap-search-wrap {
  flex: 0 1 440px;
  min-width: 180px;
  min-height: 46px; /* 44px native input plus the panel's two 1px borders */
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  color: var(--text-3);
  cursor: text;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.fullmap-search-wrap:focus-within {
  color: var(--text-2);
  border-color: rgba(255, 255, 255, 0.24);
  background: var(--grain), var(--glass-strong);
}

.fullmap-search {
  flex: 1;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  box-sizing: border-box;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  user-select: text;
}

.fullmap-search::placeholder {
  color: var(--text-3);
}

.fullmap-close {
  margin-left: auto;
  height: auto;
  min-width: 44px;
  min-height: 44px;
  box-sizing: border-box;
  padding: 0 14px 0 12px;
  border-radius: var(--r-panel);
}

.fullmap-close:hover {
  background: var(--grain), var(--glass-strong);
}

/* (centred with `translate`, which the rise-in entrance animation on `transform` leaves alone) */
.map-controls {
  position: absolute;
  top: 50%;
  right: var(--safe-right);
  translate: 0 -50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Native hit rectangles, not only the glass wrappers, are touch-sized at every viewport. */
.map-controls .icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  box-sizing: border-box;
}

.map-compass {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.map-compass svg {
  width: 44px;
  height: 44px;
}

.map-compass text {
  font: 800 7.5px var(--font-sans);
  fill: #ffffff;
}

.map-zoom {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  border-radius: 14px;
}

.fullmap-footer {
  position: absolute;
  left: 50%;
  bottom: var(--safe-bottom);
  translate: -50% 0;
  display: flex;
  max-width: min(560px, calc(100% - 2 * var(--edge) - 2 * 200px));
}

.fullmap-status {
  min-width: 0;
  padding: 10px 16px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fullmap-legend {
  position: absolute;
  right: var(--safe-right);
  bottom: var(--safe-bottom);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}

.fullmap-modal:not(.hidden) .fullmap-legend {
  animation: rise-in 0.45s var(--ease-out) both;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-swatch {
  flex: none;
  display: inline-block;
}

.player-swatch {
  width: 10px;
  height: 11px;
  background: #ffffff;
  clip-path: polygon(50% 0, 100% 100%, 50% 78%, 0 100%);
}

.landmark-swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 2px #0b0f14, 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.gps-swatch,
.bridge-swatch {
  width: 16px;
  height: 4px;
  border-radius: 2px;
}

.gps-swatch { background: var(--taxi); }
.bridge-swatch { background: var(--highway); }

.legend-counts {
  padding-left: 14px;
  border-left: 1px solid var(--divider);
  color: var(--text-3);
}

/* ------------------------------------------------------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------------------------------------------------------ */
@media (max-width: 1800px) {
  .legend-counts { display: none; }
}

@media (max-width: 1360px) {
  .fullmap-legend { display: none; }
}

@media (max-width: 1280px) {
  .brand-titles { display: none; }
  .brand { padding: 0 10px; }
}

@media (max-width: 1240px) {
  .controls-hint { display: none; }
  .mode-btn kbd { display: none; }
}

@media (max-width: 1080px) {
  .mode-label,
  .tool-label,
  .tool-btn kbd { display: none; }
  .mode-btn { padding: 0 12px; }
  .tool-btn:not(.icon-only):not(.fullmap-close) { gap: 4px; padding: 0 9px; }
}

@media (max-width: 820px) {
  :root { --edge: 12px; }
  .hud-top-left { display: none; }
  .repo-link { display: flex; align-items: center; gap: 4px; min-height: 44px; font-size: 12px; }
  .radar { width: 220px; height: 148px; }
  .cluster { width: 220px; }
  #hud-speed { font-size: 34px; }
  .fullmap-title > div { display: none; }
  .fullmap-title { padding: 9px; }
  .fullmap-footer { max-width: calc(100% - var(--safe-left) - var(--safe-right)); bottom: calc(var(--safe-bottom) + 34px); }
  .map-controls { top: auto; bottom: calc(var(--safe-bottom) + 96px); translate: none; }
}

@media (max-width: 620px) {
  .time-btn.active .seg-label { display: none; }
  .time-btn.active { padding: 0 9px; gap: 0; }
  .radar { display: none; }
  .hud-bottom-right { bottom: calc(var(--edge) + 64px); }
  .gauge { display: none; }
  .camera-switch { border-top: 0; }
}

/* A single glass control, retaining native select keyboard and touch behavior. */
.weather-control {
  display: inline-flex; align-items: center; flex: none; position: relative;
  height: 36px; gap: 8px; padding: 0 10px; border-radius: var(--r-ctl);
  color: var(--text); background: var(--hover); font-size: 13px;
}
.weather-control > span { color: var(--text-3); font-size: 11px; }
.weather-control > svg { position: absolute; right: 10px; pointer-events: none; }
#fog-preset {
  appearance: none; color: inherit; background: transparent; border: 0;
  border-radius: var(--r-ctl); font: inherit; font-weight: 600; cursor: pointer;
  height: 100%; width: 112px; padding: 0 20px 0 0; color-scheme: dark;
}
#fog-preset option { background: #20272c; color: #f4f5f6; }
.weather-control:focus-within { outline: 3px solid #ffc58f; outline-offset: 2px; }
#fog-preset:focus-visible { outline: none; }
body.touch-enabled .weather-control { height: 44px; }


:focus-visible { outline: 3px solid #ffc58f; outline-offset: 3px; }

.data-credit { display: block; margin-top: 5px; color: #ddd; font-size: 9px; text-align: center; text-shadow: 0 1px 3px #000; pointer-events: auto; }
.data-credit a { color: inherit; }

@media (max-width: 700px) {
  .toolbar { justify-content: center; gap: 2px; border-radius: 16px; }
  .toolbar .tool-btn:not(.icon-only) { padding: 0 7px; }
  .toolbar-divider { display: none; }
}

/* EUC shell adapted from NYC @cf56976, retaining SF's skyline loader, fog and dark-glass palette. */
:root {
  --safe-top: max(var(--edge), env(safe-area-inset-top));
  --safe-right: max(var(--edge), env(safe-area-inset-right));
  --safe-bottom: max(var(--edge), env(safe-area-inset-bottom));
  --safe-left: max(var(--edge), env(safe-area-inset-left));
}
.brand-badge { width: 30px; height: 30px; border-radius: 9px; background: var(--taxi); color: var(--taxi-ink); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.brand-badge .icon { width: 20px; height: 20px; stroke-width: 2; }
.website-link { color: var(--text-2); text-decoration: none; font-size: 12px; }
.website-link:hover { color: var(--text); text-decoration: underline; }
.loader { max-width: min(620px, calc(100% - 32px)); }
#startup-error[hidden] { display: none; }
#startup-error { margin-top: 18px; max-width: 440px; font-size: 13px; line-height: 1.6; }
#startup-retry { min-height: 44px; padding: 8px 24px; margin: 12px; background: var(--taxi); color: var(--taxi-ink); border-radius: 10px; font-weight: 700; }
.startup-details { text-align: left; margin-top: 12px; user-select: text; }
.startup-details summary { min-height: 44px; cursor: pointer; }
#startup-detail { max-height: 140px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; }
#loading-overlay.has-error .loader-track { display: none; }

.title-overlay { position: fixed; inset: 0; z-index: 95; display: flex; flex-direction: column; justify-content: space-between; align-items: center; text-align: center; padding: max(28px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); background: linear-gradient(to bottom, #060607b8, #06060700 48%), linear-gradient(to top, #060607dc, #06060700 52%); opacity: 0; transition: opacity .5s ease; overflow-y: auto; }
.title-overlay[hidden] { display: none; }
.title-overlay.is-shown { opacity: 1; }
.title-head, .title-foot { display: flex; flex-direction: column; align-items: center; flex: none; max-width: 100%; }
.brand-badge.title-badge { width: 46px; height: 46px; border-radius: 13px; margin-bottom: 14px; }
.title-kicker { font: 700 13px var(--font-sign); letter-spacing: .18em; text-transform: uppercase; color: var(--taxi); }
.title-name { margin-top: 2px; font-size: clamp(40px, 9vw, 76px); font-weight: 800; letter-spacing: -.04em; line-height: 1; text-shadow: 0 2px 24px #0007; }
.title-tagline { margin-top: 10px; font-size: 15px; color: var(--text-2); }
.title-rider { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px; font: 600 15px var(--font-sans); color: var(--text-2); }
#title-rider { width: min(340px, 100%); min-height: 70px; padding: 12px 16px; text-align: left; background: linear-gradient(120deg, #ffc21a1a, #121418e6); border: 1px solid #ffc21a75; border-radius: 16px; white-space: normal; box-shadow: 0 8px 28px #0003; }
#title-rider:hover { border-color: var(--taxi); }
.rider-entry-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: #ffc21a1f; color: var(--taxi); flex: none; }
.rider-entry-copy { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.rider-entry-label { font-size: 11px; color: var(--taxi); font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
#title-rider-name { color: var(--text); font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.rider-entry-action { display: flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 12px; flex: none; }
.title-ride { margin-top: 14px; min-width: 220px; min-height: 54px; padding: 0 34px; border-radius: 16px; font: 800 20px var(--font-sans); letter-spacing: .02em; color: var(--taxi-ink); background: var(--taxi); box-shadow: 0 10px 30px -10px #ffc21a99; }
.title-ride:hover { filter: brightness(1.06); }
.title-hint { margin-top: 10px; font-size: 12.5px; color: var(--text-3); }
.title-hint--gamepad, body[data-input='gamepad'] .title-hint--keyboard, body[data-input='touch'] .title-hint { display: none; }
body[data-input='gamepad'] .title-hint--gamepad { display: block; }
.title-credits { max-width: 560px; margin-top: 12px; font-size: 11px; line-height: 1.5; color: var(--text-3); }
.title-website, .title-return { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }
.title-status { max-width: 360px; font-size: 12px; line-height: 1.4; }
.title-status:empty, .title-status[hidden], .sound-unavailable[hidden] { display: none; }
.title-preparation-actions { display: flex; gap: 8px; }
.title-preparation-actions button { min-height: 44px; padding: 6px 16px; background: var(--glass-strong); border: 1px solid var(--glass-border); border-radius: 10px; }
.title-preparation-actions button[hidden] { display: none; }
.sound-unavailable { position: absolute; right: 0; top: calc(100% + 8px); max-width: min(280px, calc(100vw - var(--safe-left) - var(--safe-right))); padding: 8px 12px; border: 1px solid var(--glass-border); border-radius: 10px; background: var(--glass-strong); font-size: 11px; line-height: 1.4; pointer-events: none; }
body.title-open .hud, body.title-open #touch-controls, body.title-open .getup-prompt { visibility: hidden; }
body.title-open.game-menu-open .title-head, body.title-open.game-menu-open .title-foot { visibility: hidden; }

.game-menu { width: min(360px, calc(100% - 24px)); max-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom))); margin: auto max(12px, env(safe-area-inset-right)) auto auto; padding: 18px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--glass-border); border-radius: 18px; color: var(--text); background: var(--glass-strong); backdrop-filter: blur(18px); box-shadow: var(--shadow); font: 14px/1.45 var(--font-sans); }
.game-menu:not([open]), .game-menu [hidden] { display: none; }
.game-menu::backdrop { background: #0006; }
.game-menu h2 { margin: 0 0 12px; font-size: 22px; line-height: 1.2; }
.game-menu p { margin: 8px 0; overflow-wrap: anywhere; }
.game-menu button { display: block; width: 100%; min-height: 44px; margin-top: 8px; padding: 9px 12px; border: 1px solid var(--glass-border); border-radius: 10px; background: var(--hover); font: 600 14px/1.3 var(--font-sans); white-space: normal; overflow-wrap: anywhere; }
.game-menu button:hover { background: #ffffff24; }
.game-menu button.menu-primary { background: var(--taxi); color: var(--taxi-ink); }
.game-menu button:disabled, .title-ride:disabled, #title-rider:disabled { opacity: .6; cursor: wait; }
.game-menu button:focus-visible, .game-menu a[href]:focus-visible,
.game-menu[data-pad-focus='true'] button:focus, .game-menu[data-pad-focus='true'] a[href]:focus { outline: 2px solid var(--taxi); outline-offset: 2px; }
.menu-kicker { color: var(--taxi); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.game-menu .menu-help { color: var(--text-2); font-size: 12px; }
.menu-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.menu-links a { display: flex; flex: 1 1 140px; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 9px 12px; border: 1px solid var(--glass-border); border-radius: 10px; color: var(--text); background: var(--hover); text-decoration: none; font: 600 13px/1.3 var(--font-sans); }
.menu-links a:hover { background: #ffffff24; text-decoration: underline; }
.menu-build { margin: 10px 0 0; color: var(--text-3); font: 500 11px/1.4 var(--font-sans); font-variant-numeric: tabular-nums; text-align: center; }
.menu-departure { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--divider); }
.menu-departure p { color: var(--text-2); font-size: 12px; }
.menu-actions { display: flex; gap: 8px; }
.game-menu[data-view='picker'] { width: min(560px, calc(100% - 32px)); height: min(620px, calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom)))); padding: 0; overflow: hidden; border-radius: 22px; background: linear-gradient(145deg, #222427fa, #0e1115fa); border-color: #ffffff26; box-shadow: 0 24px 90px #0008; }
.rider-picker { height: 100%; display: grid; grid-template-rows: auto minmax(0,1fr) auto; min-height: 0; }
.picker-head { padding: 22px 24px 16px; background: linear-gradient(105deg, #ffc21a13, transparent); }
.game-menu .picker-head .menu-kicker { display: flex; justify-content: space-between; margin: 0 0 8px; font-size: 10px; letter-spacing: .12em; font-weight: 750; }
#rider-count { color: var(--text-3); letter-spacing: .03em; font-weight: 500; }
.game-menu .picker-head h2 { font-size: 27px; letter-spacing: -.035em; margin: 0; }
.game-menu #rider-current { color: var(--text-2); font-size: 12px; margin: 8px 0 0; }
.rider-picker-body { display: grid; grid-template-columns: minmax(0,.95fr) minmax(0,1.1fr); min-height: 0; border-block: 1px solid var(--divider); }
.rider-options { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 10px; scrollbar-width: thin; scrollbar-color: #ffffff3d transparent; }
.game-menu .rider-option { display: grid; grid-template-columns: 13px minmax(0,1fr) auto; min-height: 48px; gap: 10px; align-items: center; text-align: left; margin: 0 0 5px; padding: 10px; border-color: transparent; background: transparent; border-radius: 10px; font-size: 13px; }
.game-menu .rider-option:hover { background: #ffffff0f; }
.game-menu .rider-option[aria-pressed='true'] { border-color: #ffc21a99; background: #ffc21a17; }
.game-menu .rider-option:focus-visible, .game-menu[data-pad-focus='true'] .rider-option:focus { outline-offset: -3px; }
.rider-swatch { width: 12px; height: 12px; border: 1px solid #fff9; border-radius: 50%; }
.rider-active { color: var(--taxi); font-size: 10px; font-weight: 500; }
.rider-detail { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 22px; border-left: 1px solid var(--divider); background: #0000001a; scrollbar-width: thin; }
.game-menu .rider-detail-kicker { margin: 0 0 10px; color: var(--text-3); font-size: 10px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; }
#rider-detail-state { display: block; color: var(--taxi); font-size: 10px; margin-top: 5px; letter-spacing: .025em; text-transform: none; }
.rider-detail h3 { margin: 0 0 12px; font-size: 23px; line-height: 1.1; letter-spacing: -.03em; }
.game-menu #rider-detail-blurb, .game-menu #rider-wheel-blurb { color: var(--text-2); font-size: 12px; line-height: 1.65; margin: 0; }
.rider-wheel { border-top: 1px solid var(--divider); margin-top: 20px; padding-top: 16px; }
.rider-wheel h4 { margin: 0 0 7px; font-size: 14px; font-weight: 650; line-height: 1.35; }
.game-menu .rider-style-note { margin: 18px 0 0; padding-left: 10px; border-left: 2px solid #ffc21a73; font-size: 10px; line-height: 1.6; color: var(--text-3); }
.picker-foot { padding: 14px 22px 16px; }
.game-menu #rider-status { margin: 0 0 10px; min-height: 32px; font-size: 12px; line-height: 1.4; color: var(--text-2); }
.picker-foot .menu-actions { gap: 10px; }
.picker-foot .menu-actions button { margin-top: 0; min-height: 46px; }
.picker-foot .menu-actions button:not(.menu-primary) { width: 35%; flex: none; background: transparent; }
.game-menu .picker-controls { margin: 10px 0 0; color: var(--text-3); font-size: 10px; text-align: center; }
.game-menu .menu-rider-entry { display: flex; align-items: center; justify-content: space-between; border-color: #ffc21a59; background: #ffc21a0f; }
.gamepad-prompt, .touch-prompt, body[data-input='gamepad'] .keyboard-prompt, body[data-input='touch'] .keyboard-prompt { display: none; }
body[data-input='gamepad'] .gamepad-prompt, body[data-input='touch'] .touch-prompt { display: block; }
kbd[hidden], body[data-input='gamepad'] .cam-btn kbd { display: none !important; }
.game-menu[data-state='error'] #rider-status { color: var(--bad); }
#rider-button-name { display: block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; color: var(--text-2); }
body.game-menu-open .getup-prompt { visibility: hidden; }

.performance-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.fps-control, .resolution-control, .graphics-control { display: flex; align-items: center; gap: 8px; width: max-content; margin-top: 6px; padding: 3px 6px 3px 10px; color: var(--text-2); font-size: 11px; }
.resolution-label-short { display: none; }
/* One existing host-updated reading, outside the brand hidden on compact viewports.
   It occupies the old 14px FPS-label row on touch, preserving the 58px fields and 44px selects. */
.fps-reading { white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 14px; }
#fps-limit, #render-resolution, #graphics-quality { min-height: 44px; padding: 3px 6px; border: 1px solid var(--glass-border); border-radius: 6px; background: #172027; color: var(--text); color-scheme: dark; font: inherit; cursor: pointer; }
#graphics-quality { min-width: 90px; }
#graphics-quality[data-quality='high'] { color: var(--ok); }
#graphics-quality[data-quality='medium'] { color: var(--warn); }
#graphics-quality[data-quality='low'] { color: var(--bad); }
#graphics-quality option { color: var(--text); background: #172027; }
body.hud-minimized .performance-controls { display: none; }
/* URL-opt-in, read-only diagnostics. Placement below the toolbar/controls is bounded by render-stats.js. */
.render-stats {
  position: fixed; z-index: 8; top: var(--hud-content-top, 82px);
  left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right));
  width: max-content; max-width: calc(100% - max(12px, env(safe-area-inset-left)) - max(12px, env(safe-area-inset-right)));
  margin-inline: auto; padding: 8px 10px; border: 1px solid var(--glass-border); border-radius: 10px;
  color: var(--text); background: var(--glass-strong); pointer-events: none;
}
.render-stats pre { font: 11px/1.45 ui-monospace, monospace; font-variant-numeric: tabular-nums; white-space: pre-wrap; overflow-wrap: anywhere; pointer-events: none; }
.render-stats[hidden] { display: none; }
body.hud-minimized .render-stats { visibility: hidden; }
.hud-bottom-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.wheel-cues { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-width: 260px; pointer-events: none; }
.wheel-cues:not(:has(.wheel-cue:not([hidden]))) { display: none; }
.wheel-cue { padding: 7px 12px; border: 1px solid var(--glass-border); border-radius: 10px; background: var(--glass-strong); font-size: 12px; line-height: 1.4; text-align: right; }
.wheel-cue[hidden] { display: none; }
.chase-cue { border-color: #ed9b71; color: #fff3df; max-width: min(260px, 80vw); }
.chase-cue[data-hot='true'] { border-color: #ff6f62; }
.chase-detail { display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: 11px; }
.chase-heat { display: inline-flex; gap: 3px; }
.chase-heat i { width: 6px; height: 6px; border-radius: 50%; background: #66534e; }
.chase-heat[data-level='1'] i:first-child, .chase-heat[data-level='2'] i:nth-child(-n+2),
.chase-heat[data-level='3'] i { background: #ff8a72; }
.chase-meter { display: inline-block; width: 32px; height: 4px; background: #ffffff40; }
.chase-meter span { display: block; height: 100%; background: #7bf0a0; }
.chase-banner { position: fixed; z-index: 11; top: max(12px, env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%); max-width: min(90vw, 460px); padding: 9px 16px; border: 1px solid #ff9b80;
  border-radius: 12px; background: #1b2932ef; color: #fff1e6; font-size: 14px; font-weight: 750;
  text-align: center; pointer-events: none; }
.chase-banner[hidden] { display: none; }
body.title-open .chase-banner, body.game-menu-open .chase-banner { visibility: hidden; }
/* One booking suspension flag also freezes the receipt's CSS-owned animation. */
.booking-overlay[data-suspended='true'][data-signing='true'] .booking-scribble path { animation-play-state: paused; }
/* These are the actual euc-hud.js model levels, shared with NYC. Text remains authoritative. */
.power-cue[data-level='notice'], .overspeed-cue[data-level='notice'] { color: #ffd23f; }
.power-cue[data-level='warn'], .overspeed-cue[data-level='warn'] { color: #ff8a1f; }
.power-cue[data-level='tiltBack'], .overspeed-cue[data-level='critical'] { color: #ff4a3d; }
.power-cue[data-level='tiltBack'] { animation: cue-pulse 1.1s ease-in-out infinite; }
.overspeed-cue { text-transform: uppercase; letter-spacing: .06em; animation: beep-blink var(--beep-period, 1s) steps(1, end) infinite; }
@keyframes beep-blink { 0%, 74% { opacity: 1; } 75%, 100% { opacity: .34; } }
@keyframes cue-pulse { 50% { opacity: .58; } }
.trick-cue { max-width: 230px; white-space: normal; color: var(--text); border-color: #ffc21a8c; font-weight: 700; }
.getup-prompt { position: fixed; left: 50%; top: 64%; translate: -50% -50%; z-index: 20; display: flex; align-items: center; gap: 7px; padding: 10px 16px; border-radius: 12px; background: var(--taxi); color: var(--taxi-ink); font-size: 14px; font-weight: 700; pointer-events: none; }
.getup-prompt[hidden] { display: none; }
.getup-prompt kbd { color: inherit; }
body[data-input='touch'] .getup-prompt kbd { display: inline-flex; }
body.is-overspeed #hud-speed-meter { background: var(--taxi); }

/* Floating EUC touch anatomy, native layout from EUC Thrills @5f45fff via NYC. */
.euc-touch { position: fixed; inset: 0; z-index: 9; pointer-events: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; --touch-scale: 1; --touch-fit: 1; --touch-unit: calc(16px * var(--touch-scale) * var(--touch-fit)); --touch-stick: calc(6.6 * var(--touch-unit)); --touch-knob: calc(2.6 * var(--touch-unit)); --touch-throw: calc((var(--touch-stick) - var(--touch-knob)) / 2 - .28 * var(--touch-unit)); --touch-primary: calc(4.05 * var(--touch-unit)); --touch-button: calc(3.6 * var(--touch-unit)); --touch-actions-rise: calc(.95 * var(--touch-unit)); --touch-rise: 0px; --lane-x: max(18px, env(safe-area-inset-left)); --lane-x-right: max(18px, env(safe-area-inset-right)); --lane-bottom: max(16px, env(safe-area-inset-bottom)); --touch-bottom: calc(var(--lane-bottom) + var(--touch-rise)); --touch-throttle: 0; --touch-steer: 0; --touch-x: 0; --touch-y: 0; }
.euc-touch[hidden] { display: none; }
.touch-zone { position: absolute; left: 0; bottom: 0; width: min(48%, 384px); height: min(52%, 272px); pointer-events: auto; touch-action: none; }
.touch-stick { position: absolute; left: calc(var(--lane-x) + var(--touch-stick) / 2 + 6px); bottom: calc(var(--touch-bottom) + var(--touch-stick) / 2); width: var(--touch-stick); height: var(--touch-stick); display: grid; place-items: center; border: 1px solid #ffffff38; border-radius: 50%; background: #0d101457; opacity: .5; transform: translate(-50%, 50%); transition: opacity 160ms ease; pointer-events: none; }
.touch-stick[data-active='true'] { left: calc(var(--touch-x) * 1px); top: calc(var(--touch-y) * 1px); bottom: auto; opacity: .92; transform: translate(-50%, -50%); }
.touch-knob { width: var(--touch-knob); height: var(--touch-knob); border-radius: 50%; background: #f6f5f2e6; box-shadow: 0 2px 10px #0008; transform: translate(calc(var(--touch-steer) * var(--touch-throw)), calc(var(--touch-throttle) * var(--touch-throw) * -1)); }
.stick-hint { position: absolute; top: 50%; width: calc(.62 * var(--touch-unit)); height: calc(.62 * var(--touch-unit)); border-top: 2px solid #ffffff8c; border-left: 2px solid #ffffff8c; }
.stick-hint--left { left: calc(.55 * var(--touch-unit)); transform: translateY(-50%) rotate(-45deg); }
.stick-hint--right { right: calc(.55 * var(--touch-unit)); transform: translateY(-50%) rotate(135deg); }
.stick-hint--up { top: calc(.55 * var(--touch-unit)); left: 50%; transform: translateX(-50%) rotate(45deg); }
.stick-hint--down { top: auto; bottom: calc(.55 * var(--touch-unit)); left: 50%; transform: translateX(-50%) rotate(225deg); }
.touch-actions { position: absolute; right: var(--lane-x-right); bottom: calc(var(--touch-bottom) + var(--touch-actions-rise)); display: grid; grid-template-areas: 'hop .' 'getup charge'; gap: calc(.42 * var(--touch-unit)); align-items: end; justify-items: center; }
.touch-btn { width: var(--touch-button); height: var(--touch-button); min-width: 44px; min-height: 44px; display: grid; place-items: center; padding: 0; border: 1px solid #ffffff61; border-radius: calc(1.05 * var(--touch-unit)); background: #0d101494; color: var(--text); font-size: max(10px, calc(.62 * var(--touch-unit))); font-weight: 800; letter-spacing: .08em; line-height: 1; pointer-events: auto; touch-action: none; box-shadow: 0 2px 7px #0003; opacity: .82; }
.touch-btn--hop { grid-area: hop; border-color: #e65a55d1; background: #5b1f1f99; }
.touch-btn--charge { grid-area: charge; width: var(--touch-primary); height: var(--touch-primary); border-color: #5f95dfc7; background: #19355b94; font-size: max(9px, calc(.5 * var(--touch-unit))); }
.touch-btn--getup { grid-area: getup; display: none; border-color: var(--taxi); background: #ffc21ae6; color: var(--taxi-ink); font-size: max(9px, calc(.5 * var(--touch-unit))); opacity: 1; }
.euc-touch[data-down='true'] .touch-btn--getup { display: grid; }
.touch-btn[data-pressed='true'] { opacity: 1; box-shadow: inset 0 0 0 2px #ffffffb8; transform: translateY(1px); }
.touch-look-hint { position: absolute; top: calc(var(--safe-top) + 192px); left: var(--lane-x); max-width: 45%; color: var(--text-2); font-size: 11px; font-weight: 550; text-shadow: 0 1px 5px #000; animation: touch-hint-out .6s ease 9s forwards; }
.touch-look-hint-short { display: none; }
@keyframes touch-hint-out { to { opacity: 0; visibility: hidden; } }
body[data-input='touch'] .controls-hint, body.touch-enabled .radar, body.touch-enabled .gauge-top, body[data-input='touch'] kbd, body.touch-enabled .toolbar-divider, body.touch-enabled .seg-label { display: none; }
body.touch-enabled .toolbar { gap: 2px; padding: 4px; }
body.touch-enabled .time-btn, body.touch-enabled .time-btn.active { height: 44px; min-width: 44px; padding: 0 8px; gap: 0; }
body.touch-enabled .tool-btn, .pop-item { min-width: 44px; min-height: 44px; }
body.touch-enabled .tool-label { display: none; }
body.touch-enabled .hud-bottom-center { bottom: var(--safe-bottom); }
body.touch-enabled .mode-btn { width: 62px; height: 48px; padding: 0; flex-direction: column; justify-content: center; gap: 3px; }
body.touch-enabled #btn-rider { width: 96px; height: auto; min-height: 48px; padding: 4px; }
body.touch-enabled #btn-rider > .icon { display: none; }
body.touch-enabled #rider-button-name { max-width: 88px; }
body.touch-enabled .hud-bottom-right { top: calc(var(--hud-content-top, 74px) + var(--sound-notice-space, 0px)); right: var(--safe-right); bottom: auto; }
body.touch-enabled .wheel-cues { order: 2; }
body.touch-enabled .cluster { width: 230px; }
body.touch-enabled .gauge { display: block; padding: 8px 12px 9px; }
body.touch-enabled .gauge-speed { margin-top: 0; }
body.touch-enabled #hud-speed { font-size: 28px; }
body.touch-enabled .gauge-meter { margin-top: 7px; height: 3px; }
body.touch-enabled .camera-switch { border-top: 1px solid var(--divider); }
body.touch-enabled .camera-switch .icon-btn { width: 44px; height: 44px; }
body.touch-enabled .camera-current { min-height: 44px; }
body.touch-enabled .hud-bottom-left { left: var(--safe-left); bottom: calc(var(--safe-bottom) + 254px); max-width: calc(100% - 2 * var(--edge)); }
body.touch-enabled .hud-bottom-left > * { pointer-events: none; }
body.touch-enabled .fullmap-search { font-size: 16px; }
body.touch-enabled .weather-control { padding: 0 6px; }
body.touch-enabled .weather-control > span { display: none; }
body.touch-enabled #fog-preset { width: 96px; font-size: 11px; }

/* Sharp independently sized map; accessible results and complete scrollable provenance. */
.fullmap-modal { --map-credits-height: 100px; --map-status-height: 40px; }
.fullmap-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.fullmap-search-panel { position: relative; flex: 1; min-width: 0; max-width: 540px; }
.fullmap-search-wrap { width: 100%; }
.fullmap-search-results { margin-top: 8px; max-height: min(320px, 42dvh); overflow-y: auto; overscroll-behavior: contain; padding: 8px; }
.fullmap-search-results[hidden] { display: none; }
.fullmap-search-results ul { list-style: none; }
.fullmap-search-results button { display: block; width: 100%; min-height: 44px; padding: 10px; text-align: left; border-radius: 8px; }
.fullmap-search-results button:hover, .fullmap-search-results button:focus { background: var(--hover); }
.fullmap-gamepad-cursor { position: fixed; z-index: 8; width: 26px; height: 26px; border: 2px solid var(--taxi); border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; box-shadow: 0 0 0 2px #0009; }
.fullmap-gamepad-cursor::before, .fullmap-gamepad-cursor::after { content: ''; position: absolute; background: var(--taxi); left: 50%; top: 50%; transform: translate(-50%, -50%); }
.fullmap-gamepad-cursor::before { width: 8px; height: 2px; }
.fullmap-gamepad-cursor::after { height: 8px; width: 2px; }
.fullmap-gamepad-cursor[hidden] { display: none; }
#fullmap-search-summary { color: var(--text-2); padding: 5px 8px; font-size: 11px; }
.fullmap-credits { position: absolute; left: var(--safe-left); bottom: var(--safe-bottom); width: 320px; max-width: calc(100% - var(--safe-left) - var(--safe-right)); max-height: 28dvh; overflow-y: auto; overscroll-behavior: contain; padding: 10px 14px; font-size: 10px; line-height: 1.6; color: var(--text-2); user-select: text; }
.fullmap-credits a { color: var(--text); }
.fullmap-status { white-space: normal; overflow-wrap: anywhere; }
.fullmap-action-status { display: block; color: var(--taxi); }
.fullmap-action-status:empty { display: none; }
.fullmap-pad-help { padding-top: 8px; margin-top: 8px; border-top: 1px solid var(--divider); color: var(--text-2); font-size: 11px; line-height: 1.65; text-align: center; }

@media (orientation: portrait) { .euc-touch { --touch-rise: 54px; } }
@media (orientation: landscape) and (max-height: 480px) { .euc-touch { --touch-fit: .82; } .touch-zone { height: min(62%, 192px); } }
@media (max-height: 352px) { .euc-touch { --touch-fit: .7; } }
@media (max-width: 820px) {
  .hud-top-left { display: flex; flex-direction: column; align-items: flex-start; pointer-events: none; }
  .hud-top-left .brand { display: none; }
  .performance-controls { pointer-events: auto; }
  body.touch-enabled .performance-controls { display: grid; grid-template-columns: 58px 58px 98px; margin-top: 6px; }
  body.touch-enabled .performance-controls > label { margin-top: 0; }
  body.touch-enabled .fps-control, body.touch-enabled .resolution-control { flex-direction: column; gap: 2px; width: 58px; padding: 4px 3px; }
  body.touch-enabled .graphics-control { flex-direction: column; gap: 2px; width: 98px; padding: 4px 3px; }
  body.touch-enabled .graphics-control > span { line-height: 14px; }
  body.touch-enabled #graphics-quality { width: 100%; min-width: 0; min-height: 44px; padding: 3px 4px; font-size: 12px; }
  body.touch-enabled .fps-label-full, body.touch-enabled .resolution-label-full { display: none; }
  body.touch-enabled .resolution-label-short { display: block; line-height: 14px; }
  body.touch-enabled #fps-limit, body.touch-enabled #render-resolution { width: 100%; min-width: 0; min-height: 44px; padding: 3px 0; font-size: 10px; }
  .fullmap-credits { width: auto; left: var(--safe-left); right: var(--safe-right); max-height: 22dvh; }
  .fullmap-footer { bottom: calc(var(--safe-bottom) + var(--map-credits-height) + 10px); }
}
@media (max-width: 560px) and (min-height: 501px) {
  .game-menu[data-view='picker'] { width: calc(100% - 24px); margin: auto; }
  .picker-head { padding: 16px 18px 12px; }
  .game-menu .picker-head h2 { font-size: 23px; }
  .rider-picker-body { grid-template-columns: 1fr; grid-template-rows: minmax(88px,.8fr) minmax(0,1.4fr); }
  .rider-options { padding: 7px 12px; }
  .game-menu .rider-option { min-height: 44px; margin-bottom: 2px; padding-block: 8px; }
  .rider-detail { border-left: 0; border-top: 1px solid var(--divider); padding: 14px 18px; }
  .rider-detail h3 { font-size: 20px; margin-bottom: 8px; }
  .rider-wheel { margin-top: 12px; padding-top: 10px; }
  .picker-foot { padding: 12px 16px; }
  .title-credits { margin-top: 4px; }
}
@media (max-width: 560px) {
  body.touch-enabled .hud-topbar { display: contents; }
  body.touch-enabled .hud-topbar > .hud { position: fixed; }
  body.touch-enabled .hud-top-left { top: var(--safe-top); left: var(--safe-left); }
  body.touch-enabled .hud-top-right { top: var(--safe-top); right: var(--safe-right); max-width: calc(100% - 84px); }
  body.touch-enabled .toolbar { flex-wrap: wrap; width: 230px; max-width: 100%; height: auto; justify-content: center; }
  body.touch-enabled .hud-bottom-right { top: calc(var(--hud-content-top, 124px) + var(--sound-notice-space, 0px)); }
  .fullmap-modal .map-controls { top: calc(var(--safe-top) + 62px); bottom: auto; flex-direction: row; translate: none; }
  .fullmap-modal .map-zoom { flex-direction: row; }
  .fullmap-modal .fullmap-search-results { margin-top: 72px; }
}
@media (max-width: 499px) {
  /* Two numeric fields beside the gauge; Medium gets the complete second row. */
  body.touch-enabled .performance-controls { grid-template-columns: 58px 58px; margin-top: 0; }
  body.touch-enabled .graphics-control { grid-column: 1 / -1; width: 100%; }
  body.touch-enabled .touch-look-hint { width: 58px; max-width: 58px; line-height: 14px; top: auto; bottom: calc(var(--safe-bottom) + 186px); }
  body.touch-enabled .touch-look-hint-full { display: none; }
  body.touch-enabled .touch-look-hint-short { display: block; white-space: nowrap; }
}
@media (max-width: 381px) {
  /* NYC's narrow layout: Graphics occupies the toolbar's upper-left slot, then the
     numeric fields stack in the gauge gutter. Preserve all 44px native targets. */
  body.touch-enabled .performance-controls { grid-template-columns: 58px; gap: 4px; }
  body.touch-enabled .performance-controls > label { padding-block: 1px; }
  body.touch-enabled .graphics-control { grid-row: 1; width: 98px; }
  body.touch-enabled .toolbar { width: 194px; gap: 0; padding: 2px; }
  body.touch-enabled .time-switch { gap: 0; }
  body.touch-enabled #btn-teleport .icon-sm { display: none; }
}
@media (min-height: 501px) {
  /* NYC's two-line trick slot clears street signs and HOP without moving the warning stack. */
  body.touch-enabled .trick-cue { position: fixed; right: var(--safe-right); bottom: calc(var(--safe-bottom) + 210px); }
}
@media (max-width: 499px) and (min-height: 501px) and (max-height: 600px) and (orientation: portrait) {
  /* The wrapped SF toolbar puts the camera over the old sign slot on short phones.
     Share the lower slot with transient landed feedback; keep the full-size riding controls clear. */
  /* HOP's scaled border box starts at a fractional pixel: reserve a full 8px gap. */
  body.touch-enabled .hud-bottom-left { bottom: calc(var(--safe-bottom) + 211px); }
  body.touch-enabled .trick-cue { bottom: calc(var(--safe-bottom) + 211px); }
  /* Keep two long names in one bounded row; existing sign ellipsis handles overflow. */
  body.touch-enabled .location,
  body.touch-enabled .location-signs,
  body.touch-enabled .location-place { max-width: 100%; }
  body.touch-enabled .street-sign { min-width: 0; }
  body.touch-enabled:has(#hud-trick:not([hidden])) .hud-bottom-left { visibility: hidden; }
  /* Four-line hint sits in the gauge gutter, below the two-row settings. */
  body.touch-enabled .touch-look-hint { left: var(--safe-left); top: calc(var(--safe-top) + 166px); bottom: auto; }
}
@media (max-width: 381px) and (min-height: 501px) and (max-height: 600px) and (orientation: portrait) {
  body.touch-enabled .touch-look-hint { top: calc(var(--safe-top) + 214px); }
}
@media (max-width: 499px) and (max-height: 500px) {
  body.touch-enabled .touch-look-hint { display: none; }
}
@media (max-height: 500px) {
  .title-overlay { padding-top: max(14px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .brand-badge.title-badge { display: none; }
  .title-kicker { font-size: 11px; }
  .title-name { font-size: 36px; }
  .title-tagline { margin-top: 4px; font-size: 13px; }
  .title-foot { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 12px; }
  #title-rider { min-height: 54px; padding: 8px 12px; width: min(300px, 45%); }
  .title-ride { margin-top: 0; min-width: 150px; min-height: 48px; }
  .title-hint, .title-website { display: none; }
  .title-credits { flex-basis: 100%; margin-top: 0; font-size: 10px; }
  .title-status { flex-basis: 100%; }
  .game-menu { padding: 12px; }
  .game-menu h2 { font-size: 18px; margin-bottom: 6px; }
  .menu-departure { margin-top: 12px; padding-top: 8px; }
  .game-menu[data-view='picker'] { width: min(660px, calc(100% - 24px)); margin: auto; }
  .picker-head { padding: 12px 18px 10px; }
  .game-menu .picker-head h2 { font-size: 21px; }
  .rider-detail { padding: 12px 16px; }
  .picker-foot { padding: 10px 16px; }
  .game-menu #rider-status { min-height: 0; margin-bottom: 7px; }
  .map-controls { top: calc(var(--safe-top) + 62px); bottom: auto; flex-direction: row; translate: none; }
  .map-controls .map-zoom { flex-direction: row; }
  .map-controls .icon-btn { width: 44px; height: 44px; }
  .fullmap-credits { left: var(--safe-left); right: var(--safe-right); bottom: var(--safe-bottom); width: auto; max-width: none; max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 176px); }
  .fullmap-footer { left: var(--safe-left); right: var(--safe-right); translate: none; width: fit-content; margin-inline: auto; max-width: calc(100% - var(--safe-left) - var(--safe-right)); bottom: calc(var(--safe-bottom) + var(--map-credits-height) + 10px); }
  .fullmap-legend { display: none; }
  .fullmap-search-results { margin-top: 72px; max-height: max(60px, min(264px, calc(100dvh - var(--safe-top) - var(--safe-bottom) - var(--map-credits-height) - var(--map-status-height) - 142px))); }
  .fullmap-modal[data-input='gamepad']:has(#fullmap-search-results:not([hidden]) button) .fullmap-pad-help { display: none; }
  body.touch-enabled .hud-bottom-left, body.touch-enabled .gauge-meter { display: none; }
  body.touch-enabled .hud-bottom-right { top: calc(var(--hud-content-top, 74px) + var(--sound-notice-space, 0px)); }
}

@media (max-width: 820px) and (max-height: 500px) {
  /* Keep both speed units and the native camera picker in a single short row above HOP.
     The picker still offers every camera; cycling arrows yield to its >=44px target. */
  body.touch-enabled .cluster { display: flex; align-items: center; }
  body.touch-enabled .gauge { flex: 1; min-width: 0; padding: 8px; }
  body.touch-enabled #hud-speed { font-size: 24px; }
  body.touch-enabled .gauge-unit { font-size: 10px; }
  body.touch-enabled .gauge-alt { font-size: 9px; letter-spacing: 0; }
  body.touch-enabled #hud-speed-kmh { font-size: 13px; }
  body.touch-enabled .camera-switch { flex: none; width: 84px; border-top: 0; border-left: 1px solid var(--divider); }
  body.touch-enabled .camera-switch .icon-btn { display: none; }
  body.touch-enabled .camera-current { width: 100%; padding: 0 4px; font-size: 11px; gap: 4px; }
  body.touch-enabled .camera-current .icon { display: none; }
}
@media (min-width: 561px) and (max-width: 820px) and (max-height: 500px) {
  /* SF's fog field is wider than NYC's toolbar. Two compact toolbar rows alongside settings
     use less height than moving the complete toolbar under them in a short split window. */
  body.touch-enabled .hud-topbar { flex-wrap: nowrap; column-gap: 8px; }
  body.touch-enabled .hud-top-left { flex: none; }
  body.touch-enabled .toolbar { width: 300px; padding: 2px; gap: 0; flex-wrap: wrap; justify-content: center; }
}

/* A phone's short landscape window can be wider than 820px. Compact the HUD here too:
   three compact fields plus the SF toolbar fit one row at 844px, above the thumb lanes.
   The host measures the toolbar's final bottom for the gauge/camera; do not lift the touch layer. */
@media (min-width: 821px) and (max-height: 500px) and (orientation: landscape) {
  body.touch-enabled .hud-topbar { flex-wrap: nowrap; }
  body.touch-enabled .hud-topbar > .hud-top-left {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: flex-start;
    pointer-events: none;
  }
  body.touch-enabled .hud-top-left .brand { display: none; }
  body.touch-enabled .performance-controls { pointer-events: auto; display: grid; grid-template-columns: 58px 58px 98px; }
  body.touch-enabled .fps-control,
  body.touch-enabled .resolution-control {
    flex-direction: column;
    gap: 2px;
    width: 58px;
    margin-top: 0;
    padding: 4px 3px;
  }
  body.touch-enabled .fps-label-full,
  body.touch-enabled .resolution-label-full { display: none; }
  body.touch-enabled .resolution-label-short { display: block; line-height: 14px; }
  body.touch-enabled #fps-limit,
  body.touch-enabled #render-resolution {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 3px 0;
    font-size: 10px;
  }
  body.touch-enabled .graphics-control { flex-direction: column; gap: 2px; width: 98px; margin-top: 0; padding: 4px 3px; }
  body.touch-enabled .graphics-control > span { line-height: 14px; }
  body.touch-enabled #graphics-quality { width: 100%; min-width: 0; min-height: 44px; padding: 3px 4px; font-size: 12px; }
  body.touch-enabled .toolbar { width: max-content; max-width: 100%; flex-wrap: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.light-world-notice {
  position: fixed;
  z-index: 12;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 160px);
  transform: translateX(-50%);
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}

/* Search results can grow the header; keep the light-tier Close target above the compact action row. */
body[data-world-tier="light"] .fullmap-close {
  align-self: flex-start;
  height: 46px;
}
