/* css/style.css */
/* The play screen: CodedCartoony (css/cartoony.css, DESIGN.md) over a transparent HUD: no panels in the corners, text
   held legible by soft scrims & shadows; Fredoka / Nunito, cream text, taxi gold for whatever is active, cream-outlined
   cards for what opens. Only the street-name signs keep the road-sign face (Overpass) */

:root {
  /* Surfaces */
  --glass: rgba(42, 36, 56, 0.86);
  --glass-strong: var(--cc-surface);
  --glass-border: var(--cc-stroke-soft);
  --glass-highlight: transparent;
  --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: var(--cc-raised);
  --divider: var(--cc-divider);

  /* Text */
  --text: var(--cc-text);
  --text-2: rgba(255, 247, 239, 0.78);
  --text-3: rgba(255, 247, 239, 0.52);

  /* Accents */
  --taxi: var(--cc-gold);
  --taxi-ink: var(--cc-on-pastel);
  --sign-green: #0b6a46;
  --highway: #c08a3e;
  --ok: #5ee08f;
  --warn: #ffc857;
  --bad: #ff7a6b;

  /* Shape & motion */
  --edge: 20px;
  --bar-h: 50px;
  --r-panel: var(--cc-r-l);
  --r-ctl: var(--cc-r-m);
  --shadow: var(--cc-s3);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  --font-sans: var(--cc-body);
  --font-sign: var(--cc-display);
  --font-road: 'Overpass', 'Inter', 'Helvetica Neue', Arial, sans-serif; /* (street-name signs only) */

}

* {
  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;
}

/* Touch: the game surfaces take every gesture (no page pan or pinch-zoom over them); controls drop the double-tap
   zoom delay; form fields stay selectable (iOS won't place a caret in user-select: none) */
#canvas-container, #canvas-container canvas, #touch-controls { touch-action: none; }
button, label, [role="tab"], a { touch-action: manipulation; }
input, textarea { -webkit-user-select: text; user-select: text; }

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: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1.5px solid var(--cc-stroke);
  border-bottom-width: 3px;
  border-radius: 7px;
  font-family: var(--cc-display);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--cc-gold);
  background: var(--cc-raised);
  text-shadow: none;
}

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

/* (deeper at the top right, where the bare toolbar reads straight off the sky) */
body::before {
  top: 0;
  height: 140px;
  background:
    radial-gradient(60% 150px at 82% 0, rgba(0, 0, 0, 0.34), rgba(0, 0, 0, 0) 75%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0));
}

/* (deeper under the bare mode switch & speed cluster) */
body::after {
  bottom: 0;
  height: 210px;
  background:
    radial-gradient(34% 190px at 86% 100%, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 80%),
    radial-gradient(30% 130px at 50% 100%, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0) 80%),
    linear-gradient(to top, rgba(0, 0, 0, 0.36), rgba(0, 0, 0, 0));
}

/* ------------------------------------------------------------------------------------------------------------------
   Glass panel
   ------------------------------------------------------------------------------------------------------------------ */
.panel {
  background: var(--glass);
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: var(--r-panel);
  box-shadow: var(--cc-s1);
}

/* ------------------------------------------------------------------------------------------------------------------
   Loading screen: CodedCartoony (css/cartoony.css tokens): Fredoka title with a gold sticker, the stage in a speech
   bubble, a taxi riding a gold pill progress bar, a tip card. The taxi drives off as the screen fades.
   ------------------------------------------------------------------------------------------------------------------ */
#loading-overlay {
  --p: 0; /* load progress 0–1, set by js/main.js */
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: hidden auto;
  background: var(--grain), radial-gradient(90% 70% at 50% 30%, var(--cc-surface) 0%, var(--cc-bg) 70%);
  color: var(--cc-text);
  font-family: var(--cc-body);
  transition: opacity 0.7s var(--ease-out) 0.15s, visibility 0.7s 0.15s;
}

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

.load {
  box-sizing: border-box;
  min-height: 100%;
  width: min(680px, 100%);
  margin: 0 auto;
  padding: 14vh 16px 6vh;
  display: flex;
  flex-direction: column;
  gap: clamp(32px, 6vh, 56px);
}

.load-head { animation: rise-in 0.7s var(--ease-out) both; }

.load-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.18em;
  font: 700 clamp(48px, 8vw, 84px)/1 var(--cc-display);
  letter-spacing: 0.01em;
  color: var(--cc-text);
}

/* "Life": a tilted taxi-yellow sticker that settles in with a little overshoot */
.load-sticker {
  display: inline-block;
  padding: 0.06em 0.28em 0.1em;
  border: 2px solid var(--cc-stroke);
  border-radius: var(--cc-r-l);
  background: var(--cc-gold);
  color: var(--cc-on-pastel);
  box-shadow: var(--cc-s2);
  transform: rotate(-6deg);
  animation: load-stick 0.6s var(--cc-pop) 0.25s both;
}

@keyframes load-stick {
  from { opacity: 0; transform: rotate(-16deg) scale(0.6); }
  to { opacity: 1; transform: rotate(-6deg); }
}

.load-sub {
  margin-top: 18px;
  max-width: 46ch;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.55;
  color: var(--cc-steel);
  text-wrap: pretty;
}

.load-meter { animation: rise-in 0.7s var(--ease-out) 0.1s both; }

.load-readout {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 18px;
}

.load-pct {
  flex: none;
  min-width: 2.4ch;
  font: 700 56px/0.9 var(--cc-display);
  font-variant-numeric: tabular-nums;
  color: var(--cc-gold);
}

.load-pct small { margin-left: 2px; font-size: 24px; font-weight: 600; color: var(--cc-concrete); }

/* the status in a cartoon speech bubble, its tail pointing at the number */
.load-bubble {
  position: relative;
  min-width: 0;
  margin-bottom: 6px;
  padding: 9px 16px 10px;
  border: 2px solid var(--cc-stroke);
  border-radius: var(--cc-r-m);
  background: var(--cc-surface);
  box-shadow: var(--cc-s1);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.load-bubble::before {
  content: '';
  position: absolute;
  left: -9px;
  bottom: 9px;
  width: 14px;
  height: 14px;
  border-left: 2px solid var(--cc-stroke);
  border-bottom: 2px solid var(--cc-stroke);
  background: var(--cc-surface);
  transform: rotate(45deg) skew(8deg, 8deg);
}

#loading-status {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* the road: a chunky pill track (cartoony.css .cc-progress); the gold fill grows with --p and the taxi rides its edge */
.load-road {
  position: relative;
  padding-top: 34px;
  --taxi-w: 64px;
}

.load-track {
  height: 26px;
  padding: 3px;
  border: 2px solid var(--cc-stroke);
  border-radius: 999px;
  background: var(--cc-track);
  box-shadow: var(--cc-s2), inset 0 3px 0 rgba(0, 0, 0, 0.18);
}

.load-fill {
  display: block;
  height: 100%;
  width: max(16px, calc(var(--p) * 100%));
  border-radius: 999px;
  background: linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 55%), var(--cc-gold);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.14);
  transition: width 0.45s var(--ease-out);
}

.load-taxi {
  position: absolute;
  top: 0;
  left: clamp(0px, calc(var(--p) * 100% - var(--taxi-w) * 0.6), calc(100% - var(--taxi-w)));
  width: var(--taxi-w);
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
  transition: left 0.45s var(--ease-out);
}

.load-taxi-body { animation: load-bob 0.42s ease-in-out infinite alternate; }
.load-taxi .tx-paint { fill: var(--cc-gold); stroke: var(--cc-stroke); stroke-width: 2.4; stroke-linejoin: round; }
.load-taxi .tx-sign { fill: var(--cc-text); stroke: var(--cc-stroke); stroke-width: 2; }
.load-taxi .tx-glass { fill: var(--cc-blue-light); stroke: var(--cc-on-pastel); stroke-width: 1.6; stroke-linejoin: round; }
.load-taxi .tx-check { stroke: var(--cc-on-pastel); stroke-width: 3; stroke-dasharray: 3 3; }
.load-taxi .tx-lamp { fill: var(--cc-text); }
.load-taxi .tx-wheel { transform-box: fill-box; transform-origin: center; animation: load-spin 0.5s linear infinite; }
.load-taxi .tx-wheel circle { fill: var(--cc-on-pastel); stroke: var(--cc-stroke); stroke-width: 2.4; }
.load-taxi .tx-wheel path { stroke: var(--cc-concrete); stroke-width: 1.6; stroke-linecap: round; }

@keyframes load-bob { to { transform: translateY(-1.5px) rotate(-1deg); } }
@keyframes load-spin { to { transform: rotate(360deg); } }

/* tips: a card with a pink sticker tag; tips stacked in one cell, each shown 5 s in turn (CSS only: it keeps cycling
   while the city build holds the main thread) */
.load-tips {
  position: relative;
  display: grid;
  align-items: center;
  padding: 26px 22px 20px;
  border: 2px solid var(--cc-stroke);
  border-radius: var(--cc-r-l);
  background: var(--cc-surface);
  box-shadow: var(--cc-s3);
  animation: rise-in 0.7s var(--ease-out) 0.2s both;
}

.load-tips-tag {
  position: absolute;
  top: -15px;
  left: 18px;
  padding: 6px 14px;
  border: 2px solid var(--cc-stroke);
  border-radius: var(--cc-r-m);
  background: var(--cc-pink-light);
  color: var(--cc-on-pastel);
  font: 600 14px/1 var(--cc-display);
  box-shadow: var(--cc-s1);
  transform: rotate(-6deg);
}

.load-tip {
  grid-area: 1 / 1; /* (all in one cell: the card is as tall as the longest tip) */
  font-size: 15px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--cc-text);
  opacity: 0;
  animation: load-tip 45s infinite;
}

.load-tip:nth-of-type(2) { animation-delay: 5s; }
.load-tip:nth-of-type(3) { animation-delay: 10s; }
.load-tip:nth-of-type(4) { animation-delay: 15s; }
.load-tip:nth-of-type(5) { animation-delay: 20s; }
.load-tip:nth-of-type(6) { animation-delay: 25s; }
.load-tip:nth-of-type(7) { animation-delay: 30s; }
.load-tip:nth-of-type(8) { animation-delay: 35s; }
.load-tip:nth-of-type(9) { animation-delay: 40s; }

@keyframes load-tip {
  0% { opacity: 0; transform: translateY(6px); }
  1.4%, 10% { opacity: 1; transform: none; }
  11.1%, 100% { opacity: 0; transform: translateY(-4px); }
}

/* keys: little cartoon keycaps */
.load-tips kbd {
  display: inline-block;
  min-width: 1.9em;
  padding: 1px 7px 2px;
  margin: 0 1px;
  border: 2px solid var(--cc-stroke);
  border-bottom-width: 4px;
  border-radius: 8px;
  background: var(--cc-raised);
  font: 600 12.5px/1.35 var(--cc-display);
  color: var(--cc-gold);
  text-align: center;
}

