:root {
  --ink: #0b1418;
  --ink-2: #14343c;
  --cyan: #7fb2c4;
  --sand: #e3d3b8;
  --coral: #c97b5a;
  --amber: #f2a03d;
  --green: #2f4a34;
  --paper: #f5f1e8;
  --plate: rgba(9, 17, 21, 0.46);
  --plate-strong: rgba(8, 15, 19, 0.72);
  --hair: rgba(245, 241, 232, 0.18);
  --hair-soft: rgba(245, 241, 232, 0.09);
  --label: rgba(245, 241, 232, 0.62);
  --mono: "Azeret Mono", ui-monospace, monospace;
  --text: "Archivo", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --tl: max(12px, env(safe-area-inset-left));
  --tr: max(12px, env(safe-area-inset-right));
  --tt: max(12px, env(safe-area-inset-top));
  --tb: max(12px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: #071013; overflow: hidden; }
body {
  font-family: var(--text);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  touch-action: none;
}
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
#app { position: fixed; inset: 0; overflow: hidden; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: #071013; z-index: 0; filter: saturate(1.12) contrast(1.06) brightness(0.97); }
#grade, #grain, #vignette { position: absolute; inset: 0; pointer-events: none; }
#grade {
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(42, 112, 154, 0.18) 0%, rgba(255, 188, 120, 0.05) 46%, rgba(11, 20, 24, 0.26) 100%),
    radial-gradient(90% 55% at 70% 48%, rgba(255, 176, 96, 0.16), transparent 62%),
    linear-gradient(150deg, rgba(42, 120, 140, 0.12), transparent 45%);
  mix-blend-mode: soft-light;
}
#grain {
  z-index: 3;
  opacity: 0.055;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 0.7s steps(2) infinite;
}
@keyframes grainShift {
  0% { transform: translate3d(0, 0, 0); }
  33% { transform: translate3d(-1.4%, 1%, 0); }
  66% { transform: translate3d(1%, -1.2%, 0); }
  100% { transform: translate3d(0.4%, 0.8%, 0); }
}
#vignette {
  z-index: 4;
  background:
    radial-gradient(85% 75% at 50% 48%, transparent 48%, rgba(4, 9, 11, 0.34) 82%, rgba(4, 9, 11, 0.62) 100%),
    linear-gradient(180deg, rgba(4, 9, 11, 0.30) 0%, transparent 13%, transparent 86%, rgba(4, 9, 11, 0.36) 100%);
}

/* ---------------------------------------------------------------- */
/* HUD                                                               */
/* ---------------------------------------------------------------- */
#hud { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
#reticle {
  position: absolute; left: 50%; top: 50%; width: 26px; height: 26px;
  margin: -13px 0 0 -13px; z-index: 12; pointer-events: none; opacity: 0.82;
}
#reticle .reticle-dot {
  position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -1.5px 0 0 -1.5px;
  border-radius: 50%; background: rgba(245, 241, 232, 0.92); box-shadow: 0 0 4px rgba(0, 0, 0, 0.7);
}
#reticle .reticle-tick { position: absolute; background: rgba(245, 241, 232, 0.66); box-shadow: 0 0 3px rgba(0, 0, 0, 0.6); }
#reticle .reticle-tick.top { left: 50%; top: 0; width: 1px; height: 6px; margin-left: -0.5px; }
#reticle .reticle-tick.bottom { left: 50%; bottom: 0; width: 1px; height: 6px; margin-left: -0.5px; }
#reticle .reticle-tick.left { top: 50%; left: 0; width: 6px; height: 1px; margin-top: -0.5px; }
#reticle .reticle-tick.right { top: 50%; right: 0; width: 6px; height: 1px; margin-top: -0.5px; }
body.paused #hud, body.paused #touchUI, body.map-open #hud, body.map-open #touchUI { display: none; }
#hud .panel, #hud button { pointer-events: auto; }
.panel {
  background: linear-gradient(155deg, rgba(16, 30, 35, 0.58), rgba(7, 14, 18, 0.50));
  border: 1px solid var(--hair);
  border-radius: 15px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(13px) saturate(0.9);
  -webkit-backdrop-filter: blur(13px) saturate(0.9);
}
.label {
  font-family: var(--text);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--label);
  line-height: 1.2;
  white-space: nowrap;
}
.hairline { height: 1px; background: var(--hair-soft); margin: 9px 0; }

