/* Clean, realistic HUD: white type with soft dark shadows, Velocity Red accents */
:root {
  --accent: #c8141e;
  --text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8), 0 0 12px rgba(0, 0, 0, 0.35);
  --panel: rgba(12, 14, 18, 0.62);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #1a1c22; color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app, #app canvas { position: fixed; inset: 0; display: block; width: 100%; height: 100%; }

.help { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); font-size: 13px;
  opacity: 0.75; pointer-events: none; white-space: nowrap; text-shadow: var(--text-shadow); }
.credits { position: fixed; top: 56px; right: 12px; font-size: 10px; opacity: 0.6; text-shadow: var(--text-shadow);
  max-width: 240px; text-align: right; }
.credits a { color: inherit; }

.popups { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.popup { position: absolute; opacity: 0; white-space: nowrap; font-size: 17px; font-weight: 800; letter-spacing: 0.03em;
  color: #fff; text-shadow: 0 2px 3px rgba(0, 0, 0, 0.85), 0 0 14px rgba(0, 0, 0, 0.4); will-change: transform, opacity; }
.popup.perfect { font-size: 19px; color: #ffd24a; }
.popup.level { font-size: 22px; color: #fff; }
.popup.penalty { font-size: 26px; color: #ff4a4a; }
.popup.bonus { font-size: 24px; color: #7be38f; }

.banners { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); display: flex;
  flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.banner { padding: 8px 18px; border-radius: 6px; text-align: center; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); }
.banner.hidden { display: none; }
.banner-title { font-size: 19px; font-weight: 800; letter-spacing: 0.04em; }
.banner-sub { font-size: 14px; opacity: 0.9; font-variant-numeric: tabular-nums; }
.banner-police { background: #0d3b8c; border: 3px solid #fff; animation: banner-pulse 0.6s ease-in-out infinite alternate; }
.banner-construction { background: #f2c200; color: #111; border: 3px solid #111; }
@keyframes banner-pulse { from { background: #0d3b8c; } to { background: #1652c2; } }

.hint { font-size: 13px; opacity: 0.7; }

/* Speed camera: short white flash */
.flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; }

/* Instrument cluster */
.dashboard { position: fixed; left: 50%; bottom: 2px; transform: translateX(-50%); width: min(520px, 94vw);
  pointer-events: none; filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.65)); }
.dashboard svg { display: block; width: 100%; height: auto; overflow: visible; }
:is(.dashboard, .tut-dash) text { font-family: "Helvetica Neue", Arial, sans-serif; }
:is(.dashboard, .tut-dash) .dial-num { fill: #ff5a32; font-weight: 700; font-style: italic; text-anchor: middle; }
:is(.dashboard, .tut-dash) .dial-label { fill: #ff7a52; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; }
:is(.dashboard, .tut-dash) .dial-small { fill: #ff7a52; font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em; }
/* digits are printed directly on the dial, lit like the instrument lighting */
:is(.dashboard, .tut-dash) .dial-digits { fill: #f3f6ff; font-weight: 700; font-style: italic; letter-spacing: 0.01em;
  font-family: "DIN Alternate", "DIN Condensed", "Arial Narrow", Arial, sans-serif; filter: url(#digitglow); }
:is(.dashboard, .tut-dash) .dial-gear { fill: #ff7a52; font-size: 12px; font-weight: 800; letter-spacing: 0.18em; }
.help { bottom: auto; top: 10px; font-size: 12px; }

/* Sound on/off */

/* ===== States: HUD only while driving ===== */
body.state-menu .hud-only { display: none !important; }
body.state-paused .touch-controls { display: none !important; }

/* ===== Icon buttons ===== */
.icon-btn { position: fixed; top: 12px; width: 40px; height: 40px; border-radius: 50%; z-index: 30;
  border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(10, 12, 16, 0.55); cursor: pointer; padding: 0;
  display: grid; place-items: center; color: #fff; }
.icon-btn svg { width: 20px; height: 20px; fill: #fff; }
.mute-btn { right: 12px; }
.pause-btn { right: 60px; }

/* ===== Screens ===== */
.screen { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px 16px; overflow-y: auto;
  background: radial-gradient(ellipse at center, rgba(8, 10, 14, 0.55) 0%, rgba(8, 10, 14, 0.82) 100%); }
.screen.hidden { display: none; }
.panel { width: min(560px, 100%); max-height: 100%; padding: 28px 30px; border-radius: 14px; text-align: center;
  background: rgba(14, 16, 22, 0.82); border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.panel-small { width: min(400px, 100%); }
.panel h2 { font-size: 30px; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 16px; }
.title { font-size: clamp(38px, 7vw, 60px); font-weight: 900; font-style: italic; letter-spacing: 0.02em; line-height: 1;
  text-transform: uppercase; }
.title span { color: var(--accent); }
.tagline { margin: 12px auto 20px; max-width: 420px; font-size: 15px; line-height: 1.45; opacity: 0.82; }
.menu-buttons { display: flex; flex-direction: column; gap: 10px; align-items: center; margin: 14px 0 6px; }
.menu-row { flex-direction: row; justify-content: center; }
.btn { min-width: 210px; padding: 12px 22px; font: inherit; font-size: 17px; font-weight: 700; color: #fff; cursor: pointer;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 8px; }
.menu-row .btn { min-width: 150px; }
.btn:hover, .btn:focus-visible { background: rgba(255, 255, 255, 0.16); outline: none; border-color: rgba(255, 255, 255, 0.5); }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover, .btn-primary:focus-visible { background: #e01a26; border-color: #ff6a70; }
.hint { margin-top: 10px; font-size: 12px; opacity: 0.6; }

.controls { margin-top: 18px; text-align: left; font-size: 13px; opacity: 0.9; }
.controls-keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; }
.controls-keys div { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.controls-keys span { margin-left: 6px; opacity: 0.75; }
kbd { display: inline-block; min-width: 22px; padding: 2px 6px; font: inherit; font-size: 11px; font-weight: 700; text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.35); border-bottom-width: 2px; border-radius: 4px; background: rgba(255, 255, 255, 0.06); }
.controls-touch { display: none; margin-top: 8px; }
.rules { margin: 12px 0 0 18px; line-height: 1.5; opacity: 0.8; }
.credits-inline { margin-top: 16px; font-size: 10px; opacity: 0.55; }
.credits-inline a { color: inherit; }

.final-score { font-size: 52px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.final-label { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.7; margin-top: 4px; }
.final-stats { margin: 12px 0 4px; font-size: 14px; opacity: 0.85; }
.name-form { margin: 16px 0 6px; }
.name-form.hidden { display: none; }
.name-form label { display: block; font-weight: 700; color: #ffd24a; margin-bottom: 8px; }
.name-row { display: flex; gap: 8px; justify-content: center; }
.name-row input { width: min(220px, 55vw); padding: 11px 12px; font: inherit; font-size: 17px; color: #fff; border-radius: 8px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.35); }
.name-row input:focus { outline: none; border-color: #ffd24a; }
.name-row .btn { min-width: 0; }
.name-hint { margin: 8px auto 0; max-width: 360px; font-size: 12px; line-height: 1.4; color: rgba(255, 255, 255, 0.6); }
.name-hint a { color: rgba(255, 255, 255, 0.8); }

.score-list { list-style: none; margin: 14px auto 6px; max-width: 460px; text-align: left; font-variant-numeric: tabular-nums; }
.score-list li { display: grid; grid-template-columns: 34px 1fr auto 70px 64px; gap: 8px; align-items: baseline;
  padding: 6px 10px; border-radius: 6px; font-size: 14px; }
.score-list li:nth-child(odd) { background: rgba(255, 255, 255, 0.04); }
.score-list li.highlight { background: rgba(200, 20, 30, 0.35); outline: 1px solid rgba(255, 90, 90, 0.6); }
.score-list li.empty { display: block; text-align: center; opacity: 0.7; }
.score-list li.more { display: none; }
.score-list li.more-toggle { display: block; text-align: center; background: none; padding-top: 6px; }
.btn-small { min-width: 0; padding: 6px 14px; font-size: 13px; }
.score-list { max-height: 52vh; overflow-y: auto; }
.score-list .rank { opacity: 0.6; }
.score-list .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-list .score { font-weight: 800; text-align: right; }
.score-list .km, .score-list .date { text-align: right; opacity: 0.65; font-size: 12px; }

.setting { margin: 14px 0; text-align: left; }
.setting-label { font-weight: 700; margin-bottom: 6px; }
.setting-hint { font-size: 12px; opacity: 0.6; margin-top: 6px; }
.segmented { display: flex; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 8px; overflow: hidden; }
.segmented button { flex: 1; padding: 10px; font: inherit; font-weight: 700; color: #fff; cursor: pointer;
  background: transparent; border: 0; }
.segmented button + button { border-left: 1px solid rgba(255, 255, 255, 0.25); }
.segmented button.active { background: var(--accent); }

/* ===== Touch controls ===== */
.touch-controls { display: none; }
@media (pointer: coarse) {
  .touch-controls { display: block; position: fixed; inset: auto 0 0 0; height: 0; z-index: 20; }
  .controls-touch { display: block; }
  .controls-keys { display: none; }
  .help { display: none; }
}
.touch-steer, .touch-pedals { position: fixed; bottom: max(14px, env(safe-area-inset-bottom)); display: flex; gap: 12px; align-items: flex-end; }
.touch-steer { left: max(14px, env(safe-area-inset-left)); }
.touch-pedals { right: max(14px, env(safe-area-inset-right)); }
.touch-btn { width: 76px; height: 76px; border-radius: 50%; font: inherit; font-size: 24px; font-weight: 800; color: #fff;
  background: rgba(14, 16, 22, 0.5); border: 2px solid rgba(255, 255, 255, 0.4); touch-action: none; user-select: none;
  -webkit-user-select: none; -webkit-touch-callout: none; display: grid; place-items: center; }
.touch-btn.pressed { background: rgba(255, 255, 255, 0.28); transform: scale(0.95); }
.touch-gas { width: 90px; height: 110px; border-radius: 18px; font-size: 15px; background: rgba(30, 120, 60, 0.45); border-color: rgba(120, 255, 160, 0.6); }
.touch-brake { width: 80px; height: 80px; border-radius: 16px; font-size: 13px; background: rgba(150, 20, 25, 0.45); border-color: rgba(255, 120, 120, 0.6); }
.touch-flash { width: 54px; height: 54px; position: absolute; right: 0; bottom: 124px; color: #cfe2ff; }
.touch-flash svg { width: 28px; height: 28px; }

/* ===== Portrait hint ===== */
.rotate-hint { display: none; }
@media (pointer: coarse) and (orientation: portrait) {
  .rotate-hint { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 12px; background: #0b0c10; color: #fff; font-size: 22px; font-weight: 800; text-align: center; padding: 24px; }
  .rotate-hint svg { width: 90px; height: 90px; animation: rotate-phone 1.8s ease-in-out infinite; }
  .rotate-hint small { font-size: 14px; font-weight: 400; opacity: 0.7; }
}
@keyframes rotate-phone { 0%, 30% { transform: rotate(0deg); } 60%, 100% { transform: rotate(-90deg); } }

/* Small (landscape phone) screens: compact menus */
@media (max-height: 500px) {
  .panel { padding: 16px 20px; }
  .tagline { margin: 6px auto 10px; font-size: 13px; }
  .rules { display: none; }
  .btn { padding: 9px 18px; font-size: 15px; }
  .final-score { font-size: 38px; }
  .score-list li { padding: 3px 8px; font-size: 12px; }
}
@media (max-height: 500px) {
  .dashboard { width: min(330px, 46vw); }
  .banners { top: 58px; }
  .banner-title { font-size: 15px; }
}
body.state-gameover .touch-controls, body.state-gameover .pause-btn, body.state-paused .pause-btn { display: none !important; }

.fatal { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 24px; text-align: center; background: #0b0c10; }
.fatal.hidden { display: none; }
.fatal p { max-width: 420px; opacity: 0.8; line-height: 1.5; }

/* ===== Tutorial ===== */
.panel-tutorial { width: min(760px, 100%); padding: 20px 24px 22px; text-align: left; }
.tut-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tut-step { font-size: 12px; letter-spacing: 0.14em; opacity: 0.6; }
.tut-skip { font: inherit; font-size: 13px; color: rgba(255, 255, 255, 0.75); background: none; border: 0; cursor: pointer; text-decoration: underline; padding: 4px; }
.tut-skip:hover { color: #fff; }
.tut-slide { display: none; }
.tut-slide.active { display: block; animation: tut-in 0.35s ease-out; }
@keyframes tut-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.tut-slide h2 { font-size: 24px; margin: 14px 0 8px; text-transform: none; letter-spacing: 0.01em; }
.tut-slide p { font-size: 15px; line-height: 1.55; opacity: 0.88; margin-bottom: 8px; }
.tut-slide b { color: #ffd24a; font-weight: 700; }
.tut-warn { color: #ff8a8a; opacity: 1 !important; font-weight: 600; }
.tut-visual { display: block; width: 100%; aspect-ratio: 16 / 9; height: auto; object-fit: cover; border-radius: 10px;
  background: #0b0d14; border: 1px solid rgba(255, 255, 255, 0.1); }
.tut-controls { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: radial-gradient(ellipse at center, #1a1e2a 0%, #0b0d14 75%); }
.keys-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.keys-extra { margin-top: 10px; gap: 22px; }
.key-group { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; opacity: 0.9; }
.key { min-width: 54px; height: 54px; display: grid; place-items: center; font-size: 20px; border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.45); border-bottom-width: 4px; background: rgba(255, 255, 255, 0.08); }
.key-wide { min-width: 150px; font-size: 14px; }
.touch-demo { display: none; width: 88%; justify-content: space-between; align-items: center; }
.touch-demo-side { display: flex; gap: 8px; }
.touch-demo-mid { font-size: 13px; opacity: 0.7; }
.touch-dot { display: grid; place-items: center; min-width: 46px; height: 46px; padding: 0 8px; border-radius: 50%; font-size: 13px; font-weight: 800;
  border: 2px solid rgba(255, 255, 255, 0.45); background: rgba(255, 255, 255, 0.06); }
.touch-dot.red { border-radius: 10px; background: rgba(150, 20, 25, 0.5); }
.touch-dot.green { border-radius: 10px; background: rgba(30, 120, 60, 0.5); }
.tut-touch { display: none; }
@media (pointer: coarse) {
  .tut-controls .keys-row { display: none; }
  .touch-demo { display: flex; }
  .tut-keyboard { display: none; }
  .tut-touch { display: block; }
}
.tut-dash { display: grid; place-items: center; padding: 6% 8% 2%; background: radial-gradient(ellipse at center, #1a1e2a 0%, #0b0d14 75%); }
.tut-dash svg { width: 100%; height: auto; overflow: visible; }
.tut-dots { display: flex; gap: 8px; justify-content: center; margin: 14px 0 4px; }
.tut-dot { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.25); cursor: pointer; }
.tut-dot.active { background: var(--accent); transform: scale(1.25); }
.tut-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; }
.tut-nav .btn { min-width: 140px; }
.tut-nav .btn:disabled { opacity: 0.3; cursor: default; }
@media (max-height: 500px) {
  .panel-tutorial { padding: 12px 16px; display: grid; grid-template-columns: 1fr; }
  .tut-visual { max-height: 42vh; width: auto; margin: 0 auto; }
  .tut-slide h2 { font-size: 18px; margin: 8px 0 4px; }
  .tut-slide p { font-size: 13px; line-height: 1.4; margin-bottom: 4px; }
  .tut-dots { margin: 6px 0 0; }
  .key { min-width: 40px; height: 40px; font-size: 16px; }
}
.tut-dash .dial-digits { filter: none; } /* the glow filter lives in the hidden original */

/* Start button while the car and shaders are being prepared */
#screen-start .btn-primary:disabled { opacity: 0.55; cursor: progress; }

/* ===== Loading screen ===== */
.loader { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #1b1d24 0%, #0b0c10 70%); transition: opacity 0.6s ease, visibility 0.6s; }
.loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-inner { width: min(360px, 80vw); text-align: center; }
.loader .title { margin-bottom: 26px; }
.loader-bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.loader-fill { width: 0; height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.25s ease; }
.loader-text { margin-top: 12px; font-size: 13px; color: rgba(255, 255, 255, 0.65); min-height: 18px; }
.loader-text.error { color: #ffd24a; }
.loader .btn.hidden { display: none; }
.loader .btn { margin-top: 16px; }

/* =====================================================================
   Phones in landscape (screen height ≤ 500 px)
   ===================================================================== */

/* Menus never get cut off: centred when they fit, scrollable when not */
.screen { align-items: flex-start; }
.screen > .panel { margin: auto; max-height: none; }

/* Keyboard hints make no sense on touch screens */
@media (pointer: coarse) {
  .hint { display: none; }
}

@media (max-height: 500px) {
  .screen { padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left)); }
  .panel { padding: 12px 16px; border-radius: 12px; }
  .panel h2 { font-size: 20px; margin-bottom: 8px; }
  .title { font-size: 30px; }
  .tagline { margin: 4px auto 6px; font-size: 12px; line-height: 1.35; }
  .btn { min-width: 0; padding: 7px 14px; font-size: 14px; border-radius: 7px; }
  .menu-buttons { gap: 6px; margin: 8px 0 2px; }
  .menu-row .btn { min-width: 120px; }
  .controls, .credits-inline { margin-top: 8px; }
  .controls { font-size: 11px; }
  .credits-inline { font-size: 9px; }

  /* start / pause: buttons as a 2 × 2 grid */
  #screen-start .menu-buttons, #screen-pause .menu-buttons {
    display: grid; grid-template-columns: repeat(2, minmax(130px, 1fr)); max-width: 340px; margin-left: auto; margin-right: auto; }

  /* game over: result left, leaderboard right */
  #screen-gameover .panel { width: min(720px, 100%); display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    column-gap: 18px; align-items: start; text-align: center; }
  #screen-gameover .panel > * { grid-column: 1; }
  #screen-gameover .panel > .score-list { grid-column: 2; grid-row: 1 / span 8; margin: 0; max-height: calc(100vh - 40px); }
  .final-score { font-size: 32px; }
  .final-label { font-size: 10px; }
  .final-stats { margin: 6px 0 2px; font-size: 11px; line-height: 1.35; }
  .name-form { margin: 8px 0 2px; }
  .name-form label { font-size: 13px; margin-bottom: 4px; }
  .name-row input { padding: 7px 9px; font-size: 15px; width: auto; min-width: 0; flex: 1 1 auto; }
  .name-row .btn { flex: none; padding: 7px 12px; white-space: nowrap; }
  .name-hint { font-size: 10px; margin-top: 4px; }

  /* leaderboard: tighter rows, no date column */
  .score-list { max-height: calc(100vh - 110px); }
  .score-list li { grid-template-columns: 24px 1fr auto 54px; gap: 6px; padding: 3px 6px; font-size: 12px; }
  .score-list .date { display: none; }
  .btn-small { padding: 4px 10px; font-size: 12px; }

  /* settings */
  .setting { margin: 6px 0; display: grid; grid-template-columns: 96px 1fr; align-items: center; column-gap: 10px; }
  .setting-label { margin: 0; font-size: 13px; }
  .setting-hint { grid-column: 2; font-size: 10px; margin-top: 2px; }
  .segmented button { padding: 6px; font-size: 13px; }
  #screen-settings .panel { width: min(460px, 100%); }

  body.state-gameover .dashboard { display: none; } /* no tacho shining through the result */

  /* HUD while driving: smaller tacho that fits between the touch controls */
  .dashboard { width: min(300px, 42vw, 78vh, calc(100vw - 330px)); bottom: 0; }
  .icon-btn { top: max(8px, env(safe-area-inset-top)); width: 34px; height: 34px; }
  .icon-btn svg { width: 17px; height: 17px; }
  .mute-btn { right: max(8px, env(safe-area-inset-right)); }
  .pause-btn { right: calc(max(8px, env(safe-area-inset-right)) + 42px); }
  .banners { top: 46px; gap: 4px; }
  .banner { padding: 5px 12px; }
  .banner-title { font-size: 13px; }
  .banner-sub { font-size: 11px; }
  .popup { font-size: 14px; }

  /* touch controls: smaller, closer to the edges */
  .touch-steer, .touch-pedals { bottom: max(8px, env(safe-area-inset-bottom)); gap: 8px; }
  .touch-steer { left: max(10px, env(safe-area-inset-left)); }
  .touch-pedals { right: max(10px, env(safe-area-inset-right)); }
  .touch-btn { width: 58px; height: 58px; padding: 0; font-size: 19px; border-width: 1.5px; }
  .touch-gas { width: 66px; height: 84px; border-radius: 14px; font-size: 12px; }
  .touch-brake { width: 58px; height: 58px; border-radius: 12px; font-size: 10px; }
  .touch-flash { width: 42px; height: 42px; bottom: 94px; right: 12px; }
  .touch-flash svg { width: 22px; height: 22px; }
}

/* very small phones (iPhone SE & co.) */
@media (max-height: 340px) {
  .touch-btn { width: 52px; height: 52px; font-size: 17px; }
  .touch-gas { width: 60px; height: 76px; }
  .touch-brake { width: 52px; height: 52px; font-size: 9px; letter-spacing: 0; }
  .touch-flash { bottom: 86px; }
  .dashboard { width: min(260px, 40vw, 74vh, calc(100vw - 300px)); }
  .controls { display: none; }
}

/* extra short (phone with browser bars visible) */
@media (max-height: 300px) {
  .panel { padding: 8px 14px; }
  .panel h2 { font-size: 16px; margin-bottom: 4px; }
  .final-score { font-size: 26px; }
  .final-stats { margin: 3px 0 0; }
  .name-form { margin: 4px 0 0; }
  .name-hint { display: none; }
  .score-list li { padding: 2px 6px; font-size: 11px; }
  .score-list li.more-toggle { padding-top: 3px; }
  .menu-buttons { margin: 6px 0 0; }
  .btn { padding: 6px 12px; font-size: 13px; }
}

/* Steering: the container is a larger invisible touch area around the two buttons
   (left/right is decided in TouchControls.js by the finger position) */
.touch-steer {
  left: 0; bottom: 0;
  padding: 110px 44px max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  touch-action: none;
}
.touch-steer .touch-btn { pointer-events: none; }
@media (max-height: 500px) {
  .touch-steer {
    left: 0; bottom: 0;
    padding: 80px 34px max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }
}