.key-chip {
  display: inline-block;
  min-width: 1.9em;
  padding: 1px 6px 2px;
  margin: 0 1px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom-width: 2px;
  background: rgba(255, 255, 255, 0.07);
  font: 700 12px/1.4 var(--font-sign);
  color: var(--cc-gold);
  text-align: center;
}

.load-credit {
  margin-top: auto;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--cc-concrete);
}

/* out: the taxi drives off and the screen fades into the city */
#loading-overlay.hidden .load-taxi { left: calc(100% + 40px); transition: left 0.6s cubic-bezier(0.5, 0, 0.75, 0); }
#loading-overlay.hidden .load-head { transform: translateY(-3vh); transition: transform 0.7s var(--ease-out); }

@media (max-height: 760px) {
  .load { padding-top: 7vh; gap: 28px; }
}

@media (max-width: 620px) {
  .load { padding-top: 10vh; gap: 32px; }
  .load-sub { font-size: 15px; }
  .load-pct { font-size: 44px; }
  .load-bubble { font-size: 14px; }
  #loading-status { white-space: normal; }
  .load-road { --taxi-w: 54px; padding-top: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .load-sticker, .load-head, .load-meter, .load-tips { animation: none; }
  .load-taxi-body, .load-taxi .tx-wheel { animation: none; }
  .load-fill, .load-taxi { transition: none; }
  .load-tip { animation: none; }
  .load-tip:first-of-type { opacity: 1; }
}

@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-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-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 right: toolbar (time of day, teleport, map, clean view). No panel: road-sign caps straight over the city,
   held legible by the top scrim & a soft shadow; hover & focus raise a cream-outlined pill, an open menu turns it gold
   ------------------------------------------------------------------------------------------------------------------ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--bar-h);
  padding: 0 2px;
}
.toolbar > * {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 0 14px rgba(0, 0, 0, 0.35);
}
.toolbar .icon { filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.6)); }

/* The day cycle's clock: game time in Accra & the season (read-only, it runs on its own) */
.day-clock {
  height: 36px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 700 12.5px/1 var(--font-sign);
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text);
}

.day-clock .icon { color: var(--text-2); }

.tool-btn {
  position: relative;
  height: 36px;
  padding: 0 12px;
  border: var(--cc-stroke-w) solid transparent;
  border-radius: var(--cc-r-pill);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 700 12.5px/1 var(--font-sign);
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: var(--text);
  transition: background var(--cc-fast) ease-out, border-color var(--cc-fast) ease-out, color var(--cc-fast) ease-out;
}
.tool-btn:hover, .tool-btn:focus-visible, .camera-current:hover, .camera-current:focus-visible {
  background: var(--cc-raised);
  border-color: var(--cc-stroke);
  text-shadow: none;
  box-shadow: var(--cc-s1);
}
.tool-btn.is-open, .camera-current.is-open {
  background: var(--cc-gold);
  border-color: var(--cc-stroke);
  color: var(--cc-on-pastel);
  text-shadow: none;
  box-shadow: var(--cc-s1);
}
.tool-btn.is-open .icon, .camera-current.is-open .icon { filter: none; color: var(--cc-on-pastel); }
.tool-btn::after {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 3px;
  height: 2px;
  background: var(--taxi);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.32s var(--ease-out);
}
.tool-btn::after { display: none; } /* (the old gold thread: the pill replaces it) */
.tool-btn:focus-visible { outline: none; }
.tool-btn kbd { text-shadow: none; }

.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[hidden],
.icon-fs-exit { display: none; }
body.is-fullscreen .icon-fs-enter { display: none; }
body.is-fullscreen .icon-fs-exit { display: block; }

.tool-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: 8px;
  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(--cc-surface);
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: var(--cc-r-l);
  box-shadow: var(--cc-s4);
  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: 8px 10px 6px;
  font: 600 13px/1.2 var(--cc-display);
  color: var(--cc-steel);
}

.pop-title:not(:first-child) {
  margin-top: 5px;
  padding-top: 12px;
  border-top: var(--cc-stroke-w) dashed var(--divider);
}

.pop-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px;
  border: var(--cc-stroke-w) solid transparent;
  border-radius: var(--cc-r-m);
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  transition: background-color var(--cc-fast) ease-out, border-color var(--cc-fast) ease-out;
}

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

.pop-item.active,
.pop-item.active:hover {
  background: var(--cc-gold);
  border-color: var(--cc-stroke);
  color: var(--cc-on-pastel);
}

.pop-item.active kbd { color: var(--cc-on-pastel); background: rgba(255, 247, 239, 0.55); border-color: var(--cc-on-pastel); }
.pop-item.active .pop-sub { color: rgba(42, 36, 56, 0.75); }

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

.pop-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--cc-concrete);
}

/* ------------------------------------------------------------------------------------------------------------------
   Bottom left: 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.01em;
  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.01em;
  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 street-name sign */
.street-sign {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 9px 13px 7px;
  font-family: var(--font-road);
  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);
}

/* No frame: the radar's edges feather into the city (two crossed masks), like a screen rather than a card */
.radar {
  position: relative;
  width: 288px;
  height: 184px;
  overflow: hidden;
  background: #0a1118;
  cursor: pointer;
  transition: transform 0.35s var(--ease-out);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 13%, #000 87%, transparent), linear-gradient(to bottom, transparent, #000 15%, #000 85%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 13%, #000 87%, transparent), linear-gradient(to bottom, transparent, #000 15%, #000 85%, transparent);
  mask-composite: intersect;
}

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



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

.radar-north {
  position: absolute;
  top: 31px; /* (inside the feathered edge: the mask fades whatever sits in it) */
  left: 50%;
  transform: translateX(-50%);
  font: 800 11px/1 var(--font-sign);
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.radar-key {
  position: absolute;
  top: 29px;
  right: 40px;
  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 { text-shadow: none; }

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

.mode-switch {
  position: relative;
  display: flex;
  gap: 10px;
  padding: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 0 14px rgba(0, 0, 0, 0.35);
}
.mode-switch .icon { filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.6)); }

/* A gold pill under the selected mode, gliding between them (placed by main.js) */
.mode-indicator {
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  height: 42px;
  width: var(--ind-w, 0px);
  transform: translateX(var(--ind-x, 0px));
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: var(--cc-r-pill);
  background: var(--cc-gold);
  box-shadow: var(--cc-s1);
  transition: transform 0.4s var(--cc-pop), width 0.4s var(--cc-ease);
}

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

.mode-btn {
  position: relative;
  z-index: 1;
  height: 42px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 700 13px/1 var(--font-sign);
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: var(--text-2);
  transition: color 0.25s ease;
}

.mode-btn { padding: 0 14px; border-radius: var(--cc-r-pill); }
.mode-btn:hover { color: var(--text); }
.mode-btn.active { color: var(--cc-on-pastel); text-shadow: none; }
.mode-btn.active .icon { filter: none; }
.mode-btn:focus-visible { outline: 2px solid var(--cc-gold); outline-offset: 3px; }

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

.mode-btn kbd {
  margin-left: 2px;
  text-shadow: none;
}

/* ------------------------------------------------------------------------------------------------------------------
   Bottom right: speed cluster & camera switcher
   ------------------------------------------------------------------------------------------------------------------ */
.cluster {
  width: 312px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 0 14px rgba(0, 0, 0, 0.35);
}
.cluster .icon { filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.6)); }

.gauge {
  padding: 0 4px 10px;
}

.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.01em;
  color: var(--text-2);
}

.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='fly'] .gauge-alt {
  opacity: 1;
}

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

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

#hud-speed {
  font: 800 44px/1 var(--font-sign);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.gauge-unit {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--text-2);
}

.gauge-meter {
  position: relative;
  height: 2px;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  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: 0;
}

.icon-btn {
  flex: none;
  width: 36px;
  height: 36px;
  border: var(--cc-stroke-w) solid transparent;
  border-radius: 50%;
  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(--cc-raised);
  border-color: var(--cc-stroke);
}

.camera-current {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border: var(--cc-stroke-w) solid transparent;
  border-radius: var(--cc-r-pill);
  transition: background var(--cc-fast) ease-out, border-color var(--cc-fast) ease-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 700 12.5px/1 var(--font-sign);
  letter-spacing: 0.01em;
}
.camera-current kbd { text-shadow: none; }
.camera-current::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 3px;
  height: 2px;
  background: var(--taxi);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.32s var(--ease-out);
}
.camera-current::after { display: none; }
.camera-current:focus-visible { outline: none; }

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

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

/* (no panels on the map: road-sign caps & bare controls over its dark ground, shadowed off the roads' lines) */
.fullmap-modal :is(.fullmap-header, .map-controls, .fullmap-footer, .fullmap-legend) {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}
.fullmap-modal :is(.map-controls, .fullmap-search-wrap) .icon { filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.7)); }

.fullmap-title {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 2px 6px 0 0;
}

.fullmap-title h2 {
  font: 800 18px/1.1 var(--font-sign);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

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

/* a bare field on a hairline; focused, the hairline becomes the gold thread */
.fullmap-search-wrap {
  position: relative;
  flex: 0 1 440px;
  min-width: 180px;
  height: 44px;
  margin-left: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 2px;
  color: var(--text-2);
  cursor: text;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.22);
  transition: color 0.2s ease;
}
.fullmap-search-wrap::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--taxi);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.32s var(--ease-out);
}
.fullmap-search-wrap:focus-within { color: var(--text); }
.fullmap-search-wrap:focus-within::after { transform: scaleX(1); }

.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: rgba(246, 245, 242, 0.58);
}

.fullmap-close {
  margin-left: auto;
  align-self: center;
}

/* (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;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7));
}

.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;
}
.map-zoom .icon-btn { color: var(--text); }
.map-zoom .icon-btn:hover { background: none; color: var(--taxi); }

.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 0;
  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: 18px;
  padding: 10px 0;
  font: 700 11.5px/1 var(--font-sign);
  letter-spacing: 0.01em;
  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 6px; }
  .toolbar { gap: 8px; }
}

@media (max-width: 820px) {
  :root { --edge: 12px; }
  .radar { width: 220px; height: 148px; }
  .cluster { width: 220px; }
  #hud-speed { font-size: 34px; }
  .fullmap-title { display: none; }
  .fullmap-search-wrap { margin-left: 0; }
  .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) {
  .day-clock { padding: 0 4px; }
  .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: var(--cc-stroke-w) solid var(--cc-stroke);
  background: var(--cc-surface);
  box-shadow: var(--cc-s2);
  font: 600 11.5px/1.1 var(--cc-display);
  pointer-events: auto;
  touch-action: none;
}
.touch-ic { width: 24px; height: 24px; stroke-width: 2.2; }
.touch-ic-up { transform: rotate(180deg); }
.touch-boost { grid-column: 2; color: var(--taxi); }
.touch-action.is-pressed { color: var(--taxi-ink); background: var(--taxi); transform: scale(0.94); }

body.touch-enabled .controls-hint,
body.touch-enabled .radar,
body.touch-enabled .gauge,
body.touch-enabled kbd,
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: 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: min(296px, calc(100vw - 2 * var(--edge))); }
body.touch-enabled .camera-current { letter-spacing: 0.03em; }
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;
  }
}

/* Get in / get out prompt (F / E, or tap) */
.enter-prompt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto 8px;
  padding: 7px 16px 7px 8px;
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: 999px;
  font: 600 14px/1 var(--cc-display);
  color: var(--cc-on-pastel);
  background: var(--cc-gold);
  box-shadow: var(--cc-s2);
  cursor: pointer;
  pointer-events: auto;
  animation: rise-in 0.25s var(--ease-out) both;
}
.enter-prompt[hidden] { display: none; }
.enter-prompt kbd { color: var(--cc-on-pastel); background: rgba(255, 247, 239, 0.6); border-color: var(--cc-on-pastel); }
.enter-prompt:hover { transform: translateY(-2px); }
.enter-prompt:active { transform: translateY(1px) scale(0.96); }
.mode-switch.no-active .mode-indicator { opacity: 0; }

