:root {
    --pink: #E91E63;
    --pink-light: #F48FB1;
    --pink-dark: #AD1457;
    --ink: #2b1b2e;
    --cream: #FFF8EE;
    --gold: #FFC107;
    --green: #4CAF50;
    --sky: #7fc8f8;
    --glass: rgba(255, 255, 255, 0.86);
    --shadow: 0 4px 0 rgba(0, 0, 0, 0.18), 0 8px 24px rgba(0, 0, 0, 0.18);
    --font: "Fredoka", "Arial Rounded MT Bold", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
    /* UI scale — one card style, three button tiers, a 4-px spacing scale, a small type scale */
    --sp1: 4px; --sp2: 8px; --sp3: 12px; --sp4: 16px; --sp5: 24px;
    --fs-xs: 12px; --fs-sm: 14px; --fs-md: 17px; --fs-lg: 20px; --fs-xl: 26px;
    --r-btn: 16px; --r-card: 26px;
    --tap: 46px;                                  /* minimum touch target */
    --btn1: var(--pink); --btn1-edge: var(--pink-dark);                       /* primary   */
    --btn2: #fff; --btn2-edge: rgba(43, 27, 46, 0.16);                        /* secondary */
    --btn3: rgba(43, 27, 46, 0.07);                                           /* tertiary  */
    --ring: 0 0 0 3px var(--cream), 0 0 0 7px var(--pink);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: var(--sky);
    font-family: var(--font);
    color: var(--ink);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    overscroll-behavior: none;
}

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

/* ── HUD ─────────────────────────────────────────────────── */
#hud { position: fixed; inset: 0; pointer-events: none; }

.pill {
    background: var(--glass);
    border-radius: 999px;
    padding: 6px 14px;
    font-weight: 700;
    font-size: 18px;
    box-shadow: var(--shadow);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
}
.pill.score { font-size: 14px; letter-spacing: 0.04em; }
.pill.score b { font-size: 18px; }

.coin {
    width: 18px; height: 18px; border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #FFF59D, #FFC107 55%, #FF8F00);
    box-shadow: inset 0 0 0 2px #FFB300;
    display: inline-block;
}

.hud-tl {
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    display: flex; flex-direction: column; gap: 8px;
}
#hearts { font-size: 20px; letter-spacing: 2px; }
#hearts.hurt { animation: shake 0.4s; }

.hud-top {
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    left: 50%; transform: translateX(-50%);
    width: min(420px, 46vw);
    text-align: center;
}
.trip { display: flex; align-items: center; gap: 8px; font-size: 22px; }
.trip-bar {
    position: relative; flex: 1; height: 14px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.7); box-shadow: var(--shadow); overflow: visible;
}
#tripFill { position: absolute; inset: 0 auto 0 0; width: 0%; border-radius: 999px;
    background: linear-gradient(90deg, var(--pink-light), var(--pink)); }
#tripCar { position: absolute; top: 50%; left: 0%; transform: translate(-50%, -55%) scaleX(-1); font-size: 18px; }
#tripLabel { margin-top: 6px; font-weight: 700; font-size: 14px; color: #fff;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); letter-spacing: 0.06em; }

.hud-tr {
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    pointer-events: auto;
}
.round-btn {
    width: 48px; height: 48px; border-radius: 50%; border: none;
    background: var(--glass); box-shadow: var(--shadow);
    font: 700 16px var(--font); color: var(--ink); cursor: pointer;
}

.hud-br {
    position: absolute;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
}
/* touch, landscape: a slim speed pill under the trip bar, clear of the car and the thumbs */
@media (min-aspect-ratio: 1/1) {
    body.touch .hud-br { right: auto; left: 50%; transform: translateX(-50%); bottom: auto; top: calc(max(12px, env(safe-area-inset-top)) + 62px); }
    body.touch .speedo { width: auto; display: flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; }
    body.touch #mph { font-size: 16px; min-width: 2ch; }
    body.touch .speedo .unit { font-size: 9px; letter-spacing: 0.12em; }
    body.touch .speedo .boost { width: 56px; height: 7px; margin: 0; }
    body.touch .speedo .boost-label { display: none; }
}
/* touch, portrait: speedo above the pedals, trip bar below the left-hand pills, nitro over the stick */
@media (max-aspect-ratio: 1/1) {
    body.touch .hud-br { right: max(16px, env(safe-area-inset-right)); bottom: calc(max(16px, env(safe-area-inset-bottom)) + 284px); }
    body.touch .speedo { width: 76px; padding: 5px 8px 7px; border-radius: 14px; }
    body.touch #mph { font-size: 21px; }
    body.touch .speedo .unit { font-size: 9px; letter-spacing: 0.12em; }
    body.touch .speedo .boost { margin-top: 5px; height: 7px; }
    body.touch .speedo .boost-label { font-size: 9px; margin-top: 3px; }
    body.touch .hud-top { top: calc(max(12px, env(safe-area-inset-top)) + 138px); width: 78vw; }
    body.touch #tBoost { position: fixed; left: max(24px, env(safe-area-inset-left)); bottom: calc(max(24px, env(safe-area-inset-bottom)) + 196px); }
}
.speedo {
    width: 128px; padding: 10px 12px 12px; border-radius: 22px;
    background: var(--glass); box-shadow: var(--shadow); text-align: center;
}
#mph { font-size: 46px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.unit { font-size: 12px; font-weight: 700; letter-spacing: 0.2em; opacity: 0.6; }
.boost { margin-top: 8px; height: 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.12); overflow: hidden; }
#boostFill { height: 100%; width: 0%; background: linear-gradient(90deg, #FF9800, #FF5722, #E91E63); transition: width 0.1s; }
#boostFill.full { animation: glow 0.7s infinite alternate; }
.boost-label { margin-top: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; opacity: 0.7; }
.boost-label .glyph { font-size: 11px; }

/* Pop-ups stay OFF the road: toasts are a slim feed down the right edge, and while
   driving / walking (body.in-play) banners are a compact card under the trip bar. */
