/* 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;
  --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: 100vw;
  height: 100vh;
  z-index: 1;
  cursor: grab;
}

#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
   ------------------------------------------------------------------------------------------------------------------ */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 90% at 50% 38%, #1b1e24 0%, #0c0d10 55%, #060607 100%);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

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

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

.mta-bullet.loader-bullet {
  width: 56px;
  height: 56px;
  margin-bottom: 22px;
  font-size: 21px;
}

.loader-title {
  font-size: 34px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.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(--taxi);
  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;
}

@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-top-left {
  top: max(var(--edge), env(safe-area-inset-top));
  left: max(var(--edge), env(safe-area-inset-left));
}

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

.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;
}

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;
  height: var(--bar-h);
  padding: 0 18px 0 9px;
}

.mta-bullet {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--taxi);
  color: var(--taxi-ink);
  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 {
  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 {
  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;
  height: var(--bar-h);
  padding: 0 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;
}

.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);
}

.gauge-alt {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  opacity: 0;
  transition: opacity 0.3s ease;
}

body[data-mode='helicopter'] .gauge-alt {
  opacity: 1;
}

.gauge-alt-label {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.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 mode's top speed; it turns taxi yellow on boost */
#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;
}

body.is-boosting #hud-speed-meter {
  background: var(--taxi);
}

.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 {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #0a1118;
  transition: opacity 0.25s ease, visibility 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(--edge);
  left: var(--edge);
  right: var(--edge);
  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;
  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: 0;
  height: 100%;
  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;
  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(--edge);
  translate: 0 -50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.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(--edge);
  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(--edge);
  bottom: var(--edge);
  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: 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 { top: calc(max(var(--edge), env(safe-area-inset-top)) + 62px); }
  .brand > .mta-bullet,
  .brand-heading h1,
  .brand-subtitle { display: none; }
  .brand { height: 44px; padding: 0 12px; }
  .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% - 2 * var(--edge)); bottom: calc(var(--edge) + 34px); }
  .map-controls { top: auto; bottom: calc(var(--edge) + 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; }
}

/* Touch controls reserve the bottom corners; mode and camera selection remain within reach. */
#touch-controls {
  position: fixed;
  z-index: 12;
  left: max(var(--edge), env(safe-area-inset-left));
  right: max(var(--edge), env(safe-area-inset-right));
  bottom: calc(max(var(--edge), env(safe-area-inset-bottom)) + 72px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
  -webkit-touch-callout: none;
}

#touch-controls[hidden],
.touch-action[hidden] { display: none; }

.touch-movement { text-align: center; }

#touch-stick {
  position: relative;
  width: 136px;
  height: 136px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 32%, transparent 33%), var(--glass);
  box-shadow: var(--shadow), inset 0 0 0 12px rgba(255, 255, 255, 0.025);
  pointer-events: auto;
  touch-action: none;
}

.touch-stick-axis::before,
.touch-stick-axis::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.12);
}
.touch-stick-axis::before { top: 16px; bottom: 16px; width: 1px; left: 50%; }
.touch-stick-axis::after { left: 16px; right: 16px; height: 1px; top: 50%; }

#touch-stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(246, 245, 242, 0.8);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transform: translate(calc(-50% + var(--stick-x, 0px)), calc(-50% + var(--stick-y, 0px)));
  pointer-events: none;
}

#touch-stick.is-pressed #touch-stick-knob { background: var(--taxi); border-color: var(--taxi); }

.touch-caption,
.touch-look-hint {
  color: var(--text-2);
  font-size: 11px;
  font-weight: 550;
  text-shadow: 0 1px 5px #000;
}
.touch-caption { display: block; margin-top: 8px; }
.touch-look-hint {
  position: fixed;
  top: calc(max(var(--edge), env(safe-area-inset-top)) + 120px);
  right: max(var(--edge), env(safe-area-inset-right));
  padding: 4px;
}