/* perf overlay (P) */
.perf-overlay {
  position: fixed;
  top: 76px;
  right: 12px;
  z-index: 60;
  margin: 0;
  padding: 8px 10px;
  font: 11px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #d8f5d0;
  background: rgba(8, 12, 10, 0.78);
  border-radius: 6px;
  pointer-events: none;
  white-space: pre;
}
.perf-overlay[hidden] { display: none; }
.quality-toast {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  padding: 7px 14px;
  font: 700 14px/1.3 var(--cc-body);
  color: var(--cc-text);
  background: var(--cc-surface);
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: var(--cc-r-m);
  box-shadow: var(--cc-s2);
  pointer-events: none;
}
.quality-toast[hidden] { display: none; }

/* ------------------------------------------------------------------------------------------------------------------
   Battle royale (js/game): the match HUD; free-roam UI steps aside while it runs
   ------------------------------------------------------------------------------------------------------------------ */
/* the way into a match is a label like the rest; in a match ("Leave match") it is the active thing: gold */
.tool-btn-match[aria-pressed="true"] { color: var(--taxi); }
.in-match #mode-switch,
.in-match .hud-bottom-right,
.in-match #hud-controls-hint,
.in-match .enter-prompt,
.in-match #btn-teleport,
.in-match [data-camera] { display: none !important; }

/* The match HUD speaks the game's system: graphite glass with grain, taxi yellow for the active thing, Overpass
   (the road-sign face) for every number a player reads at a glance */
.mh {
  --shield: #4fa8ff;
  --health: #5ee08f;
  --danger: #ff5a4f;
  --storm: #c08cff;
  --recon: #6fe0ff;
  --num: 700 1em/1 var(--font-sign);
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  color: var(--text);
  font: 600 13px/1.3 var(--font-sans);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  font-variant-numeric: tabular-nums;
}
.mh [hidden] { display: none !important; }
.mh-ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mh-top, .mh-feed-row, .mh-prompt, .mh-slot, .mh-vitals, .mh-foe, .mh-end-panel {
  background: var(--glass);
  border: var(--cc-stroke-w) solid var(--glass-border);
  box-shadow: var(--cc-s1);
}
.mh-end-panel, .mh-prompt { border-color: var(--cc-stroke); }