#toasts {
    position: absolute; right: max(12px, env(safe-area-inset-right)); top: 34%;
    display: flex; flex-direction: column; align-items: flex-end; gap: 5px; max-width: 46vw;
}
.toast {
    font-weight: 700; font-size: 19px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
    background: linear-gradient(90deg, rgba(20,14,32,0), rgba(20,14,32,.5) 22%); border-radius: 999px; padding: 3px 12px 3px 26px;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
    animation: toastIn .3s ease-out; transition: opacity .3s, transform .3s;
}
/* the lifetime runs on game time (hud.js notifyTick): .out fades it, .bump = a merged burst (+5 → +10) */
.toast.out { opacity: 0; transform: translateY(-10px); }
.toast.bump { animation: toastBump .3s ease-out; }
.toast .ct { margin-left: 6px; font-size: .78em; background: rgba(255, 255, 255, .22); border-radius: 999px; padding: 0 7px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes toastBump { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
#banner.held { visibility: hidden; }
.toast.gold { color: #FFE082; }
.toast.pink { color: #FFC1E0; }
.toast.red { color: #FF8A80; }
.toast.big { font-size: 24px; }
body.touch #toasts { top: 22%; }
/* a bubble the pop-up budget held back (hud.js bubbleOk): still there for its feature, not drawn */
.calm-off { display: none !important; }
/* flavour toasts (hud.js budget, prio 1) are a touch smaller; on a phone smaller still */
.toast.lo { font-size: 16px; }
body.touch .toast { font-size: 16px; padding: 2px 10px 2px 20px; } body.touch .toast.lo { font-size: 14px; } body.touch .toast.big { font-size: 20px; }

#banner {
    position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%);
    background: var(--glass); border-radius: 24px; padding: 16px 26px; box-shadow: var(--shadow);
    font-weight: 700; font-size: 22px; text-align: center; max-width: 86vw;
    animation: pop 0.35s cubic-bezier(.2, 1.6, .4, 1);
}
#banner small { display: block; font-size: 15px; font-weight: 600; opacity: 0.7; margin-top: 4px; }
/* in play it lives at the top of the "center" HUD slot (under the trip bar) */
#banner.compact { position: static; transform: none; padding: 7px 18px; border-radius: 16px; font-size: 17px; max-width: min(560px, 70vw);
    background: rgba(255, 250, 244, 0.9); animation: bannerDrop .38s cubic-bezier(.2, 1.5, .4, 1); }
#banner.compact small { font-size: 13px; margin-top: 1px; }
@keyframes bannerDrop { from { transform: translateY(-14px) scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastR { 0% { opacity: 0; transform: translateX(40px); } 10% { opacity: 1; transform: translateX(-4px); }
    18% { transform: none; } 78% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-12px); } }

#padHint {
    position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%);
    background: rgba(43, 27, 46, 0.78); color: #fff; border-radius: 999px; padding: 6px 16px;
    font-size: 14px; font-weight: 600; white-space: nowrap;
}
/* (a controller on a phone held upright: the long hints ran off both edges — "A near your car to hop back in 🚗 · or take a
   walk" — they wrap instead, ci/qaweekend) */
@media (max-width: 560px) {
    #padHint { white-space: normal; width: max-content; max-width: calc(100vw - 28px); text-align: center; border-radius: 16px; line-height: 1.35; }
}

#flash { position: absolute; inset: 0; background: #ff1744; opacity: 0; transition: opacity 0.4s; }

/* ── touch controls ──────────────────────────────────────── */
#touch { position: fixed; inset: 0; pointer-events: none; }
#stickZone {
    position: absolute; left: 0; bottom: 0; width: 45%; height: 60%;
    pointer-events: auto; display: flex; align-items: flex-end; padding: 0 0 max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
}
#stickZone span { position: absolute; left: max(24px, env(safe-area-inset-left)); bottom: max(8px, env(safe-area-inset-bottom));
    width: 150px; text-align: center; color: #fff; font-weight: 700; font-size: 12px; letter-spacing: 0.2em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