.touch-actions {
  display: grid;
  grid-template-columns: repeat(2, 64px);
  gap: 10px;
  padding-bottom: 22px;
}
.touch-action {
  width: 64px;
  height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: var(--glass-strong);
  box-shadow: var(--shadow);
  font-size: 11px;
  font-weight: 650;
  pointer-events: auto;
  touch-action: none;
}
.touch-action > [aria-hidden] { font-size: 23px; line-height: 1; }
.touch-boost { grid-column: 2; border-color: rgba(255, 194, 26, 0.65); color: var(--taxi); }
.touch-action.is-pressed { color: var(--taxi-ink); background: var(--taxi); border-color: var(--taxi); }

body.touch-enabled .controls-hint,
body.touch-enabled .radar,
body.touch-enabled .gauge,
body.touch-enabled kbd,
body.touch-enabled .toolbar-divider,
body.touch-enabled .seg-label { display: none; }

body.touch-enabled .hud-top-right { top: max(var(--edge), env(safe-area-inset-top)); right: max(var(--edge), env(safe-area-inset-right)); }
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 { min-width: 44px; min-height: 44px; }
body.touch-enabled .tool-label { display: none; }
body.touch-enabled .hud-bottom-center { bottom: max(var(--edge), env(safe-area-inset-bottom)); }
body.touch-enabled .mode-label { display: block; font-size: 10px; }
body.touch-enabled .mode-btn { width: 62px; height: 48px; padding: 0; flex-direction: column; justify-content: center; gap: 3px; }
body.touch-enabled .hud-bottom-right { top: calc(max(var(--edge), env(safe-area-inset-top)) + 62px); right: max(var(--edge), env(safe-area-inset-right)); bottom: auto; }
body.touch-enabled .cluster { width: 230px; }
body.touch-enabled .camera-switch { border: 0; }
body.touch-enabled .camera-switch .icon-btn { width: 44px; height: 44px; }
body.touch-enabled .hud-bottom-left { left: max(var(--edge), env(safe-area-inset-left)); bottom: calc(max(var(--edge), env(safe-area-inset-bottom)) + 254px); max-width: calc(100% - 2 * var(--edge)); }
body.touch-enabled .fullmap-header { 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)); }
body.touch-enabled .map-controls .icon-btn { width: 44px; height: 44px; }
body.touch-enabled .pop-item { min-height: 44px; }

@media (max-width: 360px) {
  body.touch-enabled .toolbar { width: 194px; height: auto; flex-wrap: wrap; justify-content: center; }
  body.touch-enabled .hud-bottom-right { top: calc(max(var(--edge), env(safe-area-inset-top)) + 114px); }
  .touch-look-hint { top: calc(max(var(--edge), env(safe-area-inset-top)) + 172px); }
}

@media (max-height: 500px) {
  body.touch-enabled .hud-bottom-left { display: none; }
  body.touch-enabled .hud-bottom-right { top: calc(max(var(--edge), env(safe-area-inset-top)) + 58px); }
  #touch-controls { bottom: max(var(--edge), env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- Predictabl reveal film (js/film.js) ---- */
body.film-mode .hud,
body.film-mode #touch-controls,
body.film-mode .popover {
  display: none !important;
}
#film-letterbox {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}
#film-letterbox::before,
#film-letterbox::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  background: #000;
  transition: height 1.2s cubic-bezier(.2, .7, .2, 1);
}
#film-letterbox::before { top: 0; }
#film-letterbox::after { bottom: 0; }
body.film-mode #film-letterbox::before,
body.film-mode #film-letterbox::after {
  height: max(0px, calc((100vh - 100vw / 2.39) / 2));
}
body.film-mode #film-letterbox {
  animation: film-fade-in 2s ease-out both;
}
@keyframes film-fade-in {
  from { background: #000; }
  to { background: transparent; }
}
#film-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(8, 4, 20, 0.55);
}
#film-overlay[hidden] { display: none; }
#film-overlay button {
  font: 700 20px/1 Manrope, Inter, sans-serif;
  color: #fff;
  background: #6d32dd;
  border: 0;
  border-radius: 999px;
  padding: 18px 30px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 40px rgba(109, 50, 221, 0.5);
}
#film-overlay button small {
  font: 500 12px "DM Mono", monospace;
  color: #dff45f;
  letter-spacing: .04em;
}

