/* Driving Test Simulator 3D: UK, USA & Europe - UI */
:root {
  --s: 1;
  --m: 1;
  --panel: rgba(12, 16, 24, 0.72);
  --panel2: rgba(22, 28, 40, 0.86);
  --line: rgba(255, 255, 255, 0.1);
  --txt: #f3f5f8;
  --mute: #a9b2c0;
  --acc: #ffcc1a;
  --red: #e0262f;
  --green: #22c55e;
  --blue: #2f7fe0;
  --amber: #ffb000;
  --min-text: 11px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
body.touch-ui { --min-text: 12px; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0e14; color: var(--txt); font-family: var(--font); user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
#ui { position: fixed; inset: 0; pointer-events: none; font-size: calc(14px * var(--s)); }
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; }

/* ---------- loading ---------- */
.screen { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; pointer-events: auto; }
.screen.show { display: flex; }
#loading { background: radial-gradient(ellipse at 50% 30%, #1d2a40 0%, #0b0e14 70%); z-index: 50; }
.ld-box { width: min(560px, 86vw); text-align: center; }
.ld-badge { width: 74px; height: 74px; margin: 0 auto 18px; background: #fff; border-radius: 10px; color: var(--red); font: 900 58px/74px var(--font); box-shadow: 0 8px 30px #0008; }
.ld-box h1 { margin: 0 0 22px; font-size: clamp(22px, 4.2vw, 38px); font-weight: 800; letter-spacing: 0.01em; }
.ld-box h1 span { display: block; font-size: 0.5em; font-weight: 600; color: var(--acc); letter-spacing: 0.24em; text-transform: uppercase; margin-top: 6px; }
.ld-bar { height: 8px; background: #ffffff1c; border-radius: 6px; overflow: hidden; }
.ld-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--acc), #fff2a8); border-radius: 6px; transition: width 0.2s; }
.ld-msg { margin-top: 12px; color: var(--mute); font-size: max(13px, var(--min-text)); }
.ld-osm { margin-top: 26px; color: #8892a2; font-size: max(11px, var(--min-text)); }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: calc(14px * var(--s)); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 6px 20px #0005; }
.h-speed { position: absolute; left: calc(14px + env(safe-area-inset-left)); top: 12px; padding: calc(8px * var(--s)) calc(12px * var(--s)); display: flex; align-items: center; gap: calc(12px * var(--s)); }
.h-speed .v { font-size: calc(40px * var(--s)); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; min-width: 2ch; text-align: right; }
.h-speed .u { font-size: max(calc(11px * var(--s)), var(--min-text)); color: var(--mute); font-weight: 700; letter-spacing: 0.08em; }
.limit { position: relative; width: calc(46px * var(--s)); height: calc(46px * var(--s)); border-radius: 50%; background: #fff; border: calc(6px * var(--s)) solid #d81e25; color: #111; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: calc(18px * var(--s)); }
.limit.sim::after { content: 'SIM'; position: absolute; bottom: calc(-15px * var(--s)); left: 50%; transform: translateX(-50%); font-size: max(calc(9px * var(--s)), 10px); color: var(--mute); letter-spacing: 0.06em; }
.limit.over { animation: pulse 0.6s infinite alternate; }
@keyframes pulse { to { box-shadow: 0 0 0 calc(5px * var(--s)) #e0262f88; } }
.gears { display: flex; gap: 2px; font-weight: 800; font-size: calc(15px * var(--s)); }
.gears b { width: calc(20px * var(--s)); text-align: center; color: #ffffff55; border-radius: 4px; }
.gears b.on { color: #111; background: var(--acc); }
.stat { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.icons { display: flex; gap: 6px; align-items: center; height: calc(18px * var(--s)); }
.ico { width: calc(18px * var(--s)); height: calc(18px * var(--s)); opacity: 0.18; }
.ico.on { opacity: 1; }
.ico.blink.on { animation: none; }
.h-xp { position: absolute; left: calc(14px + env(safe-area-inset-left)); top: calc(86px * var(--s) + 12px); padding: 5px 10px; font-size: max(calc(12px * var(--s)), var(--min-text)); color: var(--mute); }
.h-xp b { color: var(--acc); }
.h-top { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: min(52vw, 640px); }
.h-obj { padding: calc(7px * var(--s)) calc(14px * var(--s)); font-size: max(calc(14px * var(--s)), var(--min-text)); font-weight: 600; text-align: center; }
.h-obj small { display: block; color: var(--mute); font-weight: 500; font-size: max(calc(11px * var(--s)), var(--min-text)); margin-top: 2px; }
.h-obj:empty { display: none; }
.h-right { position: absolute; right: calc(12px + env(safe-area-inset-right)); top: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.h-btns { display: flex; gap: 8px; pointer-events: auto; }
.rbtn { width: calc(42px * var(--s)); height: calc(42px * var(--s)); border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--panel); border: 1px solid var(--line); }
.rbtn svg { width: 55%; height: 55%; }
.rbtn .k { position: absolute; transform: translate(calc(16px * var(--s)), calc(16px * var(--s))); font-size: 10px; background: #000a; padding: 0 3px; border-radius: 3px; color: #ddd; }
body.touch-ui .rbtn .k { display: none; }
.mapwrap { position: relative; width: calc(190px * var(--s)); height: calc(190px * var(--s)); border-radius: 50%; overflow: hidden; border: 3px solid #ffffff2a; background: #1c2128; box-shadow: 0 6px 20px #0006; pointer-events: auto; }
.mapwrap canvas { width: 100%; height: 100%; display: block; }
.turn { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 8px; min-width: calc(190px * var(--s)); }
.turn svg { width: calc(34px * var(--s)); height: calc(34px * var(--s)); flex: none; }
.turn .d { font-size: calc(20px * var(--s)); font-weight: 800; line-height: 1.05; }
.turn .n { font-size: max(calc(12px * var(--s)), var(--min-text)); color: var(--mute); max-width: calc(150px * var(--s)); }
.turn:empty, .turn.off { display: none; }
#toasts { position: absolute; left: 50%; top: calc(64px * var(--s) + 14px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.toast { padding: 6px 14px; border-radius: 20px; background: var(--panel2); border: 1px solid var(--line); font-size: max(calc(13px * var(--s)), var(--min-text)); font-weight: 600; animation: tin 0.25s ease-out; white-space: nowrap; }
.toast.good { border-color: #22c55e66; } .toast.good b { color: var(--green); }
.toast.bad { border-color: #e0262f88; } .toast.bad b { color: #ff6b6b; }
.toast.info b { color: var(--acc); }
@keyframes tin { from { transform: translateY(-8px); opacity: 0; } }
#subtitle { position: absolute; left: 50%; top: calc(118px * var(--s) + 18px); transform: translateX(-50%); max-width: min(60vw, 680px); text-align: center; font-size: max(calc(15px * var(--s)), var(--min-text)); font-weight: 600; padding: 6px 14px; border-radius: 10px; background: #000a; display: none; }
#subtitle.show { display: block; }
#subtitle kbd, .h-obj kbd { background: #fff; color: #111; border-radius: 4px; padding: 0 6px; font-size: 0.95em; }
#subtitle i { color: var(--acc); font-style: normal; font-weight: 800; margin-right: 6px; }
.keys { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; max-width: 80vw; }
.keys span { font-size: max(calc(12px * var(--s)), var(--min-text)); color: #e8ecf2; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
.keys kbd { font: 700 max(calc(11px * var(--s)), var(--min-text)) var(--font); background: #fff; color: #111; border-radius: 4px; padding: 1px 6px; margin-right: 6px; }
.keys.hidden, body.touch-ui .keys { display: none; }
/* coach: "show me" card for one-control lesson steps (bottom centre, over the dashboard) + a hand that presses */
.coach { position: absolute; left: 50%; bottom: calc(30px * var(--s) + 10px); transform: translateX(-50%); display: flex; align-items: center; gap: calc(18px * var(--s)); padding: calc(12px * var(--s)) calc(22px * var(--s)) calc(14px * var(--s)); background: #0b0f17eb; border: 2px solid var(--acc); border-radius: calc(16px * var(--s)); box-shadow: 0 8px 30px #000a; max-width: 92vw; }
.coach.hidden, body.touch-ui .coach { display: none; }
.co-caps { display: flex; gap: calc(8px * var(--s)); }
.co-key { pointer-events: auto; cursor: pointer; min-width: calc(76px * var(--s)); height: calc(76px * var(--s)); padding: 0 calc(14px * var(--s)); border: none; border-radius: calc(12px * var(--s)); background: linear-gradient(#fff, #dde2ea); color: #111; font: 800 calc(42px * var(--s)) / 1 var(--font); box-shadow: 0 calc(6px * var(--s)) 0 #7d8697, 0 8px 18px #0009; animation: capPress 1.1s infinite; }
/* key letters in a font whose capital I has serifs (system sans shows I like l) */
.co-key kbd, .co-txt kbd, .h-obj kbd, #subtitle kbd, .keys kbd, .toast kbd { font-family: Menlo, Consolas, 'DejaVu Sans Mono', 'Courier New', monospace; font-weight: 800; }
.co-key kbd { font-size: inherit; }
.co-key.wide { min-width: calc(170px * var(--s)); font-size: calc(26px * var(--s)); }
.co-key.hold { cursor: default; }
.co-key.hold + .co-key.hold { animation: none; }
.co-key.hit { animation: none; transform: translateY(calc(5px * var(--s))); box-shadow: 0 1px 0 #7d8697; background: var(--acc); }
@keyframes capPress { 0%, 38%, 72%, 100% { transform: none; } 48%, 62% { transform: translateY(calc(5px * var(--s))); box-shadow: 0 1px 0 #7d8697, 0 4px 10px #0009; background: #fff4c2; } }
.co-txt b { display: block; font-size: max(calc(24px * var(--s)), 16px); font-weight: 800; color: #fff; letter-spacing: 0.02em; white-space: nowrap; }
.co-txt span { display: block; margin-top: 4px; font-size: max(calc(15px * var(--s)), var(--min-text)); color: #c9d1dc; }
.co-txt kbd { font-size: 1em; background: #fff; color: #111; border-radius: 4px; padding: 0 7px; }
.co-hand { position: fixed; width: calc(52px * var(--s)); height: calc(65px * var(--s)); pointer-events: none; filter: drop-shadow(0 4px 6px #000a); animation: handTap 1.1s infinite; }
.co-hand svg { display: block; width: 100%; height: 100%; }
.co-hand.hidden { display: none; }
.co-hand.demo { animation: handTap 1.3s 1 both; }
.co-hand.down { animation-name: handTapDown; }
.co-hand.down svg { transform: rotate(180deg); }
@keyframes handTapDown { 0%, 100% { transform: translate(calc(-16px * var(--s)), calc(-26px * var(--s))) rotate(-8deg); } 46%, 62% { transform: none; } }
@keyframes handTap { 0%, 100% { transform: translate(calc(16px * var(--s)), calc(26px * var(--s))) rotate(-8deg); } 46%, 62% { transform: none; } }
.mirror-inset { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); width: calc(260px * var(--s)); height: calc(60px * var(--s)); border-radius: 10px; border: 3px solid #111; overflow: hidden; display: none; }

/* ---------- touch controls ---------- */
#touch { position: absolute; inset: 0; }
#touch .tc { position: absolute; pointer-events: auto; touch-action: none; }
.t-pedal { bottom: calc(14px + env(safe-area-inset-bottom)); border-radius: calc(16px * var(--s)); display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: max(calc(17px * var(--s)), 13px); letter-spacing: 0.06em; box-shadow: 0 6px 16px #0007; color: #fff; }
.t-gas { right: calc(16px + env(safe-area-inset-right)); width: calc(92px * var(--s)); height: calc(150px * var(--s)); background: linear-gradient(#2fd36a, #129b48); }
.t-brake { right: calc(16px + env(safe-area-inset-right) + 104px * var(--s)); width: calc(110px * var(--s)); height: calc(104px * var(--s)); background: linear-gradient(#ef3b44, #b5141c); }
.t-pedal.down { filter: brightness(1.25); transform: scale(0.97); }
.t-small { width: calc(54px * var(--s)); height: calc(46px * var(--s)); border-radius: 12px; background: #11141bdd; border: 1px solid #ffffff22; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: max(calc(12px * var(--s)), 12px); color: #eef; }
.t-small svg { width: 60%; height: 60%; }
.t-small.on { background: #1f7a3f; }
.t-small.red.on { background: #b5141c; }
.t-gear { right: calc(16px + env(safe-area-inset-right) + 226px * var(--s)); bottom: calc(14px + env(safe-area-inset-bottom)); width: calc(48px * var(--s)); display: flex; flex-direction: column; gap: 3px; }
.t-gear b { height: calc(25px * var(--s)); border-radius: 8px; background: #11141bdd; border: 1px solid #ffffff22; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: max(calc(13px * var(--s)), 12px); }
.t-gear b.on { background: var(--acc); color: #111; }
.t-mg b { height: calc(51px * var(--s)); font-size: max(calc(10px * var(--s)), 10px); line-height: 1.15; text-align: center; }

/* ---------- menus ---------- */
#menus .menu { position: absolute; inset: 0; pointer-events: auto; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 30% 20%, #18243acc, #070a10ee); padding: 16px; overflow: hidden; }
#menus .menu.clear { background: linear-gradient(90deg, #070a10e8 0%, #070a10aa 45%, #0000 75%); justify-content: flex-start; }
.m-card { width: min(980px, 100%); max-height: 100%; overflow-y: auto; overflow-x: hidden; padding: calc(18px * var(--s)); }
.m-title { display: flex; align-items: center; gap: 14px; margin-bottom: calc(14px * var(--s)); }
.m-title .ld-badge { width: calc(48px * var(--s)); height: calc(48px * var(--s)); font-size: calc(38px * var(--s)); line-height: calc(48px * var(--s)); margin: 0; }
.m-title h2 { margin: 0; font-size: calc(26px * var(--s)); font-weight: 800; }
.m-title h2 span { display: block; font-size: max(calc(12px * var(--s)), var(--min-text)); color: var(--acc); letter-spacing: 0.2em; text-transform: uppercase; }
.m-sub { color: var(--mute); font-size: max(calc(13px * var(--s)), var(--min-text)); margin: -6px 0 12px; }
.m-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(200px * var(--s)), 1fr)); gap: calc(10px * var(--s)); }
.m-tile { text-align: left; padding: calc(14px * var(--s)); border-radius: 14px; background: #ffffff0d; border: 1px solid #ffffff17; display: flex; flex-direction: column; gap: 6px; min-height: calc(96px * var(--s)); transition: background 0.15s; }
.m-tile:hover { background: #ffffff1a; }
.m-tile b { font-size: calc(17px * var(--s)); }
.m-tile span { color: var(--mute); font-size: max(calc(12px * var(--s)), var(--min-text)); line-height: 1.35; }
.m-tile.primary { background: linear-gradient(135deg, #ffcc1a, #ffb000); color: #111; }
.m-tile.primary span { color: #3a2f00; }
.m-tile.locked { opacity: 0.55; }
.m-tile .stars { color: var(--acc); letter-spacing: 2px; }
.m-tile.primary .stars { color: #111; }
.m-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: calc(14px * var(--s)); }
.btn { padding: calc(10px * var(--s)) calc(18px * var(--s)); border-radius: 12px; background: #ffffff14; border: 1px solid #ffffff22; font-weight: 700; font-size: max(calc(14px * var(--s)), var(--min-text)); }
.btn.primary { background: var(--acc); color: #111; border-color: transparent; }
.btn.danger { background: #e0262f; }
.m-flag { display: inline-flex; align-items: center; gap: 8px; }
.chip { display: inline-block; font-size: max(calc(11px * var(--s)), var(--min-text)); font-weight: 800; letter-spacing: 0.08em; padding: 2px 7px; border-radius: 10px; background: #ffffff1c; color: var(--mute); }
.chip.ok { background: #22c55e33; color: #7ff0a8; }
.m-section { font-size: max(calc(12px * var(--s)), var(--min-text)); color: var(--mute); letter-spacing: 0.14em; text-transform: uppercase; margin: calc(14px * var(--s)) 0 8px; }
.m-list { display: flex; flex-direction: column; gap: 6px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 10px; background: #ffffff0a; font-size: max(calc(13px * var(--s)), var(--min-text)); }
.set-row .opts { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.set-row .opts button { padding: 5px 10px; border-radius: 8px; background: #ffffff12; font-size: max(calc(12px * var(--s)), var(--min-text)); font-weight: 700; }
.set-row .opts button.on { background: var(--acc); color: #111; }
.set-row input[type=range] { width: calc(150px * var(--s)); }
.res { text-align: center; }
.res .big { font-size: calc(46px * var(--s)); font-weight: 900; margin: 6px 0; }
.res .big.pass { color: var(--green); } .res .big.fail { color: #ff5a5a; }
.res .stars3 { font-size: calc(40px * var(--s)); color: var(--acc); letter-spacing: 6px; }
.res .stars3 .off { color: #ffffff2a; }
.faults { text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: max(calc(13px * var(--s)), var(--min-text)); margin: 10px auto; max-width: 520px; }
.faults .h { color: var(--mute); text-transform: uppercase; font-size: max(calc(11px * var(--s)), var(--min-text)); letter-spacing: 0.1em; }
.faults .ser { color: #ffa94d; } .faults .dan { color: #ff5a5a; }
.bigmap { position: absolute; inset: 0; pointer-events: auto; background: #0b0e14f2; display: flex; }
.bigmap canvas { flex: 1; width: 100%; height: 100%; display: block; touch-action: none; }
.bigmap .side { position: absolute; left: 12px; top: 12px; bottom: 12px; width: min(300px, 36vw); padding: 12px; overflow-y: auto; }
.bigmap .side .btn { width: 100%; text-align: left; margin-bottom: 6px; }
.bigmap .close { position: absolute; right: 14px; top: 14px; }
.hint-pop { position: absolute; left: 50%; bottom: 18%; transform: translateX(-50%); }

/* rotate card */
#rotate { background: #0b0e14; z-index: 60; }
#rotate.show { display: flex; }
.rot-box { text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; font-size: 16px; }
.rot-box span { color: var(--mute); font-size: 14px; }
.rot-icon { width: 60px; height: 96px; border: 4px solid #fff; border-radius: 12px; animation: rot 1.6s ease-in-out infinite; margin-bottom: 12px; }
@keyframes rot { 50% { transform: rotate(-90deg); } }

/* scrollbar (CrazyGames wants a visible custom bar) */
.m-card::-webkit-scrollbar, .bigmap .side::-webkit-scrollbar { width: 8px; }
.m-card::-webkit-scrollbar-thumb, .bigmap .side::-webkit-scrollbar-thumb { background: #ffffff44; border-radius: 4px; }

@media (max-height: 430px) {
  .h-speed .v { font-size: calc(30px * var(--s)); }
  .mapwrap { width: calc(140px * var(--s)); height: calc(140px * var(--s)); }
}

/* short landscape screens (phones): instructor subtitles replace the objective strip at the top, never mid-road */
@media (max-height: 520px) {
  #subtitle { top: 6px; max-width: min(46vw, 560px); font-size: max(calc(13px * var(--s)), 12px); padding: 5px 10px; }
  body.sub-on .h-top { visibility: hidden; }
  #toasts { top: calc(56px * var(--s) + 8px); }
  .h-xp { display: none; }
}
/* steering wheel choice (first launch, main menu, Settings) */
.wp { z-index: 60; background: radial-gradient(ellipse at 50% 30%, #1d2a40 0%, #0b0e14 75%); padding: 12px; overflow: auto; }
.wp-box { text-align: center; max-width: 760px; width: 100%; }
.wp-box h2 { margin: 0 0 clamp(10px, 3vh, 22px); font-size: clamp(22px, 4.2vmin, 34px); font-weight: 800; color: #fff; }
.wp-row { display: flex; gap: clamp(12px, 3vw, 28px); justify-content: center; }
.wp-tile { flex: 1 1 0; max-width: 330px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: clamp(10px, 2.4vmin, 18px); border-radius: 18px; border: 3px solid #ffffff22; background: #121a27; color: #fff; cursor: pointer; font-family: var(--font); transition: transform 0.12s, border-color 0.12s; }
.wp-tile:hover, .wp-tile.on { border-color: var(--acc); }
.wp-tile:active { transform: scale(0.97); }
.wp-tile svg { width: clamp(96px, 30vmin, 190px); height: auto; }
.wp-tile b { font-size: clamp(24px, 5vmin, 38px); font-weight: 900; letter-spacing: 0.06em; color: var(--acc); }
.wp-tile span { font-size: clamp(14px, 2.6vmin, 18px); color: #d6dce6; line-height: 1.35; }
.wp-note { margin-top: clamp(8px, 2.4vh, 18px); color: #9aa4b4; font-size: clamp(13px, 2.2vmin, 15px); }
@media (orientation: portrait) { .wp-row { flex-direction: column; align-items: center; } .wp-tile { width: 100%; } }
.h-act { position: absolute; left: calc(14px + env(safe-area-inset-left)); top: calc(86px * var(--s) + 48px); pointer-events: auto; padding: calc(8px * var(--s)) calc(14px * var(--s)); border-radius: 10px; border: 2px solid var(--acc); background: #0b0f17e0; color: var(--acc); font: 800 max(calc(13px * var(--s)), 12px) var(--font); letter-spacing: 0.04em; cursor: pointer; }
.h-act.hidden { display: none; }
.h-act:active { transform: scale(0.96); }
/* main menu hub */
#menus .menu.hubwrap { padding: 10px calc(14px + env(safe-area-inset-right)) 10px calc(14px + env(safe-area-inset-left)); }
.hubwrap .m-card { width: min(640px, 64vw); background: #0b0f17d9; }
.hub-head { display: flex; align-items: center; gap: 12px; margin-bottom: calc(10px * var(--s)); }
.hub-head .ld-badge { width: calc(44px * var(--s)); height: calc(44px * var(--s)); margin: 0; font-size: calc(34px * var(--s)); line-height: calc(44px * var(--s)); flex: none; }
.hub-name { flex: 1; min-width: 0; }
.hub-name h1 { margin: 0; font-size: max(calc(22px * var(--s)), 16px); font-weight: 900; }
.hub-name span { display: block; color: var(--mute); font-size: max(calc(12px * var(--s)), var(--min-text)); }
.hub-play { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; border: none; border-radius: 14px; cursor: pointer; padding: calc(12px * var(--s)) calc(18px * var(--s)); background: linear-gradient(180deg, #ffd84a, #f5b700); color: #111; box-shadow: 0 6px 18px #0008; font-family: var(--font); }
.hub-play b { font-size: max(calc(30px * var(--s)), 22px); font-weight: 900; letter-spacing: 0.04em; }
.hub-play span { font-size: max(calc(14px * var(--s)), 12px); font-weight: 700; opacity: 0.8; }
.hub-play:active, .hub-tile:active { transform: scale(0.98); }
.hub-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(8px * var(--s)); margin-top: calc(10px * var(--s)); }
.hub-tile { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: calc(74px * var(--s)); padding: calc(9px * var(--s)) calc(11px * var(--s)); border-radius: 12px; border: 1px solid #ffffff26; background: #151c29; color: #fff; text-align: left; cursor: pointer; font-family: var(--font); }
.hub-tile:hover { border-color: var(--acc); }
.hub-tile svg { width: calc(22px * var(--s)); height: calc(22px * var(--s)); color: var(--acc); }
.hub-tile b { font-size: max(calc(14px * var(--s)), 12px); font-weight: 900; letter-spacing: 0.02em; }
.hub-tile span { font-size: max(calc(12px * var(--s)), var(--min-text)); color: #b9c2cf; line-height: 1.25; }
.hub-switch { display: flex; flex-wrap: wrap; gap: calc(8px * var(--s)) calc(18px * var(--s)); margin-top: calc(10px * var(--s)); }
.hub-switch > div { display: flex; align-items: center; gap: 8px; }
.hub-switch > div > span { font-size: max(calc(13px * var(--s)), 12px); color: #cfd6e0; font-weight: 700; }
.seg { display: inline-flex; border: 1px solid #ffffff33; border-radius: 10px; overflow: hidden; }
.seg button { border: none; background: #10151f; color: #cfd6e0; padding: calc(7px * var(--s)) calc(12px * var(--s)); font: 800 max(calc(13px * var(--s)), 12px) var(--font); cursor: pointer; }
.seg button.on { background: var(--acc); color: #111; }
.hub-foot { margin-top: calc(8px * var(--s)); color: #8f99a8; font-size: max(calc(11px * var(--s)), var(--min-text)); line-height: 1.35; }
/* profile */
.lvl { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.lvl b { font-size: max(calc(20px * var(--s)), 16px); color: var(--acc); }
.lvl .bar { flex: 1; min-width: 140px; height: 10px; border-radius: 6px; background: #ffffff1f; overflow: hidden; }
.lvl .bar i { display: block; height: 100%; background: var(--acc); }
.lvl span { color: var(--mute); font-size: max(calc(12px * var(--s)), var(--min-text)); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { background: #151c29; border-radius: 10px; padding: 8px 10px; }
.stats b { display: block; font-size: max(calc(18px * var(--s)), 14px); }
.stats span { color: var(--mute); font-size: max(calc(12px * var(--s)), var(--min-text)); }
.achs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.ach { padding: 7px 10px; border-radius: 10px; background: #121722; opacity: 0.6; }
.ach.on { opacity: 1; border: 1px solid var(--acc); }
.ach b { display: block; font-size: max(calc(13px * var(--s)), 12px); }
.ach span { color: var(--mute); font-size: max(calc(12px * var(--s)), var(--min-text)); }
@media (max-height: 430px) { .hubwrap .m-card { width: min(640px, 70vw); } .hub-tile { min-height: 0; } .hub-tile svg { display: none; } }
.t-sbtn { bottom: calc(14px + env(safe-area-inset-bottom)); width: calc(96px * var(--s)); height: calc(96px * var(--s)); border-radius: calc(18px * var(--s)); background: #11141bdd; border: 2px solid #ffffff33; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: max(calc(17px * var(--s)), 14px); letter-spacing: 0.05em; color: #fff; box-shadow: 0 6px 16px #0007; }
#tSL { left: calc(18px + env(safe-area-inset-left)); }
#tSR { left: calc(18px + env(safe-area-inset-left) + 108px * var(--s)); }
.t-sbtn.down { background: #2c3a52; }
/* emergency stop call: red frame flash (no text over the road) */
body.estop #hud::before { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 12px #e0262f, inset 0 0 140px #e0262f99; animation: estopFlash 0.35s 4 alternate; }
@keyframes estopFlash { from { opacity: 1; } to { opacity: 0.35; } }
.faults small.why { display: block; color: #aeb7c4; font-size: max(calc(12px * var(--s)), var(--min-text)); margin-top: 2px; }
ol.pre { margin: 4px 0 10px 18px; padding: 0; color: #dfe5ee; font-size: max(calc(14px * var(--s)), 12px); line-height: 1.45; }
/* garage */
.gstats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.gstats div { background: #0b2f7a96; border-radius: 10px; padding: 7px 12px; }
.gstats b { display: block; font-size: max(calc(15px * var(--s)), 13px); }
.gstats span { color: var(--mute); font-size: max(calc(12px * var(--s)), var(--min-text)); }
.gbars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
.gbar { display: flex; align-items: center; gap: 8px; }
.gbar span { width: 44%; font-size: max(calc(13px * var(--s)), 12px); color: #cfd6e0; }
.gbar .bar { flex: 1; height: 8px; border-radius: 5px; background: #ffffff1c; overflow: hidden; }
.gbar .bar i { display: block; height: 100%; background: var(--acc); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 3px; width: calc(78px * var(--s)); padding: 6px 4px; border-radius: 10px; border: 2px solid transparent; background: #121722; color: #dfe5ee; cursor: pointer; font-family: var(--font); }
.swatch i { width: calc(30px * var(--s)); height: calc(30px * var(--s)); border-radius: 50%; background: var(--c); border: 2px solid #ffffff55; }
.swatch span { font-size: max(calc(11px * var(--s)), var(--min-text)); text-align: center; line-height: 1.15; }
.swatch.on { border-color: var(--acc); }
.swatch.locked { opacity: 0.45; cursor: default; }
/* short landscape phones: the whole hub fits without scrolling */
@media (max-height: 400px) {
  .hub-head { margin-bottom: 6px; }
  .hub-head .ld-badge { width: 34px; height: 34px; font-size: 26px; line-height: 34px; }
  .hub-name h1 { font-size: 17px; }
  .hub-name span { display: none; }
  .hub-play { padding: 6px 14px; }
  .hub-play b { font-size: 22px; }
  .hub-grid { gap: 6px; margin-top: 6px; }
  .hub-tile { padding: 6px 9px; }
  .hub-tile span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .hub-switch { margin-top: 6px; flex-wrap: nowrap; gap: 10px; }
  .hub-switch > div > span { font-size: 12px; }
  .seg button { padding: 5px 9px; font-size: 12px; }
  .hub-foot { display: none; }
  #menus .menu.hubwrap { padding-top: 6px; padding-bottom: 6px; }
  .hubwrap .m-card { padding: 10px 12px; width: min(620px, 74vw); }
}

/* studio logo (first second) */
.logo { background: #0b0e14; z-index: 70; transition: opacity 0.25s; }
.logo.out { opacity: 0; }
.logo-mark { display: flex; flex-direction: column; align-items: center; gap: 10px; animation: logoIn 0.45s ease-out; }
.logo-mark .ld-badge { margin: 0; }
.logo-mark b { font-size: clamp(16px, 3.2vmin, 24px); letter-spacing: 0.28em; font-weight: 800; color: #fff; }
@keyframes logoIn { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
/* region choice: three cards, side by side on wide screens, stacked rows on narrow ones, never a scroll on a phone */
.rp { z-index: 60; background: radial-gradient(ellipse at 50% 20%, #1d2a40 0%, #0b0e14 75%); padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.rp-box { width: 100%; max-width: 1120px; height: 100%; max-height: 720px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(6px, 1.8vh, 16px); }
.rp-box h2 { margin: 0; font-size: clamp(18px, 4.4vmin, 34px); font-weight: 800; color: #fff; text-align: center; }
.rp-row { flex: 0 1 auto; min-height: 0; height: min(68vh, 460px); width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(8px, 1.8vw, 18px); }
.rp-card { display: flex; flex-direction: column; min-height: 0; padding: 0; border-radius: 16px; overflow: hidden; background: #141a26; border: 3px solid #ffffff22; text-align: left; transition: transform 0.12s, border-color 0.12s; }
.rp-card:hover, .rp-card.on { border-color: var(--acc); }
.rp-card:active { transform: scale(0.98); }
.rp-pic { flex: 0 0 58%; min-height: 0; display: block; background-size: cover; background-position: center; background-color: #243044; }
.rp-txt { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; gap: 2px; padding: clamp(6px, 1.6vmin, 14px) clamp(8px, 1.8vmin, 16px); }
.rp-txt b { font-size: clamp(14px, 3vmin, 22px); font-weight: 900; color: #fff; letter-spacing: 0.02em; }
.rp-txt em { font-style: normal; font-weight: 800; font-size: clamp(13px, 2.5vmin, 18px); color: var(--acc); }
.rp-txt small { font-size: clamp(12px, 2vmin, 15px); color: #cfd6e0; line-height: 1.25; }
.rp-note { color: #9aa4b4; font-size: clamp(12px, 1.9vmin, 14px); text-align: center; }
.rp-back { flex: none; }
@media (max-height: 430px) { .rp-blurb, .rp-note { display: none; } .rp-row { height: calc(100vh - 62px); } .rp-pic { flex: 1 1 0; } .rp-txt { flex: none; } }
@media (max-aspect-ratio: 1/1) {
  .rp-row { grid-template-columns: 1fr; grid-template-rows: repeat(3, minmax(0, 1fr)); height: min(78vh, 720px); }
  .rp-card { flex-direction: row; }
  .rp-pic { flex: 1 1 42%; }
  .rp-txt { flex: 1 1 58%; justify-content: center; }
}
.btn.big { font-size: max(calc(17px * var(--s)), 15px); padding: calc(13px * var(--s)) calc(22px * var(--s)); }
/* New York limit sign: white rectangle */
body.region-us .limit { border-radius: 6px; border: 2px solid #111; width: calc(40px * var(--s)); height: calc(50px * var(--s)); font-size: calc(19px * var(--s)); padding-top: calc(11px * var(--s)); }
body.region-us .limit::before { content: 'LIMIT'; position: absolute; top: 3px; left: 0; right: 0; text-align: center; font-size: calc(8px * var(--s)); font-weight: 800; color: #111; }
.rot-box { padding: 0 20px; text-align: center; }

/* ==================== v0.3.1 ==================== */
body.region-fr { --acc: #5eb0ff; }
body.region-us { --acc: #ffc61a; }
body.region-uk { --acc: #ffcc1a; }

/* region cards */
.rp-head { display: flex; align-items: center; gap: calc(12px * var(--m)); }
.rp-head .ld-badge { width: calc(46px * var(--m)); height: calc(46px * var(--m)); margin: 0; font-size: calc(36px * var(--m)); line-height: calc(46px * var(--m)); flex: none; }
.rp-head span { display: block; color: #aeb8c8; font-size: max(calc(13px * var(--m)), 12px); }
.rp-box h2 { text-align: left; }
.rp-card { position: relative; }
.rp-card:hover .rp-pic { transform: scale(1.05); }
.rp-pic { transition: transform 0.25s; }
.rp-txt { position: relative; background: #141a26; }
.rp-flag { position: absolute; right: calc(10px * var(--m)); top: calc(10px * var(--m)); width: calc(34px * var(--m)); }
.rp-flag svg { display: block; width: 100%; border-radius: 3px; box-shadow: 0 1px 4px #0008; }
.rp-prog { color: var(--acc, #ffcc1a) !important; font-weight: 700; }
@media (max-height: 430px) { .rp-head span { display: none; } .rp-row { height: calc(100vh - 72px); } }

/* menu frame */
#menus .menu.screen, #menus .menu.center { background: linear-gradient(120deg, #070b14f0, #0a1120d9 55%, #0a112099); justify-content: center; padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
#menus .menu.screen.clearbg { background: linear-gradient(90deg, #070b14f5 0%, #070b14e0 58%, #070b1433 86%); justify-content: flex-start; }
.menu.screen.clearbg .m-card { width: min(calc(760px * var(--m)), 72vw); }
.menu.screen .m-card { position: relative; width: min(calc(1040px * var(--m)), 100%); height: 100%; max-height: min(100%, calc(640px * var(--m))); display: flex; flex-direction: column; overflow: hidden; padding: calc(14px * var(--m)) calc(16px * var(--m)); background: #0d131fe6; border-radius: calc(18px * var(--m)); }
.menu.center .m-card { background: #0d131ff0; border-radius: calc(18px * var(--m)); padding: calc(18px * var(--m)) calc(22px * var(--m)); width: min(calc(700px * var(--m)), 100%); max-height: 100%; overflow: auto; }
.sc-head { display: flex; align-items: center; gap: calc(12px * var(--m)); flex: none; margin-bottom: calc(10px * var(--m)); }
.sc-back { display: flex; align-items: center; gap: 4px; padding: calc(7px * var(--m)) calc(13px * var(--m)) calc(7px * var(--m)) calc(8px * var(--m)); border-radius: calc(10px * var(--m)); background: #ffffff14; font-weight: 800; font-size: max(calc(14px * var(--m)), 13px); flex: none; min-height: 40px; }
.sc-back svg { width: calc(20px * var(--m)); height: calc(20px * var(--m)); min-width: 16px; min-height: 16px; }
.sc-back:hover { background: #ffffff26; }
.sc-title { flex: 1; min-width: 0; }
.sc-title h2 { margin: 0; font-size: max(calc(24px * var(--m)), 17px); font-weight: 900; line-height: 1.1; }
.sc-title span { display: block; margin-top: 2px; color: #a9b4c4; font-size: max(calc(13px * var(--m)), 12px); }
.sc-city { display: flex; align-items: center; gap: 7px; flex: none; color: #cfd6e0; font-size: max(calc(13px * var(--m)), 12px); }
.sc-city svg { width: calc(28px * var(--m)); min-width: 22px; border-radius: 2px; }
.sc-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding-right: 14px; touch-action: pan-y; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.sc-body::-webkit-scrollbar { display: none; }
/* v0.3.12 drawn scroll bar (ui/scrollbar.js): navy track, gold thumb, the browser's own bar hidden */
.sb-box { scrollbar-width: none; }
.sb-box::-webkit-scrollbar { display: none; width: 0; height: 0; }
.sb-track { position: absolute; z-index: 3; width: 10px; border-radius: 6px; background: #020a22cc; box-shadow: inset 0 0 0 1px #27a4ff55; touch-action: none; cursor: pointer; }
.sb-thumb { position: absolute; left: 2px; right: 2px; top: 0; border-radius: 4px; background: linear-gradient(180deg, #ffe066, #ffc61a 55%, #e9a400); box-shadow: 0 0 6px #ffc61a66; cursor: grab; touch-action: none; }
.sb-track:hover .sb-thumb, .sb-thumb.drag { background: linear-gradient(180deg, #fff0a0, #ffd84a 55%, #ffb300); }
.sb-thumb.drag { cursor: grabbing; }
body.touch-ui .sb-track { width: 8px; }
.sc-foot { flex: none; display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; padding-top: calc(10px * var(--m)); }
.sc-note { color: #a9b4c4; font-size: max(calc(13px * var(--m)), 12px); margin: 10px 0 0; line-height: 1.4; }
.btn { border-radius: calc(11px * var(--m)); transition: filter 0.12s; }
.btn:hover { filter: brightness(1.12); }
.btn.big { font-size: max(calc(16px * var(--m)), 14px); padding: calc(11px * var(--m)) calc(20px * var(--m)); min-height: 42px; }
.btn.primary { border: none; }
.m-tile.primary { background: var(--acc); color: #0b1220; }
.m-section { font-size: max(calc(13px * var(--m)), 12px); }
.d-easy b { color: #4ade80; } .d-medium b { color: #fbbf24; } .d-hard b { color: #fb7185; }
.m-grid.pk { grid-template-columns: repeat(3, minmax(0, 1fr)); }

#menus .menu.hubwrap { padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); justify-content: flex-start; background: linear-gradient(90deg, #060a12f7 0%, #060a12e6 55%, #060a1266 78%, #060a1200 92%); }
.hubwrap .m-card { width: min(calc(780px * var(--m)), 72vw); height: 100%; max-height: 100%; padding: 0; background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; overflow: visible; }
.seg button { padding: calc(5px * var(--m)) calc(10px * var(--m)); min-height: 30px; }

/* lessons */
.ls-g { margin-bottom: calc(10px * var(--m)); }
.ls-g h3 { display: flex; justify-content: space-between; margin: 0 0 calc(6px * var(--m)); font-size: max(calc(14px * var(--m)), 12px); color: #cfd6e0; text-transform: uppercase; letter-spacing: 0.08em; }
.ls-g h3 span { color: var(--acc); letter-spacing: 0; }
.ls-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: calc(7px * var(--m)); }
.ls { display: grid; grid-template-columns: auto 1fr; column-gap: calc(9px * var(--m)); align-items: center; text-align: left; padding: calc(8px * var(--m)) calc(10px * var(--m)); border-radius: calc(11px * var(--m)); background: #ffffff0f; border: 2px solid transparent; min-height: 54px; }
.ls:hover { background: #ffffff1f; }
.ls em { grid-row: 1 / 3; width: calc(34px * var(--m)); height: calc(34px * var(--m)); min-width: 28px; min-height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #ffffff1c; font-style: normal; font-weight: 900; font-size: max(calc(15px * var(--m)), 13px); }
.ls em svg { width: 58%; height: 58%; }
.ls b { font-size: max(calc(14px * var(--m)), 13px); font-weight: 800; line-height: 1.15; }
.ls span { font-size: max(calc(12px * var(--m)), 12px); color: #aeb8c8; }
.ls-st { color: var(--acc); font-style: normal; letter-spacing: 1px; }
.ls.done em { background: var(--acc); color: #0b1220; }
.ls.next { border-color: var(--acc); background: #ffffff1a; }
.ls.locked { opacity: 0.55; cursor: default; }
.br { max-width: calc(760px * var(--m)); }
.br-txt { font-size: max(calc(17px * var(--m)), 14px); line-height: 1.45; margin: 0 0 12px; color: #e8edf4; }
.br-obj { padding: calc(10px * var(--m)) calc(13px * var(--m)); border-radius: calc(11px * var(--m)); background: #ffffff10; font-size: max(calc(15px * var(--m)), 13px); line-height: 1.4; }
.br-obj b { display: block; color: var(--acc); font-size: max(calc(13px * var(--m)), 12px); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 2px; }

/* test */
.tm { display: grid; grid-template-columns: 1.15fr 1fr; gap: calc(16px * var(--m)); }
.tm ol.pre { font-size: max(calc(14px * var(--m)), 12px); margin-bottom: 0; }
.tm-score { padding: calc(10px * var(--m)) calc(13px * var(--m)); border-radius: calc(12px * var(--m)); background: #ffffff0d; }
.tm-score h3 { margin: 0 0 3px; font-size: max(calc(16px * var(--m)), 14px); }
.tm-list { display: grid; gap: 3px; margin-top: 7px; }
.tm-list span { display: flex; gap: 9px; font-size: max(calc(13px * var(--m)), 12px); color: #dfe5ee; }
.tm-list b { width: 2.6em; text-align: right; flex: none; }
.tm-hist { margin-top: 8px; display: flex; gap: 5px; flex-wrap: wrap; }
.up { color: #4ade80; } .down { color: #ff7a7a; }

/* settings */
.st-tabs { display: flex; gap: 5px; margin-bottom: calc(9px * var(--m)); flex-wrap: wrap; }
.st-tabs button { padding: calc(7px * var(--m)) calc(13px * var(--m)); min-height: 36px; border-radius: calc(9px * var(--m)); background: #ffffff10; font-weight: 800; font-size: max(calc(14px * var(--m)), 13px); }
.st-tabs button.on { background: var(--acc); color: #0b1220; }
.st-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px calc(14px * var(--m)); }

/* progress */
.pf-cities { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(7px * var(--m)); margin-bottom: calc(9px * var(--m)); }
.pf-city { padding: calc(8px * var(--m)) calc(10px * var(--m)); border-radius: calc(11px * var(--m)); background: #ffffff0f; display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; align-items: center; }
.pf-city svg { width: calc(26px * var(--m)); min-width: 22px; border-radius: 2px; }
.pf-city b { font-size: max(calc(15px * var(--m)), 13px); }
.pf-city span, .pf-city small { grid-column: 1 / 3; color: #aeb8c8; font-size: max(calc(12px * var(--m)), 12px); }
.pf-city .hx-bar { grid-column: 1 / 3; }

/* cards in the middle of the screen */
.cardx { text-align: center; }
.cardx h2 { margin: 6px 0; font-size: max(calc(26px * var(--m)), 18px); font-weight: 900; line-height: 1.15; }
.cardx p { margin: 0; color: #b9c2cf; font-size: max(calc(14px * var(--m)), 13px); }
.cardx p b { color: var(--acc); }
.cx-ok { display: inline-flex; width: calc(52px * var(--m)); height: calc(52px * var(--m)); min-width: 40px; min-height: 40px; align-items: center; justify-content: center; border-radius: 50%; background: #22c55e; color: #fff; font-style: normal; font-weight: 900; font-size: calc(30px * var(--m)); }
.cx-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: calc(13px * var(--m)); }
.cx-flag svg { width: calc(64px * var(--m)); border-radius: 4px; }
.pz-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(8px * var(--m)); margin-top: calc(11px * var(--m)); }
.pz-t { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: calc(11px * var(--m)) calc(6px * var(--m)); border-radius: calc(12px * var(--m)); background: #ffffff10; }
.pz-t:hover { background: #ffffff20; }
.pz-t em { font-style: normal; color: var(--acc); }
.pz-t svg { width: calc(26px * var(--m)); height: calc(26px * var(--m)); min-width: 20px; min-height: 20px; display: block; }
.pz-t b { font-size: max(calc(15px * var(--m)), 13px); font-weight: 800; }
.pz-t span { font-size: max(calc(12px * var(--m)), 12px); color: #aeb8c8; }
.pz-t.primary { background: var(--acc); color: #0b1220; }
.pz-t.primary em, .pz-t.primary span { color: #0b1220; }
.pz-foot { display: block; margin-top: 9px; color: #8f99a8; font-size: 11px; }
.qa small { color: var(--acc); font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; font-size: max(calc(13px * var(--m)), 12px); }
.qa h2 { font-size: max(calc(20px * var(--m)), 15px); }
.qa-list { display: grid; gap: 7px; margin-top: 10px; }
.qa-list .btn { text-align: left; font-weight: 600; min-height: 42px; }

/* results */
.rs-top { display: flex; align-items: center; justify-content: center; gap: calc(18px * var(--m)); flex-wrap: wrap; margin-bottom: calc(9px * var(--m)); }
.rs .big { font-size: calc(46px * var(--m)); font-weight: 900; line-height: 1; }
.rs .big.pass { color: #4ade80; } .rs .big.fail { color: #ff6b6b; }
.rs .stars3 { font-size: calc(38px * var(--m)); color: var(--acc); letter-spacing: 5px; line-height: 1; }
.rs .stars3 .off { color: #ffffff2a; }
.rs-score { display: flex; flex-direction: column; align-items: center; line-height: 1; padding: calc(5px * var(--m)) calc(13px * var(--m)); border-radius: calc(11px * var(--m)); background: #ffffff12; }
.rs-score b { font-size: calc(34px * var(--m)); font-weight: 900; }
.rs-score span { font-size: max(calc(12px * var(--m)), 12px); color: #aeb8c8; }
.rs-note { flex-basis: 100%; text-align: center; color: #cfd6e0; font-size: max(calc(14px * var(--m)), 13px); }
.rs-lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: calc(12px * var(--m)); }
.rs-lists section { padding: calc(8px * var(--m)) calc(11px * var(--m)); border-radius: calc(11px * var(--m)); background: #ffffff0c; }
.rs-lists h3 { margin: 0 0 5px; display: flex; justify-content: space-between; font-size: max(calc(14px * var(--m)), 13px); }
.rs-lists em { font-style: normal; }
.rs-lists ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rs-lists li { display: flex; gap: 8px; font-size: max(calc(13px * var(--m)), 12px); }
.rs-lists li > b { width: 2.6em; flex: none; text-align: right; }
.rs-lists li i { color: #aeb8c8; font-style: normal; }
.rs-lists li small { display: block; color: #aeb8c8; font-size: max(calc(12px * var(--m)), 12px); }
.rs-lists li.none { color: #aeb8c8; }
.result .faults { font-size: max(calc(14px * var(--m)), 13px); }

/* phones sideways: lists keep their columns, everything stays on screen */
@media (max-height: 430px) {
  .ls-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .m-grid.pk { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .st-list { grid-template-columns: 1fr; }
  .tm { grid-template-columns: 1fr 1fr; gap: 10px; }
  .pz-t span { display: none; }
  .menu.screen .m-card { padding: 8px 12px; border-radius: 12px; }
  .sc-head { margin-bottom: 5px; }
  .sc-title span { display: none; }
}
@media (max-height: 310px) {
}
@media (max-aspect-ratio: 1/1) { .ls-grid, .m-grid.pk { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tm, .rs-lists, .st-list, .pf-cities { grid-template-columns: 1fr; } }

/* live score + feed + sign assist */
.h-score { position: absolute; left: calc(14px + env(safe-area-inset-left)); top: calc(86px * var(--s) + 12px); padding: calc(3px * var(--s)) calc(11px * var(--s)); display: flex; align-items: baseline; gap: 7px; }
.h-score span { font-size: max(calc(11px * var(--s)), var(--min-text)); color: var(--mute); font-weight: 800; letter-spacing: 0.08em; }
.h-score b { font-size: calc(23px * var(--s)); font-weight: 900; color: var(--acc); font-variant-numeric: tabular-nums; }
.h-score.pop b { animation: scPop 0.3s; }
@keyframes scPop { 40% { transform: scale(1.22); } }
body.scoring .h-xp { display: none; }
.h-feed { position: absolute; left: calc(14px + env(safe-area-inset-left)); top: calc(86px * var(--s) + 52px); display: flex; flex-direction: column; gap: 4px; max-width: min(40vw, calc(330px * var(--s))); }
.fd { display: flex; gap: 7px; align-items: baseline; padding: 2px 10px 3px 7px; border-radius: 9px; background: #0b1220d6; font-size: max(calc(13px * var(--s)), var(--min-text)); font-weight: 600; animation: fdIn 0.2s ease-out, fdOut 0.5s 4.7s forwards; }
.fd b { font-weight: 900; font-size: 1.1em; flex: none; }
.fd.up b { color: #4ade80; } .fd.down b { color: #ff7a7a; }
.fd.down { background: #3a1216e0; }
@keyframes fdIn { from { transform: translateX(-10px); opacity: 0; } }
@keyframes fdOut { to { opacity: 0; } }
.h-signs { position: absolute; left: calc(180px * var(--s) + 14px + env(safe-area-inset-left)); top: calc(86px * var(--s) + 12px); display: flex; gap: 8px; pointer-events: none; }
.sg { display: flex; flex-direction: column; align-items: center; width: calc(78px * var(--s)); padding: 3px 3px 4px; border-radius: 10px; background: #0b1220c4; }
.sg img { width: calc(40px * var(--s)); height: calc(40px * var(--s)); object-fit: contain; }
.sg span { font-size: max(calc(11px * var(--s)), var(--min-text)); line-height: 1.05; text-align: center; font-weight: 700; }
.sg i { font-style: normal; font-size: max(calc(11px * var(--s)), var(--min-text)); color: var(--acc); font-weight: 800; }
@media (max-height: 430px) { .sg span { display: none; } .sg { width: auto; min-width: 46px; } .h-signs { left: calc(120px + env(safe-area-inset-left)); top: calc(78px * var(--s) + 6px); } .h-score { top: calc(78px * var(--s) + 6px); } .h-feed { top: calc(78px * var(--s) + 42px); } }

/* tutorial: the key strip stays on screen, the current key lights up, the coach card sits above it */
.keys span.on { background: var(--acc); color: #0b1220; border-color: transparent; animation: keyGlow 0.9s infinite alternate; }
@keyframes keyGlow { to { box-shadow: 0 0 calc(12px * var(--s)) var(--acc); } }
body.tut .keys { gap: 4px; left: 2vw; right: 2vw; max-width: none; transform: none; bottom: 6px; }
body.tut .keys span { padding: 2px 6px; font-size: max(calc(11px * var(--s)), var(--min-text)); }
body.tut .keys kbd { margin-right: 4px; }
body.tut .coach { bottom: calc(34px * var(--s) + 22px); padding: calc(7px * var(--s)) calc(14px * var(--s)); gap: calc(12px * var(--s)); }
body.tut .co-key { min-width: calc(54px * var(--s)); height: calc(54px * var(--s)); font-size: calc(28px * var(--s)); padding: 0 calc(8px * var(--s)); }
body.tut .co-txt b { font-size: max(calc(18px * var(--s)), 15px); }
body.tut .co-txt span { font-size: max(calc(13px * var(--s)), var(--min-text)); margin-top: 1px; }

/* ==================== the game logo sets the look: navy and electric blue, chrome titles, gold buttons, the red ribbon ==================== */
:root {
  --navy0: #030b22; --navy1: #061a4a; --navy2: #0b2f7a; --edge: #1f7bea; --glow: #27a4ff; --ink: #0a1430;
  --goldg: linear-gradient(#ffe45c 0%, #ffcb1f 48%, #f5a400 100%);
  --redg: linear-gradient(#e2181e, #9d0b12);
  --chrome: linear-gradient(#ffffff 0%, #e6ebf1 46%, #a9b4c2 54%, #eef2f6 100%);
  --brandbg: radial-gradient(ellipse at 50% 32%, #0b2f7a 0%, #05143a 58%, #020817 100%);
}
#menus, .rp, .logo, #loading, #rotate { --acc: #ffc61a; }
#loading, .logo, .rp, #rotate { background: var(--brandbg); }
.ld-logo { display: block; width: min(560px, 78vw, 112vh); margin: 0 auto 10px; filter: drop-shadow(0 8px 24px #0009); }
.ld-box { width: min(560px, 88vw); }
.ld-box h1 { font-size: clamp(12px, 2.4vmin, 16px); margin: 0 0 14px; font-weight: 800; color: #ffd84a; letter-spacing: 0.14em; text-transform: uppercase; }
.ld-msg, .ld-osm { color: #b6c6e4; }
.logo-mark img { width: min(640px, 80vw, 128vh); filter: drop-shadow(0 10px 30px #000a); }
.logo-mark b { color: #cfdcf3; font-size: clamp(12px, 2.4vmin, 17px); }
#rotate { z-index: 90; padding: 16px; }
.rot-box img { width: min(82vw, 440px); filter: drop-shadow(0 6px 18px #0009); }
.rot-box b { color: #ffd84a; font-size: 18px; font-style: italic; font-weight: 900; letter-spacing: 0.02em; }
.rot-box span { color: #cfdcf3; }
.rot-icon { margin: 14px 0 22px; }

/* city choice */
.rp-head { justify-content: center; gap: calc(16px * var(--m)); }
.rp-head img { height: calc(118px * var(--m)); max-height: 23vh; width: auto; filter: drop-shadow(0 6px 16px #0009); }
.rp-box h2, .rp-head h2 { padding: calc(6px * var(--m)) calc(20px * var(--m)); border-radius: calc(8px * var(--m)); background: var(--redg); box-shadow: inset 0 0 0 2px #ffcf3a55, 0 4px 12px #0007; color: #ffd84a; font-style: italic; font-weight: 900; letter-spacing: 0.02em; transform: skewX(-8deg); white-space: nowrap; font-size: clamp(16px, 4vmin, 30px); }
.rp-card { background: var(--navy1); border-color: var(--edge); box-shadow: 0 0 16px #27a4ff33; }
.rp-card:hover, .rp-card.on { border-color: #ffc61a; box-shadow: 0 0 20px #ffc61a66; }
.rp-txt { background: var(--navy1); }
.rp-txt em { color: #ffd84a; }
.rp-txt b { font-style: italic; }
.rp-note { color: #b6c6e4; }

/* main menu: logo, the gold button, the list under it, the real city alive on the right */
#menus .menu.hubwrap { padding: 0; justify-content: flex-start; background: linear-gradient(90deg, #030b22f7 0%, #05143aee 32%, #05143aa8 44%, #05143a00 60%); }
.hubwrap .m-card { position: absolute; inset: 0; width: auto; max-width: none; height: auto; max-height: none; padding: 0; background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; overflow: visible; }
.home { position: absolute; left: 0; top: 0; bottom: 0; width: min(calc(452px * var(--m)), 47vw); padding: 8px 0 8px max(calc(22px * var(--m)), calc(env(safe-area-inset-left) + 12px)); display: flex; flex-direction: column; justify-content: center; gap: calc(8px * var(--m)); }
.gamelogo { display: block; width: 100%; max-height: 22vh; object-fit: contain; object-position: left center; flex: none; filter: drop-shadow(0 6px 18px #000a); }
.mplay { display: flex; align-items: center; gap: calc(12px * var(--m)); min-height: calc(64px * var(--m)); padding: calc(6px * var(--m)) calc(16px * var(--m)); border-radius: calc(13px * var(--m)); color: var(--ink); background: var(--goldg); text-align: left; flex: none; box-shadow: inset 0 1px 0 #fffb, inset 0 -2px 0 #b5620066, 0 6px 18px #ffa00055; transition: transform 0.12s, filter 0.12s; }
.mplay i { flex: none; width: calc(30px * var(--m)); height: calc(30px * var(--m)); min-width: 22px; min-height: 22px; }
.mplay i svg { width: 100%; height: 100%; display: block; }
.mplay span { min-width: 0; display: flex; flex-direction: column; }
.mplay b { font-style: italic; font-weight: 900; letter-spacing: 0.03em; font-size: max(calc(25px * var(--m)), 19px); line-height: 1.05; }
.mplay small { font-weight: 700; font-size: max(calc(13px * var(--m)), 12px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mplay:hover { filter: brightness(1.07); transform: translateX(3px); }
.mplay:active, .mr:active, .hcity:active { transform: scale(0.98); }
.mlist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: calc(6px * var(--m)); flex: none; }
.mr { display: flex; align-items: center; gap: calc(8px * var(--m)); min-height: calc(42px * var(--m)); padding: 0 calc(10px * var(--m)); border-radius: calc(10px * var(--m)); background: #0b2f7ae0; border: 1px solid #1f7beaa8; text-align: left; transition: transform 0.12s, border-color 0.12s, background 0.12s; }
.mr i { flex: none; color: #ffc61a; width: calc(22px * var(--m)); height: calc(22px * var(--m)); min-width: 18px; min-height: 18px; }
.mr i svg { width: 100%; height: 100%; display: block; }
.mr b { flex: 1; min-width: 0; font-weight: 800; letter-spacing: 0.02em; font-size: max(calc(15px * var(--m)), 13px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mr em { flex: none; font-style: normal; font-weight: 800; font-size: max(calc(12px * var(--m)), 11px); color: var(--ink); background: var(--goldg); border-radius: 99px; padding: 1px 7px; }
.mr:hover { border-color: #ffc61a; background: #0e3a94; transform: translateX(2px); }
.mr { position: relative; }
.mr em.corner { position: absolute; top: calc(-8px * var(--m)); right: calc(6px * var(--m)); font-size: max(calc(11px * var(--m)), 11px); line-height: 1.35; padding: 0 calc(6px * var(--m)); box-shadow: 0 1px 4px #0008; pointer-events: none; }
.hcities { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(6px * var(--m)); flex: none; }
.hcity { display: flex; align-items: center; justify-content: center; gap: calc(6px * var(--m)); min-height: calc(36px * var(--m)); padding: 0 calc(6px * var(--m)); border-radius: calc(9px * var(--m)); background: #030b22b8; border: 2px solid transparent; }
.hcity:hover { border-color: #1f7bea; }
.hcity.on { border-color: #ffc61a; background: #05143ae0; }
.hcity svg { width: calc(26px * var(--m)); min-width: 20px; flex: none; border-radius: 2px; }
.hcity b { font-size: max(calc(13px * var(--m)), 12px); font-weight: 800; white-space: nowrap; }
.hcity span { font-size: max(calc(12px * var(--m)), 11px); color: #b6c6e4; }
.hlv { position: absolute; right: max(calc(16px * var(--m)), calc(env(safe-area-inset-right) + 10px)); top: max(calc(14px * var(--m)), env(safe-area-inset-top)); width: calc(170px * var(--m)); min-width: 120px; padding: calc(7px * var(--m)) calc(10px * var(--m)); border-radius: calc(10px * var(--m)); background: #05143ad9; border: 1px solid #1f7bea99; display: grid; grid-template-columns: 1fr auto; gap: 3px 6px; align-items: baseline; }
.hlv b { font-size: max(calc(14px * var(--m)), 12px); color: #ffd84a; font-style: italic; font-weight: 900; }
.hlv span { font-size: max(calc(12px * var(--m)), 11px); color: #cfdcf3; }
.hx-bar { grid-column: 1 / 3; display: block; height: calc(6px * var(--m)); min-height: 4px; border-radius: 4px; background: #ffffff24; overflow: hidden; }
.hx-bar u { display: block; height: 100%; background: var(--goldg); border-radius: 4px; }
.hfoot { position: absolute; right: max(calc(16px * var(--m)), calc(env(safe-area-inset-right) + 10px)); bottom: max(6px, env(safe-area-inset-bottom)); max-width: 46vw; text-align: right; color: #e3ebf8; font-size: max(calc(11px * var(--m)), 11px); line-height: 1.25; text-shadow: 0 1px 3px #000; }

/* every other screen */
#menus .menu.screen, #menus .menu.center { background: linear-gradient(120deg, #030b22f4, #061a4ae0 55%, #0b2f7a9e); }
#menus .menu.screen.clearbg { background: linear-gradient(90deg, #030b22f7 0%, #05143ae6 58%, #05143a33 86%); }
.menu.screen .m-card, .menu.center .m-card { background: linear-gradient(170deg, #0a2460f4, #051338f7); border: 2px solid var(--edge); box-shadow: 0 0 0 1px #02081a, 0 0 26px #27a4ff44; }
.sc-title h2, .cardx h2 { font-style: italic; font-weight: 900; text-transform: uppercase; letter-spacing: 0.01em; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sc-title span, .sc-city, .cardx p, .sc-note, .ls span, .pf-city span, .pf-city small, .pz-t span, .rs-score span, .rs-lists li i, .rs-lists li small { color: #c3d2ec; }
.sc-logo { flex: none; height: calc(58px * var(--m)); min-height: 38px; width: auto; }
.sc-back, .btn, .st-tabs button { background: #0b2f7a; border: 1px solid #1f7bea99; }
.sc-back:hover, .st-tabs button:hover, .btn:hover { background: #0e3a94; }
.btn.primary, .m-tile.primary, .pz-t.primary, .st-tabs button.on, .seg button.on { background: var(--goldg); color: var(--ink); border-color: transparent; font-weight: 900; box-shadow: inset 0 1px 0 #fffb, 0 3px 12px #ffa00044; }
.btn.danger { background: var(--redg); }
.ls, .m-tile, .pz-t, .pf-city, .tm-score, .br-obj, .rs-lists section, .rs-score, .set-row { background: #0b2f7a96; }
.ls, .m-tile, .pz-t { border: 1px solid #1f7bea66; }
.ls:hover, .m-tile:hover, .pz-t:hover { background: #0e3a94; }
.m-tile.primary:hover, .pz-t.primary:hover { background: var(--goldg); filter: brightness(1.07); }
.ls.next { border: 2px solid #ffc61a; background: #0e3a94; }
.ls.done em { background: var(--goldg); }
.ls em { background: #030b2280; }
.ls-g h3, .m-section, .br-obj b { color: #ffd84a; font-style: italic; }
.rs .stars3 .off { color: #ffffff2e; }

/* the steering pad, as in the studio's other driving games */
#touch { --joyh: clamp(64px, 19vh, 96px); --trow: calc(env(safe-area-inset-bottom) + 14px + var(--joyh) + 9px); }
.tzone { position: absolute; left: 0; bottom: 0; width: 42%; height: 64%; pointer-events: auto; touch-action: none; }
.tjoy { position: absolute; left: calc(18px + env(safe-area-inset-left)); bottom: calc(14px + env(safe-area-inset-bottom)); width: clamp(170px, 46vh, 240px); height: var(--joyh); border-radius: 999px; background: #05143a80; box-shadow: inset 0 0 0 2px #27a4ffb0, 0 6px 16px #0006; pointer-events: none; }
.tjoy.act { background: #05143ab8; }
.tjoy-knob { position: absolute; left: 50%; top: 8%; height: 84%; aspect-ratio: 1; translate: -50% 0; border-radius: 50%; background: linear-gradient(#ffffff, #cfd6e0); box-shadow: 0 3px 10px #0006; }
.tjoy i { position: absolute; top: 50%; width: 22%; height: 44%; transform: translateY(-50%); color: #ffffffc0; display: flex; align-items: center; justify-content: center; }
.tjoy i svg { height: 100%; width: auto; filter: drop-shadow(0 1px 2px #0008); }
.tjoy .tj-l { left: 3%; } .tjoy .tj-r { right: 3%; }

/* phones sideways: designed at 844 x 390 */
@media (max-height: 430px) {
  .home { width: min(58vw, 500px); padding: 5px 0 5px max(12px, calc(env(safe-area-inset-left) + 8px)); gap: 5px; }
  .gamelogo { width: auto; height: 21vh; max-width: 74%; object-fit: contain; }
  .mplay { min-height: 44px; padding: 3px 12px; gap: 9px; border-radius: 11px; }
  .mplay i { width: 22px; height: 22px; }
  .mplay b { font-size: 20px; }
  .mplay small { font-size: 12px; }
  .mlist { gap: 4px; }
  .mr { min-height: 35px; gap: 6px; padding: 0 8px; border-radius: 9px; }
  .mr i { width: 18px; height: 18px; }
  .mr b { font-size: 13px; }
  .mr em { font-size: 11px; padding: 0 6px; }
  .hcities { gap: 4px; }
  .hcity { min-height: 30px; gap: 5px; padding: 0 4px; }
  .hcity b { font-size: 12px; } .hcity span { display: none; }
  .hlv { width: 128px; padding: 4px 8px; }
  .hfoot { max-width: 38vw; }
  .sc-city b { display: none; }
  #toasts { top: 74px; }
  .sc-logo { height: 40px; }
  .rp-head img { height: 62px; max-height: none; }
  .rp-head h2 { font-size: 17px; padding: 3px 14px; }
  .rp-row { height: calc(100vh - 76px); }
}
@media (max-height: 310px) {
  .home { gap: 3px; padding-top: 3px; padding-bottom: 3px; }
  .gamelogo { height: 16vh; }
  .mplay { min-height: 36px; padding: 2px 10px; } .mplay b { font-size: 17px; } .mplay small { display: none; }
  .mr { min-height: 29px; } .mlist { gap: 3px; }
  .hcity { min-height: 26px; }
  .rp-head img { height: 42px; } .rp-row { height: calc(100vh - 60px); }
}

/* Free Drive: the choice of vehicle */
.rd-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: calc(12px * var(--m)); }
.rd-card { display: flex; flex-direction: column; min-width: 0; padding: 0; border-radius: calc(14px * var(--m)); overflow: hidden; background: var(--navy1); border: 3px solid var(--edge); color: #fff; text-align: left; transition: transform 0.12s, border-color 0.12s; }
.rd-card:hover, .rd-card.on { border-color: #ffc61a; box-shadow: 0 0 20px #ffc61a66; }
.rd-card:active { transform: scale(0.98); }
.rd-card i { display: block; aspect-ratio: 8 / 5; background: #243044 center / cover no-repeat; }
.rd-card b { padding: calc(8px * var(--m)) calc(10px * var(--m)) 0; font-size: max(calc(18px * var(--m)), 15px); font-weight: 900; font-style: italic; }
.rd-card span { padding: 0 calc(10px * var(--m)) calc(10px * var(--m)); font-size: max(calc(13px * var(--m)), 12px); color: #b6c6e4; }

/* ==================== sideways phones (v0.3.10): nothing on top of anything ====================
   bottom row, left to right: steering pad (indicators over it) ... P R N D (HORN LIGHTS WIPERS START over it), BRAKE (P-BRAKE
   over it), GAS. Top: speed panel left, objective / instructor / toasts in the measured free band, round buttons 2 x 2 beside
   the minimap right, the next turn under the buttons. Sizes from --ts (game.resize: short side / 430), floors for thumbs. */
#touch {
  --mr: calc(14px + env(safe-area-inset-right)); --ml: calc(16px + env(safe-area-inset-left)); --mb: calc(12px + env(safe-area-inset-bottom));
  --gap: max(8px, calc(10px * var(--ts, 1)));
  --gasW: max(64px, calc(100px * var(--ts, 1))); --gasH: max(100px, calc(150px * var(--ts, 1)));
  --brkW: max(76px, calc(116px * var(--ts, 1))); --brkH: max(70px, calc(104px * var(--ts, 1))); --pbH: max(34px, calc(42px * var(--ts, 1)));
  --gc: max(36px, calc(48px * var(--ts, 1))); --gh: max(34px, calc(44px * var(--ts, 1))); --gw: calc(var(--gc) * 4 + 12px);
  --gr: calc(var(--mr) + var(--gasW) + var(--brkW) + var(--gap) * 2);
  --ah: max(34px, calc(42px * var(--ts, 1))); --aw: max(50px, calc(66px * var(--ts, 1))); --ew: max(52px, calc(64px * var(--ts, 1)));
  --joyh: max(60px, calc(86px * var(--ts, 1))); --joyw: max(150px, calc(224px * var(--ts, 1)));
  --iw: max(54px, calc(66px * var(--ts, 1))); --ih: max(42px, calc(50px * var(--ts, 1)));
}
#touch .tjoy { left: var(--ml); bottom: var(--mb); width: var(--joyw); height: var(--joyh); }
#touch .t-sbtn { bottom: var(--mb); width: calc(var(--joyw) / 2 - 5px); height: var(--joyh); border-radius: calc(16px * var(--ts, 1)); }
#touch #tSL { left: var(--ml); } #touch #tSR { left: calc(var(--ml) + var(--joyw) / 2 + 5px); }
#touch .t-small { border-radius: max(10px, calc(12px * var(--ts, 1))); font-size: max(12px, calc(14px * var(--ts, 1))); }
#touch .t-ind { bottom: calc(var(--mb) + var(--joyh) + var(--gap)); width: var(--iw); height: var(--ih); }
#touch #tIL { left: var(--ml); } #touch #tIR { left: calc(var(--ml) + var(--iw) + 8px); }
#touch .t-ind svg { width: 62%; height: 62%; }
#touch .t-pedal { bottom: var(--mb); border-radius: max(12px, calc(16px * var(--ts, 1))); font-size: max(15px, calc(19px * var(--ts, 1))); }
#touch .t-gas { right: var(--mr); width: var(--gasW); height: var(--gasH); }
#touch .t-brake { right: calc(var(--mr) + var(--gasW) + var(--gap)); width: var(--brkW); height: var(--brkH); }
#touch #tHB { right: calc(var(--mr) + var(--gasW) + var(--gap)); bottom: calc(var(--mb) + var(--brkH) + var(--gap)); width: var(--brkW); height: var(--pbH); }
#touch .t-gear { right: var(--gr); bottom: var(--mb); width: var(--gw); flex-direction: row; gap: 4px; }
#touch .t-gear b { width: var(--gc); height: var(--gh); border-radius: max(8px, calc(10px * var(--ts, 1))); font-size: max(15px, calc(18px * var(--ts, 1))); }
#touch .t-mg { flex-direction: row-reverse; }
#touch .t-mg b { width: calc((var(--gw) - 4px) / 2); height: var(--gh); font-size: max(11px, calc(12px * var(--ts, 1))); line-height: 1.1; }
#touch .t-aux { bottom: calc(var(--mb) + var(--gh) + var(--gap)); height: var(--ah); width: var(--aw); font-size: max(11px, calc(13px * var(--ts, 1))); font-weight: 800; letter-spacing: 0.02em; }
#touch #tEng { right: var(--gr); width: var(--ew); }
#touch #tWipers { right: calc(var(--gr) + var(--ew) + 6px); }
#touch #tLights { right: calc(var(--gr) + var(--ew) + var(--aw) + 12px); }
#touch #tHorn { right: calc(var(--gr) + var(--ew) + var(--aw) * 2 + 18px); }

/* the HUD on touch screens: the left column stacks under the speed panel (above the steering zone, so SKIP takes a tap) */
.h-left, .h-row { display: contents; }
#menus .menu { z-index: 5; }
body.touch-ui { --rb: max(36px, calc(44px * var(--ts, 1))); --mapD: max(92px, calc(150px * var(--ts, 1))); }
body.touch-ui .h-speed { top: 8px; }
body.touch-ui .h-speed .icons { display: none; }
body.touch-ui .gears b:not(.on):not(.sub) { display: none; }
body.touch-ui .h-left { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; position: absolute; left: calc(14px + env(safe-area-inset-left)); top: var(--hb, 80px); max-width: max(140px, calc(var(--hl, 200px) - 24px)); z-index: 2; pointer-events: none; }
body.touch-ui .h-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; }
body.touch-ui .h-left > *, body.touch-ui .h-row > * { position: static; }
body.touch-ui .h-act { min-height: 36px; padding: 4px 16px; pointer-events: auto; }
body.touch-ui .h-feed { width: max-content; max-width: min(44vw, 320px); }
body.touch-ui .fd { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.touch-ui .h-signs { gap: 6px; }
@media (max-height: 330px) { body.touch-ui .sg img { width: 26px; height: 26px; } body.touch-ui .sg { min-width: 40px; padding: 2px 3px 3px; } }
/* the top stays quiet on every screen (owner 03.11): one slot in the measured band between the speed panel and the round
   buttons: the step card (two lines at most), or the instructor in its place (two lines at most), and one message of one line */
.h-top { left: var(--hl, 24vw); right: var(--hr, 24vw); top: 8px; transform: none; max-width: none; }
.h-obj { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-obj small { overflow: hidden; text-overflow: ellipsis; }
body.sub-on .h-top { visibility: hidden; }
#subtitle { left: var(--hl, 24vw); right: var(--hr, 24vw); top: 8px; transform: none; max-width: none; width: -webkit-fit-content; width: fit-content; margin: 0 auto;
  font-size: max(12px, calc(14px * var(--ts, 1))); line-height: 1.3; padding: 4px 12px; border-left: 3px solid var(--acc); }
#subtitle.show { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
#toasts { left: var(--hl, 24vw); right: var(--hr, 24vw); top: var(--tb, 60px); transform: none; }
.toast { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
body.touch-ui .h-right { top: 8px; right: calc(12px + env(safe-area-inset-right)); display: grid; grid-template-columns: auto auto; align-items: start; justify-items: end; gap: 6px; }
body.touch-ui .h-btns { grid-column: 1; grid-row: 1; display: grid; grid-template-columns: repeat(2, auto); gap: 5px; }
body.touch-ui .rbtn { width: var(--rb); height: var(--rb); }
body.touch-ui .rbtn svg { width: 50%; height: 50%; }
body.touch-ui .mapwrap { grid-column: 2; grid-row: 1 / span 2; width: var(--mapD); height: var(--mapD); }
body.touch-ui .turn { grid-column: 1; grid-row: 2; min-width: 0; gap: 6px; padding: 4px 10px 4px 6px; }
body.touch-ui .turn svg { width: max(22px, calc(28px * var(--ts, 1))); height: max(22px, calc(28px * var(--ts, 1))); }
body.touch-ui .turn .d { font-size: max(15px, calc(19px * var(--ts, 1))); white-space: nowrap; }
@media (max-height: 520px) { body.touch-ui .turn .n { display: none; } }


/* ---------------------------------------------------------------- v0.3.12: CrazyGames Full Launch ads */
/* display banner (ui/adbanner.js): the box itself shows nothing (no background, no border: nothing on a no-fill) */
.cg-banner { position: fixed; z-index: 20; pointer-events: auto; background: none; border: 0; overflow: hidden; }
/* v0.3.14: ONE box for the main menu and every menu screen, worked out from the window alone (ui/adbanner.js), so the banner
   never moves when a screen opens: the top and the right end of a screen card's header row. --ady: its top, --adr: from its
   right end to the window's right edge, --adw / --adh: its size, --adg: the room the garage's narrower header row leaves it */
/* main menu: the Level card sits right under the box, lined up with its right end */
#menus.ad-on .hlv { right: var(--adr, 34px); top: calc(var(--ady, 28px) + var(--adh, 60px) + 8px); transform: none; }
/* menu screens: the box sits at the right end of the header row; the city label and the game logo give it the room */
#menus.ad-on .sc-head { min-height: var(--adh, 60px); padding-right: calc(var(--adw, 468px) + 12px); }
#menus.ad-on .clearbg .sc-head { padding-right: var(--adg, 0px); }
#menus.ad-on .sc-city, #menus.ad-on .sc-logo { display: none; }
#menus.ad-on .sc-title h2 { font-size: max(calc(21px * var(--m)), 16px); overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; padding-right: 0.2em; }
#menus.ad-on .sc-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* rewarded offers: the video-camera mark + words, the same button as the others on the card */
.btn.rw { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.btn.rw .rw-cam { width: 1.35em; height: 1.35em; flex: none; color: #ffd84a; }
.btn.rw.done, .btn.rw.none { opacity: 0.75; pointer-events: none; }
.btn.rw.done { color: #9ff0b8; }
.btn.rw.wait { opacity: 0.6; cursor: default; filter: none; }
.btn.rw em.rw-t { font-style: normal; font-weight: 800; color: #ffd84a; }
.btn.rw em.rw-t:empty { display: none; }
.hlv .rw-free { grid-column: 1 / 3; margin-top: 4px; padding: calc(5px * var(--m)) calc(8px * var(--m)); font-size: max(calc(13px * var(--m)), 12px); min-height: 30px; border-radius: calc(8px * var(--m)); }
.rw-sec { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rw-sec .rw-row { display: inline-flex; align-items: center; gap: 10px; letter-spacing: 0; text-transform: none; }
.rw-sec .rw-row small { color: #c3d2ec; font-size: max(calc(12px * var(--m)), 12px); }
.rw-sec .rw-free { padding: calc(6px * var(--m)) calc(12px * var(--m)); font-size: max(calc(14px * var(--m)), 13px); min-height: 34px; }
/* while a video ad is asked for and plays, nothing on the card can be pressed */
.menu.ad-wait button, .menu.ad-wait [data-a] { pointer-events: none; }
.menu.ad-wait .rw:not(.done) { opacity: 0.7; }
.menu-toast { position: absolute; left: 50%; bottom: calc(18px * var(--m)); transform: translateX(-50%); z-index: 8; padding: 8px 16px; border-radius: 10px; background: #0b3a1cf0; border: 1px solid #3ddc8499; color: #c8ffd9; font-weight: 800; font-size: max(calc(14px * var(--m)), 13px); pointer-events: none; }

/* v0.3.13 Free Drive rest stop: three numbers from this drive over the two buttons */
.brk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: calc(8px * var(--m)); margin-top: calc(12px * var(--m)); }
.brk-grid div { display: flex; flex-direction: column; gap: 2px; padding: calc(8px * var(--m)) calc(10px * var(--m)); border-radius: calc(10px * var(--m)); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); }
.brk-grid b { font-size: max(calc(20px * var(--m)), 15px); font-weight: 900; color: #fff; white-space: nowrap; }
.brk-grid span { font-size: max(calc(12px * var(--m)), 12px); color: #c3d2ec; }

/* v0.3.13 the studio's community: four small round icons in the bottom-right corner of the main menu (CrazyGames only); the
   map credit line sits over them */
.hcomm { position: absolute; right: max(calc(16px * var(--m)), calc(env(safe-area-inset-right) + 10px)); bottom: max(8px, env(safe-area-inset-bottom)); display: flex; gap: 8px; z-index: 2; pointer-events: auto; }
.hcomm a { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; background: rgba(3,11,34,.78); border: 1px solid rgba(255,255,255,.28); box-shadow: 0 2px 8px rgba(0,0,0,.35); transition: background .12s, transform .1s; }
.hcomm svg { width: 56%; height: 56%; fill: currentColor; display: block; }
@media (hover: hover) { .hcomm a:hover { background: rgba(40,80,170,.92); } } .hcomm a:active { transform: scale(.94); }
.hubwrap.comm .hfoot { bottom: calc(max(8px, env(safe-area-inset-bottom)) + 42px); }
body.touch-ui .hcomm a { width: 40px; height: 40px; } body.touch-ui .hubwrap.comm .hfoot { bottom: calc(max(8px, env(safe-area-inset-bottom)) + 48px); }

/* v0.3.14 pause card (CrazyGames 18.11): no camera tile, the camera changes while driving (C, or the round camera button). Five
   tiles (lessons, parking, the test: Restart is there) sit three over two centred, four (Free Drive, the tutorial) two by two */
.pz-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.pz-grid > .pz-t { grid-column: span 2; }
.pz-grid > .pz-t:nth-child(4):nth-last-child(2) { grid-column: 2 / span 2; }
.pz-grid > .pz-t:first-child:nth-last-child(4), .pz-grid > .pz-t:first-child:nth-last-child(4) ~ .pz-t { grid-column: span 3; }

/* v0.3.14 (CrazyGames 18.11 "it can appear overlapped"): the +/- points feed never runs over the road-sign cards beside the
   score: while cards show it starts under them (--sgh: their height, from ui/hud.js). Touch screens stack the column already. */
.h-feed { top: max(calc(86px * var(--s) + 52px), calc(86px * var(--s) + 18px + var(--sgh, 0px))); }
@media (max-height: 430px) { .h-feed { top: max(calc(78px * var(--s) + 42px), calc(78px * var(--s) + 12px + var(--sgh, 0px))); } }