/* overlays: storm, low health, scope */
.mh-storm { position: absolute; inset: 0; opacity: 0; transition: opacity 0.5s var(--ease-out); background: radial-gradient(ellipse at center, rgba(120, 40, 200, 0.06) 35%, rgba(110, 30, 190, 0.55)); }
.mh-lowhp { position: absolute; inset: 0; opacity: 0; transition: opacity 0.4s var(--ease-out); background: radial-gradient(ellipse at center, transparent 55%, rgba(200, 20, 20, 0.45)); animation: mh-pulse 1.1s ease-in-out infinite; }
/* the sniper scope: a big lens with a soft dark rim (it fades in as it comes up), a mil-dot reticle, the range & breath */
.mh-scope { position: absolute; inset: 0; background: radial-gradient(circle at center, transparent 0 39vh, rgba(5, 5, 6, 0.55) 41vh, rgba(5, 5, 6, 0.92) 42.5vh, #050506 44vh); animation: mh-fade 0.16s var(--ease-out); }
.mh-scope-reticle { position: absolute; left: 50%; top: 50%; width: 84vh; height: 84vh; transform: translate(-50%, -50%); overflow: visible; }
.mh-scope-reticle .post { fill: #050506; }
.mh-scope-reticle .thin { stroke: #050506; stroke-width: 0.32; }
.mh-scope-reticle .mil { fill: #050506; }
.mh-scope-reticle .dot { fill: #050506; transition: fill 0.1s; }
.mh-scope.is-on .mh-scope-reticle .dot { fill: var(--cc-danger); }
.mh-scope-range { position: absolute; left: 50%; top: calc(50% + 15vh); transform: translateX(-50%); font: 700 16px/1 var(--cc-display); font-variant-numeric: tabular-nums; color: var(--cc-text); -webkit-text-stroke: 4px var(--cc-bg); paint-order: stroke fill; }
.mh-scope-breath { position: absolute; left: 50%; top: calc(50% + 15vh + 24px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; font: 600 11.5px/1 var(--cc-body); color: var(--cc-steel); -webkit-text-stroke: 3px var(--cc-bg); paint-order: stroke fill; }
.mh-scope-breath i { display: block; width: 64px; height: 4px; border-radius: var(--cc-r-pill); background: var(--cc-text); transform-origin: left; opacity: 0.75; }
.mh-scope.is-holding .mh-scope-breath i { background: var(--cc-gold); opacity: 1; }

/* crosshair & markers */
.mh-cross { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.mh-cross i { position: absolute; left: 0; top: 0; background: rgba(255, 255, 255, 0.95); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); transition: background 0.12s; }
.mh-cross-t, .mh-cross-b { width: 2px; height: 9px; }
.mh-cross-l, .mh-cross-r { width: 9px; height: 2px; }
.mh-cross-dot { position: absolute; width: 3px; height: 3px; left: -1.5px; top: -1.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); }
.mh-cross.is-on i, .mh-cross.is-on .mh-cross-dot { background: var(--danger); }
.mh-target { position: absolute; left: 50%; top: calc(50% + 26px); transform: translateX(-50%); font: 700 12px/1 var(--font-sans); color: #ff9a92; letter-spacing: 0.01em; }
.mh-hit { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; transform: translate(-50%, -50%) rotate(45deg); opacity: 0; }
.mh-hit::before, .mh-hit::after { content: ''; position: absolute; background: #fff; }
.mh-hit::before { left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; clip-path: polygon(0 0, 35% 0, 35% 100%, 0 100%, 0 0, 65% 0, 100% 0, 100% 100%, 65% 100%); }
.mh-hit::after { top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%, 0 65%, 100% 65%, 100% 100%, 0 100%); }
.mh-hit.is-head::before, .mh-hit.is-head::after { background: var(--taxi); }
.mh-hit.is-kill::before, .mh-hit.is-kill::after { background: var(--danger); }
.mh-arc { position: absolute; left: 50%; top: 50%; width: 220px; height: 220px; border-radius: 50%; opacity: 0; border-top: 5px solid rgba(255, 170, 60, 0.95); transform: translate(-50%, -50%);
  -webkit-mask: conic-gradient(from -25deg, #000 50deg, transparent 0); mask: conic-gradient(from -25deg, #000 50deg, transparent 0); }
.mh-arc.is-hurt { width: 260px; height: 260px; border-top: 8px solid var(--danger); }
.mh-stamina { position: absolute; left: calc(50% + 46px); top: calc(50% - 24px); width: 5px; height: 48px; border-radius: 3px; background: rgba(0, 0, 0, 0.45); overflow: hidden; opacity: 0; transition: opacity 0.3s; }
.mh-stamina span { position: absolute; inset: 0; background: var(--taxi); transform-origin: bottom; }

/* world-anchored: damage numbers, enemies' bars, recon marks */
.mh-dmg { position: absolute; inset: 0; }
/* damage numbers: chunky display numerals with a thick ink outline (readable on sky, walls & grass) & a soft shadow;
   cream on health, light blue on shield, gold on a headshot */
.mh-num { position: absolute; left: 0; top: 0; font: 700 28px/1 var(--cc-display); font-variant-numeric: tabular-nums; color: var(--cc-text); -webkit-text-stroke: 6px var(--cc-bg); paint-order: stroke fill; text-shadow: 0 3px 10px rgba(0, 0, 0, 0.45); white-space: nowrap; will-change: transform, opacity; }
.mh-num.is-shield { color: var(--cc-blue-light); }
.mh-num.is-head { color: var(--cc-gold); font-size: 34px; }
/* what the player just lost: beside the health bar */
.mh-hurt-num { position: absolute; left: calc(100% + 6px); bottom: 10px; font: 700 26px/1 var(--cc-display); font-variant-numeric: tabular-nums; color: var(--cc-danger); -webkit-text-stroke: 6px var(--cc-bg); paint-order: stroke fill; text-shadow: 0 3px 10px rgba(0, 0, 0, 0.45); white-space: nowrap; opacity: 0; transform-origin: left bottom; pointer-events: none; }
.mh-hurt-num.is-shield { color: var(--cc-blue-light); }
.mh-foe { position: absolute; left: 0; top: 0; width: 92px; padding: 5px 7px 6px; border-radius: 9px; opacity: 0; transition: opacity 0.18s var(--ease-out); }
.mh-foe-name { font: 700 11px/1 var(--font-sans); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mh-foe-bar { height: 5px; border-radius: 3px; background: rgba(0, 0, 0, 0.5); overflow: hidden; }
.mh-foe-bar + .mh-foe-bar { margin-top: 3px; }
.mh-foe-bar span { display: block; height: 100%; transform-origin: left; transition: transform 0.18s var(--ease-out); }
.mh-foe-bar.is-shield span { background: var(--shield); }
.mh-foe-bar.is-health { height: 6px; }
.mh-foe-bar.is-health span { background: var(--health); }
/* recon marks: a red pin (cream outline) with a ring pulsing out, the distance in a pill; off screen, a red arrow on
   the edge pointing the enemy's way (--a, clockwise from ahead) */
.mh-mark { position: absolute; left: 0; top: 0; opacity: 0; display: flex; flex-direction: column-reverse; align-items: center; gap: 5px; pointer-events: none; }
.mh-mark-pin { position: relative; width: 16px; height: 16px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--cc-danger); border: var(--cc-stroke-w) solid var(--cc-stroke); box-shadow: var(--cc-s1); }
.mh-mark-pin::after { content: ''; position: absolute; inset: -9px; border-radius: 50%; border: var(--cc-stroke-w) solid var(--cc-danger); animation: mh-ping 1.1s var(--cc-ease) infinite; }
.mh-mark b { padding: 3px 8px 4px; border-radius: var(--cc-r-pill); background: var(--glass); border: var(--cc-stroke-w) solid var(--cc-stroke-soft); font: 700 12px/1 var(--cc-display); font-variant-numeric: tabular-nums; color: var(--cc-text); white-space: nowrap; }
.mh-mark.is-edge .mh-mark-pin { width: 24px; height: 24px; border: 0; border-radius: 0; background: var(--cc-danger); clip-path: polygon(50% 0, 100% 92%, 50% 70%, 0 92%); transform: rotate(var(--a, 0rad)); filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5)); }
.mh-mark.is-edge .mh-mark-pin::after { display: none; }
@keyframes mh-ping { from { transform: scale(0.35); opacity: 0.95; } to { transform: scale(1.7); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mh-mark-pin::after { animation: none; opacity: 0.6; } }

/* top bar */
.mh-top { position: absolute; top: 76px; right: var(--edge); display: flex; align-items: center; height: 38px; padding: 0 4px; border-radius: 12px; }
.mh-stat { display: flex; align-items: center; gap: 7px; padding: 0 12px; height: 100%; color: var(--text-2); }
.mh-stat + .mh-stat { border-left: 1px solid var(--divider); }
.mh-stat b { font: var(--num); font-size: 17px; color: var(--text); }
.mh-stat.is-storm { color: var(--storm); }
.mh-stat.is-storm.is-moving b { color: var(--storm); animation: mh-pulse 1.2s ease-in-out infinite; }
.mh-stat.is-recon { color: var(--recon); }
.mh-stat.is-recon.is-active b { color: var(--recon); }

/* kill feed */
.mh-feed { position: absolute; top: var(--edge); left: var(--edge); display: flex; flex-direction: column; align-items: flex-start; gap: 5px; max-width: 46vw; }
.mh-feed-row { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 9px; font-weight: 500; color: var(--text-2); animation: mh-in 0.35s var(--ease-out); transition: opacity 0.4s, transform 0.4s var(--ease-out); }
.mh-feed-row b { font-weight: 700; color: var(--text); }
.mh-feed-row.is-mine { background: var(--grain), rgba(255, 194, 26, 0.2); }
.mh-feed-row.is-mine b { color: var(--taxi); }
.mh-feed-row.is-out { opacity: 0; transform: translateX(-8px); }
.mh-feed-gun { width: 34px; height: 20px; }
.mh-feed-cause { font-size: 11px; color: var(--text-3); }
.mh-feed-head { font-size: 10.5px; font-weight: 700; color: var(--taxi); }

/* vitals */
.mh-vitals { position: absolute; left: 50%; bottom: var(--edge); transform: translateX(-50%); width: min(380px, 70vw); padding: 10px 14px 11px; border-radius: 14px; display: flex; flex-direction: column; gap: 6px; }
.mh-status { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); white-space: nowrap; padding: 4px 10px; border-radius: 8px; background: rgba(10, 11, 13, 0.7); color: var(--taxi); font-weight: 700; font-size: 12px; }
.mh-vital { display: grid; grid-template-columns: 18px 1fr 34px; align-items: center; gap: 9px; }
.mh-vital .mh-ic { width: 17px; height: 17px; }
.mh-vital.is-shield { color: var(--shield); }
.mh-vital.is-health { color: var(--health); }
.mh-vital-track { position: relative; height: 12px; border-radius: 4px; background: rgba(0, 0, 0, 0.5); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5); }
.mh-vital.is-health .mh-vital-track { height: 16px; }
.mh-vital-fill, .mh-vital-trail { position: absolute; inset: 0; transform-origin: left; }
.mh-vital-trail { background: rgba(255, 255, 255, 0.55); }
.mh-vital-fill { transition: transform 0.15s var(--ease-out); }
.mh-vital.is-shield .mh-vital-fill { background: linear-gradient(#8cc8ff, var(--shield) 55%, #2f7de1); }
.mh-vital.is-health .mh-vital-fill { background: linear-gradient(#a6f5c2, var(--health) 55%, #2fae5a); }
.mh-vital-track i { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: rgba(10, 11, 13, 0.7); z-index: 1; }
.mh-vital-num { font: var(--num); font-size: 18px; color: var(--text); text-align: right; }
.mh-vital.is-empty { opacity: 0.55; }
.mh-vital.is-low { color: var(--danger); }
.mh-vital.is-low .mh-vital-fill { background: linear-gradient(#ffb0a8, var(--danger) 55%, #c22d22); animation: mh-pulse 0.9s ease-in-out infinite; }

/* inventory */
.mh-inv { position: absolute; right: var(--edge); bottom: var(--edge); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.mh-ammo { display: flex; align-items: baseline; gap: 6px; }
.mh-ammo b { font: var(--num); font-size: 38px; }
.mh-ammo span { font: var(--num); font-size: 16px; color: var(--text-2); }
.mh-ammo span::before { content: '/'; margin-right: 6px; color: var(--text-3); }
.mh-ammo.is-low b { color: var(--danger); }
.mh-weapon-name { font-weight: 700; font-size: 12.5px; color: var(--text-2); min-height: 16px; }
.mh-slots { display: flex; gap: 6px; }
.mh-slot { position: relative; width: 66px; height: 62px; border-radius: 11px; display: grid; place-items: center; overflow: hidden; transition: transform 0.2s var(--ease-out), border-color 0.2s, background 0.2s; }
.mh-slot.is-empty { opacity: 0.55; }
.mh-slot.is-sel { transform: translateY(-6px); border-color: var(--taxi); background: var(--grain), rgba(40, 36, 22, 0.78); box-shadow: inset 0 1px 0 var(--glass-highlight), 0 0 0 1px var(--taxi), var(--shadow); }
.mh-slot kbd { position: absolute; top: 4px; left: 6px; font: 700 10px/1 var(--font-sans); color: var(--text-3); }
.mh-slot.is-sel kbd { color: var(--taxi); }
.mh-slot-icon { width: 50px; height: 30px; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6)); }
.mh-slot em { position: absolute; right: 6px; bottom: 6px; font: 700 11px/1 var(--font-sign); font-style: normal; color: var(--text); }
.mh-slot-band { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }
.mh-reserve { display: flex; gap: 12px; padding-right: 2px; }
.mh-ammo-tag { display: inline-flex; align-items: center; gap: 4px; }
.mh-ammo-tag img { width: 26px; height: 16px; }
.mh-ammo-tag b { font: var(--num); font-size: 12.5px; }
.mh-ammo-tag.is-none { opacity: 0.4; }

/* prompt & centre message */
.mh-prompt { position: absolute; left: 50%; bottom: calc(var(--edge) + 112px); transform: translateX(-50%); display: flex; align-items: center; gap: 9px; padding: 6px 12px 6px 6px; border-radius: 11px; font-weight: 700; animation: mh-prompt 0.25s var(--ease-out); }
.mh-prompt kbd { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--taxi); color: var(--taxi-ink); font: 600 13px/1 var(--cc-display); text-shadow: none; border: 1.5px solid var(--cc-stroke); border-bottom-width: 3px; }
.mh-prompt img { width: 40px; height: 24px; }
.mh-center { position: absolute; left: 50%; top: 24%; transform: translateX(-50%); max-width: 80vw; font: 700 24px/1.2 var(--font-sign); text-align: center; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6); }
.mh-center.is-in { animation: mh-rise 0.45s var(--ease-out); }

/* end screen */
/* the match's end: no dimming, the game plays on (your killer, the last fights); a compact see-through card docked
   low in the middle, over the HUD's bottom row */
.mh-end { position: absolute; inset: 0; display: grid; place-items: end center; padding-bottom: calc(var(--edge) + 4px); pointer-events: none; animation: mh-fade 0.5s var(--ease-out); }
.mh-end-panel { position: relative; overflow: hidden; width: min(560px, calc(100vw - 32px)); padding: 16px 22px 14px; border-radius: var(--cc-r-l); background: var(--cc-surface-veil); text-align: center; pointer-events: auto; animation: mh-panel 0.55s var(--ease-out); }
.mh-end-place { font: 700 52px/0.9 var(--cc-display); color: var(--text); letter-spacing: -0.02em; }
.mh-end-killer:empty { display: none; }
.mh-end-killer { margin: 10px 0 2px; }
.mh-end-cause { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; font: 700 18px/1.2 var(--cc-display); }
.mh-end-gun { width: 58px; height: 36px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45)); }
.mh-end-dist { color: var(--cc-steel); font: 600 15px/1 var(--cc-body); }
.mh-end-head { transform: rotate(-6deg); }
.mh-end-left { margin-top: 6px; font-size: 13.5px; color: var(--cc-steel); }
.mh-end.is-won .mh-end-place, .mh-end.is-won h2 { color: var(--taxi); }
.mh-end h2 { margin: 6px 0 2px; font: 700 24px/1.1 var(--cc-display); letter-spacing: -0.01em; text-wrap: balance; }
.mh-end p { color: var(--text-2); font-weight: 500; }
.mh-end-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 12px 0 14px; border-top: 1px solid var(--divider); border-bottom: 1px solid var(--divider); }
.mh-end-stats:empty { display: none; }
.mh-end-stat { padding: 12px 6px; display: flex; flex-direction: column; gap: 4px; }
.mh-end-stat + .mh-end-stat { border-left: 1px solid var(--divider); }
.mh-end-stat b { font: var(--num); font-size: 22px; }
.mh-end-stat span { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.mh-end-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.mh-btn { padding: 11px 16px; border-radius: var(--r-ctl); background: var(--taxi); color: var(--taxi-ink); font: 800 14px/1 var(--font-sans); text-shadow: none; cursor: pointer; transition: transform 0.15s var(--ease-out), filter 0.15s, background 0.15s; }
.mh-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.mh-btn:active { transform: translateY(1px); }
.mh-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.mh-btn.is-quiet { background: rgba(255, 255, 255, 0.1); color: var(--text); box-shadow: inset 0 0 0 1px var(--glass-border); }
.mh-btn.is-quiet:hover { background: rgba(255, 255, 255, 0.16); }
.mh-end-note { margin-top: 14px; font-size: 12px; color: var(--text-3); font-weight: 500; }

@keyframes mh-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes mh-rise { from { opacity: 0; transform: translate(-50%, 10px); filter: blur(4px); } }
@keyframes mh-fade { from { opacity: 0; } }
@keyframes mh-pulse { 50% { opacity: 0.55; } }
@keyframes mh-panel { from { opacity: 0; transform: translateY(12px) scale(0.98); filter: blur(4px); } }
@keyframes mh-prompt { from { opacity: 0; transform: translate(-50%, 6px); } }

/* flip the car upright (free roam & the match) */
.flip-prompt {
  position: fixed; left: 50%; bottom: calc(var(--edge) + 168px); transform: translateX(-50%); z-index: 45;
  display: flex; align-items: center; gap: 9px; padding: 6px 14px 6px 6px; border-radius: 11px; cursor: pointer;
  background: var(--glass); border: var(--cc-stroke-w) solid var(--cc-stroke);
  border: 1px solid var(--glass-border); box-shadow: inset 0 1px 0 var(--glass-highlight), var(--shadow);
  color: var(--text); font: 700 13px/1.3 var(--font-sans); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  animation: mh-prompt 0.25s var(--ease-out);
}
.flip-prompt[hidden] { display: none; }
.flip-prompt kbd { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--taxi); color: var(--taxi-ink); font: 600 13px/1 var(--cc-display); text-shadow: none; border: 1.5px solid var(--cc-stroke); border-bottom-width: 3px; }
.flip-prompt:focus-visible { outline: 2px solid var(--taxi); outline-offset: 2px; }
@media (pointer: coarse) { .flip-prompt kbd { display: none; } .flip-prompt { padding: 10px 16px; } }

@media (prefers-reduced-motion: reduce) {
  .mh *, .mh *::before { animation: none !important; transition: none !important; }
}
@media (max-width: 820px) {
  .mh-top { top: 66px; height: 34px; }
  .mh-feed { top: 108px; max-width: 70vw; }
  .mh-feed-row { padding: 4px 8px; font-size: 11.5px; }
  .mh-vitals { left: var(--edge); bottom: 92px; transform: none; width: min(260px, 64vw); padding: 7px 10px 8px; }
  .mh-vital { grid-template-columns: 14px 1fr 28px; gap: 7px; }
  .mh-vital-num { font-size: 15px; }
  .mh-status { left: 0; transform: none; }
  .mh-inv { right: 8px; left: 8px; align-items: stretch; }
  .mh-ammo, .mh-weapon-name { align-self: flex-end; }
  .mh-slots { justify-content: space-between; gap: 4px; }
  .mh-prompt { bottom: 196px; }
  .mh-stat { padding: 0 8px; }
  .mh-stat b { font-size: 15px; }
  .mh-slot { flex: 1; width: auto; max-width: 60px; height: 52px; }
  .mh-slot-icon { width: 38px; height: 24px; }
  .mh-ammo b { font-size: 30px; }
  .mh-ammo { position: absolute; right: 0; bottom: 64px; }
  .mh-weapon-name { position: absolute; right: 0; bottom: 104px; }
  .mh-reserve { display: none; }
}
/* an enemy in sight at range: a red chevron over its head */
.mh-spot { position: absolute; left: 0; top: 0; width: 12px; height: 9px; opacity: 0; transition: opacity 0.25s var(--ease-out); background: var(--danger); clip-path: polygon(0 0, 100% 0, 50% 100%); filter: drop-shadow(0 0 1px #000) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7)); }
/* cars' health: over a car you hit or aim at, and in the vitals while driving (taxi yellow, red once it burns) */
.mh-car .mh-foe-name { display: flex; align-items: center; gap: 5px; color: var(--taxi); }
.mh-car .mh-ic { width: 13px; height: 13px; }
.mh-foe-bar.is-car { height: 6px; }
.mh-foe-bar.is-car span { background: var(--taxi); }
.mh-car.is-burning .mh-foe-name { color: var(--danger); }
.mh-car.is-burning .mh-foe-bar span { background: var(--danger); animation: mh-pulse 0.6s ease-in-out infinite; }
.mh-vital.is-car { color: var(--taxi); }
.mh-vital.is-car .mh-vital-track { height: 8px; }
.mh-vital.is-car .mh-vital-fill { background: linear-gradient(#ffe68a, var(--taxi) 55%, #d9a300); }
.mh-vital.is-car .mh-vital-num { font-size: 14px; }
.mh-vital.is-car.is-low { color: var(--danger); }
.mh-vital[hidden] { display: none; }

/* ------------------------------------------------------------------------------------------------------------------
   Main menu & pause (js/menu.js): CodedCartoony (css/cartoony.css). A rail of Fredoka labels over the live city; the
   focused one becomes an outlined card (gold for the play actions), Settings / Account / Feedback are cards on the right
   ------------------------------------------------------------------------------------------------------------------ */
::selection { background: rgba(255, 194, 26, 0.32); color: var(--cc-text); }

.menu {
  --menu-x: clamp(20px, 7vw, 112px);
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  grid-template: auto 1fr auto / 1fr;
  padding: max(var(--edge), env(safe-area-inset-top)) var(--menu-x) max(var(--edge), env(safe-area-inset-bottom));
  color: var(--cc-text);
  font-family: var(--cc-body);
  animation: menu-in 0.5s var(--cc-ease);
}
.menu[hidden] { display: none; }
/* (the city shows through: ink on the left only, clear by mid-screen, plus a low band for the credit) */
.menu::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    var(--grain),
    linear-gradient(90deg, rgba(22, 18, 30, 0.92) 0%, rgba(22, 18, 30, 0.78) 44%, rgba(22, 18, 30, 0.32) 62%, rgba(22, 18, 30, 0) 78%),
    linear-gradient(0deg, rgba(22, 18, 30, 0.72) 0%, rgba(22, 18, 30, 0) 22%);
  pointer-events: none;
}
@keyframes menu-in { from { opacity: 0; } to { opacity: 1; } }

/* everything of play steps back while the menu is up */
body.menu-open .hud,
body.menu-open #touch-controls,
body.menu-open .mh,
body.menu-open .flip-prompt,
body.menu-open .quality-toast,
body.menu-open::before,
body.menu-open::after {
  opacity: 0 !important;
  visibility: hidden;
  pointer-events: none !important;
}

/* wordmark: "Coded" + the loading screen's gold "Life" sticker, small */
.menu-top { display: flex; align-items: center; gap: 20px; }
.menu-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 700 26px/1 var(--cc-display);
  color: var(--cc-text);
}
.menu-brand span {
  padding: 3px 9px 4px;
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: var(--cc-r-s);
  background: var(--cc-gold);
  color: var(--cc-on-pastel);
  box-shadow: var(--cc-s1);
  transform: rotate(-6deg);
}

.menu-rail {
  position: relative;
  align-self: center;
  width: min(600px, 100%);
}
.menu-list { list-style: none; display: grid; gap: clamp(4px, 0.9vh, 10px); }

/* each item keeps the same padding & a transparent outline at rest, so focusing one never shifts the rail */
.menu-item {
  display: grid;
  grid-template-rows: auto 0fr;
  justify-items: start;
  width: 100%;
  padding: 10px 22px 12px;
  border: var(--cc-stroke-w) solid transparent;
  border-radius: var(--cc-r-l);
  text-align: left;
  color: rgba(255, 247, 239, 0.62);
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease,
    transform 0.25s var(--cc-pop), grid-template-rows 0.42s var(--cc-ease);
}
.menu-item[hidden] { display: none; }
.menu-list li:has(> .menu-item[hidden]) { display: none; }
.menu-item.is-nope .menu-label { animation: menu-nope 0.36s var(--cc-ease); }
@keyframes menu-nope { 25% { transform: translateX(-6px) rotate(-2deg); } 60% { transform: translateX(4px) rotate(1deg); } }
.menu-item:focus-visible { outline: none; } /* (focus shows as the card itself) */
.menu-label {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font: 600 clamp(30px, 3.6vw, 50px)/1.05 var(--cc-display);
  letter-spacing: 0.005em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
}
.menu-sub { overflow: hidden; }
.menu-sub > span {
  display: block;
  max-width: 54ch;
  text-wrap: pretty;
  padding: 8px 0 2px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--cc-steel);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s ease, transform 0.42s var(--cc-ease);
}
.menu-item:hover:not(.is-focus) { color: var(--cc-text); }

/* focus: an outlined surface card, nudged right */
.menu-item.is-focus {
  grid-template-rows: auto 1fr;
  color: var(--cc-text);
  border-color: var(--cc-stroke);
  background: var(--cc-surface);
  box-shadow: var(--cc-s2);
  transform: translateX(8px);
}
.menu-item.is-focus .menu-label { text-shadow: none; }
.menu-item.is-focus .menu-sub > span { opacity: 1; transform: none; transition-delay: 0.08s; }
/* the play actions are the CTAs: their focused card is taxi gold */
.menu-item.is-focus:is([data-action="roam"], [data-action="match"], [data-action="resume"]):not([aria-disabled="true"]) {
  background: var(--cc-gold);
  color: var(--cc-on-pastel);
}
.menu-item.is-focus:is([data-action="roam"], [data-action="match"], [data-action="resume"]):not([aria-disabled="true"]) .menu-sub > span { color: rgba(42, 36, 56, 0.82); }
.menu-item:active { transform: translateX(8px) scale(0.98); }

.menu-item[aria-disabled="true"] { cursor: default; }
.menu-item[aria-disabled="true"] .menu-label { color: rgba(255, 247, 239, 0.34); }
.menu-item[aria-disabled="true"].is-focus .menu-label { color: rgba(255, 247, 239, 0.6); }

/* "Coming soon" / "Sign in to play": tilted stickers (cartoony.css .cc-sticker) */
.menu-soon {
  white-space: nowrap;
  padding: 6px 11px;
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: var(--cc-r-s);
  background: var(--cc-pink-light);
  color: var(--cc-on-pastel);
  font: 600 13px/1 var(--cc-display);
  letter-spacing: 0.01em;
  text-shadow: none;
  box-shadow: var(--cc-s1);
  transform: rotate(-6deg);
}
.menu-lock { background: var(--cc-mint); }

/* (the old gold underline: the focused card replaces it; js/menu.js still positions it) */
.menu-thread { display: none; }

.menu-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  font-size: 13px;
  font-weight: 600;
  color: var(--cc-concrete);
  transition: opacity 0.25s ease;
}
.menu-foot a { color: var(--cc-steel); }
.menu-keys { display: flex; gap: 18px; color: var(--cc-steel); }
.menu-keys > span { display: inline-flex; align-items: center; gap: 6px; }
.menu-keys > span[hidden] { display: none; }
/* keycaps (cartoony.css .cc-key) */
.menu-keys kbd, .settings kbd {
  display: inline-grid;
  place-items: center;
  min-width: 1.9em;
  height: auto;
  padding: 1px 7px 2px;
  margin: 0 1px;
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-bottom-width: 4px;
  border-radius: 8px;
  background: var(--cc-raised);
  box-shadow: none;
  font: 600 12.5px/1.35 var(--cc-display);
  color: var(--cc-gold);
}
.menu-key-ic { width: 12px; height: 12px; stroke-width: 2.6; margin: 2px 0; }
.menu-key-up { transform: rotate(180deg); }

/* Settings open: the rail steps back so the sheet holds the only focus */
.menu:has(.settings:not([hidden])) .menu-item.is-focus { color: rgba(255, 247, 239, 0.62); background: transparent; border-color: transparent; box-shadow: none; transform: none; }
.menu:has(.settings:not([hidden])) .menu-item.is-focus .menu-sub > span { opacity: 0; }

/* arriving from the loading screen: the labels pop up one after another */
.menu.is-title .menu-list > li { animation: menu-rise 0.55s var(--cc-pop) both; }
.menu.is-title .menu-list > li:nth-child(2) { animation-delay: 0.1s; }
.menu.is-title .menu-list > li:nth-child(3) { animation-delay: 0.16s; }
.menu.is-title .menu-list > li:nth-child(5) { animation-delay: 0.22s; }
.menu.is-title .menu-list > li:nth-child(6) { animation-delay: 0.28s; }
.menu.is-title .menu-list > li:nth-child(7) { animation-delay: 0.34s; }
.menu.is-title .menu-list > li:nth-child(8) { animation-delay: 0.4s; }
@keyframes menu-rise { from { opacity: 0; transform: translateY(18px) scale(0.96); } to { opacity: 1; transform: none; } }

/* ---- Settings sheet: an outlined card on the right (cartoony.css .cc-card) ---- */
.settings {
  position: absolute;
  top: max(var(--edge), env(safe-area-inset-top));
  right: max(var(--edge), env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  width: min(470px, calc(100vw - 2 * var(--edge)));
  max-height: calc(100% - 2 * max(var(--edge), env(safe-area-inset-top)));
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: var(--cc-r-l);
  background: var(--cc-surface);
  box-shadow: var(--cc-s4);
  color: var(--cc-text);
  font-family: var(--cc-body);
  animation: sheet-in 0.4s var(--cc-pop);
}
.settings[hidden] { display: none; }
.settings:focus { outline: none; }
@keyframes sheet-in { from { opacity: 0; transform: translateX(28px) rotate(1.5deg); } to { opacity: 1; transform: none; } }
.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 4px 24px;
}
.settings-head h2 { font: 700 26px/1.1 var(--cc-display); }

/* pill tabs (cartoony.css .cc-tab) */
.settings-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 16px 12px;
  border-bottom: var(--cc-stroke-w) dashed var(--cc-divider);
  overflow-x: auto;
  scrollbar-width: none;
}
.settings-tab {
  flex: none;
  padding: 6px 10px;
  border: var(--cc-stroke-w) solid transparent;
  border-radius: var(--cc-r-pill);
  color: var(--cc-steel);
  font: 600 13.5px/1.2 var(--cc-display);
  transition: background var(--cc-fast) ease-out, color var(--cc-fast) ease-out, border-color var(--cc-fast) ease-out;
}
.settings-tab:hover { color: var(--cc-text); background: var(--cc-raised); }
.settings-tab[aria-selected="true"] { border-color: var(--cc-stroke); background: var(--cc-gold); color: var(--cc-on-pastel); box-shadow: var(--cc-s1); }
.settings-tab:focus-visible { outline: 2px solid var(--cc-gold); outline-offset: 2px; }

.settings-panel {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 24px 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--cc-track) transparent;
}
.settings-panel[hidden] { display: none; }
.settings-panel::-webkit-scrollbar { width: 8px; }
.settings-panel::-webkit-scrollbar-thumb { border-radius: 6px; background: var(--cc-track); }

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  min-height: 66px;
  padding: 14px 0;
  border: 0;
  border-bottom: var(--cc-stroke-w) dashed var(--cc-divider);
  font-size: 15px;
}
.set-row > label,
.set-row > legend { color: var(--cc-text); font-weight: 700; }
fieldset.set-row > legend { float: left; padding: 0; }
.set-note { padding-top: 14px; max-width: 52ch; font-size: 13.5px; font-weight: 600; line-height: 1.55; color: var(--cc-steel); }

/* segmented choice: a chunky pill track, the selected one a gold pill */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: var(--cc-r-m);
  background: var(--cc-bg);
}
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.seg span {
  display: block;
  padding: 7px 12px;
  border-radius: 11px;
  font: 600 13.5px/1.25 var(--cc-display);
  color: var(--cc-steel);
  transition: background var(--cc-fast) ease-out, color var(--cc-fast) ease-out, transform var(--cc-fast) ease-out;
}
.seg label:hover span { color: var(--cc-text); background: var(--cc-raised); }
.seg input:checked + span { background: var(--cc-gold); color: var(--cc-on-pastel); box-shadow: var(--cc-s1); }
.seg label:active span { transform: scale(0.95); }
.seg input:focus-visible + span { outline: 2px solid var(--cc-gold); outline-offset: 2px; }

/* slider: a chunky outlined track, gold fill (--fill, set by js/menu.js), a cream knob */
.range { display: flex; align-items: center; gap: 14px; }
.range output {
  min-width: 46px;
  text-align: right;
  font: 600 15px/1 var(--cc-display);
  font-variant-numeric: tabular-nums;
  color: var(--cc-text);
}
.range input {
  -webkit-appearance: none;
  appearance: none;
  width: 168px;
  height: 28px;
  background: transparent;
  cursor: pointer;
}
.range input::-webkit-slider-runnable-track {
  height: 14px;
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cc-gold) var(--fill, 50%), var(--cc-track) var(--fill, 50%));
}
.range input::-moz-range-track { height: 10px; border: var(--cc-stroke-w) solid var(--cc-stroke); border-radius: 999px; background: var(--cc-track); }
.range input::-moz-range-progress { height: 10px; border-radius: 999px; background: var(--cc-gold); }
.range input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -7px;
  border: var(--cc-stroke-w) solid var(--cc-on-pastel);
  border-radius: 50%;
  background: var(--cc-text);
  box-shadow: var(--cc-s1);
  transition: transform var(--cc-fast) ease-out;
}
.range input::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: var(--cc-stroke-w) solid var(--cc-on-pastel);
  border-radius: 50%;
  background: var(--cc-text);
  box-shadow: var(--cc-s1);
}
.range input:active::-webkit-slider-thumb { transform: scale(1.15); }
.range input:focus-visible { outline: none; }
.range input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--cc-gold); }
.range input:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--cc-gold); }