/* The film's closing slogan (js/film.js cues .show-1, .show-2, .show-3) */
#film-closing {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(max(0px, (100vh - 100vw / 2.39) / 2) + 4.5vh);
  z-index: 55;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35em;
  padding: 0 24px;
  text-align: center;
  pointer-events: none;
  font-size: clamp(18px, 3.1vw, 50px);
}
body:not(.film-mode) #film-closing { display: none; }
#film-closing::before {
  content: '';
  position: absolute;
  inset: -14vh 0 -6vh;
  z-index: -1;
  background: radial-gradient(ellipse 65% 75% at 50% 68%, rgba(8, 4, 20, 0.78), rgba(8, 4, 20, 0.35) 55%, transparent 75%);
  opacity: 0;
  transition: opacity 1.4s ease;
}
#film-closing.show-1::before { opacity: 1; }
.closing-line {
  margin: 0;
  font-family: Unbounded, Manrope, sans-serif;
  letter-spacing: -0.02em;
  line-height: 1.1;
  opacity: 0;
  filter: blur(14px);
  transform: translateY(0.5em);
  transition: opacity 1.1s cubic-bezier(.2, .7, .2, 1), filter 1.1s cubic-bezier(.2, .7, .2, 1), transform 1.1s cubic-bezier(.2, .7, .2, 1), letter-spacing 1.6s cubic-bezier(.2, .7, .2, 1);
}
.closing-1 {
  font-weight: 300;
  color: #f6f5ef;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.55);
}
.closing-2 {
  font-weight: 700;
  background: linear-gradient(90deg, #dff45f, #e6dcff 55%, #b48cff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: blur(14px) drop-shadow(0 2px 24px rgba(109, 50, 221, 0.45));
}
#film-closing.show-1 .closing-1,
#film-closing.show-2 .closing-2 {
  opacity: 1;
  filter: blur(0);
  transform: none;
}
#film-closing.show-2 .closing-2 { filter: drop-shadow(0 2px 24px rgba(109, 50, 221, 0.45)); }
.closing-cta {
  margin-top: 1.1em;
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.95em 1.6em;
  border-radius: 999px;
  background: #6d32dd;
  color: #fff;
  font: 500 clamp(13px, 1.25vw, 20px)/1 Unbounded, Manrope, sans-serif;
  letter-spacing: 0.02em;
  text-decoration: none;
  box-shadow: 0 10px 40px rgba(109, 50, 221, 0.55), inset 0 0 0 1px rgba(230, 220, 255, 0.25);
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(.2, .7, .2, 1), background 0.2s ease, box-shadow 0.2s ease;
}
.closing-cta span { color: #dff45f; transition: transform 0.2s ease; }
#film-closing.show-3 .closing-cta {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.closing-cta:hover { background: #7d44ee; box-shadow: 0 12px 48px rgba(109, 50, 221, 0.7), inset 0 0 0 1px rgba(230, 220, 255, 0.4); }
.closing-cta:hover span { transform: translateX(4px); }
@media (prefers-reduced-motion: reduce) {
  .closing-line, .closing-cta { transition: opacity 0.6s ease; filter: none; transform: none; }
}

/* Phones upright: no letterbox (the take opens its lens instead, js/film.js), and a nudge to turn sideways */
@media (max-aspect-ratio: 1/1) {
  body.film-mode #film-letterbox::before,
  body.film-mode #film-letterbox::after { height: 0; }
  #film-closing { bottom: 9vh; font-size: clamp(18px, 6.2vw, 34px); }
  .closing-cta { font-size: 14px; }
  #film-overlay { align-content: center; gap: 14px; }
  #film-overlay::after {
    content: '\21BB  best in landscape';
    font: 500 12px "DM Mono", monospace;
    color: rgba(246, 245, 239, 0.7);
    letter-spacing: .04em;
  }
}