.minimap-panel {
  position: absolute; top: var(--tt); left: var(--tl);
  width: clamp(140px, 16vw, 202px);
  padding: 9px 9px 7px;
}
.minimap-frame { position: relative; width: 100%; aspect-ratio: 1; border-radius: 11px; overflow: hidden; background: #0d1b20; }
#minimap { width: 100%; height: 100%; display: block; }
.minimap-ring {
  position: absolute; inset: 0; border-radius: 11px;
  box-shadow: inset 0 0 0 1px rgba(245, 241, 232, 0.14), inset 0 0 26px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.minimap-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 6px 2px 0;
  font-family: var(--text); font-size: 8px; font-weight: 600;
  letter-spacing: 0.17em; color: var(--label); text-transform: uppercase;
}
.minimap-meta .mono { font-size: 8px; letter-spacing: 0.1em; color: rgba(245, 241, 232, 0.42); }
.glyph-btn {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 0; border: 0; background: transparent; color: var(--paper);
  cursor: pointer; border-radius: 9px; overflow: hidden;
  position: relative;
}
.glyph-btn img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 9px; }
.glyph-btn span {
  font-family: var(--text); font-size: 7px; font-weight: 600;
  letter-spacing: 0.2em; color: rgba(245, 241, 232, 0.66);
}
.glyph-btn:hover img, .glyph-btn:focus-visible img { filter: brightness(1.22) saturate(1.05); }
.glyph-btn:focus-visible { outline: 1px solid var(--amber); outline-offset: 2px; }
.map-open {
  position: absolute; z-index: 4; right: 12px; bottom: 24px;
  width: 30px; height: 32px; border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
}
.map-open img { border-radius: 8px; }
.glyph-tile { width: 42px; height: 46px; border-radius: 10px; overflow: hidden; flex: 0 0 auto; }
.glyph-tile.small { width: 38px; height: 42px; }
.glyph-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }

.status-stack {
  position: absolute; top: var(--tt); right: var(--tr);
  display: flex; flex-direction: column; align-items: flex-end; gap: 7px;
}
.status-panel { width: clamp(190px, 21vw, 272px); padding: 10px 12px 11px; }
.status-row { display: flex; align-items: center; gap: 10px; }
.status-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mode-sub { font-family: var(--text); font-size: 8px; letter-spacing: 0.15em; color: rgba(245, 241, 232, 0.38); text-transform: uppercase; }
.clock-block { display: flex; flex-direction: column; gap: 2px; }
.clock { font-size: 21px; font-weight: 400; letter-spacing: 0.03em; color: var(--paper); line-height: 1; }
.cash-block { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.cash { font-size: 15px; color: var(--amber); line-height: 1; letter-spacing: 0.02em; }
.tiny-btn {
  position: relative; z-index: 2;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 10px; border-radius: 9px; cursor: pointer;
  font-family: var(--text); font-size: 8px; font-weight: 600;
  letter-spacing: 0.2em; color: var(--label); background: rgba(8, 15, 19, 0.48);
  border: 1px solid var(--hair-soft);
}
.tiny-btn .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.tiny-btn.muted .dot { background: rgba(245, 241, 232, 0.25); box-shadow: none; }

.speed-panel {
  position: absolute; bottom: var(--tb); left: var(--tl);
  width: clamp(160px, 17vw, 210px);
  padding: 11px 14px 12px;
}
.speed-line { display: flex; align-items: baseline; gap: 7px; }
.speed { font-size: clamp(32px, 5.2vw, 46px); font-weight: 300; line-height: 0.92; letter-spacing: -0.03em; color: var(--paper); }
.speed-line .unit { font-size: 8px; letter-spacing: 0.18em; }
.gear-line { display: flex; align-items: center; gap: 7px; margin-top: 5px; }
.gear { font-size: 14px; color: var(--amber); letter-spacing: 0.04em; }
.gear-line .surface { margin-left: auto; font-size: 7.5px; letter-spacing: 0.12em; color: rgba(245, 241, 232, 0.42); }
.rpm-track { margin-top: 9px; height: 2px; background: rgba(245, 241, 232, 0.12); overflow: hidden; border-radius: 2px; }
.rpm-track i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--cyan), var(--amber)); transition: width 80ms linear; }