/* on/off switch: outlined pill, gold when on */
.switch {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  width: 52px;
  height: 30px;
  flex: none;
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: 999px;
  background: var(--cc-track);
  cursor: pointer;
  transition: background 0.2s ease;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border: var(--cc-stroke-w) solid var(--cc-on-pastel);
  border-radius: 50%;
  box-sizing: border-box;
  background: var(--cc-text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s var(--cc-pop);
}
.switch:checked { background: var(--cc-gold); }
.switch:checked::after { transform: translateX(22px); }
.switch:focus-visible { outline: 2px solid var(--cc-gold); outline-offset: 3px; }

/* controls reference */
.settings-controls h3 {
  padding: 18px 0 10px;
  font: 600 15px/1.3 var(--cc-display);
  color: var(--cc-steel);
}
.keys {
  display: grid;
  grid-template-columns: minmax(118px, auto) 1fr;
  gap: 10px 16px;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
}
.keys dt { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; color: var(--cc-steel); }
.keys dd { color: var(--cc-text); }

/* touch: no keyboard hints; phones: the rail goes to the bottom, Settings fills the screen from below */
@media (hover: none) { .menu-keys { display: none; } }
@media (max-width: 620px), (max-height: 500px) {
  .menu { grid-template: auto 1fr auto auto / 1fr; padding-left: max(var(--edge), env(safe-area-inset-left)); padding-right: max(var(--edge), env(safe-area-inset-right)); }
  .menu::before {
    background:
      var(--grain),
      linear-gradient(180deg, rgba(22, 18, 30, 0.6) 0, rgba(22, 18, 30, 0) 130px),
      linear-gradient(0deg, rgba(22, 18, 30, 0.94) 0%, rgba(22, 18, 30, 0.74) 46%, rgba(22, 18, 30, 0) 78%);
  }
  .menu-rail { align-self: end; padding-bottom: 14px; }
  .menu-item { padding: 8px 16px 10px; }
  .menu-item.is-focus, .menu-item:active { transform: none; }
  .menu-label { font-size: clamp(26px, 7.6vw, 34px); flex-wrap: wrap; row-gap: 6px; }
  .menu-sub > span { padding-top: 6px; font-size: 14px; }
  .menu-foot { font-size: 11.5px; }
  .menu:has(.settings:not([hidden])) .menu-foot { opacity: 0; visibility: hidden; }
  .settings {
    top: auto;
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: auto;
    max-height: 86vh;
    animation-name: sheet-up;
  }
  .settings-panel { padding: 4px 18px 20px; }
  .settings-head { padding-left: 18px; }
  .range input { width: 128px; }
}
@media (max-height: 500px) {
  .menu-rail { align-self: center; }
  .menu-list { gap: 0; }
  .menu-item { padding-block: 4px 6px; }
  .menu-label { font-size: 24px; }
  .settings { top: 12px; max-height: calc(100% - 24px); }
}
@keyframes sheet-up { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .menu, .settings { animation: none; }
  .menu-item, .menu-sub > span, .switch::after, .seg span { transition: none; }
  .menu.is-title .menu-list > li { animation: none; }
}

/* ---- Account sheet (js/account.js): the Settings card, with forms ---- */
.acct-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 24px 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--cc-track) transparent;
}
.acct-view { display: grid; gap: 14px; }
.acct-view[hidden] { display: none; }
.acct-lead { font-size: 15px; font-weight: 600; line-height: 1.55; color: var(--cc-steel); }
.acct-msg {
  margin: 4px 0 14px;
  padding: 11px 14px;
  border: var(--cc-stroke-w) solid var(--cc-stroke-soft);
  border-radius: var(--cc-r-m);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--cc-text);
  background: var(--cc-raised);
}
.acct-msg[hidden] { display: none; }
.acct-msg.is-ok { border-color: var(--cc-green); background: var(--cc-ok-soft); }
.acct-msg.is-error { border-color: var(--cc-danger); background: var(--cc-danger-soft); }