/* ---- Loading screen: Make it anywhere (Predictabl) ---- */
#loading-overlay {
  background: radial-gradient(120% 90% at 50% 38%, #251050 0%, #0f0724 55%, #07040f 100%);
}
.loader-mark {
  width: 74px;
  height: auto;
  margin-bottom: 24px;
  filter: drop-shadow(0 8px 30px rgba(109, 50, 221, 0.55));
  animation: mark-pulse 2.4s ease-in-out infinite;
}
.loader-kicker {
  font: 500 12px/1 "DM Mono", ui-monospace, monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #dff45f;
  margin-bottom: 12px;
}
#loading-overlay .loader-title {
  font-family: Unbounded, Manrope, sans-serif;
  font-weight: 300;
  font-size: clamp(28px, 6vw, 46px);
  letter-spacing: -0.02em;
  color: #f6f5ef;
}
#loading-overlay .loader-title span {
  font-weight: 700;
  background: linear-gradient(90deg, #dff45f, #e6dcff 55%, #b48cff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
#loading-overlay .loader-fill { background: linear-gradient(90deg, #6d32dd, #dff45f); }
#loading-overlay #loading-status { color: rgba(230, 220, 255, 0.55); }
@keyframes mark-pulse {
  0%, 100% { transform: translateY(0); filter: drop-shadow(0 8px 30px rgba(109, 50, 221, 0.45)); }
  50% { transform: translateY(-4px); filter: drop-shadow(0 12px 40px rgba(109, 50, 221, 0.8)); }
}

/* Recording (js/film.js driveOverlays): no wall-clock transitions */
body.recording #film-letterbox { animation: none !important; }
body.recording #film-letterbox::before,
body.recording #film-letterbox::after,
body.recording #film-closing *,
body.recording #film-closing::before { transition: none !important; }
body.recording #film-closing::before { opacity: var(--closing-bg, 0) !important; }

/* ---------------------------------------------------------------------------------------------------------------
   Make it anywhere: the site link, the clicked screen's card, and the embedded views (js/live.js)
   --------------------------------------------------------------------------------------------------------------- */
#site-link {
  position: fixed; top: 20px; left: 20px; z-index: 30;
  display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 12px; row-gap: 3px; align-items: center;
  padding: 12px 18px 12px 14px; border-radius: 18px;
  background: rgba(15, 7, 36, 0.82); color: #f6f5ef; text-decoration: none; white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(230, 220, 255, 0.22); backdrop-filter: blur(8px);
}
#site-link .site-logo { grid-row: 1 / 3; width: 26px; height: 38px; filter: drop-shadow(0 0 10px rgba(223, 244, 95, 0.25)); }
#site-link .site-name { font: 300 19px/1.1 Unbounded, Manrope, system-ui, sans-serif; letter-spacing: -0.01em; }
#site-link .site-name b { font-weight: 700; color: #dff45f; }
#site-link .site-sub { display: inline-flex; align-items: center; gap: 7px; color: #c3b9dc; font: 500 12.5px Manrope, system-ui, sans-serif; }
@media (max-width: 900px) { #site-link .site-tip { display: none; } }
/* phones: the logo and the live dot only, so the toolbar on the right has room */
@media (max-width: 620px) {
  #site-link { top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); padding: 9px 12px 9px 10px; column-gap: 8px; border-radius: 14px; }
  #site-link .site-logo { width: 20px; height: 29px; }
  #site-link .site-name, #site-link .site-online { display: none; }
  #site-link .site-sub { font-size: 12px; }
  #map-credit { right: 0; left: 0; bottom: 1px; text-align: center; white-space: nowrap; font-size: 8px; } /* under the mode bar */
}
#site-link .site-dot { width: 8px; height: 8px; border-radius: 50%; background: #ff3b5c; animation: live-pulse 1.6s ease-out infinite; }
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 59, 92, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(255, 59, 92, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 59, 92, 0); }
}
#screen-card {
  /* on the right: the player stays in view in the middle */
  position: fixed; right: 24px; bottom: 120px; z-index: 31;
  width: min(360px, calc(100vw - 32px)); box-sizing: border-box; padding: 18px 20px 16px; border-radius: 16px;
  background: rgba(15, 7, 36, 0.95); color: #f6f5ef; font-family: Manrope, system-ui, sans-serif;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(223, 244, 95, 0.4);
}
@media (max-width: 700px) { #screen-card { right: auto; left: 50%; transform: translateX(-50%); } }
#screen-card[hidden] { display: none; }
#screen-card .card-close { position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; border: 0; background: none; color: #e6dcff; font-size: 24px; cursor: pointer; }
#screen-card .card-screen { font: 500 12px 'DM Mono', monospace; letter-spacing: 0.1em; text-transform: uppercase; color: #dff45f; }
#screen-card .card-head { display: flex; align-items: center; gap: 12px; margin: 10px 0 6px; }
#screen-card .card-logo { flex: none; width: 44px; height: 44px; border-radius: 10px; object-fit: contain; background: #fff; padding: 5px; box-sizing: border-box; }
#screen-card .card-logo[hidden] { display: none; }
#screen-card .card-name { font: 700 22px/1.15 Unbounded, Manrope, sans-serif; }
#screen-card .card-slogan { margin: 0 0 4px; color: #d9d1ee; font-style: italic; }
#screen-card .card-price { color: #9d93b8; font-size: 13px; margin-top: 10px; }
#screen-card .card-price:empty { display: none; }
#screen-card .card-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-top: 14px; }
#screen-card .card-actions a { text-align: center; text-decoration: none; border-radius: 999px; font-weight: 700; }
/* a held screen: their site first (big), taking the screen second; a free screen: taking it is the one action */
#screen-card .card-site { background: #dff45f; color: #0f0724; padding: 12px 18px; font-size: 15px; }
#screen-card .card-site[hidden] { display: none; }
#screen-card .card-take { color: #e6dcff; padding: 9px 16px; font-size: 13px; box-shadow: inset 0 0 0 1px rgba(230, 220, 255, 0.3); }
#screen-card.free .card-take { background: #dff45f; color: #0f0724; padding: 12px 18px; font-size: 15px; box-shadow: none; }
body.film-mode #site-link, body.film-mode #screen-card, body.recording #site-link { display: none; }

/* ?embed: the splash page's hero and the preview: just the city */
body.embed .hud, body.embed #site-link, body.embed #screen-card, body.embed #film-overlay,
body.embed #touch-controls, body.embed #fullmap-modal { display: none !important; }
body.embed #loading-overlay .loader-kicker, body.embed #loading-overlay .loader-title, body.embed #loading-overlay .loader-mark { display: none; }

/* "Take it" under the screen in front of you (js/live.js): small on a paid ad, loud on a free screen */
#screen-chip {
  position: fixed; left: 0; top: 0; z-index: 29; will-change: transform;
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 999px;
  background: rgba(15, 7, 36, 0.86); color: #f6f5ef; text-decoration: none; white-space: nowrap;
  font: 600 14px Manrope, system-ui, sans-serif; box-shadow: inset 0 0 0 1px rgba(223, 244, 95, 0.45);
  backdrop-filter: blur(6px); transition: padding 0.3s ease, font-size 0.3s ease;
}
#screen-chip[hidden] { display: none; }
#screen-chip .chip-price { background: #dff45f; color: #0f0724; border-radius: 999px; padding: 6px 12px; font-weight: 800; }
#screen-chip.compact { padding: 5px 5px 5px 12px; font-size: 12px; opacity: 0.85; }
#screen-chip.compact .chip-price { padding: 4px 9px; }
#screen-chip.free {
  font: 700 17px Manrope, system-ui, sans-serif; padding: 10px 10px 10px 20px;
  background: #6d32dd; box-shadow: 0 0 0 0 rgba(223, 244, 95, 0.7); animation: chip-call 1.4s ease-out infinite;
}
#screen-chip.free .chip-price { font-size: 18px; padding: 8px 14px; animation: chip-bounce 1.4s ease-in-out infinite; }
@keyframes chip-call { 0% { box-shadow: 0 0 0 0 rgba(223, 244, 95, 0.75); } 80% { box-shadow: 0 0 0 18px rgba(223, 244, 95, 0); } 100% { box-shadow: 0 0 0 0 rgba(223, 244, 95, 0); } }
@keyframes chip-bounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12) rotate(-3deg); } }
body.film-mode #screen-chip, body.embed #screen-chip { display: none; }