.right-controls {
  position: absolute; right: var(--tr); bottom: var(--tb);
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
.control-panel { display: flex; gap: 6px; padding: 6px; }
.control-panel .glyph-btn { width: 48px; height: 58px; padding-bottom: 3px; }
.control-panel .glyph-btn img { width: 46px; height: 48px; }
.slots { display: flex; gap: 5px; }
.slot {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  padding: 6px 9px; min-width: 58px;
  border: 1px solid var(--hair-soft); border-radius: 8px;
  background: rgba(8, 15, 19, 0.36);
  backdrop-filter: blur(8px);
}
.slot span { font-family: var(--text); font-size: 6.5px; font-weight: 600; letter-spacing: 0.18em; color: rgba(245, 241, 232, 0.36); }
.slot b { font-family: var(--mono); font-size: 10px; font-weight: 400; color: rgba(245, 241, 232, 0.42); letter-spacing: 0.08em; }

.hint-pill {
  position: absolute; bottom: calc(var(--tb) + 2px); left: 50%; transform: translateX(-50%);
  padding: 8px 15px; border-radius: 999px;
  font-family: var(--text); font-size: 8px; font-weight: 500;
  letter-spacing: 0.13em; text-transform: uppercase; color: rgba(245, 241, 232, 0.52);
  white-space: nowrap; max-width: 62vw; overflow: hidden; text-overflow: ellipsis;
}
.hint-pill kbd {
  font-family: var(--mono); font-size: 8px; font-weight: 500;
  color: rgba(245, 241, 232, 0.76); background: rgba(245, 241, 232, 0.08);
  border: 1px solid rgba(245, 241, 232, 0.10); border-radius: 3px;
  padding: 2px 4px; margin: 0 1px;
}
.hint-pill i { font-style: normal; color: rgba(245, 241, 232, 0.22); margin: 0 4px; }
.hint-touch { display: none; }

/* ---------------------------------------------------------------- */
/* opening gate                                                      */
/* ---------------------------------------------------------------- */
#gate {
  position: absolute; inset: 0; z-index: 30; overflow: hidden;
  background: #0a1114;
  transition: opacity 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}