/* text fields (cartoony.css .cc-field) */
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 700; color: var(--cc-text); }
.field input, .field textarea {
  height: 46px;
  padding: 0 14px;
  border: var(--cc-stroke-w) solid var(--cc-stroke-soft);
  border-radius: var(--cc-r-m);
  background: var(--cc-bg);
  font: 500 15px/1 var(--cc-body);
  color: var(--cc-text);
  caret-color: var(--cc-gold);
  transition: border-color var(--cc-fast) ease-out, box-shadow var(--cc-fast) ease-out;
}
.field input:hover, .field textarea:hover { border-color: rgba(255, 247, 239, 0.6); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--cc-gold); box-shadow: 0 0 0 4px var(--cc-gold-soft); }
.field input:-webkit-autofill { -webkit-text-fill-color: var(--cc-text); box-shadow: inset 0 0 0 40px var(--cc-bg); }
.field-hint { font-size: 13px; font-weight: 600; line-height: 1.45; color: var(--cc-concrete); }
.field-hint a, .menu-credit a { color: inherit; text-decoration: underline; text-decoration-color: var(--cc-gold); text-underline-offset: 3px; }

/* buttons: .btn-primary / .btn-quiet / .btn-danger are styled in css/cartoony.css; layout only here */
.btn-quiet { justify-self: start; }

.link-btn {
  justify-self: start;
  padding: 2px 0;
  font: 700 14px/1.4 var(--cc-body);
  color: var(--cc-text);
  text-decoration: underline;
  text-decoration-color: var(--cc-gold);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  transition: color var(--cc-fast) ease-out;
}
.link-btn:hover { color: var(--cc-gold); }
.link-btn.is-danger { color: var(--cc-danger); text-decoration-color: var(--cc-danger); }
.acct-switch { font-size: 14px; font-weight: 600; color: var(--cc-steel); }
.acct-switch .link-btn { margin-left: 4px; }