/* "There's a new #1. in town" (js/live.js): a purchase is playing out on Times Square and you're not looking */
#news-toast {
  position: fixed; z-index: 40; top: 84px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 18px; max-width: calc(100vw - 32px);
  border-radius: 16px; background: rgba(15, 7, 36, 0.92); color: #f6f5ef; backdrop-filter: blur(8px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(223, 244, 95, 0.6);
  font: 500 14px Manrope, system-ui, sans-serif; animation: news-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#news-toast[hidden] { display: none; }
#news-toast .news-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff3b5c; flex: none; animation: news-pulse 1.4s ease-out infinite; }
#news-toast .news-text { display: flex; flex-direction: column; min-width: 0; }
#news-toast strong { font: 700 16px Unbounded, Manrope, sans-serif; color: #dff45f; }
#news-toast .news-sub { color: #d9d1ee; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#news-toast .news-go { min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: #dff45f; color: #0f0724; font: 700 14px Manrope, sans-serif; cursor: pointer; white-space: nowrap; }
#news-toast .news-close { width: 36px; height: 44px; border: 0; background: none; color: #b8acd6; font-size: 22px; cursor: pointer; }
body.film-mode #news-toast, body.embed #news-toast { display: none; }
@keyframes news-in { from { opacity: 0; transform: translate(-50%, -16px); } }
@keyframes news-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 59, 92, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(255, 59, 92, 0); } 100% { box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { #news-toast, #news-toast .news-dot { animation: none; } }

/* Make it anywhere: the map data's and the city's credit (OpenStreetMap asks for it wherever its data is shown) */
#map-credit { position: fixed; z-index: 5; right: 8px; bottom: 2px; font: 500 10px/1.4 'DM Mono', ui-monospace, monospace; color: rgba(255, 255, 255, 0.5); text-decoration: none; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
#map-credit:hover { color: rgba(255, 255, 255, 0.85); }
body.embed #map-credit, body.film-mode #map-credit, body.recording #map-credit { display: none; }

/* The treasure hunt (js/treasure-hunt.js): the hint, and the panel to claim a free board */
#hunt-hint {
  position: fixed; z-index: 40; top: 84px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; padding: 12px 10px 12px 16px; max-width: calc(100vw - 32px);
  border-radius: 16px; background: rgba(20, 12, 2, 0.9); color: #fff6e3; backdrop-filter: blur(8px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 201, 60, 0.7);
  font: 500 14px Manrope, system-ui, sans-serif; animation: news-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: opacity 0.5s ease;
}
#hunt-hint.out { opacity: 0; }
#hunt-hint .hunt-emoji { font-size: 28px; line-height: 1; }
#hunt-hint .hunt-text { display: flex; flex-direction: column; }
#hunt-hint strong { font: 700 15px Unbounded, Manrope, sans-serif; color: #ffc93c; }
#hunt-hint .hunt-x { width: 36px; height: 40px; border: 0; background: none; color: #e9c98a; font-size: 22px; cursor: pointer; }
body.embed #hunt-hint { display: none; }

/* The GPU gave up (js/main.js gpuLost): a way out instead of a frozen frame */
body.gpu-lost canvas { visibility: hidden; }
body.gpu-lost .hud, body.gpu-lost #touch-controls, body.gpu-lost #site-link, body.gpu-lost #lite-hint { display: none !important; }
#gpu-lost { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: radial-gradient(70% 50% at 50% 35%, #2a1260, #0d0620 75%); }
#gpu-lost .gl-box { max-width: 380px; text-align: center; color: #f3efff; font: 500 15px/1.5 Manrope, system-ui, sans-serif; display: flex; flex-direction: column; gap: 14px; align-items: center; }
#gpu-lost .gl-icon { font-size: 44px; }
#gpu-lost h2 { margin: 0; font: 700 21px/1.25 Unbounded, Manrope, sans-serif; }
#gpu-lost p { margin: 0; color: #c9bfe4; }
#gpu-lost .gl-btn { display: inline-flex; align-items: center; min-height: 50px; padding: 0 26px; border-radius: 999px; background: #dff25c; color: #160a33; font-weight: 800; text-decoration: none; }
#gpu-lost .gl-link { color: #c9bfe4; font-size: 14px; }

/* Phones get Midtown only (js/main.js setupLiteEdge) */
#lite-hint {
  position: fixed; z-index: 40; top: calc(env(safe-area-inset-top) + 132px); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; padding: 8px 6px 8px 16px; width: max-content; max-width: calc(100vw - 32px);
  border-radius: 14px; background: rgba(22, 12, 48, 0.88); color: #f3efff; backdrop-filter: blur(8px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(223, 242, 92, 0.45);
  font: 600 14px/1.35 Manrope, system-ui, sans-serif; animation: news-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: opacity 0.5s ease;
}
#lite-hint.out { opacity: 0; }
#lite-hint button { flex: none; width: 34px; height: 34px; border: 0; background: none; color: #dff25c; font-size: 22px; cursor: pointer; }
body.embed #lite-hint, body.film-mode #lite-hint, body.recording #lite-hint { display: none; }