#gate.fading { opacity: 0; pointer-events: none; }
#gatePlate {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.035);
  animation: gateDrift 26s ease-out forwards;
  filter: saturate(1.02) contrast(1.02);
}
@keyframes gateDrift { from { transform: scale(1.02); } to { transform: scale(1.075) translate3d(-0.5%, -0.4%, 0); } }
.gate-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(6, 12, 15, 0.48) 0%, rgba(6, 12, 15, 0.10) 26%, rgba(6, 12, 15, 0.02) 48%, rgba(6, 12, 15, 0.24) 78%, rgba(6, 12, 15, 0.72) 100%),
    radial-gradient(80% 65% at 50% 38%, transparent 30%, rgba(5, 10, 12, 0.42) 100%);
}
.gate-content {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: clamp(26px, 7vh, 74px) 6vw 0;
  text-align: center;
}
.wordmark { display: flex; flex-direction: column; align-items: center; }
.wordmark-main {
  width: min(70vw, 740px, 92vh);
  aspect-ratio: 977 / 264;
  overflow: hidden;
  filter: drop-shadow(0 16px 34px rgba(0, 0, 0, 0.45));
}
.wordmark-main img { width: 100%; display: block; }
.wordmark-sub {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(13px, 2.1vw, 24px);
  letter-spacing: 0.44em;
  text-indent: 0.44em;
  text-transform: uppercase;
  color: #f6eee0;
  margin-top: clamp(4px, 1.1vh, 12px);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55), 0 0 28px rgba(255, 190, 120, 0.18);
}
.gate-line {
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(12px, 1.55vw, 17px);
  letter-spacing: 0.04em;
  color: rgba(245, 241, 232, 0.78);
  margin: clamp(14px, 3.6vh, 34px) 0 clamp(16px, 3.4vh, 30px);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.6);
}
#enterBtn {
  display: inline-flex; align-items: center; gap: 16px;
  padding: 14px 22px 14px 28px;
  background: rgba(242, 160, 61, 0.10);
  border: 1px solid rgba(242, 160, 61, 0.68);
  border-radius: 2px;
  color: #f7eee1; cursor: pointer;
  font-family: var(--text); font-size: 11px; font-weight: 600;
  letter-spacing: 0.3em; text-transform: uppercase;
  backdrop-filter: blur(6px);
  transition: background 0.35s, border-color 0.35s, box-shadow 0.35s;
}
#enterBtn:hover, #enterBtn:focus-visible {
  background: rgba(242, 160, 61, 0.24);
  border-color: var(--amber);
  box-shadow: 0 0 34px rgba(242, 160, 61, 0.24);
  outline: none;
}
.enter-key {
  font-family: var(--mono); font-size: 8px; letter-spacing: 0.12em;
  color: rgba(245, 241, 232, 0.56);
  border: 1px solid rgba(245, 241, 232, 0.20);
  border-radius: 3px; padding: 3px 6px;
}
.gate-meta {
  display: flex; gap: 12px; align-items: center;
  margin-top: clamp(14px, 3.2vh, 30px);
  font-family: var(--text); font-size: 7.5px; font-weight: 600;
  letter-spacing: 0.24em; text-transform: uppercase; color: rgba(245, 241, 232, 0.42);
}
.gate-meta i { font-style: normal; color: rgba(245, 241, 232, 0.2); }
.gate-foot {
  position: absolute; left: 0; right: 0; bottom: calc(var(--tb) + 4px);
  display: flex; justify-content: center; gap: clamp(18px, 5vw, 60px);
  font-family: var(--text); font-size: 7.5px; font-weight: 500;
  letter-spacing: 0.22em; color: rgba(245, 241, 232, 0.34);
  text-transform: uppercase;
}

/* ---------------------------------------------------------------- */
/* loading                                                           */
/* ---------------------------------------------------------------- */
#loading {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(80% 80% at 50% 40%, #102329 0%, #071013 70%);
  transition: opacity 0.7s ease;
}
#loading.fading { opacity: 0; }
.loading-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.loading-word {
  font-family: var(--display); font-size: clamp(22px, 3.4vw, 38px);
  letter-spacing: 0.28em; text-indent: 0.28em; color: rgba(245, 241, 232, 0.86);
}
.loading-bar { width: 180px; height: 1px; background: rgba(245, 241, 232, 0.14); overflow: hidden; }
.loading-bar i { display: block; width: 40%; height: 100%; background: var(--amber); animation: loadSlide 1.1s ease-in-out infinite; }
@keyframes loadSlide { 0% { transform: translateX(-100%); } 100% { transform: translateX(280%); } }
.loading-note { font-family: var(--text); font-size: 8px; letter-spacing: 0.26em; text-transform: uppercase; color: rgba(245, 241, 232, 0.38); }