.acct-name { font: 700 30px/1.1 var(--cc-display); }
.acct-email { margin-top: -8px; font-size: 14px; font-weight: 600; color: var(--cc-steel); overflow-wrap: anywhere; }
.acct-verify {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: var(--cc-stroke-w) solid var(--cc-gold);
  border-radius: var(--cc-r-m);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--cc-steel);
  background: var(--cc-gold-soft);
}
.acct-verify[hidden] { display: none; }
.acct-verify strong { color: var(--cc-text); font-weight: 800; overflow-wrap: anywhere; }
.acct-view h3 {
  padding-top: 10px;
  font: 600 15px/1.3 var(--cc-display);
  color: var(--cc-steel);
}
.acct-data { display: flex; flex-wrap: wrap; gap: 8px 22px; }

/* Terms agreement on sign-up: an outlined box that fills gold */
.check { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; font-size: 14px; font-weight: 600; line-height: 1.5; color: var(--cc-steel); cursor: pointer; }
.check input {
  appearance: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin: 0;
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: 8px;
  background: var(--cc-bg);
  cursor: pointer;
  transition: background var(--cc-fast) ease-out, transform var(--cc-fast) ease-out;
}
.check input::after { content: ''; width: 10px; height: 5px; border: solid var(--cc-on-pastel); border-width: 0 0 3px 3px; transform: translateY(-1px) rotate(-45deg) scale(0); transition: transform 0.2s var(--cc-pop); }
.check input:checked { background: var(--cc-gold); }
.check input:checked::after { transform: translateY(-1px) rotate(-45deg) scale(1); }
.check input:active { transform: scale(0.9); }
.check input:focus-visible { outline: 2px solid var(--cc-gold); outline-offset: 2px; }
.check a { color: var(--cc-text); text-decoration: underline; text-decoration-color: var(--cc-gold); text-underline-offset: 3px; }

/* ---- Feedback sheet (js/feedback.js): the Account sheet's forms ---- */
.fb-form, .fb-done { display: grid; gap: 14px; }
.fb-form[hidden], .fb-done[hidden], .fb-guest[hidden], .fb-details[hidden] { display: none; }
.fb-kind { min-height: 0; padding: 0 0 4px; border-bottom: 0; }
.field textarea { height: auto; min-height: 124px; padding: 12px 14px; font-size: 15px; line-height: 1.5; resize: vertical; }
.field textarea::placeholder { color: var(--cc-concrete); }
@media (max-height: 500px) { .field textarea { min-height: 76px; } }
.fb-count { justify-self: end; font-variant-numeric: tabular-nums; }
.fb-count.is-near { color: var(--cc-gold); }
.field-optional { margin-left: 6px; font-weight: 500; color: var(--cc-concrete); }
.fb-details summary { width: max-content; cursor: pointer; font-size: 14px; font-weight: 700; color: var(--cc-steel); }
.fb-details summary:hover { color: var(--cc-text); }
.fb-context {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 10px 0 0;
  padding: 12px 14px;
  border: var(--cc-stroke-w) solid var(--cc-divider);
  border-radius: var(--cc-r-m);
  background: var(--cc-bg);
  font-size: 13px;
  line-height: 1.45;
}
.fb-context dt { color: var(--cc-concrete); }
.fb-context dd { margin: 0; color: var(--cc-text); overflow-wrap: anywhere; white-space: pre-line; }

/* the age rating in the menu's foot; the policy links under Settings > Privacy */
.menu-age { display: inline-block; margin-right: 6px; padding: 1px 7px; border: var(--cc-stroke-w) solid var(--cc-stroke); border-radius: 8px; font: 600 11.5px/1.4 var(--cc-display); color: var(--cc-text); }
.set-links { display: flex; gap: 20px; font-weight: 700; }
.set-links a { color: var(--cc-text); text-decoration: underline; text-decoration-color: var(--cc-gold); text-decoration-thickness: 2px; text-underline-offset: 4px; }
@media (max-width: 620px), (max-height: 500px) { .acct-body { padding: 4px 18px 20px; } }

/* ---- Players online (js/presence.js): a quiet glass pill top-left in play; on the menu a CodedCartoony pill ---- */
.hud-top-left { top: var(--edge); left: var(--edge); }
.online-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 600 12.5px/1 var(--font-sans);
  color: var(--text-2);
  white-space: nowrap;
}
.online-count[hidden] { display: none; }
.online-count.panel { height: 36px; padding: 0 14px 0 12px; border-radius: 999px; }
.online-num { font: 700 14px/1 var(--font-sign); font-variant-numeric: tabular-nums; color: var(--text); transform: translateY(1px); } /* (Overpass sits high beside Inter) */
.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(94, 224, 143, 0.18);
  animation: online-beat 2.4s ease-in-out infinite;
}
.menu .online-count {
  height: 34px;
  padding: 0 14px 0 12px;
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: var(--cc-r-pill);
  background: var(--cc-surface);
  box-shadow: var(--cc-s1);
  font: 700 13px/1 var(--cc-body);
  color: var(--cc-steel);
}
.menu .online-num { font: 600 15px/1 var(--cc-display); color: var(--cc-text); transform: none; }
.menu .online-dot { width: 9px; height: 9px; background: var(--cc-green); box-shadow: 0 0 0 3px rgba(110, 220, 160, 0.22); }
@keyframes online-beat { 50% { opacity: 0.45; } }
@media (max-width: 620px) {
  .hud .online-word { display: none; }
  .hud .online-count.panel { height: 32px; padding: 0 11px 0 10px; }
}
@media (prefers-reduced-motion: reduce) { .online-dot { animation: none; } }

/* ---- Battle Royale on touch screens (js/game/hud.js): fire (held), aim (a toggle), reload; tappable slots & prompt ---- */
.mh-touch { display: none; }
body.touch-enabled .mh-touch {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(max(var(--edge), env(safe-area-inset-bottom)) + 236px);
  display: grid;
  grid-template: 'reload .' 'aim fire' / 64px 84px;
  align-items: end;
  gap: 12px;
  pointer-events: auto;
}
.mh-touch .touch-action .icon { width: 22px; height: 22px; }
.mh-touch-reload { grid-area: reload; }
.mh-touch-aim { grid-area: aim; }
.mh-touch-aim[aria-pressed="true"] { color: var(--taxi-ink); background: var(--taxi); border-color: var(--taxi); }
.mh-touch-fire { grid-area: fire; width: 84px; height: 84px; border-color: rgba(255, 194, 26, 0.65); color: var(--taxi); }
.mh-touch-fire .icon { width: 30px; height: 30px; }
body.touch-enabled .mh-slot,
body.touch-enabled .mh-prompt { pointer-events: auto; cursor: pointer; }
@media (max-height: 500px) {
  body.touch-enabled .mh-touch { bottom: calc(max(var(--edge), env(safe-area-inset-bottom)) + 190px); grid-template: 'aim reload fire' / 56px 56px 76px; }
  /* (a phone in landscape: vitals narrow at the bottom centre, the slots above them, both clear of the joystick on
     the left and jump / boost on the right) */
  body.touch-enabled .mh-vitals { left: 50%; transform: translateX(-50%); bottom: max(var(--edge), env(safe-area-inset-bottom)); width: min(300px, 38vw); padding: 6px 10px 7px; }
  body.touch-enabled .mh-inv { right: calc(max(var(--edge), env(safe-area-inset-right)) + 150px); bottom: calc(max(var(--edge), env(safe-area-inset-bottom)) + 66px); }
  body.touch-enabled .mh-slot { width: 46px; height: 42px; }
  body.touch-enabled .mh-slot-icon { width: 34px; height: 22px; }
  body.touch-enabled .mh-ammo b { font-size: 26px; }
  body.touch-enabled .mh-reserve { display: none; }
  body.touch-enabled .mh-touch .touch-action:not(.mh-touch-fire) { width: 56px; height: 56px; }
  .mh-touch-fire { width: 76px; height: 76px; }
}

/* ---- Accessibility (Settings > Accessibility, js/menu.js) ---- */
/* HUD size */
body[data-hud-scale="115"] :is(.hud, .mh, #touch-controls) { zoom: 1.15; }
body[data-hud-scale="130"] :is(.hud, .mh, #touch-controls) { zoom: 1.3; }
/* reduce motion: every transition & animation settles at once (the scenic camera & shakes stop in js) */
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}
/* higher contrast: brighter secondary text, deeper scrims & shadows behind the bare HUD */
body.hud-contrast { --text-2: rgba(246, 245, 242, 0.9); --text-3: rgba(246, 245, 242, 0.72); }
body.hud-contrast::before { background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0)); }
body.hud-contrast::after { background: linear-gradient(to top, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0)); }
body.hud-contrast :is(.toolbar > *, .mode-switch, .cluster, .controls-hint, .online-count, .mh) {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95), 0 0 10px rgba(0, 0, 0, 0.8);
}
/* colour-blind-safe match colours (Okabe-Ito based: blue, lemon, vermilion, purple; light enough for a dark HUD) */
body.cb-safe .mh {
  --shield: #56b4e9;
  --health: #f0e442;
  --danger: #e8601c;
  --storm: #cc79a7;
  --recon: #9be3ff;
}
.set-touch-only { display: none; }
body.touch-enabled .set-touch-only { display: flex; }
.settings-tabs { overflow-x: auto; scrollbar-width: none; }
.settings-tab { flex: none; }

/* ---- Menu notices (js/pwa.js): "Update ready" & "Play from your home screen", only on the title & pause screens ---- */
.menu-notices {
  position: absolute;
  right: var(--menu-x);
  bottom: calc(max(var(--edge), env(safe-area-inset-bottom)) + 52px);
  display: grid;
  gap: 14px;
  width: min(360px, calc(100% - 2 * var(--edge)));
}
.menu-notices:empty { display: none; }
.menu:has(.settings:not([hidden])) .menu-notices { display: none; }
.notice {
  padding: 16px 18px;
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: var(--cc-r-l);
  background: var(--cc-surface);
  box-shadow: var(--cc-s3);
  color: var(--cc-text);
  animation: rise-in 0.45s var(--cc-pop) both;
}
.notice h3 { font: 600 17px/1.2 var(--cc-display); }
.notice p { margin-top: 6px; font-size: 14px; font-weight: 600; line-height: 1.5; color: var(--cc-steel); }
.notice strong { color: var(--cc-text); font-weight: 800; }
.notice-share { width: 16px; height: 16px; vertical-align: -3px; color: var(--cc-text); }
.notice-actions { display: flex; gap: 10px; margin-top: 14px; }
.notice-actions :is(.btn-primary, .btn-quiet) { min-height: 40px; padding: 8px 14px; font-size: 14px; }
@media (max-width: 620px), (max-height: 500px) {
  .menu-notices { top: calc(max(var(--edge), env(safe-area-inset-top)) + 44px); bottom: auto; left: max(var(--edge), env(safe-area-inset-left)); right: max(var(--edge), env(safe-area-inset-right)); width: auto; }
}
.in-match .touch-look-hint { display: none; }