#hunt-panel {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(60% 50% at 50% 40%, rgba(255, 190, 40, 0.18), transparent 70%), rgba(8, 4, 0, 0.55);
  animation: hunt-fade 0.3s ease-out;
}
@keyframes hunt-fade { from { opacity: 0; } }
#hunt-panel .hunt-box {
  position: relative; width: min(440px, 100%); max-height: calc(100vh - 32px); overflow-x: hidden; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px; padding: 4px 24px 24px; border-radius: 26px; text-align: center;
  background: radial-gradient(120% 60% at 50% 0%, rgba(255, 196, 50, 0.32), transparent 62%), linear-gradient(180deg, #2b1904, #140b02 70%);
  color: #fff6e3; font: 500 15px/1.45 Manrope, system-ui, sans-serif;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.65), 0 0 60px rgba(255, 190, 40, 0.18), inset 0 0 0 1.5px rgba(255, 210, 90, 0.75);
  animation: hunt-in 0.55s cubic-bezier(0.18, 1.3, 0.4, 1);
}
@keyframes hunt-in { from { opacity: 0; transform: scale(0.82) translateY(18px); } }
#hunt-panel .hunt-box.won { animation: hunt-won 1.3s ease-out; }
@keyframes hunt-won {
  0% { box-shadow: 0 0 0 0 rgba(255, 201, 60, 0.9), inset 0 0 0 1.5px rgba(255, 210, 90, 0.75); }
  35% { box-shadow: 0 0 160px 50px rgba(255, 201, 60, 0.55), inset 0 0 0 3px #ffd75a; }
  100% { box-shadow: 0 40px 120px rgba(0, 0, 0, 0.65), 0 0 60px rgba(255, 190, 40, 0.18), inset 0 0 0 1.5px rgba(255, 210, 90, 0.75); }
}
/* the hero: the prize popping in over slowly turning rays, the confetti comes from here */
#hunt-panel .hunt-hero { position: relative; height: 128px; margin: 0 -24px -6px; display: grid; place-items: center; }
#hunt-panel .hunt-rays {
  position: absolute; left: 50%; top: 50%; width: 300px; height: 300px; margin: -150px 0 0 -150px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 214, 90, 0.34) 0deg 7deg, transparent 7deg 22.5deg);
  -webkit-mask: radial-gradient(closest-side, #000 18%, transparent 100%); mask: radial-gradient(closest-side, #000 18%, transparent 100%);
  animation: hunt-rays 18s linear infinite;
}
@keyframes hunt-rays { to { transform: rotate(360deg); } }
#hunt-panel .hunt-apple {
  position: relative; font-size: 74px; line-height: 1; filter: drop-shadow(0 0 22px rgba(255, 201, 60, 0.95)) drop-shadow(0 8px 10px rgba(0, 0, 0, 0.4));
  animation: hunt-pop 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) both, hunt-bob 2.6s ease-in-out 0.7s infinite;
}
@keyframes hunt-pop { from { transform: scale(0) rotate(-25deg); } }
@keyframes hunt-bob { 50% { transform: translateY(-6px) rotate(4deg); } }
#hunt-panel .hunt-confetti { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
#hunt-panel .hunt-confetti i {
  position: absolute; width: 8px; height: 13px; border-radius: 2px; opacity: 0;
  animation: hunt-bit var(--d) cubic-bezier(0.1, 0.7, 0.3, 1) forwards;
}
@keyframes hunt-bit {
  0% { opacity: 1; transform: translate(0, 0) rotate(0) scale(0.6); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 110px)) rotate(var(--r)) scale(1); }
}
#hunt-panel .hunt-kicker { font: 500 12px 'DM Mono', ui-monospace, monospace; letter-spacing: 0.2em; text-transform: uppercase; color: #ffc93c; }
#hunt-panel h2 {
  margin: -4px 0 0; font: 800 27px/1.15 Unbounded, Manrope, sans-serif; letter-spacing: -0.01em;
  background: linear-gradient(180deg, #fff6d6 10%, #ffc93c 60%, #f29d16); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 12px rgba(255, 180, 30, 0.35));
}
#hunt-panel .hunt-sub { margin: 0 auto; max-width: 34ch; color: #ecdcb8; }
#hunt-panel .hunt-close { position: absolute; z-index: 2; top: 10px; right: 10px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.06); color: #e9c98a; font-size: 24px; cursor: pointer; }
#hunt-panel .hunt-close:hover { background: rgba(255, 255, 255, 0.12); }
#hunt-panel .hunt-form { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
#hunt-panel input[type='text'] { min-height: 52px; padding: 0 18px; border: 0; border-radius: 14px; background: rgba(255, 255, 255, 0.08); color: #fff6e3; font: 500 16px Manrope, sans-serif; text-align: center; box-shadow: inset 0 0 0 1px rgba(255, 201, 60, 0.4); outline: none; }
#hunt-panel input[type='text']:focus { box-shadow: inset 0 0 0 2px #ffc93c, 0 0 0 5px rgba(255, 201, 60, 0.15); }
#hunt-panel .hunt-btn {
  position: relative; overflow: hidden; min-height: 54px; padding: 0 24px; border: 0; border-radius: 999px;
  background: linear-gradient(180deg, #ffe07a, #ffc93c 55%, #f0a91c); color: #1f1300; font: 800 16px Manrope, sans-serif; cursor: pointer;
  box-shadow: 0 10px 30px rgba(255, 180, 30, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#hunt-panel .hunt-btn:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 14px 36px rgba(255, 180, 30, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.6); }
#hunt-panel .hunt-btn::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%; transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent); animation: hunt-shine 2.8s ease-in-out 0.6s infinite;
}
@keyframes hunt-shine { 0%, 60% { left: -40%; } 100% { left: 130%; } }
#hunt-panel .hunt-btn:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
#hunt-panel .hunt-btn:disabled::after { display: none; }
#hunt-panel .hunt-link { border: 0; background: none; color: #ecdcb8; font: 600 14px Manrope, sans-serif; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
#hunt-panel .hunt-card { width: 100%; height: auto; aspect-ratio: 2 / 1; border-radius: 14px; display: block; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 210, 90, 0.35); }
#hunt-panel .won .hunt-card { animation: hunt-pop 0.8s cubic-bezier(0.2, 1.4, 0.4, 1) 0.15s both; }
#hunt-panel .hunt-terms { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: #ecdcb8; cursor: pointer; text-align: left; }
#hunt-panel .hunt-terms input { margin-top: 2px; width: 18px; height: 18px; accent-color: #ffc93c; flex: none; }
#hunt-panel .hunt-terms a { color: #ffc93c; }
#hunt-panel .hunt-err { color: #ffb3a0; font-size: 14px; }
#hunt-panel .hunt-fine { margin: 0; color: #b9a882; font-size: 13px; }
#hunt-panel .hunt-dots { display: flex; justify-content: center; gap: 8px; padding: 8px 0 4px; }
#hunt-panel .hunt-dots i { width: 10px; height: 10px; border-radius: 50%; background: #ffc93c; animation: hunt-dot 1s ease-in-out infinite; }
#hunt-panel .hunt-dots i:nth-child(2) { animation-delay: 0.15s; }
#hunt-panel .hunt-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes hunt-dot { 0%, 100% { opacity: 0.3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) {
  #hunt-panel .hunt-rays, #hunt-panel .hunt-apple, #hunt-panel .hunt-btn::after, #hunt-panel .hunt-dots i { animation: none; }
}