/* ---------------------------------------------------------------- */
/* map, pause, toast                                                 */
/* ---------------------------------------------------------------- */
#mapOverlay, #pauseMenu {
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 9, 11, 0.66);
  backdrop-filter: blur(12px);
  padding: 3vh 3vw;
}
.map-sheet {
  width: min(1080px, 94vw);
  background: linear-gradient(160deg, rgba(18, 36, 42, 0.92), rgba(7, 14, 18, 0.93));
  border: 1px solid var(--hair);
  border-radius: 18px;
  padding: 16px 18px 14px;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.5);
}
.map-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 10px; }
.map-head h2 { font-family: var(--text); font-weight: 600; font-size: 12px; letter-spacing: 0.28em; margin: 0 0 4px; color: var(--paper); text-transform: uppercase; }
.map-head p { margin: 0; font-family: var(--display); font-style: italic; font-size: 13px; color: rgba(245, 241, 232, 0.5); letter-spacing: 0.02em; }
#bigMap { width: 100%; height: auto; display: block; border-radius: 12px; background: #0a1a1f; border: 1px solid var(--hair-soft); }
.map-legend { display: flex; gap: 18px; margin-top: 10px; font-family: var(--text); font-size: 7px; font-weight: 600; letter-spacing: 0.18em; color: rgba(245, 241, 232, 0.44); text-transform: uppercase; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.sw.road { background: #d9d1b8; }
.sw.beach { background: #d6c19a; }
.sw.water { background: #1d4a53; }
.sw.car { background: var(--amber); }

#pauseMenu { z-index: 55; }
.pause-card {
  width: min(640px, 92vw);
  background: linear-gradient(160deg, rgba(18, 36, 42, 0.94), rgba(7, 14, 18, 0.95));
  border: 1px solid var(--hair); border-radius: 18px; padding: 24px 26px;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.55);
}
.pause-kicker { font-family: var(--text); font-size: 8px; font-weight: 600; letter-spacing: 0.3em; color: var(--amber); text-transform: uppercase; }
.pause-card h2 { font-family: var(--display); font-size: 38px; font-weight: 500; letter-spacing: 0.06em; margin: 6px 0 18px; }
.pause-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin-bottom: 20px; }
.pause-grid div { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--hair-soft); padding-bottom: 8px; }
.pause-grid span { font-family: var(--text); font-size: 8px; font-weight: 500; letter-spacing: 0.16em; color: rgba(245, 241, 232, 0.55); text-transform: uppercase; margin-left: 6px; }
.pause-grid kbd {
  font-family: var(--mono); font-size: 10px; color: var(--paper);
  background: rgba(245, 241, 232, 0.08); border: 1px solid var(--hair);
  border-radius: 3px; padding: 3px 6px;
}
.resume {
  font-family: var(--text); font-size: 10px; font-weight: 600; letter-spacing: 0.3em;
  padding: 12px 26px; color: var(--ink); background: var(--amber); border: 0;
  border-radius: 2px; cursor: pointer; text-transform: uppercase;
}
#toast {
  position: absolute; left: 50%; bottom: 16vh; transform: translateX(-50%);
  z-index: 56; pointer-events: none;
  padding: 10px 18px; border: 1px solid var(--hair); border-radius: 999px;
  background: rgba(8, 15, 19, 0.72); backdrop-filter: blur(10px);
  font-family: var(--text); font-size: 9px; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--paper);
  transition: opacity 0.6s ease;
}
#toast.fade { opacity: 0; }

/* ---------------------------------------------------------------- */
/* touch                                                             */
/* ---------------------------------------------------------------- */
#touchUI { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.stick {
  position: absolute; left: calc(var(--tl) + 6px); bottom: calc(var(--tb) + 84px);
  width: 108px; height: 108px; pointer-events: auto;
  touch-action: none;
}
.stick-base {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid rgba(245, 241, 232, 0.18);
  background: radial-gradient(circle at 50% 50%, rgba(12, 22, 27, 0.35), rgba(8, 15, 19, 0.58));
  backdrop-filter: blur(8px);
}
.stick-knob {
  position: absolute; left: 50%; top: 50%; width: 44px; height: 44px;
  margin: -22px 0 0 -22px; border-radius: 50%;
  background: rgba(242, 160, 61, 0.30);
  border: 1px solid rgba(242, 160, 61, 0.7);
  box-shadow: 0 0 20px rgba(242, 160, 61, 0.18);
}
.stick-label {
  position: absolute; left: 0; right: 0; bottom: -16px; text-align: center;
  font-family: var(--text); font-size: 6.5px; font-weight: 600;
  letter-spacing: 0.22em; color: rgba(245,241,232,0.38);
}
.touch-buttons {
  position: absolute; z-index: 4; right: var(--tr); bottom: calc(var(--tb) + 78px);
  display: grid; grid-template-columns: repeat(2, 58px); gap: 8px;
  pointer-events: auto; align-items: end;
}
.touch-btn {
  position: relative; z-index: 2;
  font-family: var(--text); font-size: 8px; font-weight: 600; letter-spacing: 0.16em;
  color: var(--paper); background: rgba(8, 15, 19, 0.55);
  border: 1px solid var(--hair); border-radius: 14px;
  padding: 14px 6px; text-transform: uppercase;
  backdrop-filter: blur(8px); touch-action: none;
}
.touch-btn.small { padding: 10px 4px; font-size: 7.5px; border-radius: 11px; }
.touch-btn.wide { grid-column: span 2; padding: 18px 6px; border-color: rgba(242, 160, 61, 0.5); color: var(--amber); }
.touch-btn:active { background: rgba(242, 160, 61, 0.22); }