/* ---- Walk-in rooms (js/interiors): the ink cover between city & hall, the room's corner, the city HUD put away ---- */
.room-fade {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  background: var(--cc-bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s var(--cc-ease);
}
.room-fade.shown { opacity: 1; pointer-events: auto; }
.room-fade-name {
  margin: 0;
  color: var(--cc-text);
  font: 600 clamp(30px, 4vw, 44px)/1.1 var(--cc-display);
  transform: translateY(6px);
  transition: transform 0.32s var(--cc-pop);
}
.room-fade.shown .room-fade-name { transform: none; }
.room-hud {
  position: fixed;
  left: var(--edge);
  bottom: var(--edge);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55), 0 2px 12px rgba(0, 0, 0, 0.35);
}
.room-hud[hidden] { display: none; }
.room-hud-name { color: var(--cc-text); font: 600 24px/1.1 var(--cc-display); }
.room-hud-sub { color: var(--cc-steel); font: 600 13.5px/1.4 var(--cc-body); }
.room-hud-leave { margin-top: 8px; min-height: 38px; padding: 6px 16px; font-size: 15px; pointer-events: auto; text-shadow: none; }
.hud-minimized .room-hud { opacity: 0; }
.room-hud-actions { display: flex; gap: 8px; margin-top: 8px; }
.room-hud-actions .cc-btn { min-height: 38px; padding: 6px 16px; font-size: 15px; pointer-events: auto; text-shadow: none; }
.room-hud-actions .cc-key { font-size: 11px; }
@media (pointer: coarse) { .room-hud-actions .cc-key { display: none; } }

/* names & speech bubbles over heads (js/interiors/room-people.js), projected each frame */
.room-tags { position: fixed; inset: 0; z-index: 9; pointer-events: none; overflow: hidden; }
.room-tag {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  will-change: transform;
}
.room-tag-name {
  color: var(--cc-text);
  font: 600 14px/1 var(--cc-display);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 2px 10px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}
.room-tag-say {
  max-width: 240px;
  margin: 0 0 4px;
  padding: 7px 12px 8px;
  color: var(--cc-text);
  font: 700 14px/1.35 var(--cc-body);
  text-align: center;
  overflow-wrap: anywhere;
  animation: rise-in 0.2s var(--cc-pop) both;
}
.room-tag-say[hidden] { display: none; }
/* voice: a ring round the name of whoever is heard speaking (green: online), ours gold while we talk */
.room-tag.speaking .room-tag-name {
  padding: 3px 10px 4px;
  border: var(--cc-stroke-w) solid var(--cc-green);
  border-radius: var(--cc-r-pill);
  background: var(--cc-surface);
  text-shadow: none;
  box-shadow: var(--cc-s1);
}
.room-tag--self.speaking .room-tag-name { border-color: var(--cc-gold); }
.room-tag--self .room-tag-name:empty { display: none; }
.room-hud-talk { touch-action: none; user-select: none; -webkit-user-select: none; }
.room-hud-talk[hidden] { display: none; }
.room-hud-talk[aria-pressed="true"] { background: var(--cc-gold); color: var(--cc-on-pastel); }

/* the chat: lines over play (no panel), the field bottom centre, a card for a tapped name */
.room-chat {
  position: fixed;
  left: var(--edge);
  bottom: calc(var(--edge) + 128px);
  z-index: 10;
  width: min(380px, calc(100vw - 2 * var(--edge)));
  pointer-events: none;
}
.room-chat[hidden] { display: none; }
.room-chat-log { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.room-chat-log li {
  color: var(--cc-text);
  font: 600 14.5px/1.4 var(--cc-body);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 2px 10px rgba(0, 0, 0, 0.35);
  overflow-wrap: anywhere;
  transition: opacity 0.6s ease;
}
.room-chat-log li.old { opacity: 0.5; }
.room-chat-who {
  margin-right: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--cc-steel);
  font: 600 14.5px/1.4 var(--cc-display);
  text-shadow: inherit;
}
span.room-chat-who { color: var(--cc-gold); }
button.room-chat-who { cursor: pointer; pointer-events: auto; }
button.room-chat-who:hover { color: var(--cc-text); text-decoration: underline 2px var(--cc-gold); text-underline-offset: 3px; }
button.room-chat-who:focus-visible { outline: 2px solid var(--cc-gold); outline-offset: 2px; border-radius: 4px; }
.room-chat-note { color: var(--cc-concrete) !important; font-size: 13px !important; }
.room-chat-entry {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--edge) + 72px);
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(560px, calc(100vw - 2 * var(--edge)));
  margin-inline: auto;
  animation: rise-in 0.2s var(--cc-ease) both;
}
.room-chat-entry[hidden] { display: none; }
.room-chat-field { flex: 1; min-width: 0; box-shadow: var(--cc-s2); }
.room-chat-keys {
  flex: none;
  color: var(--cc-steel);
  font: 600 13px/1 var(--cc-body);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}
@media (pointer: coarse) { .room-chat-keys { display: none; } }
.room-person {
  position: fixed;
  left: var(--edge);
  bottom: calc(var(--edge) + 128px);
  z-index: 15;
  width: min(280px, calc(100vw - 2 * var(--edge)));
  padding: 14px 16px 12px;
  animation: rise-in 0.2s var(--cc-pop) both;
}
.room-person[hidden] { display: none; }
.room-person-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.room-person-name { font: 700 20px/1.2 var(--cc-display); overflow-wrap: anywhere; }
.room-person-actions { display: flex; gap: 8px; margin-top: 12px; }
.room-person-actions .cc-btn { flex: 1; min-height: 40px; padding: 8px 12px; font-size: 15px; }
.room-person-note { margin: 10px 0 0; color: var(--cc-concrete); font: 600 12.5px/1.4 var(--cc-body); }
.room-chat-entry.shout .room-chat-field { border-color: var(--cc-gold); }
/* what a shoutout is, over its button on hover or keyboard focus */
.room-hud-tipwrap { position: relative; display: inline-flex; }
.room-hud-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 14px);
  width: 270px;
  margin: 0;
  color: var(--cc-text);
  font: 600 13.5px/1.45 var(--cc-body);
  text-shadow: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  pointer-events: none;
  transition: opacity var(--cc-fast) ease-out, transform var(--cc-fast) var(--cc-ease);
}
.room-hud-tipwrap:hover .room-hud-tip,
.room-hud-shout:focus-visible + .room-hud-tip { opacity: 1; transform: translate(-50%, 0); }
.reduce-motion .room-hud-tip { transition: none; }

/* ---- In-game cedis (js/wallet-panel.js, js/jobs.js, js/toast.js) ---- */
.hud-top-left { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px 0 7px;
  color: var(--cc-text);
  font: 600 19px/1 var(--cc-display);
  font-variant-numeric: tabular-nums;
  pointer-events: auto;
  cursor: pointer;
  transition: transform var(--cc-fast) ease-out, box-shadow var(--cc-fast) ease-out, background var(--cc-fast) ease-out;
}
.wallet-pill[hidden] { display: none; }
#btn-teleport:disabled { opacity: 0.45; cursor: not-allowed; }
.wallet-pill:hover { transform: translateY(-2px); box-shadow: var(--cc-s2); }
.wallet-pill:active { transform: translateY(1px) scale(0.96); }
.wallet-pill:focus-visible { outline: 2px solid var(--cc-gold); outline-offset: 3px; }
.wallet-pill.is-open { background: var(--cc-gold); color: var(--cc-on-pastel); }
.wallet-pill.signed-out { font: 600 14px/1 var(--cc-display); color: var(--cc-steel); }
.wallet-sign {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: 50%;
  background: var(--cc-gold);
  color: var(--cc-on-pastel);
  font: 700 15px/1 var(--cc-display);
}
.job-line {
  max-width: min(420px, 60vw);
  margin: 0;
  color: var(--cc-text);
  font: 600 13.5px/1.35 var(--cc-body);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 2px 10px rgba(0, 0, 0, 0.35);
}
.job-line[hidden] { display: none; }
.wallet-card { width: min(360px, calc(100vw - 2 * var(--edge))); padding: 12px; }
.wallet-head { display: flex; flex-direction: column; gap: 2px; padding: 4px 10px 8px; }
.wallet-big { font: 700 30px/1.1 var(--cc-display); font-variant-numeric: tabular-nums; color: var(--cc-text); }
.wallet-note, .wallet-sub { color: var(--cc-concrete); font: 600 12.5px/1.4 var(--cc-body); }
.wallet-sub { display: block; }
.wallet-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 10px; }
.wallet-row-text { color: var(--cc-steel); font: 600 13.5px/1.4 var(--cc-body); }
.wallet-row-text strong { display: block; color: var(--cc-text); font: 600 14.5px/1.3 var(--cc-display); }
.wallet-btn { flex: none; min-height: 36px; padding: 6px 14px; font-size: 14px; }
.wallet-recent { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 4px 10px; list-style: none; }
.wallet-recent li { display: flex; justify-content: space-between; color: var(--cc-steel); font: 600 13px/1.4 var(--cc-body); }
.wallet-in { color: var(--cc-green); font-family: var(--cc-display); }
.wallet-out { color: var(--cc-steel); font-family: var(--cc-display); }
.wallet-fine { margin: 8px 10px 2px; color: var(--cc-concrete); font: 600 12px/1.4 var(--cc-body); }
.game-toasts {
  position: fixed;
  top: calc(var(--edge) + 52px);
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.game-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(520px, calc(100vw - 2 * var(--edge)));
  padding: 10px 16px;
  font: 600 14px/1.4 var(--cc-body);
  animation: rise-in 0.22s var(--cc-pop) both;
  transition: opacity 0.26s ease, transform 0.26s ease;
}
.game-toast.going { opacity: 0; transform: translateY(-6px); }
.game-toast--error { border-color: var(--cc-danger); }
.game-toast-amount { flex: none; font-size: 15px; }
.reduce-motion .game-toast { animation: none; transition: none; }
.in-room #mode-switch,
.in-room .hud-bottom-left,
.in-room .hud-bottom-right,
.in-room #btn-teleport,
.in-room #btn-open-map,
.in-room [data-camera] { display: none !important; }
.reduce-motion .room-fade, .reduce-motion .room-fade-name { transition: none; }
.reduce-motion .room-tag-say, .reduce-motion .room-chat-entry, .reduce-motion .room-person { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .room-fade, .room-fade-name { transition: none; }
}
/* a larger HUD: the key hints wrap narrower instead of running into the speed cluster */
body[data-hud-scale="115"] .controls-hint { max-width: 500px; }
body[data-hud-scale="130"] .controls-hint { max-width: 420px; }

/* ---- Graphics reset (main.js showGraphicsLost): the GPU device was lost; one card over the frozen frame ---- */
.gpu-lost { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; padding: 16px; background: var(--cc-surface-veil); }
.gpu-lost-card { max-width: 380px; padding: 24px; text-align: center; }
.gpu-lost-card h2 { margin: 0 0 8px; font: 600 22px/1.2 var(--cc-display); }
.gpu-lost-card p { margin: 0 0 20px; font: 500 15px/1.5 var(--cc-body); color: var(--cc-steel); }