#stickBase {
    position: relative; width: 150px; height: 150px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.28); border: 3px solid rgba(255, 255, 255, 0.7);
}
#stickKnob {
    position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px;
    border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #F48FB1 60%, #E91E63);
    box-shadow: var(--shadow);
}
.pedals {
    position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
    display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto auto; gap: 10px;
    pointer-events: auto; justify-items: end; align-items: end;
}
.tbtn {
    border: none; border-radius: 20px; font: 700 15px var(--font); color: #fff; cursor: pointer;
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.25); touch-action: none;
}
.tbtn.small { width: 62px; height: 52px; background: rgba(43, 27, 46, 0.6); font-size: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.tbtn.small small { font-size: 9px; letter-spacing: 0.1em; margin-top: 3px; }
#tBoost { grid-column: 1; grid-row: 1; }
#tHonk { grid-column: 2; grid-row: 1; }
#tCam { grid-column: 2; grid-row: 2; justify-self: end; }
.tbtn.pedal { width: 92px; height: 120px; letter-spacing: 0.08em; }
.tbtn.gas { grid-column: 2; grid-row: 3; background: linear-gradient(#66BB6A, #2E7D32); height: 140px; }
.tbtn.brake { grid-column: 1; grid-row: 2 / span 2; background: linear-gradient(#EF5350, #B71C1C); }
.tbtn.brake.rev { font-size: 13px; letter-spacing: 0.04em; background: linear-gradient(#FFA726, #E65100); }   /* the same pedal reversing (input.js setBrakePedal) */
.tbtn.down { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); filter: brightness(1.1); }
/* on foot (body.onfoot — features/foot): a big JUMP under the right thumb, ROLL beside it */
#footPad { display: none; position: absolute; right: max(18px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom));
    align-items: flex-end; gap: 12px; pointer-events: auto; }
body.onfoot #footPad { display: flex; }
#footPad .tbtn { border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
#footPad .tbtn small { font-size: 10px; letter-spacing: 0.1em; margin-top: 3px; }
#tJump { width: 92px; height: 92px; font-size: 34px; background: radial-gradient(circle at 40% 30%, #FF80AB, #E91E63 70%); }
#tRoll { width: 64px; height: 64px; font-size: 24px; margin-bottom: 4px; background: rgba(0, 151, 167, 0.82); }

/* ── screens ─────────────────────────────────────────────── */
@media (min-aspect-ratio: 5/4) and (min-width: 820px) {
    body.title-mode .screen { justify-content: flex-start; padding-left: max(5vw, 24px); background: linear-gradient(90deg, rgba(43, 27, 46, 0.35), rgba(43, 27, 46, 0) 60%); }
    body.title-mode .card { width: min(500px, 46vw); }
}
.screen {
    position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
    padding: 16px; background: linear-gradient(180deg, rgba(127, 200, 248, 0.15), rgba(43, 27, 46, 0.35));
}
.card {
    background: var(--cream); border-radius: 28px; box-shadow: var(--shadow);
    padding: 22px 26px; width: min(560px, 100%); max-height: calc(100% - 8px); overflow: auto;
    text-align: center; animation: pop 0.35s cubic-bezier(.2, 1.6, .4, 1);
}
.logo { display: flex; flex-direction: column; align-items: center; line-height: 0.9; margin: 4px 0 10px; }
.logo .l1 { font-size: 56px; font-weight: 700; color: var(--pink); text-shadow: 0 4px 0 var(--pink-dark); }
.logo .l2 { font-size: 40px; font-weight: 700; color: var(--ink); }
.logo .l3 { margin-top: 6px; font-size: 20px; font-weight: 700; color: #fff; background: var(--pink); border-radius: 999px;
    padding: 4px 14px; letter-spacing: 0.2em; box-shadow: 0 3px 0 var(--pink-dark); }
.card h2 { margin: 6px 0 8px; font-size: 30px; }
.card p { margin: 6px 0; font-size: 16px; line-height: 1.4; }
.card .quote { font-size: 19px; font-weight: 600; background: #fff; border-radius: 18px; padding: 12px 16px; margin: 10px 0; }
.stats { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.stat { background: #fff; border-radius: 16px; padding: 8px 14px; min-width: 96px; }
.stat b { display: block; font-size: 24px; }
.stat span { font-size: 12px; letter-spacing: 0.08em; opacity: 0.65; font-weight: 700; }

.menu { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; align-items: center; }
/* Buttons: three tiers only.
   primary   .btn / .btn.pink                 — the one main action (pink)
   secondary .btn.alt / .btn.purple / .tile  — everything else (white)
   tertiary  .btn.ghost                      — back / quit / not now (soft, no edge) */
.btn {
    width: min(320px, 100%); min-height: var(--tap); border: none; border-radius: var(--r-btn); padding: 12px 18px;
    font: 700 19px var(--font); color: #fff; background: var(--btn1); cursor: pointer;
    box-shadow: 0 4px 0 var(--btn1-edge); transition: transform 0.08s;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn.pink { background: var(--btn1); box-shadow: 0 4px 0 var(--btn1-edge); }
.btn.alt, .btn.purple { background: var(--btn2); color: var(--ink); box-shadow: 0 4px 0 var(--btn2-edge), inset 0 0 0 2px rgba(43, 27, 46, 0.05); }
.btn.ghost { background: var(--btn3); color: var(--ink); box-shadow: none; font-size: 17px; }
.btn.focus { outline: none; box-shadow: var(--ring), 0 4px 0 rgba(0, 0, 0, 0.18); transform: scale(1.03); position: relative; z-index: 1; }
.btn:active { transform: translateY(3px); }
.btn .glyph { background: rgba(255, 255, 255, 0.92); color: var(--ink); }
.btn.alt .glyph, .btn.purple .glyph, .btn.ghost .glyph, .btn.row .glyph, .tile:not(.hero) .glyph { background: var(--ink); color: #fff; }

.glyph {
    display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 6px;
    border-radius: 999px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; line-height: 1;
}
.glyph.k { border-radius: 6px; }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; text-align: left; font-size: 14px; margin: 12px 0 2px;
    background: #fff; border-radius: 18px; padding: 12px 16px; }
.controls div { display: flex; align-items: center; gap: 8px; }
.controls .hdr { grid-column: 1 / -1; font-weight: 700; font-size: 12px; letter-spacing: 0.12em; opacity: 0.6; }
.pad-status { margin-top: 10px; font-size: 13px; font-weight: 600; opacity: 0.7; }
.pad-status.on { color: #2E7D32; opacity: 1; }
.fine { font-size: 12px !important; opacity: 0.6; }
a.back2d { color: var(--pink-dark); font-weight: 700; }

.loading-card { width: min(420px, 100%); }
.loadbar { height: 14px; border-radius: 999px; background: rgba(0, 0, 0, 0.1); overflow: hidden; margin: 18px 0 10px; }
#loadFill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--pink-light), var(--pink)); transition: width 0.2s; }
#loadText { font-size: 15px; opacity: 0.7; }

@keyframes toast { 0% { opacity: 0; transform: translateY(14px) scale(0.8); } 12% { opacity: 1; transform: translateY(0) scale(1.08); }
    25% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-26px); } }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#banner { animation-name: popc; }
@keyframes popc { from { transform: translate(-50%, -50%) scale(0.85); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes glow { from { filter: brightness(1); } to { filter: brightness(1.5); } }

@media (max-height: 520px) {
    .logo .l1 { font-size: 40px; } .logo .l2 { font-size: 28px; }
    .card { padding: 14px 18px; } .controls { font-size: 12px; }
    .speedo { width: 108px; } #mph { font-size: 36px; }
    .tbtn.pedal { height: 96px; width: 80px; } .tbtn.gas { height: 110px; }
}
@media (max-width: 600px) {
    .hud-top { width: 40vw; top: max(70px, env(safe-area-inset-top)); }
    .controls { grid-template-columns: 1fr; }
}

/* ── foundation additions ────────────────────────────────── */
:root { --hud-scale: 1; }
#hud { font-size: calc(16px * var(--hud-scale)); }
.hud-tl, .hud-top, .hud-tr, .hud-br { transform-origin: top left; }
.hud-br { transform-origin: bottom right; }
.hud-tl { zoom: var(--hud-scale); }
.hud-br .speedo { zoom: var(--hud-scale); }

/* feature HUD slots */
.hud-slot { position: absolute; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.hud-slot.left { top: calc(max(12px, env(safe-area-inset-top)) + 150px); left: max(12px, env(safe-area-inset-left)); align-items: flex-start; }
.hud-slot.center { top: calc(max(12px, env(safe-area-inset-top)) + 64px); left: 50%; transform: translateX(-50%); align-items: center; }
.hud-slot.right { top: calc(max(12px, env(safe-area-inset-top)) + 60px); right: max(12px, env(safe-area-inset-right)); align-items: flex-end; }
.hud-slot.bottom { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 40px); left: 50%; transform: translateX(-50%); align-items: center; }
body.touch .hud-slot.bottom { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 170px); }
body.touch .hud-slot.center { top: calc(max(12px, env(safe-area-inset-top)) + 100px); }
.hud-slot > * { pointer-events: auto; }
.hud-chip { background: var(--glass); border-radius: 999px; padding: 5px 12px; font-weight: 700; font-size: 15px; box-shadow: var(--shadow); white-space: nowrap; }
.prompt { background: rgba(43, 27, 46, 0.82); color: #fff; border-radius: 999px; padding: 8px 18px; font-weight: 700; font-size: 17px; white-space: nowrap; }
.prompt .glyph { background: #fff; color: var(--ink); }

/* extra feature touch buttons (missile, pepper spray, interact…) */
#touchExtra { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: calc(max(16px, env(safe-area-inset-bottom)) + 300px);
    display: flex; flex-direction: column; gap: 10px; pointer-events: auto; }
@media (min-aspect-ratio: 1/1) { #touchExtra { right: auto; left: max(190px, calc(env(safe-area-inset-left) + 180px)); bottom: max(16px, env(safe-area-inset-bottom)); flex-direction: row; } }

/* wider cards, settings rows, 3-column controls */
.card.wide { width: min(820px, 100%); }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.btn.setting { width: 100%; justify-content: space-between; font-size: 16px; padding: 9px 14px; text-align: left; line-height: 1.2; }
.btn.setting b { flex: none; background: #FCE4EC; color: var(--pink-dark); border-radius: 999px; padding: 2px 10px; font-size: 14px; }
.settings .set-h { grid-column: 1 / -1; text-align: left; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .55; margin: 6px 2px -4px; }
.settings .set-h:first-child { margin-top: 0; }
@media (max-width: 600px) { .settings { grid-template-columns: 1fr; } }
.controls.ctl3 { grid-template-columns: 1.4fr 1fr 1fr; }
.controls.ctl3 > div { display: block; }
.controls.ctl3 .hdr { grid-column: auto; }
.tagline { font-size: 15px !important; }
.tagline .coin { width: 14px; height: 14px; vertical-align: -2px; }
a.btn { text-decoration: none; }

/* ── TV / console mode (PS5, Xbox, smart TVs): 10-foot UI ── */
body.tv { cursor: none; }
body.tv.cursor { cursor: auto; }
body.tv .hud-tl, body.tv .hud-top, body.tv .hud-tr, body.tv .hud-br { margin: 3vh 3vw; }
body.tv .hud-slot.right { top: calc(max(12px, env(safe-area-inset-top)) + 3vh + 58px); right: calc(max(12px, env(safe-area-inset-right)) + 3vw); }   /* under the TV-margined ❚❚, not on it */
body.tv .pill { font-size: 26px; padding: 8px 20px; }
body.tv .pill.score { font-size: 18px; } body.tv .pill.score b { font-size: 28px; }
body.tv .coin { width: 24px; height: 24px; }
body.tv #hearts { font-size: 30px; }
body.tv .hud-top { width: min(640px, 44vw); }
body.tv .trip { font-size: 30px; } body.tv .trip-bar { height: 18px; } body.tv #tripLabel { font-size: 20px; }
body.tv .speedo { width: 180px; } body.tv #mph { font-size: 66px; } body.tv .unit, body.tv .boost-label { font-size: 16px; }
body.tv .toast { font-size: 30px; } body.tv .toast.big { font-size: 38px; }
body.tv #banner { font-size: 34px; padding: 22px 36px; } body.tv #banner small { font-size: 22px; }
body.tv #banner.compact { font-size: 26px; padding: 10px 26px; } body.tv #banner.compact small { font-size: 18px; }
body.tv #padHint, body.tv .prompt { font-size: 22px; padding: 10px 24px; }
body.tv .glyph { min-width: 32px; height: 32px; font-size: 18px; }
body.tv .screen { padding: 5vh 5vw; }
body.tv .card { width: min(900px, 100%); padding: 32px 40px; border-radius: 34px; }
body.tv .card.wide { width: min(1300px, 100%); }
body.tv .card h2 { font-size: 44px; } body.tv .card p { font-size: 24px; } body.tv .card .quote { font-size: 28px; }
body.tv .btn { width: min(520px, 100%); font-size: 28px; padding: 18px 24px; border-radius: 22px; }
body.tv .btn.setting { font-size: 22px; } body.tv .btn.setting b { font-size: 20px; }
body.tv .btn.focus { transform: scale(1.06); box-shadow: 0 0 0 10px rgba(233, 30, 99, 0.6), 0 6px 0 rgba(0,0,0,.22); }
body.tv .logo .l1 { font-size: 84px; } body.tv .logo .l2 { font-size: 60px; } body.tv .logo .l3 { font-size: 28px; }
body.tv .controls { font-size: 20px; } body.tv .stat b { font-size: 34px; } body.tv .stat span { font-size: 16px; }
body.tv .pad-status { font-size: 22px; }
body.tv .hud-slot.left { top: calc(3vh + 210px); left: 3vw; }
body.tv .hud-chip { font-size: 22px; padding: 8px 18px; }
@media (min-aspect-ratio: 5/4) { body.tv.title-mode .card { width: min(720px, 48vw); } }

/* ══ Home screen + grouped title sub-menus (core/screens.js) ═══════════════ */
.card.title-card { padding: 14px 18px 16px; text-align: left; }
.home { display: flex; flex-direction: column; gap: 10px; }
.home-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 30px; }
.home-bar .hb-sp { flex: 1; }
.home-bar > *:not(.hb-sp) { margin: 0; background: #fff; border-radius: 999px; padding: 3px 10px; font-size: var(--fs-sm); font-weight: 700;
    box-shadow: inset 0 0 0 2px rgba(43, 27, 46, .07); white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; line-height: 1.5; }
.home-bar .coins b { font-variant-numeric: tabular-nums; }
.home-bar .coin { width: 15px; height: 15px; }
.home .logo { margin: 0; }
.home .logo .l1 { font-size: 46px; } .home .logo .l2 { font-size: 32px; } .home .logo .l3 { font-size: 15px; margin-top: 4px; padding: 2px 12px; }

.tile { width: 100%; text-align: left; justify-content: flex-start; gap: 10px; padding: 10px 14px; line-height: 1.15; }
.tile .t-ic { flex: none; font-size: 26px; line-height: 1; }
.tile .t-tx { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tile .t-l { font-size: var(--fs-md); }
.tile .t-s { font-size: var(--fs-xs); font-weight: 600; opacity: .68; }
.tile .t-s:empty { display: none; }

/* the hero: the one primary action */
.tile.hero { min-height: 78px; padding: 12px 16px; background: linear-gradient(160deg, #F2407F, var(--pink) 60%); }
.tile.hero .t-ic { font-size: 40px; }
.tile.hero .t-l { font-size: var(--fs-xl); display: flex; align-items: center; gap: 8px; }
.tile.hero .t-s { opacity: .95; font-size: 13px; }

/* play tiles: secondary, icon on top */
.home-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp2); }
.home-tiles[data-n="1"] { grid-template-columns: 1fr; }
.home-tiles[data-n="2"], .home-tiles[data-n="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.home-tiles .tile { background: var(--btn2); color: var(--ink); box-shadow: 0 4px 0 var(--btn2-edge), inset 0 0 0 2px rgba(43, 27, 46, .05);
    flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; min-height: 70px; padding: 8px 6px; }
.home-tiles .tile .t-tx { align-items: center; }
.home-tiles .tile .t-ic { font-size: 24px; }
.home-tiles .tile .t-l { font-size: 15px; }
.home-tiles .tile .t-s { font-size: 11px; }

/* group tiles: tertiary, each opens a sub-menu */
.home-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp2); }
.home-groups[data-n="1"] { grid-template-columns: 1fr; }
.home-groups[data-n="2"], .home-groups[data-n="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile.grp { background: var(--btn3); color: var(--ink); box-shadow: none; padding: 8px 8px; gap: 3px; min-height: 52px;
    flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.tile.grp .t-tx { align-items: center; max-width: 100%; }
.tile.grp .t-ic { font-size: 22px; }
.tile.grp .t-l { font-size: 15px; display: flex; align-items: center; gap: 4px; }
.tile.grp .t-s { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tg-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #FF5252; box-shadow: 0 0 0 2px #fff; }

.home-notes { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-xs); text-align: center; }
.home-notes > *, .home-notes p { margin: 0 !important; }
.home-foot { text-align: center; }
.home-foot .pad-status { margin: 0; font-size: var(--fs-xs); }

/* a sub-menu: tabs on top, a list of rows, Back at the bottom */
.tsub-head { display: flex; align-items: center; gap: 6px; }
.tsub-g { flex: none; }
.tsub-tabs { flex: 1; display: flex; gap: 6px; min-width: 0; }
.tsub-tab { flex: 1; min-width: 0; min-height: 40px; border: none; border-radius: 12px; padding: 6px 8px; cursor: pointer; white-space: nowrap;
    font: 700 var(--fs-sm) var(--font); background: var(--btn3); color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.tsub-tab.on { background: var(--ink); color: #fff; }
.tsub-info { margin-top: var(--sp2); font-size: var(--fs-sm); }
.tsub-list { display: flex; flex-direction: column; gap: var(--sp2); margin-top: var(--sp3); }
.btn.row { width: 100%; justify-content: flex-start; text-align: left; background: var(--btn2); color: var(--ink);
    box-shadow: 0 4px 0 var(--btn2-edge), inset 0 0 0 2px rgba(43, 27, 46, .05); min-height: 54px; padding: 8px 14px; gap: 12px; }
.btn.row.focus { box-shadow: var(--ring), 0 4px 0 var(--btn2-edge); }
.row .t-ic { flex: none; width: 30px; text-align: center; font-size: 24px; line-height: 1; }
.row .t-tx { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row .t-l { font-size: 18px; }
.row .t-s { font-size: 13px; font-weight: 600; opacity: .62; }
.row .r-ch { flex: none; font-size: 26px; line-height: 1; opacity: .3; }
.row .gx-next { margin: 4px 0 0; width: 100%; align-items: stretch; opacity: 1; font-size: 12px; }
.tsub-foot { display: flex; justify-content: center; margin-top: var(--sp3); }
.tsub-foot .btn { width: min(240px, 100%); }

/* ══ Pause menu ═══════════════════════════════════════════════════════════ */
.card.pause-card { width: min(460px, 100%); padding: 16px 20px 18px; }
.pause-menu h2 { margin: 0 0 var(--sp3); }
.pause-menu .pad-status { margin: -4px 0 var(--sp3); color: #B71C1C; opacity: 1; }
.pm-main { display: flex; flex-direction: column; gap: var(--sp2); }
.pm-main .btn { width: 100%; }
.pm-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp2); margin-top: var(--sp3); }
.btn.sm { width: 100%; font-size: 16px; padding: 8px 10px; min-height: var(--tap); }
.pm-tools .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
.pm-exit { display: flex; gap: var(--sp2); margin-top: var(--sp3); }
.pm-exit .btn { flex: 1; }

/* settings + controls: centred and wide, even over the title's left-hand layout */
body.title-mode .screen:has(> .card.wide) { justify-content: center; padding-left: 16px; }
body.title-mode .card.wide { width: min(820px, 100%); }
.card.settings-card { width: min(760px, 100%); }

/* ══ Clean HUD (Settings › HUD: Clean) ═════════════════════════════════════
   Hides the secondary bits — the score, per-drive collectible chips (a feature marks
   its own chip .hud-secondary) — and slims the trip bar. Hearts, coins, speed,
   tasks, wanted stars and prompts stay. */
body.hud-clean .pill.score, body.hud-clean .hud-secondary { display: none !important; }
body.hud-clean .trip { font-size: 15px; gap: 6px; }
body.hud-clean .trip-from, body.hud-clean .trip-to { display: none; }
body.hud-clean .trip-bar { height: 7px; }
body.hud-clean #tripCar { font-size: 14px; }
body.hud-clean #tripLabel { font-size: 12px; margin-top: 3px; opacity: .9; }
body.hud-clean .hud-top { width: min(300px, 34vw); }
body.hud-clean .speedo .boost-label { display: none; }
body.hud-clean .hud-slot.left { top: calc(max(12px, env(safe-area-inset-top)) + 100px); }

/* ══ TV (10-foot) ══════════════════════════════════════════════════════════ */
body.tv .card.title-card { padding: 26px 32px 28px; }
body.tv .home { gap: 16px; }
body.tv .home-bar > *:not(.hb-sp) { font-size: 22px; padding: 6px 16px; }
body.tv .home-bar .coin { width: 22px; height: 22px; }
body.tv .home .logo .l1 { font-size: 72px; } body.tv .home .logo .l2 { font-size: 50px; } body.tv .home .logo .l3 { font-size: 22px; }
body.tv .tile, body.tv .btn.row, body.tv .btn.setting, body.tv .btn.sm, body.tv .pm-main .btn { width: 100%; }
body.tv .tile.hero { min-height: 120px; } body.tv .tile.hero .t-ic { font-size: 60px; } body.tv .tile.hero .t-l { font-size: 40px; } body.tv .tile.hero .t-s { font-size: 20px; }
body.tv .home-tiles { gap: 14px; } body.tv .home-tiles .tile { min-height: 108px; }
body.tv .home-tiles .tile .t-ic { font-size: 38px; } body.tv .home-tiles .tile .t-l { font-size: 24px; } body.tv .home-tiles .tile .t-s { font-size: 16px; }
body.tv .home-groups { gap: 14px; } body.tv .tile.grp { min-height: 76px; }
body.tv .tile.grp .t-ic { font-size: 32px; } body.tv .tile.grp .t-l { font-size: 23px; } body.tv .tile.grp .t-s { font-size: 16px; }
body.tv .home-notes, body.tv .home-foot .pad-status { font-size: 18px; }
body.tv .tsub-tab { font-size: 22px; min-height: 58px; border-radius: 16px; }
body.tv .btn.row { min-height: 84px; gap: 18px; padding: 12px 22px; }
body.tv .row .t-ic { font-size: 38px; width: 48px; } body.tv .row .t-l { font-size: 28px; } body.tv .row .t-s { font-size: 19px; }
body.tv .tsub-info { font-size: 20px; }
body.tv .card.pause-card { width: min(680px, 100%); }
body.tv .btn.sm { font-size: 24px; min-height: 70px; }
body.tv .btn.ghost { font-size: 24px; }
body.tv .settings .set-h { font-size: 17px; }
@media (min-aspect-ratio: 5/4) { body.tv.title-mode .card.title-card { width: min(780px, 46vw); } }
/* a console / TV browser at 720p: the same 10-foot layout, one notch smaller so the home screen still fits */
@media (max-height: 820px) {
    body.tv .screen { padding: 3vh 4vw; }
    body.tv .card.title-card { padding: 16px 22px 18px; }
    body.tv .home { gap: 10px; }
    body.tv .home-bar > *:not(.hb-sp) { font-size: 18px; padding: 4px 12px; }
    body.tv .home .logo .l1 { font-size: 50px; } body.tv .home .logo .l2 { font-size: 35px; } body.tv .home .logo .l3 { font-size: 17px; }
    body.tv .tile.hero { min-height: 88px; } body.tv .tile.hero .t-ic { font-size: 44px; } body.tv .tile.hero .t-l { font-size: 30px; } body.tv .tile.hero .t-s { font-size: 16px; }
    body.tv .home-tiles { gap: 10px; } body.tv .home-tiles .tile { min-height: 82px; }
    body.tv .home-tiles .tile .t-ic { font-size: 28px; } body.tv .home-tiles .tile .t-l { font-size: 19px; } body.tv .home-tiles .tile .t-s { font-size: 13px; }
    body.tv .home-groups { gap: 10px; } body.tv .tile.grp { min-height: 60px; }
    body.tv .tile.grp .t-ic { font-size: 24px; } body.tv .tile.grp .t-l { font-size: 19px; } body.tv .tile.grp .t-s { font-size: 13px; }
    body.tv .tile.hero .jtitle .nx { font-size: 16px; } body.tv .tile.hero .jtitle .stamp { width: 24px; height: 24px; font-size: 14px; }
    body.tv .tsub-tab { font-size: 18px; min-height: 46px; }
    body.tv .btn.row { min-height: 64px; padding: 8px 18px; } body.tv .row .t-ic { font-size: 30px; width: 40px; } body.tv .row .t-l { font-size: 22px; } body.tv .row .t-s { font-size: 15px; }
    body.tv .btn { font-size: 22px; padding: 12px 20px; }
    body.tv .btn.sm { font-size: 19px; min-height: 52px; }
    body.tv .btn.setting { font-size: 18px; padding: 7px 14px; } body.tv .btn.setting b { font-size: 16px; }
    body.tv .card h2 { font-size: 34px; }
    body.tv .card.pause-card { width: min(560px, 100%); }
}
@media (max-height: 820px) and (min-aspect-ratio: 5/4) {
    body.tv.title-mode .card.title-card { width: min(780px, 54vw); }
    body.tv .home-tiles[data-n="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
body.tv.title-mode .card.wide, body.tv .card.settings-card { width: min(1300px, 100%); }

/* ══ Phones ════════════════════════════════════════════════════════════════ */
/* short landscape (a phone on its side): the home card goes two-column */
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
    body.title-mode .screen { 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)); }
    body.title-mode .card.home-card { width: min(640px, 76vw); padding: 10px 14px 12px; }
    .home { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); grid-template-areas: "bar bar" "logo tiles" "hero tiles" "hero groups" "notes groups"; gap: 8px 12px; align-items: start; }
    .home-bar { grid-area: bar; min-height: 0; }
    .home .logo { grid-area: logo; }
    .home .logo .l1 { font-size: 30px; } .home .logo .l2 { font-size: 21px; } .home .logo .l3 { font-size: 11px; padding: 1px 9px; margin-top: 3px; }
    .home-hero { grid-area: hero; }
    .home-tiles { grid-area: tiles; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 6px; }
    .home-tiles[data-n="1"] { grid-template-columns: 1fr !important; }
    .home-groups { grid-area: groups; gap: 6px; }
    .home-notes { grid-area: notes; }
    .home-foot { display: none; }
    .tile.hero { min-height: 64px; padding: 8px 12px; }
    .tile.hero .t-ic { font-size: 30px; } .tile.hero .t-l { font-size: 21px; }
    .home-tiles .tile { flex-direction: row; justify-content: flex-start; text-align: left; min-height: var(--tap); padding: 6px 10px; gap: 8px; }
    .home-tiles .tile .t-tx { align-items: flex-start; }
    .home-tiles .tile .t-ic { font-size: 20px; }
    .home-tiles .tile .t-l { font-size: 14px; }
    .tile.grp { min-height: var(--tap); padding: 6px 8px; flex-direction: row; gap: 6px; }
    .tile.grp .t-s { display: none; }
    .tile.grp .t-l { font-size: 14px; }
    body.title-mode .card.title-card.tsub-card { width: min(560px, 70vw); }
    .tsub-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
    .btn.row { min-height: var(--tap); padding: 6px 10px; gap: 8px; }
    .row .t-l { font-size: 15px; } .row .t-s { font-size: 11px; } .row .t-ic { font-size: 20px; width: 24px; } .row .r-ch { display: none; }
    .tsub-foot { margin-top: 8px; }
    .settings { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .btn.setting { font-size: 14px; padding: 6px 10px; }
    .card.settings-card h2, .card.pause-card h2 { font-size: 22px; margin-bottom: 6px; }
    .card.pause-card { width: min(560px, 100%); }
    .pm-tools { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 8px; }
    .pm-tools .btn:last-child:nth-child(odd) { grid-column: auto; }
    .pm-exit { margin-top: 8px; }
    .pm-main .btn { min-height: 44px; padding: 8px 14px; }
}
/* touch players tap the buttons themselves: no "A" / "Back" glyph pills inside them, no L1/R1 hints */
body.dev-touch .btn .glyph, body.dev-touch .tsub-g { display: none; }
/* ── touch HUD: nothing may sit on the touch buttons, the speedo or the trip bar ── */
/* landscape: feature chips (items, wanted) run in a row under the pause button, above the
   NITRO / HONK column; toasts slide in just left of the pedal column */
@media (min-aspect-ratio: 1/1) {
    body.touch .hud-slot.right { flex-direction: row-reverse; flex-wrap: wrap; align-items: flex-start; max-width: 46vw; top: calc(max(12px, env(safe-area-inset-top)) + 58px); }
    body.touch #toasts { top: 30%; right: calc(max(16px, env(safe-area-inset-right)) + 172px); max-width: 34vw; }
}
/* portrait: one row of pills, the trip bar under it, feature chips below that,
   extra touch buttons (🚀 fire…) on the left above NITRO, clear of the speedo */
@media (max-aspect-ratio: 1/1) {
    body.touch .hud-tl { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; max-width: calc(100% - 96px); }
    body.touch .hud-tl .pill { padding: 5px 11px; font-size: 16px; }
    body.touch .hud-top { top: calc(max(12px, env(safe-area-inset-top)) + 62px); width: calc(100% - 32px); }
    body.touch .hud-slot.left, body.touch .hud-slot.right, body.touch .hud-slot.center { top: calc(max(12px, env(safe-area-inset-top)) + 122px); }
    body.touch .hud-slot.center { max-width: 58vw; }
    body.touch #banner.compact { max-width: 58vw; font-size: 15px; }
    body.touch #toasts { top: 40%; max-width: 62vw; }
    body.touch #touchExtra { right: auto; left: max(24px, env(safe-area-inset-left)); bottom: calc(max(24px, env(safe-area-inset-bottom)) + 258px); }
    body.touch.hud-clean .hud-slot.left { top: calc(max(12px, env(safe-area-inset-top)) + 122px); }
}
/* a narrow phone: ❤️ + 💰 + SCORE don't fit one row once the score has 3 digits — the score wraps under them and sat on
   the trip bar (ci/qaweekend). Room for two rows of pills; the trip bar + the chips come down a row. */
@media (max-aspect-ratio: 1/1) and (max-width: 430px) {
    body.touch:not(.hud-clean) .hud-top { top: calc(max(12px, env(safe-area-inset-top)) + 100px); }
    body.touch:not(.hud-clean) .hud-slot.left, body.touch:not(.hud-clean) .hud-slot.right, body.touch:not(.hud-clean) .hud-slot.center { top: calc(max(12px, env(safe-area-inset-top)) + 162px); }
}
/* ══ HUD fit (ci/hudfit) — what sits where when the screen is small. hud.js › fitHud also nudges the feature stacks,
   the ✋ prompt and the controller's hint (and core/skip.js the ⏭ pill) off whatever they'd cover; these rules give
   them room to start with. Test: scripts/tests3d/hudfit.js (every pair of HUD pieces, 10 screen sizes). ═════════ */
/* a phone on its side (touch): the pills take two rows (♥ + 💰, then the score) left of a slimmer trip bar, the chips
   start right under them, and a slightly smaller stick sits below the chips — it covered 📝 Ima's list + ON FOOT. */
@media (min-aspect-ratio: 1/1) and (max-height: 520px) {
    body.touch .hud-top { width: min(420px, 42vw); }
    body.touch .hud-tl { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; max-width: calc(29vw - 20px); }
    body.touch .hud-tl .pill { padding: 5px 11px; }
    body.touch .hud-slot.left { top: calc(max(12px, env(safe-area-inset-top)) + 48px); }
    body.touch .hud-slot.left > * { max-width: min(260px, 31vw); }
    body.touch .hud-slot.left .jphone { width: min(260px, 31vw); }
    body.touch .hud-slot.left .foot-chip { white-space: normal; }
    body.touch #stickBase { width: 128px; height: 128px; }
    body.touch #stickZone span { width: 128px; }
    /* the "center" stack (the WELCOME banner…) fits between the left chips and the right-hand buttons */
    body.touch .hud-slot.center { max-width: calc(100vw - 2 * (min(260px, 31vw) + 24px)); }
    body.touch #banner.compact { max-width: 100%; }
    /* the ✋ prompt (centred, it sat on the banner): driving, low in the free band between the stick and the pedals
       (hud.js lifts it off a feature button that's there: 🚀…); on foot, right above the ✋ button it's about */
    body.touch .hud-slot.bottom { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 12px); left: calc(50vw - 17px); }
    body.touch .hud-slot.bottom .prompt { white-space: normal; text-align: center; max-width: calc(100vw - 360px); }
    body.touch.onfoot .hud-slot.bottom { left: auto; right: calc(max(18px, env(safe-area-inset-right)) + 180px); transform: none;
        bottom: calc(max(22px, env(safe-area-inset-bottom)) + 106px); align-items: flex-end; }
    body.touch.onfoot .hud-slot.bottom .prompt { max-width: calc(100vw - min(260px, 31vw) - 220px); }
}
/* a phone held upright (touch): the "center" stack (the WELCOME banner…) carries on the left column — it ducks under
   the left / right chips (hud.js) and keeps out of the speedo's column on the right */
@media (max-aspect-ratio: 1/1) {
    body.touch .hud-slot.center { left: max(12px, env(safe-area-inset-left)); right: calc(max(16px, env(safe-area-inset-right)) + 84px); transform: none; max-width: none; align-items: flex-start; }
    body.touch #banner.compact { max-width: 100%; }
}
/* a phone (touch, ≤ 760 px tall either way): no room for a third chip in the left column — while a phone call / text
   card is up there, the ON FOOT chip steps aside */
@media (max-height: 760px) {
    body.touch .hud-slot.left:has(.jphone, .jtext) .foot-chip { display: none; }
    body.touch .hud-slot.left .jtext:has(~ .jtext) { display: none; }      /* two texts at once: the newest (both are in 💬 Messages) */
}
/* a small phone held upright: the banner's second line stays one line (… if it must) so the stack ends above NITRO */
@media (max-aspect-ratio: 1/1) and (max-height: 700px) {
    body.touch #banner.compact small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
}
/* a narrow phone held upright (touch): the 150 px stick reached the BRAKE pedal */
@media (max-aspect-ratio: 1/1) and (max-width: 380px) {
    body.touch #stickBase { width: 140px; height: 140px; }
    body.touch #stickZone span { width: 140px; }
}
/* a controller / keyboard on a phone held upright (no touch layout): the touch-portrait arrangement — the pills in a
   row (two once the score is long), the trip bar full width under them, the chips under that, a compact speedo. The
   desktop column of pills ran into the trip label, and the bottom prompt + hint sat on the big speedo. */
@media (max-aspect-ratio: 1/1) and (max-width: 600px) {
    body:not(.touch) .hud-tl { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; max-width: calc(100% - 96px); }
    body:not(.touch) .hud-tl .pill { padding: 5px 11px; font-size: 16px; }
    body:not(.touch) .hud-top { top: calc(max(12px, env(safe-area-inset-top)) + 100px); width: calc(100% - 32px); }
    body:not(.touch) .hud-slot.left, body:not(.touch) .hud-slot.right, body:not(.touch) .hud-slot.center { top: calc(max(12px, env(safe-area-inset-top)) + 162px); }
    body:not(.touch) .hud-slot.center { left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); transform: none; max-width: none; }
    body:not(.touch) #banner.compact { max-width: 100%; }
    body:not(.touch) .speedo { width: 84px; padding: 6px 8px 8px; border-radius: 16px; }
    body:not(.touch) #mph { font-size: 26px; }
    body:not(.touch) .speedo .unit { font-size: 9px; letter-spacing: 0.12em; }
    body:not(.touch) .speedo .boost { margin-top: 5px; height: 7px; }
    body:not(.touch) .speedo .boost-label { font-size: 9px; margin-top: 3px; }
}
/* portrait phones: full-width card, comfortable taps */
@media (max-width: 520px) and (max-aspect-ratio: 1/1) {
    .card.title-card { padding: 12px 14px 14px; }
    .home .logo .l1 { font-size: 40px; } .home .logo .l2 { font-size: 28px; }
    .tile.grp .t-s { display: none; }
    .settings { grid-template-columns: 1fr; }
}

/* ONE GAME, NOT A MENU OF MODES (roadmap 10): ▶ PLAY is the one big button; the two small tiles under it
   (👯 Friends · 👧 Dina) sit icon-left, clearly secondary */
.tile.hero#play .t-ic { color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.18); font-variant-emoji: text; font-family: system-ui, sans-serif; }
.tile.hero#play .t-l { letter-spacing: 1px; }
@media (min-height: 560px) {
    .tile.hero#play { min-height: 92px; }
    .tile.hero#play .t-ic { font-size: 48px; }
    .tile.hero#play .t-l { font-size: calc(var(--fs-xl) * 1.2); }
}
.home-tiles[data-n="2"] .tile { flex-direction: row; justify-content: flex-start; text-align: left; min-height: 56px; padding: 8px 12px; gap: 10px; }
.home-tiles[data-n="2"] .tile .t-tx { align-items: flex-start; }
body.tv .tile.hero#play { min-height: 140px; } body.tv .tile.hero#play .t-ic { font-size: 72px; } body.tv .tile.hero#play .t-l { font-size: 50px; }
body.tv .home-tiles[data-n="2"] .tile { min-height: 84px; }
@media (max-height: 820px) {
    body.tv .tile.hero#play { min-height: 106px; } body.tv .tile.hero#play .t-ic { font-size: 54px; } body.tv .tile.hero#play .t-l { font-size: 38px; }
    body.tv .home-tiles[data-n="2"] .tile { min-height: 64px; }
}