body.touch .hint-desktop { display: none; }
body.touch .hint-touch { display: inline; }
body.touch .hint-pill { display: none; }
body.touch .right-controls {
  display: flex; flex-direction: row; align-items: center; gap: 4px;
  left: 50%; right: auto; bottom: calc(var(--tb) + 8px); transform: translateX(-50%);
}
body.touch .right-controls .control-panel { display: none; }
body.touch .right-controls .slots { display: flex; }
body.touch .right-controls .slot { min-width: 46px; padding: 4px 6px; }
body.touch .right-controls .slot span { font-size: 6px; letter-spacing: 0.12em; }
body.touch .right-controls .slot b { font-size: 9px; }
body.touch .minimap-panel { width: 104px; padding: 6px; }
body.touch .minimap-meta { display: none; }
body.touch .map-open { width: 26px; height: 28px; right: 8px; bottom: 8px; }
body.touch .speed-panel { top: calc(var(--tt) + 120px); bottom: auto; left: var(--tl); width: 124px; padding: 7px 9px; }
body.touch .speed { font-size: 26px; }
body.touch .speed-panel .gear-line .surface { display: none; }
body.touch .stick { bottom: calc(var(--tb) + 64px); width: 96px; height: 96px; }
body.touch .stick-knob { width: 40px; height: 40px; margin: -20px 0 0 -20px; }
body.touch .touch-buttons { bottom: calc(var(--tb) + 66px); grid-template-columns: repeat(2, 56px); gap: 7px; }
body.touch .touch-btn { padding: 11px 4px; font-size: 7.5px; border-radius: 12px; }
body.touch .touch-btn.small { padding: 9px 4px; font-size: 7px; border-radius: 10px; }
body.touch .touch-btn.wide { padding: 13px 4px; }
body.touch #toast { bottom: 24vh; }
body.touch .status-panel { width: 176px; padding: 8px 9px; }
body.touch .status-panel .glyph-tile { display: none; }
body.touch .status-panel .clock { font-size: 17px; }
body.touch .status-panel .cash { font-size: 12px; }
body.touch .status-panel .mode-sub { display: none; }

