/* TRAFFIC TANTRUM — menus, HUD and buttons.
   Layout concept: full-screen 3D view; menus are highway-sign panels; HUD is a dashboard strip on top
   and thumb buttons at the bottom corners. One deliberate dark "asphalt at dusk" look (no light theme). */
:root {
  --asphalt: #1d2126;      /* page background */
  --asphalt-2: #2a3038;    /* raised panels */
  --sign: #0f6b45;         /* highway-sign green */
  --sign-edge: #e9f2ec;    /* sign border / white text */
  --cone: #ff7a1a;         /* construction orange — the one loud accent */
  --taxi: #ffd23f;         /* points, highlights */
  --siren: #ff3b5c;        /* danger / police */
  --ink: #f3f5f2;          /* main text */
  --ink-soft: #b9c2bb;     /* secondary text */
  --shade: rgba(10, 12, 14, 0.62);
  --font-display: 'Bungee', 'Arial Black', Impact, sans-serif;
  --font-body: 'Atkinson Hyperlegible', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --txt: 1;                /* text scale (Large text setting sets 1.2) */
  color-scheme: dark;
}
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--asphalt); color: var(--ink); font-family: var(--font-body);
  overflow: hidden; overscroll-behavior: none; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
#app { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
button { font-family: var(--font-body); color: var(--ink); cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--taxi); outline-offset: 2px; }