/* ---------------------------------------------------------------- */
/* responsive                                                        */
/* ---------------------------------------------------------------- */
@media (max-width: 900px) {
  .status-panel { width: 206px; }
  .status-row { gap: 8px; }
  .glyph-tile { width: 36px; height: 40px; }
  .control-panel .glyph-btn { width: 42px; height: 52px; }
  .control-panel .glyph-btn img { width: 40px; height: 44px; }
  .hint-pill { font-size: 7px; letter-spacing: 0.09em; max-width: 56vw; }
  .slots .slot { min-width: 50px; padding: 5px 7px; }
}
@media (max-width: 700px) {
  .minimap-panel { width: 124px; padding: 7px; }
  .minimap-meta { font-size: 6.5px; }
  .minimap-meta #mapCoords { display: none; }
  .map-open { width: 24px; height: 26px; right: 9px; bottom: 20px; }
  .status-stack { gap: 5px; }
  .status-panel { width: 176px; padding: 8px 9px; }
  .status-panel .glyph-tile { display: none; }
  .clock { font-size: 17px; }
  .cash { font-size: 12px; }
  .mode-sub { display: none; }
  .speed-panel { width: 134px; padding: 8px 10px 9px; }
  .speed { font-size: 30px; }
  .gear-line .surface { display: none; }
  .control-panel .glyph-btn { width: 36px; height: 46px; }
  .control-panel .glyph-btn img { width: 34px; height: 38px; }
  .control-panel .glyph-btn span { font-size: 6px; }
  .slots .slot:nth-child(n+2) { display: none; }
  .hint-pill { display: none; }
  .gate-content { padding-top: 9vh; }
  .wordmark-main { width: min(86vw, 560px); }
  .wordmark-sub { font-size: 12px; letter-spacing: 0.34em; }
  .gate-line { font-size: 11px; margin: 16px 0; }
  #enterBtn { font-size: 10px; padding: 12px 18px 12px 20px; }
  .gate-foot { font-size: 6px; gap: 12px; }
  .pause-grid { grid-template-columns: 1fr; }
  .map-legend { flex-wrap: wrap; gap: 8px 14px; }
  .map-head p { display: none; }
}
@media (max-height: 480px) {
  .wordmark-main { width: min(58vw, 420px, 70vh); }
  .gate-content { padding-top: 3vh; }
  .gate-line { margin: 8px 0 10px; font-size: 10px; }
  .gate-meta { display: none; }
  .gate-foot { display: none; }
  .minimap-panel { width: 110px; }
  .status-panel { width: 180px; }
  .speed { font-size: 28px; }
}
@media (orientation: portrait) and (max-width: 720px) {
  .status-stack { max-width: 45vw; }
  .status-panel { width: 100%; }
  .right-controls .slots .slot:nth-child(n+2) { display: none; }
  .gate-content { padding-top: 12vh; }
}

/* the scene fills the screen; avoid browser rubber-banding */
canvas { touch-action: none; }
button { font-family: inherit; }

/* ---------------------------------------------------------------- */
/* busted                                                            */
/* ---------------------------------------------------------------- */
#busted {
  position: absolute; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(70% 70% at 50% 50%, rgba(70, 10, 12, 0.55), rgba(3, 7, 11, 0.9));
  backdrop-filter: blur(5px);
  animation: bustedSiren 1.1s steps(2) infinite;
  padding: 3vh 3vw;
}
@keyframes bustedSiren {
  0%, 100% { background-color: rgba(0, 0, 0, 0); }
  50% { background-color: rgba(34, 52, 150, 0.22); }
}
.busted-card {
  width: min(560px, 92vw);
  padding: 26px 30px 22px;
  background: linear-gradient(160deg, rgba(28, 18, 20, 0.95), rgba(7, 12, 16, 0.96));
  border: 1px solid rgba(255, 110, 90, 0.34);
  border-radius: 18px;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.62), inset 0 0 60px rgba(190, 30, 24, 0.08);
  text-align: center;
}
.busted-kicker { font-family: var(--text); font-size: 8px; font-weight: 600; letter-spacing: 0.32em; color: #ff8f70; text-transform: uppercase; }
.busted-kicker i { font-style: normal; color: rgba(255, 143, 112, 0.4); }
.busted-card h2 {
  font-family: var(--display); font-weight: 500; font-size: clamp(46px, 10vw, 92px);
  letter-spacing: 0.12em; text-indent: 0.12em; margin: 4px 0 6px;
  color: #ffe3da; text-shadow: 0 0 46px rgba(255, 46, 30, 0.55);
}
.busted-card p { margin: 0 0 18px; font-family: var(--display); font-style: italic; font-size: 14px; color: rgba(245, 241, 232, 0.6); }
.busted-foot {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid rgba(255, 110, 90, 0.2); padding-top: 12px;
  font-family: var(--text); font-size: 8px; font-weight: 600; letter-spacing: 0.24em; color: rgba(245, 241, 232, 0.5);
  text-transform: uppercase;
}
.busted-foot b { font-family: var(--mono); font-size: 18px; font-weight: 400; letter-spacing: 0.04em; color: #ffb08e; }
.slot b.hot { color: #ff7a58; text-shadow: 0 0 10px rgba(255, 80, 50, 0.65); }