/* ---------- Screens (menus) ---------- */
.screen {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding-inline: 16px; padding-block: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-bottom, 0px));
  overflow-y: auto; background: radial-gradient(ellipse at 50% 120%, #3a2a1a 0%, var(--asphalt) 60%); z-index: 30;
}
.screen.dim { background: var(--shade); backdrop-filter: blur(3px); }
.panel {
  width: 100%; max-width: 420px; background: var(--sign); border: 4px solid var(--sign-edge);
  border-radius: 14px; padding: 22px 20px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 10px 0 #08392a, 0 18px 40px rgba(0,0,0,.5); margin: auto;
}
.panel.wide { max-width: 620px; }
.eyebrow { margin: 0; font-size: calc(12px * var(--txt)); letter-spacing: .14em; text-transform: uppercase; color: var(--taxi); font-weight: 700; }
.logo { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(40px, 11vw, 64px); line-height: .92; letter-spacing: .01em; color: var(--ink); text-shadow: 4px 4px 0 var(--cone); }
.h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: calc(26px * var(--txt)); text-wrap: balance; }
.h2.big { font-size: clamp(28px, 7vw, 42px); color: var(--taxi); }
.lede { margin: 0; font-size: calc(16px * var(--txt)); line-height: 1.45; color: var(--ink); max-width: 60ch; }
.fine { margin: 0; font-size: calc(13px * var(--txt)); color: var(--ink-soft); line-height: 1.4; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack.row { flex-direction: row; flex-wrap: wrap; }
.pill {
  border: 3px solid var(--sign-edge); background: var(--cone); color: #1b1206; font-weight: 700;
  font-size: calc(16px * var(--txt)); padding: 11px 18px; border-radius: 999px; min-height: 46px;
  box-shadow: 0 4px 0 #8a3c06; transition: transform .08s;
}
.pill:active { transform: translateY(3px); box-shadow: 0 1px 0 #8a3c06; }
.pill.big { font-family: var(--font-display); font-weight: 400; font-size: calc(20px * var(--txt)); }
.pill.ghost { background: transparent; color: var(--ink); box-shadow: none; }
.pill.small { min-height: 34px; padding: 5px 12px; font-size: 13px; }

.setting { display: flex; flex-direction: column; gap: 6px; }
.set-label { font-size: calc(12px * var(--txt)); letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--sign-edge); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  flex: 1 1 auto; min-height: 42px; padding: 8px 10px; border-radius: 8px; border: 2px solid rgba(233,242,236,.5);
  background: rgba(0,0,0,.18); font-weight: 700; font-size: calc(14px * var(--txt));
}
.seg button[aria-checked="true"] { background: var(--taxi); color: #1b1606; border-color: var(--taxi); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.cong-row { display: flex; align-items: center; gap: 12px; }
.cong-row input { flex: 1 1 auto; min-width: 0; accent-color: var(--taxi); height: 32px; }
.cong-name { font-family: var(--font-display); font-weight: 400; font-size: calc(16px * var(--txt)); color: var(--taxi); min-width: 9.5em; text-align: right; }
.cong-scale { display: flex; justify-content: space-between; font-size: calc(11px * var(--txt)); color: var(--ink-soft); margin-top: -4px; }
@media (max-width: 420px) { .cong-name { min-width: 0; font-size: 14px; } }
.toggles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.tog { display: flex; gap: 10px; align-items: flex-start; font-size: calc(15px * var(--txt)); line-height: 1.3; }
.tog input { width: 22px; height: 22px; accent-color: var(--cone); flex: none; margin: 0; }
.tog small { display: block; color: var(--ink-soft); font-size: calc(12px * var(--txt)); }
.sliders { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; font-size: calc(14px * var(--txt)); }
.sliders input { accent-color: var(--cone); width: 100%; min-width: 0; }

.voicecheck { background: rgba(0,0,0,.25); border-radius: 8px; padding: 8px 10px; color: var(--ink); }
.voicecheck b { color: var(--taxi); }
.tog-wide { grid-column: 1 / -1; }
.tips { font-size: calc(13px * var(--txt)); color: var(--ink-soft); }
.tips summary { cursor: pointer; color: var(--taxi); font-weight: 700; }
.tips ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.45; }
.tips b { color: var(--ink); }
.cast-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; max-height: 58vh; overflow-y: auto; padding-right: 4px; }
.cast-card { background: rgba(0,0,0,.22); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cast-card .portrait { position: relative; align-self: center; width: 128px; height: 128px; padding: 0; border-radius: 50%; border: 3px solid var(--sign-edge); overflow: hidden;
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--card) 45%, #ffffff) 0%, var(--card) 70%, color-mix(in srgb, var(--card) 60%, #000000) 100%); }
.cast-card .portrait img { width: 100%; height: 100%; display: block; }
.cast-card .portrait span { position: absolute; right: 6px; bottom: 6px; font-size: 16px; background: rgba(0,0,0,.55); border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; }
.cast-card b { font-family: var(--font-display); font-weight: 400; font-size: 17px; }
.cast-card .tag { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--taxi); font-weight: 700; }
.cast-card p { margin: 0; font-size: 13px; color: var(--ink-soft); line-height: 1.35; }
.cast-card q { font-size: 13px; font-style: italic; color: var(--ink); }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
.hud-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 6px; align-items: stretch;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 10px 8px; flex-wrap: wrap;
  background: linear-gradient(to bottom, rgba(10,12,14,.7), rgba(10,12,14,0));
}
.hud-cell { background: var(--shade); border-radius: 8px; padding: 4px 9px; display: flex; flex-direction: column; min-width: 0; }
.hud-label { font-size: calc(10px * var(--txt)); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }
.hud-num { font-family: var(--font-display); font-size: calc(17px * var(--txt)); font-variant-numeric: tabular-nums; color: var(--ink); line-height: 1.1; }
#hud-tantrum { color: var(--cone); }
#hud-karma { color: #7fe0a8; }
.donuts { display: flex; gap: 3px; padding-top: 3px; }
.donut { width: 16px; height: 16px; border-radius: 50%; border: 5px solid #4b4f55; display: block; }
.donut.on { border-color: #ff6fb1; box-shadow: 0 0 8px #ff6fb1; }
.donut.half { border-color: #a35b80; }
.hud-voice { margin-left: auto; font-size: 18px; }
.hud-voice + .hud-pause { margin-left: 0; }
.hud-pause { pointer-events: auto; margin-left: auto; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--sign-edge); background: var(--shade); font-weight: 700; font-size: 16px; }
.speedo { position: absolute; right: 10px; top: calc(env(safe-area-inset-top, 0px) + 62px); background: var(--shade); border-radius: 10px; padding: 3px 12px; text-align: center; }
.speedo span { font-family: var(--font-display); font-size: calc(22px * var(--txt)); font-variant-numeric: tabular-nums; }
.speedo small { display: block; font-size: 10px; color: var(--ink-soft); margin-top: -3px; }
.dignity { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 70px); left: 50%; transform: translateX(-50%); width: min(420px, 86vw); display: flex; flex-direction: column; gap: 4px; background: var(--shade); border-radius: 10px; padding: 6px 10px; }
.dig-row { display: grid; grid-template-columns: 70px 1fr; gap: 8px; align-items: center; font-size: 12px; font-weight: 700; }
.dig-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dig-bar { height: 12px; background: #3a3f46; border-radius: 6px; overflow: hidden; }
.dig-bar i { display: block; height: 100%; width: 100%; background: #7fe0a8; transition: width .15s; }
.dig-bar.foe i { background: var(--siren); }
.banner {
  position: absolute; top: 44%; left: 50%; transform: translate(-50%, -50%); text-align: center; max-width: 90vw;
  font-family: var(--font-display); font-size: clamp(22px, 6vw, 40px); color: var(--taxi); text-shadow: 3px 3px 0 #000;
  animation: pop .35s ease-out;
}
.banner.danger { color: var(--siren); animation: pop .35s ease-out, flash .5s steps(2) infinite; }
.combo { position: absolute; top: 38%; right: 6%; font-family: var(--font-display); color: var(--cone); font-size: calc(22px * var(--txt)); text-shadow: 2px 2px 0 #000; animation: pop .25s; }
.nope { position: absolute; top: 46%; left: 50%; transform: translateX(-50%); background: var(--taxi); color: #222; font-weight: 700; padding: 6px 14px; border-radius: 999px; animation: pop .25s; }
.gesture-pop { position: absolute; left: 50%; top: 48%; transform: translate(-50%, -50%); font-size: 96px; animation: pop .25s; filter: drop-shadow(0 4px 0 rgba(0,0,0,.4)); }
.gesture-pop.blur { filter: blur(9px) contrast(1.4); }
.gesture-pop.blur::after { content: '▦'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 60px; color: rgba(255,255,255,.7); filter: none; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.6); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.combo, .nope { animation-name: popsimple; }
@keyframes popsimple { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.nope { animation-name: popnope; }
@keyframes popnope { from { transform: translateX(-50%) scale(.6); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
@keyframes flash { 50% { color: #fff; } }

/* speech bubbles drawn above characters */
#bubbles { position: absolute; inset: 0; overflow: hidden; }
.bubble {
  position: absolute; left: 0; top: 0; max-width: min(240px, 60vw); padding: 7px 11px; border-radius: 14px;
  background: #fff; color: #161616; font-weight: 700; font-size: calc(14px * var(--txt)); line-height: 1.25;
  border: 3px solid var(--bc, #222); box-shadow: 3px 3px 0 rgba(0,0,0,.35); transform: translate(-50%, -100%);
  will-change: transform; text-wrap: balance;
}
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -11px; border: 8px solid transparent; border-top-color: var(--bc, #222); transform: translateX(-50%); }
.bubble .who { display: block; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--bc, #555); }
#app.bubbles-small .bubble { max-width: min(170px, 44vw); padding: 4px 7px; font-size: calc(11.5px * var(--txt)); border-width: 2px; border-radius: 10px; box-shadow: 2px 2px 0 rgba(0,0,0,.3); line-height: 1.2; }
#app.bubbles-small .bubble .who { font-size: 8.5px; }
#app.bubbles-small .bubble::after { border-width: 6px; bottom: -8px; }
#app.bubbles-off #bubbles { display: none; }
@media (max-width: 600px) { .subtitle { font-size: calc(13px * var(--txt)); padding: 4px 9px; bottom: calc(env(safe-area-inset-bottom, 0px) + 190px); max-width: 88vw; } }
.bubble.mega { font-size: calc(18px * var(--txt)); background: var(--taxi); }
.subtitle {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 168px);
  max-width: min(640px, 92vw); background: rgba(0,0,0,.72); padding: 6px 12px; border-radius: 8px;
  font-size: calc(15px * var(--txt)); text-align: center; line-height: 1.3;
}
.subtitle b { color: var(--sc, var(--taxi)); }

/* ---------- Touch controls ---------- */
#controls { position: absolute; left: 0; right: 0; bottom: 0; height: 190px; padding-bottom: env(safe-area-inset-bottom, 0px); }
.stick-zone { position: absolute; left: 0; bottom: 0; width: 46%; height: 100%; pointer-events: auto; touch-action: none; }
.stick-base { position: absolute; left: 22px; bottom: calc(env(safe-area-inset-bottom, 0px) + 22px); width: 128px; height: 128px; border-radius: 50%; background: rgba(255,255,255,.08); border: 3px solid rgba(255,255,255,.35); }
.stick-knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: rgba(255,255,255,.55); border: 3px solid #fff; }
.btns {
  position: absolute; right: calc(env(safe-area-inset-right, 0px) + 10px); bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); display: grid;
  grid-template-columns: repeat(4, 62px); grid-auto-rows: 58px; gap: 7px; pointer-events: auto; direction: rtl;
}
.cbtn {
  direction: ltr; border-radius: 14px; border: 2px solid rgba(255,255,255,.55); background: rgba(20,24,28,.6);
  font-size: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  touch-action: none; padding: 0;
}
.cbtn .wicon { font-weight: 400; }
.cbtn span { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.cbtn.big { grid-row: span 2; font-family: var(--font-display); font-size: 17px; }
.cbtn.gas { background: rgba(15,107,69,.85); }
.cbtn.boost { background: rgba(255,90,20,.55); }
.cbtn.boost.pressed { background: #ff5a14; }
.boostbar { display: block; height: 5px; margin-top: 3px; background: #3a3f46; border-radius: 3px; overflow: hidden; }
.boostbar b { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff7a1a, #ffd23f); }
.cbtn.brake { background: rgba(160,40,40,.75); font-weight: 700; font-size: 12px; }
.cbtn.swing { background: rgba(255,122,26,.85); color: #1b1206; }
.cbtn.honk { background: rgba(255,210,63,.25); }
.cbtn.talk { background: rgba(255,122,26,.35); }
.cbtn.pressed { transform: scale(.93); background: rgba(255,255,255,.35); }
.cbtn:disabled { opacity: .3; }
.cbtn[hidden] { display: none !important; }
#app.lefty .stick-zone { left: auto; right: 0; }
#app.lefty .stick-base { left: auto; right: 22px; }
#app.lefty .btns { right: auto; left: 10px; direction: ltr; }
@media (max-width: 420px) { .btns { grid-template-columns: repeat(4, 54px); grid-auto-rows: 52px; gap: 6px; } .stick-base { width: 112px; height: 112px; } }
@media (hover: hover) and (pointer: fine) { .stick-zone { opacity: .55; } }

/* ---------- Talk wheel ---------- */
.wheel-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 20; }
.wheel { position: relative; width: min(340px, 88vw); aspect-ratio: 1; max-width: 100%; border-radius: 50%; background: rgba(15,107,69,.92); border: 4px solid var(--sign-edge); }
.wheel-target { position: absolute; top: -38px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-weight: 700; background: var(--shade); padding: 4px 12px; border-radius: 999px; font-size: calc(14px * var(--txt)); }
.wslice { position: absolute; width: 29%; height: 18%; border-radius: 12px; border: 2px solid var(--sign-edge); background: rgba(0,0,0,.28); font-weight: 700; font-size: calc(13px * var(--txt)); line-height: 1.1; padding: 2px 4px; transform: translate(-50%, -50%); }
.wslice:active, .wcenter:active { background: var(--cone); color: #1b1206; }
.wcenter { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 34%; aspect-ratio: 1; border-radius: 50%; border: 3px solid var(--taxi); background: rgba(0,0,0,.4); font-weight: 700; font-size: calc(13px * var(--txt)); }
.wclose { position: absolute; right: -6px; top: -6px; width: 40px; height: 40px; border-radius: 50%; border: 2px solid #fff; background: var(--siren); font-weight: 700; }

.typebox { position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 74px); transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); background: var(--sign); border: 3px solid var(--sign-edge); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; z-index: 25; }
.type-label { font-size: calc(13px * var(--txt)); color: var(--taxi); font-weight: 700; }
.type-row { display: flex; gap: 6px; flex-wrap: wrap; }
.type-row input { flex: 1 1 180px; min-width: 0; min-height: 44px; border-radius: 8px; border: 2px solid var(--sign-edge); background: #0b2a1d; color: var(--ink); padding: 0 10px; font-size: 16px; font-family: var(--font-body); -webkit-user-select: text; user-select: text; }

/* ---------- Tutorial ---------- */
.tutorial { position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 76px); transform: translateX(-50%); width: min(460px, calc(100vw - 32px)); background: #12233a; border: 3px solid #8fb7ff; border-radius: 12px; padding: 10px 12px; z-index: 15; display: flex; flex-direction: column; gap: 6px; }
.tut-badge { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: #8fb7ff; }
.tutorial p { margin: 0; font-size: calc(16px * var(--txt)); line-height: 1.35; }
.tutorial .pill { align-self: flex-end; }
@media (min-width: 760px) { .tutorial { left: 16px; transform: none; top: calc(env(safe-area-inset-top, 0px) + 70px); width: 360px; } }

/* ---------- Results ---------- */
.res-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.res-stat { background: rgba(0,0,0,.22); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; }
.res-stat b { font-family: var(--font-display); font-weight: 400; font-size: calc(22px * var(--txt)); font-variant-numeric: tabular-nums; }
.ticket { display: flex; gap: 12px; background: #f6efd9; color: #2a2418; border-radius: 6px; padding: 10px; flex-wrap: wrap; }
.mugshot { width: 96px; flex: none; background: repeating-linear-gradient(to bottom, #d9d4c4 0 10px, #c9c3b1 10px 11px); border-radius: 4px; padding: 8px 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mug-face { width: 54px; height: 62px; border-radius: 45% 45% 40% 40%; background: var(--skin, #d8a47f); position: relative; border: 2px solid #2a2418; }
.mug-face::before { content: '× ×'; position: absolute; top: 18px; left: 0; right: 0; text-align: center; font-weight: 700; letter-spacing: 4px; }
.mug-face::after { content: ''; position: absolute; bottom: 12px; left: 18px; width: 16px; height: 6px; border-radius: 0 0 8px 8px; border: 2px solid #2a2418; border-top: none; }
.mug-board { background: #222; color: #fff; font-size: 9px; text-align: center; padding: 2px 6px; font-weight: 700; letter-spacing: .06em; }
.ticket-body { flex: 1 1 200px; min-width: 0; }
.ticket-head { margin: 0 0 4px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.ticket ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.4; }

@media (prefers-reduced-motion: reduce) { .banner, .combo, .nope, .gesture-pop { animation: none; } .banner.danger { animation: none; } }
@media (max-width: 600px) { .dignity { top: calc(env(safe-area-inset-top, 0px) + 116px); } }
@media (max-width: 600px) { .speedo { top: calc(env(safe-area-inset-top, 0px) + 112px); } }

/* ---------- Customize your driver ---------- */
.custom .cust-h { margin: 8px 0 0; font-family: var(--font-display); font-weight: 400; font-size: calc(18px * var(--txt)); color: var(--taxi); }
.preview-wrap { position: sticky; top: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 0; background: var(--sign); }
#cust-preview { width: min(100%, 300px, 30vh * 1.07); height: auto; aspect-ratio: 32 / 30; border-radius: 14px; border: 3px solid var(--sign-edge); background: linear-gradient(#bfe3ff, #eaf6ff 60%, #8a9099 60%, #6f757d); }
.text-in { width: 100%; min-height: 44px; border-radius: 10px; border: 2px solid var(--sign-edge); background: rgba(0,0,0,.22); color: var(--ink); font: 700 calc(16px * var(--txt)) var(--font-body); padding: 8px 12px; }
select.text-in option { color: #111; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgba(255,255,255,.35); padding: 0; }
.swatches button[aria-checked="true"] { border-color: var(--taxi); box-shadow: 0 0 0 3px var(--asphalt); transform: scale(1.08); }
.weapon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.weapon-grid button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 12px; border: 2px solid rgba(255,255,255,.3); background: rgba(0,0,0,.18); font-weight: 700; font-size: calc(12px * var(--txt)); }
.weapon-grid button .wi { font-size: 24px; line-height: 1.1; }
.weapon-grid button .ws { font-weight: 400; color: var(--ink-soft); font-size: 11px; }
.weapon-grid button[aria-checked="true"] { border-color: var(--taxi); background: rgba(255,210,63,.18); }
.cust-actions { margin-top: 6px; }

/* small note when typed lines can't be spoken on this device */
.voice-toast { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); width: min(92vw, 440px); display: flex; align-items: center; gap: 8px;
  background: rgba(20, 22, 30, .9); color: #fff; font-size: calc(12px * var(--txt, 1)); line-height: 1.35; padding: 8px 10px; border-radius: 12px; z-index: 30; pointer-events: auto; }
.voice-toast span { flex: 1; }
.voice-toast .vt-btn { background: none; border: 1px solid rgba(255,255,255,.5); color: #fff; border-radius: 999px; padding: 4px 8px; font: inherit; white-space: nowrap; cursor: pointer; }
.voice-toast .vt-x { background: none; border: 0; color: #fff; font-size: 16px; padding: 2px 6px; cursor: pointer; }

/* the game's logo art on the age screen and main menu */
.logo-art { display: block; width: 96px; height: 96px; border-radius: 22px; margin: 0 auto 10px; box-shadow: 4px 4px 0 var(--cone); object-fit: cover; }
@media (max-height: 520px) { .logo-art { width: 64px; height: 64px; border-radius: 16px; } }

/* Cartoon look: arcade speed streaks around the screen edges (opacity set from ui.js) */
#speedlines { position: fixed; inset: -10%; pointer-events: none; opacity: 0; z-index: 1;
  background: repeating-conic-gradient(from 0deg at 50% 46%, rgba(255,255,255,0) 0deg 4deg, rgba(255,255,255,.7) 4.4deg 4.9deg, rgba(255,255,255,0) 5.3deg 9deg);
  -webkit-mask-image: radial-gradient(ellipse 60% 55% at 50% 46%, transparent 55%, #000 100%); mask-image: radial-gradient(ellipse 60% 55% at 50% 46%, transparent 55%, #000 100%);
  animation: speedspin 0.35s steps(3) infinite; }
@keyframes speedspin { from { transform: rotate(0deg); } to { transform: rotate(3deg); } }
@media (prefers-reduced-motion: reduce) { #speedlines { display: none; } }

/* ---------- Clean screen layout (menu: Screen layout, or the 👁 button) ---------- */
.hud-pause + .hud-pause { margin-left: 0; }
.cbtn.more { display: none; font-size: 24px; line-height: .8; }
#app.clean .cbtn.more:not([hidden]) { display: flex; }
#app.clean.tray-open .cbtn.more { background: rgba(255,255,255,.28); }
#app.clean:not(.tray-open) .cbtn.sec { display: none; }
#app.clean .cbtn.exit:disabled, #app.clean .cbtn.enter:disabled { display: none; }
#app.clean .hud-score { display: none; }
#app.clean .hud-cell { padding: 3px 8px; }
#app.clean .hud-top { background: linear-gradient(to bottom, rgba(10,12,14,.45), rgba(10,12,14,0)); }
#app.clean .stick-base { opacity: .6; }
#app.clean .speedo { padding: 2px 10px; }
#app.clean .speedo span { font-size: calc(19px * var(--txt)); }
.cbtn.throw { background: rgba(255,240,200,.18); }

/* About & credits screen */
.about { max-height: 86vh; overflow-y: auto; }
.about h3 { margin: 14px 0 4px; font-size: calc(15px * var(--txt)); color: var(--taxi); }
.about p { margin: 0 0 6px; font-size: calc(14px * var(--txt)); line-height: 1.45; }

/* Hall of Shame */
.board-tabs button { font-size: 13px; }
.board-list { list-style: none; padding: 0; margin: 10px 0; counter-reset: rank; }
.board-list li { counter-increment: rank; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; padding: 8px 10px; margin: 6px 0; border-radius: 12px; background: rgba(255,255,255,0.06); }
.board-list li::before { content: counter(rank); font-family: Bungee, 'Arial Black', sans-serif; font-size: 18px; color: #ffd23f; text-align: center; }
.board-list li:first-child::before { content: '👑'; }
.board-list .who { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list .meta { display: block; font-size: 12px; opacity: 0.7; font-weight: 400; }
.board-list .val { font-family: Bungee, 'Arial Black', sans-serif; color: #ffd23f; white-space: nowrap; }
.board-list .empty { display: block; grid-template-columns: none; text-align: center; opacity: 0.75; }
.board-list .empty::before { content: none; }
.res-record { font-weight: 700; color: #ffd23f; margin: 4px 0 0; }
.board-list .meta { white-space: normal; }

/* Loading sign: the logo art sits in the space beside the title */
.loading-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.loading-art { flex: none; width: 120px; height: 120px; border-radius: 22px; border: 3px solid rgba(255,255,255,.92); box-shadow: 4px 4px 0 var(--cone); object-fit: cover; }
@media (max-width: 480px) { .loading-art { width: 72px; height: 72px; border-radius: 14px; } }
.loading-sign { max-width: min(600px, calc(100vw - 32px)); }
.loading-sign .logo { font-size: clamp(34px, 9vw, 56px); min-width: 0; }
.loading-art { width: 104px; height: 104px; }
@media (max-width: 480px) { .loading-art { width: 64px; height: 64px; border-radius: 12px; } }

/* Main menu: collapsible groups of related settings */
.menu-group { margin: 10px 0; border-radius: 14px; background: rgba(255,255,255,0.05); border: 2px solid rgba(255,255,255,0.12); }
.menu-group > summary { list-style: none; cursor: pointer; padding: 12px 14px; font-family: var(--font-display); font-size: 17px; letter-spacing: .02em; display: flex; align-items: center; justify-content: space-between; gap: 10px; user-select: none; }
.menu-group > summary::-webkit-details-marker { display: none; }
.menu-group > summary::after { content: '▾'; font-size: 18px; transition: transform .2s; opacity: .8; }
.menu-group:not([open]) > summary::after { transform: rotate(-90deg); }
.menu-group[open] > summary { border-bottom: 2px solid rgba(255,255,255,0.1); color: var(--taxi); }
.menu-group > summary .peek { font-family: inherit; font-size: 12px; opacity: .7; margin-left: auto; font-weight: 400; text-transform: none; letter-spacing: 0; }
.grp-body { padding: 4px 14px 12px; }
.grp-body > .setting:first-child { margin-top: 8px; }

/* Surprise mission chip in the HUD */
.mission-cell { background: rgba(15,107,69,.85); border-radius: 10px; padding: 2px 8px; }
.mission-cell .hud-num { font-size: calc(15px * var(--txt)); white-space: nowrap; }
.mission-cell.urgent { background: rgba(200,16,46,.9); animation: mpulse .6s infinite alternate; }
@keyframes mpulse { to { transform: scale(1.06); } }
.grp-body .setting + .setting, .grp-body .setting + .toggles, .grp-body .toggles + .setting, .grp-body .sliders { margin-top: 14px; }

#screen-loading { transition: opacity .25s ease; }
#screen-loading.fading { opacity: 0; }
/* small pop-ups (section call-outs, hazards, toggles): a neat pill near the top, not a screen-wide shout */
.banner.small { top: 21%; font-size: calc(17px * var(--txt)); padding: 6px 14px; border-radius: 999px; background: rgba(15,18,22,.72); text-shadow: none; color: #fff; }
.banner.small > div { font-size: calc(12px * var(--txt)) !important; margin-top: 2px !important; opacity: .85; }
.banner { font-size: clamp(22px, 5.5vw, 36px); }

/* Phone held upright during a drive */
.turn-phone { position: absolute; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(12,14,18,.94); color: #fff; text-align: center; padding: 24px; font-size: calc(17px * var(--txt)); }
.turn-phone[hidden] { display: none; }
.turn-icon { font-size: 56px; animation: turnme 1.6s ease-in-out infinite; }
@keyframes turnme { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
/* Notches and rounded corners on the sides in landscape: keep buttons, joystick and scores clear of them */
.hud-top { padding-left: calc(env(safe-area-inset-left, 0px) + 10px); padding-right: calc(env(safe-area-inset-right, 0px) + 10px); }
.stick-base { left: calc(env(safe-area-inset-left, 0px) + 22px); }
.speedo { right: calc(env(safe-area-inset-right, 0px) + 10px); }
