/* Game UI in the "Pist" style chosen in phase 5 (race-track kerbs, chequer,
 * black asphalt panels, slanted italic buttons). Structure: screens, sizes,
 * safe areas, phones.
 * --u is about 1/100 of a landscape phone's width and sizes everything, so
 * the screens keep their shape from 667×300 up to desktop. */
/* The font: Sofia Sans Condensed (SIL OFL, assets/fonts), upright and italic, one variable
 * file per script, so every device draws the same letters. Chinese, Japanese, Korean and
 * Arabic fall back to the device's own font. */
@font-face { font-family: "Sofia Sans Condensed"; font-style: italic; font-weight: 1 1000; font-display: swap; src: url("../assets/fonts/sofia-sans-condensed-cyrillic-italic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Sofia Sans Condensed"; font-style: italic; font-weight: 1 1000; font-display: swap; src: url("../assets/fonts/sofia-sans-condensed-latin-ext-italic.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Sofia Sans Condensed"; font-style: italic; font-weight: 1 1000; font-display: swap; src: url("../assets/fonts/sofia-sans-condensed-latin-italic.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Sofia Sans Condensed"; font-style: normal; font-weight: 1 1000; font-display: swap; src: url("../assets/fonts/sofia-sans-condensed-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Sofia Sans Condensed"; font-style: normal; font-weight: 1 1000; font-display: swap; src: url("../assets/fonts/sofia-sans-condensed-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Sofia Sans Condensed"; font-style: normal; font-weight: 1 1000; font-display: swap; src: url("../assets/fonts/sofia-sans-condensed-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --u: clamp(4.4px, min(1vw, 2.15vh), 9px);
  --safe-t: env(safe-area-inset-top, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px);
  --font: "Sofia Sans Condensed", "Avenir Next Condensed", "Arial Narrow", sans-serif;
  --bg: #12141c; --panel: #16171b; --line: rgba(255, 255, 255, 0.14); --text: #fff; --muted: #9a9aa4;
  --accent: #e3201b; --gold: #ffd21f; --green: #46dc78; --p1: #ff5a3c; --p2: #3cc6ff;
  --glass: rgba(255, 255, 255, 0.16); --glass-b: rgba(255, 255, 255, 0.32);
  --tshadow: 0 2px 0 rgba(0, 0, 0, 0.35), 0 0 12px rgba(0, 0, 0, 0.25);
  /* Style tokens. The values are the chosen "Pist" style (phase 5); the design
     pages' other styles (css/ui-themes.css, ?ui=X) override them. */
  --text2: #e4e4e8; --dim: linear-gradient(rgba(10, 14, 30, 0.55), rgba(10, 14, 30, 0.8));
  --radius: 4px; --panel-border: 0; --panel-shadow: 0 16px 34px rgba(0, 0, 0, 0.55);
  --btn-bg: #24252b; --btn-hover: #2e3037; --btn-border: 2px solid #3a3c44; --btn-text: var(--text);
  --btn-radius: 4px; --btn-shadow: none; --btn-ts: none; --btn-clip: polygon(5% 0, 100% 0, 95% 100%, 0 100%); --btn-style: italic;
  --primary-bg: #e3201b; --primary-text: #fff; --primary-border: 0; --primary-shadow: none; --primary-press: none;
  --pill-bg: #16171b; --pill-text: var(--text); --tile-bg: rgba(22, 23, 27, 0.92); --tile-sub: #c9cfe0; --card-bg: #202127;
  --logo-font: var(--font); --logo-color: #fff; --logo-style: italic; --logo-tilt: 0deg; --logo-shadow: 3px 3px 0 #e3201b, 6px 6px 0 rgba(0, 0, 0, 0.5);
  --title-ts: none; --switch-off: rgba(255, 255, 255, 0.2); --field-bg: rgba(255, 255, 255, 0.1);
  /* Canvas HUD (read by RG.render.css) */
  --hud-text: #ffffff; --hud-bar: #e3201b; --hud-btn: rgba(22, 23, 27, 0.55); --hud-btn-line: #ffffff;
  --pill-radius: 3px;
  --round-radius: 4px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.4 var(--font); overflow: hidden; }
body { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
.ico { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; flex: none; }
.ico.fill { fill: currentColor; stroke: none; }
[dir="rtl"] .ico.flip { transform: scaleX(-1); }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 5;
  padding: calc(var(--safe-t) + 12px) calc(var(--safe-r) + 12px) calc(var(--safe-b) + 12px) calc(var(--safe-l) + 12px); }
.overlay.show { display: flex; animation: fade 0.22s ease both; }
.overlay.show > .panel { animation: rise 0.32s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.overlay.dim { background: var(--dim); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
.reduce-motion *, .reduce-motion *::before { animation: none !important; transition: none !important; }

.panel { position: relative; background: var(--panel); border: var(--panel-border); border-radius: var(--radius); width: min(calc(96 * var(--u)), 100%);
  max-height: 100%; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--panel-shadow); }
.head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 10px 12px 6px; }
.head h2 { margin: 0; font-size: clamp(18px, calc(3.6 * var(--u)), 28px); font-weight: 900; text-align: center; text-shadow: var(--title-ts); font-style: var(--btn-style); }
.head .meta { justify-self: end; display: flex; gap: 6px; }
.body { padding: 6px 16px 14px; overflow-y: auto; min-height: 0; }
/* Scrollbars in the Pist style on everything that scrolls (screen bodies, the market grid,
   leaderboards): a dark asphalt lane with a red/white kerb for the thumb. Chrome, Edge and
   Safari draw these; Firefox gets the thin red-on-dark version. */
:is(.body, .mk-grid, .lb-list)::-webkit-scrollbar { width: 10px; height: 10px; }
:is(.body, .mk-grid, .lb-list)::-webkit-scrollbar-button { display: none; }
:is(.body, .mk-grid, .lb-list)::-webkit-scrollbar-corner { background: transparent; }
:is(.body, .mk-grid, .lb-list)::-webkit-scrollbar-track { background: #0b0c0f; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07); }
:is(.body, .mk-grid, .lb-list)::-webkit-scrollbar-thumb { border: 2px solid #0b0c0f; border-radius: 3px; min-height: 36px;
  background: repeating-linear-gradient(180deg, var(--accent) 0 12px, #fff 12px 24px); }
:is(.body, .mk-grid, .lb-list)::-webkit-scrollbar-thumb:hover { border-width: 1px; }
@supports not selector(::-webkit-scrollbar) { .body, .mk-grid, .lb-list { scrollbar-width: thin; scrollbar-color: var(--accent) #0b0c0f; } }
.foot { padding: 10px 16px 14px; display: flex; gap: 10px; justify-content: center; border-top: 1px solid var(--line); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; border-radius: var(--btn-radius);
  background: var(--btn-bg); border: var(--btn-border); color: var(--btn-text); font-weight: 800; font-size: clamp(15px, calc(2.2 * var(--u)), 19px);
  cursor: pointer; text-decoration: none; text-shadow: var(--btn-ts); transition: transform 0.08s, background 0.15s;
  box-shadow: var(--btn-shadow); clip-path: var(--btn-clip); font-style: var(--btn-style); }
.btn:hover { background: var(--btn-hover); }
.btn:active { transform: scale(0.96); }
.btn.primary { background: var(--primary-bg); color: var(--primary-text); border: var(--primary-border); box-shadow: var(--primary-shadow); }
.btn.primary:active { box-shadow: var(--primary-press); transform: translateY(3px); }
.btn.round { width: 48px; height: 48px; padding: 0; border-radius: var(--round-radius, 50%); clip-path: none; }
.btn.big { min-height: 64px; font-size: clamp(20px, calc(3.4 * var(--u)), 30px); padding: 12px 28px; border-radius: calc(var(--btn-radius) * 1.3); }
.btn[disabled] { opacity: 0.45; cursor: default; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: var(--pill-radius, 18px); background: var(--pill-bg); color: var(--pill-text);
  border: var(--pill-border, 1px solid var(--line)); font-weight: 800; font-variant-numeric: tabular-nums; text-shadow: var(--btn-ts); }
.pill .ico { width: 18px; height: 18px; }
.gold { color: var(--gold); }
.pill.gold { color: var(--pill-gold, var(--gold)); }

/* Pist touches: a red/white kerb along the top of every panel, ending in a chequer */
.panel { border-top: 10px solid transparent;
  background-image: repeating-linear-gradient(90deg, #fff 0 5px, #111 5px 10px), repeating-linear-gradient(90deg, #111 0 5px, #fff 5px 10px),
    repeating-linear-gradient(90deg, #e3201b 0 22px, #fff 22px 44px);
  background-size: 60px 5px, 60px 5px, 100% 10px; background-position: right top, right 0 top 5px, left top;
  background-repeat: no-repeat; background-origin: border-box; }
[dir="rtl"] .panel { background-position: left top, left 0 top 5px, left top; }
.head h2 { font-style: italic; }

/* ---------- Main menu ---------- */
#ov-menu { align-items: stretch; justify-content: stretch; padding: 0; }
.topbar { position: absolute; top: calc(var(--safe-t) + 10px); left: calc(var(--safe-l) + 10px); right: calc(var(--safe-r) + 10px);
  display: flex; align-items: center; gap: 8px; }
.topbar .grow { flex: 1; }
.logo { position: absolute; top: calc(var(--safe-t) + 8px); left: 50%; transform: translateX(-50%) rotate(var(--logo-tilt)); margin: 0; pointer-events: none;
  font-size: clamp(30px, calc(7.5 * var(--u)), 66px); font-weight: 900; letter-spacing: -0.02em; font-family: var(--logo-font); font-style: var(--logo-style); color: var(--logo-color);
  text-shadow: var(--logo-shadow); text-align: center; line-height: 0.95; }
/* Second word of the name on a red race-number strip */
.logo small { display: block; width: max-content; margin: 0.12em auto 0; padding: 0.05em 0.45em 0.08em; font-size: 0.42em; letter-spacing: 0.3em;
  color: #fff; background: var(--accent); text-shadow: none; font-style: normal; transform: skewX(-12deg); }
.menu-side { position: absolute; right: calc(var(--safe-r) + 16px); top: 50%; transform: translateY(-46%); width: min(calc(40 * var(--u)), 46vw);
  display: grid; gap: 10px; }
.menu-side .btn.big { width: 100%; flex-direction: column; gap: 0; line-height: 1.1; }
.menu-side .btn.big small { font-size: 0.55em; opacity: 0.9; font-weight: 700; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { background: var(--tile-bg); flex-direction: column; gap: 2px; min-height: calc(13 * var(--u)); padding: 8px; font-size: clamp(13px, calc(1.9 * var(--u)), 17px); }
.tile .ico { width: 26px; height: 26px; }
.tile.wide { grid-column: 1 / -1; flex-direction: row; gap: 8px; min-height: calc(8 * var(--u)); }
.tile.wide small { margin-inline-start: 6px; }
.tile small { font-size: 0.75em; color: var(--tile-sub); font-weight: 700; text-shadow: none; text-wrap: balance; text-align: center; }

/* Tap to Start Wheelie: above the brand; a tap on the scene does the same */
.tap-start { position: absolute; bottom: calc(var(--safe-b) + 124px); --tx: -50%; left: 50%; transform: translateX(var(--tx)); z-index: 1; margin: 0; padding: 5px 16px;
  background: rgba(10, 14, 30, 0.5); border: 0; border-radius: 20px; cursor: pointer; font: inherit; font-weight: 900; font-size: clamp(20px, calc(3.2 * var(--u)), 30px); white-space: nowrap;
  color: #fff; text-shadow: var(--tshadow); animation: tap-pulse 1.4s ease-in-out infinite; }
@keyframes tap-pulse { 50% { opacity: 0.45; transform: translateX(var(--tx)) scale(0.96); } }
/* Brand: bottom left on the menu and pause in landscape, bottom centre upright (below) */
.brand { position: absolute; bottom: calc(var(--safe-b) + 12px); left: calc(var(--safe-l) + 16px); display: flex; flex-direction: column; align-items: flex-end; gap: 2px; z-index: 1; }
.brand-credit { font-size: 11px; font-weight: 800; color: rgba(255, 255, 255, 0.85); text-shadow: var(--tshadow); }
.brand-link { display: block; transition: transform 0.15s; }
.brand-link:hover { transform: scale(1.05); }
.brand-link img { display: block; width: 136px; height: auto; }
/* More Games bar (css/more-games.css): under the settings button, the icons sized to the height. */
#ov-menu .mg { position: absolute; z-index: 1; left: calc(var(--safe-l) + 10px); top: calc(var(--safe-t) + 68px);
  --mg-size: clamp(36px, calc((100vh - 220px) / 3.3), 68px); }
[dir="rtl"] #ov-menu .mg { left: auto; right: calc(var(--safe-r) + 10px); }   /* under settings, which is on the right there */
#ov-menu .mg-C, #ov-menu .mg-E { --mg-size: clamp(34px, calc((100vh - 250px) / 3.3), 64px); }
@media (max-aspect-ratio: 4/5) { #ov-menu .mg { --mg-size: 54px; } #ov-menu .mg-C, #ov-menu .mg-E { --mg-size: 50px; } }

/* ---------- Levels ---------- */
.world-switch { display: flex; align-items: center; gap: 10px; justify-content: center; }
.world-switch .btn.round { width: 40px; height: 40px; min-height: 40px; }
.world-switch .btn[disabled] { visibility: hidden; }
.lock-note { text-align: center; color: var(--gold); font-weight: 800; margin: 0 0 8px; }
#lv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(17 * var(--u)), 1fr)); gap: 8px; }
.lvl { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: start; background: var(--card-bg);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; cursor: pointer; min-height: 84px; color: var(--text); }
.lvl:hover { border-color: rgba(255, 255, 255, 0.35); }
.lvl .n { font-size: 20px; font-weight: 900; }
.lvl .nm { font-size: 12.5px; color: var(--text2); line-height: 1.2; }
.lvl .st { color: var(--gold); letter-spacing: 2px; margin-top: auto; }
.lvl .tag { position: absolute; top: 8px; inset-inline-end: 8px; font-size: 10.5px; background: rgba(255, 255, 255, 0.14); border-radius: 6px; padding: 1px 6px; }
.lvl.show { background: rgba(255, 210, 90, 0.1); border-color: rgba(255, 210, 90, 0.35); }
.lvl.next { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255, 90, 60, 0.35) inset; }
.lvl.locked { opacity: 0.45; cursor: default; }
.lvl.locked .ico { width: 22px; height: 22px; margin-top: 6px; }

/* ---------- Intro ---------- */
#in-goal { color: var(--accent); font-weight: 900; font-size: 18px; margin: 0; }
#in-hint { color: var(--text2); margin: 8px 0; }
#in-stars { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 4px; color: var(--muted); }
#in-stars li.got { color: var(--gold); }
.note { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
kbd { background: rgba(255, 255, 255, 0.12); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font: 700 12px var(--font); }

/* ---------- In-game ---------- */
#hud { position: fixed; top: calc(var(--safe-t) + 10px); inset-inline-end: calc(var(--safe-r) + 10px); z-index: 3; }
#hud .btn.round { background: var(--pill-bg); color: var(--pill-text); }
#ov-fail .panel, #ov-result .panel, #ov-vsend .panel { text-align: center; }
#fail-why { font-size: clamp(22px, calc(4 * var(--u)), 32px); font-weight: 900; margin: 0 0 6px; }
#fail-why.failed { color: var(--accent); text-transform: uppercase; }
.fail-btns { display: flex; gap: 12px; justify-content: center; margin-top: 12px; }
.fail-btns .btn { flex: 1 1 0; max-width: 200px; }
.tap { color: var(--gold); font-weight: 800; margin-top: 10px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
/* A vehicle won on this pass */
.unlock-line { margin: 6px auto 0; padding: 6px 12px; width: max-content; max-width: 100%; background: var(--gold); color: #1b1b1b; font-weight: 900; border-radius: 6px; }
#res-stars { font-size: clamp(40px, calc(8 * var(--u)), 62px); letter-spacing: 8px; margin: 2px 0; }
#res-stars span { color: var(--switch-off); display: inline-block; }
#res-stars span.on { color: var(--gold); animation: pop 0.45s both; }
#res-stars span.new { text-shadow: 0 0 18px rgba(255, 210, 90, 0.8); }
@keyframes pop { 0% { transform: scale(0.2); opacity: 0; } 70% { transform: scale(1.3); } 100% { transform: scale(1); opacity: 1; } }
.lines { list-style: none; padding: 0; margin: 6px auto; max-width: 360px; text-align: start; }
.lines li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 5px 0; font-size: 14px; }
.lines b { font-variant-numeric: tabular-nums; }
.pause-buttons { display: flex; gap: 14px; justify-content: center; align-items: center; margin: 8px 0 4px; }
.pause-buttons .btn.round { width: 60px; height: 60px; flex: none; }
.pause-buttons .btn.round.primary { width: 78px; height: 78px; }
.pause-buttons .ico { width: 26px; height: 26px; }
.score-big { font-size: clamp(40px, calc(9 * var(--u)), 72px); font-weight: 900; font-variant-numeric: tabular-nums; margin: 0; line-height: 1; }
.score-big .a { color: var(--p1); } .score-big .b { color: var(--p2); }

/* ---------- Garage & market ---------- */
.panel.market { width: min(88vw, 900px, 100%); height: min(88vh, 560px, 100%); }
.mk-tabs { flex-wrap: nowrap; justify-content: center; }
.mk-tabs .btn { flex: 0 1 auto; min-width: 0; }
.mk-tabs .btn.on { background: var(--primary-bg); color: var(--primary-text); }
.mk-body { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 12px; padding: 4px 14px 12px; min-height: 0; flex: 1; }
.mk-preview { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 0; }
.mk-preview canvas { width: 100%; flex: 1; min-height: 110px; max-height: 240px; display: block; border-radius: 6px; }
.mk-name { font-weight: 900; font-size: 20px; text-align: center; }
.mk-sub { color: var(--muted); font-size: 13px; text-align: center; min-height: 1.3em; }
.mk-count { color: var(--muted); font-size: 12px; }
.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; overflow-y: auto; align-content: start; min-height: 0; padding: 2px; }
.mk-grid.drag { cursor: grabbing; }
.mk-grid.drag .mk-card { pointer-events: none; }   /* no hover or press look while dragging */
/* A drag on the grid holds the kerb a little wider (the scrollbar style is with .body, above). */
.mk-grid { padding-inline-end: 6px; }
.mk-grid.drag::-webkit-scrollbar-thumb { border-width: 1px; }
.mk-card { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 4px; border-radius: 6px; cursor: pointer;
  background: var(--card-bg); border: 2px solid transparent; color: var(--text); font: inherit; }
.mk-card canvas { width: 100%; height: 56px; display: block; }
.mk-card .nm { font-size: 11px; font-weight: 800; line-height: 1.1; min-height: 2.2em; text-align: center; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }   /* long names on two lines */
.mk-card .pr { font-size: 11px; font-weight: 900; text-align: center; color: var(--gold); }
.mk-card .pr.own { color: var(--green); } .mk-card .pr.lock { color: var(--muted); }
.mk-card.sel { border-color: #fff; }
.mk-card.use::after { content: "✓"; position: absolute; top: 2px; inset-inline-end: 6px; color: var(--green); font-weight: 900; }
.badge { position: absolute; top: 4px; inset-inline-end: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent);
  color: #fff; font: 900 11px/18px var(--font); font-style: normal; text-align: center; }
.tile { position: relative; }
.panel.market .head { grid-template-columns: auto minmax(0, 1fr) auto; }
@media (max-aspect-ratio: 4/5) {
  .panel.market { width: 100%; height: 100%; }
  .mk-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .mk-preview canvas { max-height: 170px; }
  .panel.market .head { grid-template-columns: auto 1fr auto; row-gap: 8px; }
  .mk-tabs { grid-row: 2; grid-column: 1 / -1; gap: 4px; } .mk-tabs .btn { flex: 1 1 0; padding: 4px 8px; font-size: 14px; min-height: 36px; }
  .panel.market .head .pill { padding: 0 8px; height: 30px; }
}

/* ---------- In-app store (js/shop.js) and the starter offer ---------- */
.shop-btn .ico { width: 24px; height: 24px; }
.panel.shop { width: min(calc(130 * var(--u)), 100%); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 4px 0; }
.shop-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 10px 10px; text-align: center;
  background: var(--card-bg); border: 2px solid var(--line); border-radius: 14px; min-width: 0; }
.shop-card b { font-size: 15px; font-weight: 900; line-height: 1.15; }
.shop-card small { color: var(--muted); font-size: 12px; line-height: 1.25; flex: 1; text-wrap: balance; overflow-wrap: anywhere; }
.shop-card.feat { grid-column: span 2; border-color: var(--gold); background: linear-gradient(180deg, rgba(255, 210, 90, 0.16), var(--card-bg)); }
.shop-card.own { opacity: 0.7; }
.shop-card .btn, .panel.offer .btn.primary { gap: 6px; }
.shop-card .btn { min-height: 38px; padding: 4px 14px; font-size: 15px; margin-top: 4px; width: 100%; }
.shop-card .btn.own { background: transparent; color: var(--green); border: 2px solid var(--green); box-shadow: none; }
.btn img.cur { width: 18px; height: 18px; object-fit: contain; flex: none; }
.shop .art, .panel.offer .art { position: relative; display: flex; align-items: center; justify-content: center; height: 52px; }
.shop .art .ico, .panel.offer .art .ico { width: 44px; height: 44px; }
.shop .art .coin, .panel.offer .art .coin { color: var(--gold); }
.shop .art .coin.c2 { margin-inline-end: -26px; transform: translateY(-6px); }
.shop .art .coin.c3 { margin-inline-end: -26px; transform: translateY(-12px); }
.shop .art .slash { position: absolute; color: #ff5050; width: 50px; height: 50px; }
.shop .art .x2 { font-size: 18px; font-weight: 900; color: var(--gold); margin-inline-start: 2px; }
.shop .tag, .panel.offer .tag { position: absolute; top: -9px; inset-inline-end: 10px; padding: 1px 8px; border-radius: 9px; background: var(--gold); color: #1b1b1b;
  font-size: 11px; font-weight: 900; white-space: nowrap; }
.shop .timer, .offer-time { font-size: 13px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; margin: 0; }
#shop-foot { padding-block: 6px 8px; }
#shop-restore { min-height: 36px; padding: 4px 14px; font-size: 14px; }
#shop-foot:has(#shop-restore[hidden]) { display: none; }
.panel.offer { overflow: visible; }
.panel.offer .body { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding-top: 18px; }
.panel.offer h2 { margin: 0; color: var(--gold); }
.panel.offer .note { margin: 0; }
.panel.offer .tag { top: -12px; inset-inline-end: 16px; }
.panel.offer .art .ico { color: var(--gold); width: 52px; height: 52px; }
@media (max-height: 560px) {
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .shop-card { padding: 8px 8px 8px; gap: 2px; }
  .shop-card b { font-size: 14px; }
  .shop-card small { font-size: 11px; }
  .shop-card .btn { min-height: 32px; font-size: 14px; }
  #shop-foot { padding-block: 4px 6px; }
  .shop .art { height: 36px; } .shop .art .ico { width: 32px; height: 32px; }
  .shop .art .slash { width: 38px; height: 38px; }
  .panel.offer .body { gap: 4px; padding-top: 14px; }
  .panel.offer .art { height: 40px; } .panel.offer .art .ico { width: 40px; height: 40px; }
}
@media (max-width: 360px) { .shop-grid { grid-template-columns: 1fr 1fr; } .shop-card.feat { grid-column: 1 / -1; } }

/* ---------- Settings ---------- */
.setting { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 12px; padding: 10px 4px; background: none; border: 0;
  border-bottom: 1px solid var(--line); cursor: pointer; font-weight: 700; font-size: 16px; text-align: start; }
.switch { position: relative; width: 46px; height: 26px; border-radius: 13px; background: var(--switch-off); flex: none; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: inset-inline-start 0.15s; }
.setting.on .switch { background: var(--green); }
.setting.on .switch::after { inset-inline-start: 23px; }
select { font: inherit; font-weight: 700; color: var(--text); background: var(--field-bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
select option { color: #111; }
.links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 13px; }
.links a { color: var(--muted); }
.links .sec { width: 100%; color: var(--muted); font-size: 12px; font-weight: 800; margin-top: 4px; }

/* ---------- Vehicle picker (garage and versus) ---------- */
.picker { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px; }
.picker canvas { width: 100%; height: calc(20 * var(--u)); min-height: 90px; display: block; }
#garage-picker canvas { height: calc(30 * var(--u)); min-height: 140px; }
.picker .name { grid-column: 1 / -1; text-align: center; font-weight: 900; font-size: 18px; margin-top: -4px; }
.picker .kind { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: 13px; margin-top: -6px; }
.picker .hint { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: 12px; }
.pcard { border: 2px solid var(--line); border-radius: 16px; padding: 8px 10px 10px; background: var(--card-bg); }
.pcard h3 { margin: 0; text-align: center; font-size: 15px; font-weight: 900; }
.pcard.p1 { border-color: rgba(255, 90, 60, 0.6); } .pcard.p1 h3 { color: var(--p1); }
.pcard.p2 { border-color: rgba(60, 198, 255, 0.6); } .pcard.p2 h3 { color: var(--p2); }
.pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pickers.solo { grid-template-columns: calc(50% - 5px); justify-content: center; }   /* vs CPU: your card alone, centred */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg .btn { min-height: 40px; padding: 6px 12px; font-size: 14px; flex: 1; }
.seg .btn.on { background: var(--primary-bg); color: var(--primary-text); }
.lbl { color: var(--muted); font-size: 12px; font-weight: 800; margin: 10px 0 4px; }
.desc { color: var(--text2); font-size: 13px; margin: 6px 0 0; min-height: 2.6em; }

/* Toast and rotate tip */
#toast { position: fixed; top: calc(var(--safe-t) + 14px); left: 50%; transform: translateX(-50%); z-index: 9; background: var(--gold); color: #1b1b1b;
  font-weight: 800; padding: 8px 16px; border-radius: 20px; pointer-events: none; }
#rotate-tip { position: fixed; bottom: calc(var(--safe-b) + 12px); left: 50%; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 8px;
  background: rgba(10, 14, 30, 0.8); border: 1px solid var(--line); border-radius: 22px; padding: 6px 6px 6px 14px; font-size: 13px; font-weight: 700; white-space: nowrap; }
#rotate-tip .btn.round { width: 32px; height: 32px; min-height: 32px; }

/* ---------- Phones ---------- */
/* Landscape phones: smaller chrome, logo to the corner, side panels side by side */
@media (max-height: 560px) {
  .btn.big { min-height: 54px; }
  .brand { left: calc(var(--safe-l) + 12px); bottom: calc(var(--safe-b) + 8px); }
  .brand-link img { width: 100px; }
  .tap-start { font-size: 19px; bottom: calc(var(--safe-b) + 12px); }   /* still at the bottom centre: on the road under the wheels */
  .head { padding: 6px 10px 2px; }
  .body { padding: 4px 12px 10px; }
  .foot { padding: 6px 12px 8px; }
  .picker canvas { height: 64px; min-height: 64px; }
  #garage-picker canvas { height: 140px; min-height: 140px; }
  #garage-picker .kind { display: block; }
  .picker .kind, #ov-vs .lbl, #ov-vs .note { display: none; }
  .picker .name { font-size: 15px; margin-top: -2px; }
  .desc { min-height: 0; margin: 4px 0; font-size: 12px; }
  .seg .btn { min-height: 34px; padding: 4px 8px; font-size: 13px; }
  .pcard { padding: 4px 8px 6px; }
  .head h2 { font-size: 20px; }
  .head .btn.round { width: 40px; height: 40px; min-height: 40px; }
  #vs-cpu-row { margin-top: 6px; }
  .logo { font-size: 44px; }
  .menu-side { top: calc(var(--safe-t) + 66px); transform: none; width: min(320px, 42vw); gap: 6px; }
  .logo { font-size: 38px; }
  .menu-side .btn.big { min-height: 44px; padding-block: 3px; }
  .tiles { gap: 6px; }
  .tile { min-height: 44px; padding: 2px 6px; gap: 0; }
  .tile.wide { min-height: 30px; }
  .tile .ico { width: 16px; height: 16px; }
  .lvl { min-height: 70px; }
  .pause-buttons .btn.round.primary { width: 64px; height: 64px; }
}
/* Versus setup on a phone held sideways (and short windows): everything on one screen, no scrolling */
@media (max-height: 700px) and (min-aspect-ratio: 4/5) {
  #ov-vs .lbl, #ov-vs .note, #ov-vs .picker .kind { display: none; }
  #ov-vs .desc { min-height: 0; margin: 4px 0; font-size: 12px; }
  #ov-vs { padding-top: calc(var(--safe-t) + 6px); padding-bottom: calc(var(--safe-b) + 6px); }
  #ov-vs .head { padding-top: 2px; }
  #ov-vs .head .btn.round { width: 36px; height: 36px; min-height: 36px; }
  #ov-vs .head h2 { font-size: 18px; }
  #ov-vs .seg .btn { min-height: 32px; }
  #ov-vs #vs-cpu-row { margin-top: 2px; }
  #ov-vs .desc { line-height: 1.25; }
  #ov-vs .pickers { margin-top: 6px !important; gap: 8px; }
  #ov-vs .pcard h3 { font-size: 13px; line-height: 1.15; }
  #ov-vs .picker { gap: 2px 6px; }
  #ov-vs .picker .btn.round { width: 38px; height: 38px; min-height: 38px; }
  #ov-vs .picker canvas { height: 50px; min-height: 50px; }
  #ov-vs .picker .name { font-size: 14px; margin-top: 0; line-height: 1.15; }
  #ov-vs .picker .hint { font-size: 11px; line-height: 1.2; }
  #ov-vs .foot { padding: 4px 12px 6px; border-top: 0; }
  #ov-vs .foot .btn.big { min-height: 42px; padding-block: 2px; font-size: 20px; }
}
/* Short laptop and portal windows: lower menu tiles, so the menu (with More Games) fits */
@media (min-height: 561px) and (max-height: 680px) {
  .menu-side { gap: 6px; transform: translateY(-40%); }
  .tiles { gap: 6px; }
  .tile { min-height: calc(10 * var(--u)); }
  .tile.wide { min-height: 40px; }
  .menu-side .btn.big { min-height: 56px; }
}
/* Upright phones: menu buttons under the scene */
@media (max-aspect-ratio: 4/5) {
  .menu-side { left: calc(var(--safe-l) + 16px); right: calc(var(--safe-r) + 16px); width: auto; top: auto; bottom: calc(var(--safe-b) + 118px); transform: none; }
  .tap-start { font-size: clamp(16px, calc(2.6 * var(--u)), 24px); }   /* game.js: placeTap sets its height */
  .menu-side { gap: 6px; }
  .tiles { gap: 6px; }
  .tile.wide { min-height: 38px; padding: 4px 10px; }
  .menu-side .tile .ico { width: 20px; height: 20px; }
  .menu-side .btn.big { min-height: 52px; }
  .logo { top: calc(var(--safe-t) + 64px); }
  .pickers, .pickers.solo { grid-template-columns: 1fr; }
  .brand { left: 50%; transform: translateX(-50%); }
}
/* Versus setup on an upright phone: both player cards and Start on one screen */
@media (max-aspect-ratio: 4/5) and (max-height: 820px) {
  #ov-vs .lbl, #ov-vs .note, #ov-vs .picker .kind { display: none; }
  #ov-vs .head { padding-top: 4px; padding-bottom: 0; }
  #ov-vs .head .btn.round { width: 40px; height: 40px; min-height: 40px; }
  #ov-vs .seg .btn { min-height: 38px; padding: 4px 6px; font-size: 13px; }
  #ov-vs .desc { min-height: 0; margin: 4px 0; font-size: 12px; }
  #ov-vs #vs-cpu-row { margin-top: 4px; }
  #ov-vs .pickers { gap: 8px; margin-top: 6px !important; }
  #ov-vs .pcard { padding: 4px 8px 6px; }
  #ov-vs .picker .btn.round { width: 40px; height: 40px; min-height: 40px; }
  #ov-vs .picker canvas { height: 64px; min-height: 64px; }
  #ov-vs .picker .name { font-size: 15px; margin-top: 0; }
  #ov-vs .foot { padding: 8px 12px 10px; }
  #ov-vs .foot .btn.big { min-height: 52px; }
}
/* Player 1 (A/D keys) stays on the left in every language */
[dir="rtl"] .pickers { direction: ltr; }
[dir="rtl"] .pickers > .pcard { direction: rtl; }

/* Rewarded offers (an ad for something): gold outline, the ad icon */
.btn.offer { border: 2px solid var(--gold); color: var(--gold); background: transparent; margin: 8px auto 0; font-size: 14px; }
.btn.offer.primary { background: var(--gold); color: #1b1b1b; }
.btn.offer .ico { width: 20px; height: 20px; }
/* The level result's double coins: the biggest thing on the screen, breathing */
#res-double { display: flex; width: min(94%, 420px); min-height: 60px; padding: 8px 16px; font-size: clamp(17px, calc(2.6 * var(--u)), 22px); font-weight: 900; line-height: 1.1; text-shadow: none;
  background: linear-gradient(180deg, #ffe066, var(--gold)); border: 0; animation: x2-pulse 1.2s ease-in-out infinite; }
#res-double .ico { width: 28px; height: 28px; flex: none; }
@keyframes x2-pulse { 50% { transform: scale(1.06); } }
@media (max-height: 560px) { #res-double { min-height: 46px; margin-top: 4px; font-size: 16px; } #res-double .ico { width: 22px; height: 22px; } }
@media (max-height: 400px) { #res-stars { font-size: 28px; line-height: 1; margin: 0; } #res-double { min-height: 42px; } #ov-result .note { margin: 4px 0 0; } }
/* Ride on: the one thing to look at. The wrapper breathes and carries the glow, since a
   box-shadow would be cut by the button's slanted clip-path; a filter on the parent is not. */
#ov-revive .panel { width: min(calc(72 * var(--u)), 100%); }
#ov-revive .body { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 16px; text-align: center; }
#ov-revive .btn:not(.primary) { min-height: 40px; font-size: 14px; }
.rv-cta { width: min(92%, 480px); filter: drop-shadow(0 0 16px rgba(255, 196, 31, 0.75)); animation: rv-breathe 1s ease-in-out infinite; }
@keyframes rv-breathe { 50% { transform: scale(1.07); } }
#rv-watch { position: relative; overflow: hidden; width: 100%; min-height: 72px; padding: 10px 26px; color: #1b1b1b; text-shadow: none; border: 0;
  font-size: clamp(19px, calc(3 * var(--u)), 25px); font-weight: 900; line-height: 1.1;
  background: linear-gradient(180deg, #fff08a, var(--gold) 55%, #ffb300); }
#rv-watch .ico { width: 32px; height: 32px; flex: none; }
#rv-watch span { text-wrap: balance; }
#rv-watch::before { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 26%; transform: skewX(-20deg); pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent); animation: rv-shine 2s ease-in-out infinite; }
@keyframes rv-shine { 60%, 100% { left: 115%; } }
#rv-key { flex: none; margin-inline-start: 4px; padding: 3px 8px; background: #1b1b1b; border: 0; color: var(--gold); font-size: 13px; font-style: normal; }
.rv-time { width: min(92%, 480px); height: 6px; flex: none; overflow: hidden; border-radius: 3px; background: rgba(255, 255, 255, 0.14); }
.rv-time i { display: block; height: 100%; transform-origin: left; background: linear-gradient(90deg, var(--accent), var(--gold)); }
[dir="rtl"] .rv-time i { transform-origin: right; background: linear-gradient(270deg, var(--accent), var(--gold)); }
@media (max-height: 400px) {
  #ov-revive .body { gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  #ov-revive .score-big { font-size: 34px; }
  #rv-score.why { font-size: 17px; }
  #rv-watch { min-height: 52px; font-size: 18px; }
  #rv-watch .ico { width: 26px; height: 26px; }
  #ov-revive .btn:not(.primary) { min-height: 34px; padding-block: 4px; }
}
#rv-score.why { font-size: 20px; margin: 0; }   /* a career level: why you fell, not a score */

/* Online leaderboard */
.panel.lb .body { display: flex; flex-direction: column; gap: 6px; }
.lb-reset { text-align: center; min-height: 1.2em; margin: 0; }
.lb-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; max-height: min(46vh, 340px); }
.lb-list li, .lb-me { display: grid; grid-template-columns: 3em minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.lb-list .rk, .lb-me .rk { font-weight: 900; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-list .nm, .lb-me .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-list b, .lb-me b { font-variant-numeric: tabular-nums; }
.lb-list .top1 .rk { color: #ffd21f; } .lb-list .top2 .rk { color: #cfd6e0; } .lb-list .top3 .rk { color: #e3954f; }
.lb-list .me, .lb-me { background: color-mix(in srgb, var(--primary-bg) 22%, transparent); }
.lb-list .lb-state { display: block; text-align: center; color: var(--muted); padding: 18px 8px; border: 0; }
.lb-name { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.lb-name label { font-size: 13px; color: var(--muted); }
.lb-name-row { display: flex; gap: 8px; }
.lb-name input { flex: 1; min-width: 0; font: 700 16px/1 var(--font); padding: 10px 12px; border-radius: var(--btn-radius); border: 1px solid var(--line); background: rgba(0,0,0,0.25); color: inherit; }
.lb-name .btn { min-height: 40px; }
#lb-msg { min-height: 1.2em; font-size: 12px; color: var(--muted); }
#lb-msg.ok { color: #46dc78; } #lb-msg.err { color: #ff6b5a; }
.lb-line { text-align: center; font-weight: 800; color: var(--gold); }

/* The + by the coins: free coins for an ad */
.pill.has-plus { padding-inline-end: 4px; }
.pill-plus { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; margin-inline-start: 4px; border: 0; border-radius: 50%; background: var(--gold); color: #1b1b1b; cursor: pointer; }
.pill-plus[hidden] { display: none; }
.pill-plus .ico { width: 16px; height: 16px; stroke-width: 3.4; }
.pill-plus:active { transform: scale(0.88); }
#ov-earn .body { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding-top: 16px; }
#ov-earn h2 { margin: 0; }
#ov-earn.short h2 { color: #ff8f80; }
.earn-coin { display: flex; align-items: center; gap: 10px; }
.earn-coin .ico { width: 60px; height: 60px; color: var(--gold); filter: drop-shadow(0 6px 14px rgba(255, 190, 40, 0.45)); }
#ov-earn.show .earn-coin .ico { animation: pop 0.4s both; }
.earn-coin b { font-size: 44px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
#ov-earn .btn:not(.primary) { min-height: 40px; font-size: 14px; }

/* Daily challenge */
.badge.dot { min-width: 12px; width: 12px; height: 12px; padding: 0; font-size: 0; }
.dl-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.dl-card canvas { display: block; width: 100%; height: clamp(110px, 24vh, 190px); border-radius: 10px; background: #0d0f15; }
.dl-left { text-align: center; margin: 0 0 4px; }
.dl-goal { margin: 10px 0 2px; font-size: 20px; font-weight: 900; color: var(--gold); text-align: center; }
.dl-card .lines { max-width: none; margin: 4px 0 0; }
.dl-board h3 { margin: 0 0 6px; font-size: 15px; }
.dl-board .lb-list { max-height: none; }
.dl-board .btn { width: 100%; margin-top: 8px; min-height: 40px; font-size: 14px; }
@media (max-aspect-ratio: 4/5) {
  .dl-body { grid-template-columns: 1fr; }
  .dl-card canvas { height: 150px; }
}

/* Menu: More Games (Twoplayergames and Rocket Games builds) */
.menu-side .tile.more { text-decoration: none; border: 2px solid var(--gold); color: var(--gold); }

/* ---------- Tutorial (js/tutorial.js): the step card, the keycaps, Skip ----------
   Over the practice ride; only Skip takes clicks, so touches still reach the canvas. */
#tut { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.tut-card { position: absolute; top: calc(var(--safe-t) + 10px); left: 50%; transform: translateX(-50%); width: max-content; max-width: min(720px, calc(100% - 150px));
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 28px 14px; text-align: center;
  background: rgba(22, 23, 27, 0.9); border-top: 4px solid transparent; border-radius: var(--radius); box-shadow: var(--panel-shadow);
  border-image: repeating-linear-gradient(90deg, var(--accent) 0 16px, #fff 16px 32px) 4; transition: background 0.2s; }
.tut-card.ok { background: rgba(26, 64, 40, 0.94); }
.tut-card.ready { background: rgba(26, 64, 40, 0.94); }
.tut-top { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.tut-dots { display: flex; gap: 5px; }
.tut-dots i { width: 11px; height: 11px; border-radius: 2px; background: rgba(255, 255, 255, 0.2); transform: skewX(-12deg); }
.tut-dots i.on { background: var(--green); }
.tut-dots i.cur { background: var(--accent); }
.tut-title { font-size: clamp(19px, 2.9vw, 28px); font-weight: 900; font-style: italic; line-height: 1.2; text-wrap: balance; }
.tut-card.ok .tut-title::after, .tut-card.ready .tut-title::before { content: "✓"; color: var(--green); margin-inline-start: 8px; font-style: normal; }
.tut-card.ready .tut-title::before { margin: 0 8px 0 0; }
.tut-combo { display: flex; flex-direction: column; align-items: center; gap: 5px; margin-top: 2px; }
.tut-combo .line { display: flex; align-items: center; gap: 6px; }
.tut-combo .cmb { display: inline-flex; align-items: center; gap: 4px; }
.tut-combo .plus, .tut-combo .or { font-style: normal; font-weight: 900; color: var(--muted); }
.tut-combo .plus { color: var(--gold); font-size: 18px; margin: 0 2px; }
.tut-combo .x2 { color: var(--gold); font-weight: 900; margin-inline-start: 2px; }
.tut-combo .sub { color: var(--text2); font-size: 15px; font-weight: 700; }
.tut-combo .who { min-width: 36px; padding: 3px 8px; border-radius: 3px; font-size: 14px; font-weight: 900; color: #fff; margin-right: 4px; }
.tut-combo .who.p1 { background: var(--p1); } .tut-combo .who.p2 { background: var(--p2); }
.tut-combo .who.ok::after { content: " ✓"; }

/* A keycap: dark key, a deep bottom edge, the letter on it; red and pressed in while held. */
.key { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 8px; box-sizing: border-box;
  background: linear-gradient(#34363e, #24252b); color: #fff; font: 900 16px/1 var(--font); font-style: normal;
  border: 1px solid #4a4c55; border-bottom: 5px solid #0e0f12; border-radius: 6px; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
  transition: transform 0.06s, background 0.06s, border-width 0.06s; }
.key.wide { min-width: 84px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
.key.on { background: linear-gradient(#ff4a3d, var(--accent)); border-color: #ff7a70; border-bottom-width: 1px; transform: translateY(4px); box-shadow: 0 0 14px rgba(227, 32, 27, 0.6); }
.tut-combo .key { min-width: 30px; height: 30px; font-size: 14px; }
.tut-combo .key.wide { min-width: 70px; font-size: 12px; }

#tut-rows .tut-row { position: absolute; left: 50%; bottom: calc(var(--safe-b) + 14px); transform: translateX(-50%); display: flex; gap: 10px; align-items: center;
  padding: 12px 20px 10px; background: rgba(16, 17, 21, 0.82); border-radius: var(--radius); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
  border: 2px solid transparent; transition: border-color 0.2s; }
#tut-rows .tut-row:empty { display: none; }
/* The new key is due (the ride is slowed): the row's frame lights up gold. */
#tut-rows .tut-row.wait { border-color: var(--gold); }
#tut-rows .tut-row.ok { border-color: var(--green); }
.tut-row .grp.done b { color: var(--green); font-size: 22px; padding: 2px 10px; }
.tut-row .plus { color: var(--gold); font-style: normal; font-weight: 900; font-size: 20px; margin-bottom: 16px; }
.tut-row .x2 { color: var(--gold); font-weight: 900; font-size: 15px; margin-inline-start: 2px; }
#tut.duo #tut-rows .tut-row { bottom: auto; }
/* 2 Player: the card 30% smaller, so it covers less of player 1's view. */
#tut.duo .tut-card { transform: translateX(-50%) scale(0.7); transform-origin: top center; }
.tut-row .grp { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tut-row .grp.held { opacity: 0.6; }
.tut-row .grp.cue { animation: tut-in 0.25s ease-out; }
.tut-row .key { min-width: 40px; height: 40px; font-size: 18px; }
.tut-row .grp.cue .key { min-width: 60px; height: 58px; font-size: 26px; border-bottom-width: 6px; }
.tut-row .grp.cue .key.on { border-bottom-width: 1px; transform: translateY(5px); }
.tut-row .grp.cue .key.wide { min-width: 136px; font-size: 17px; }
.tut-row .grp.cue small { font-size: 14px; }
@keyframes tut-in { from { transform: translateY(8px); opacity: 0; } }
.tut-row .grp.cue .key:not(.on) { animation: tut-cue 1s ease-in-out infinite; }
.tut-row .caps { display: flex; align-items: center; gap: 4px; }
.tut-row .or { color: var(--muted); font-style: normal; font-weight: 900; font-size: 12px; }
.tut-row small { color: var(--text2); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.tut-row .grp.cue small { color: var(--gold); }
@keyframes tut-cue { 50% { box-shadow: 0 0 0 3px var(--gold), 0 3px 8px rgba(0, 0, 0, 0.45); } }
.reduce-motion .tut-row .grp.cue .key:not(.on) { animation: none; box-shadow: 0 0 0 3px var(--gold); }
.reduce-motion .tut-row .grp.cue { animation: none; }

.tut-skip { position: absolute; bottom: calc(var(--safe-b) + 12px); inset-inline-end: calc(var(--safe-r) + 12px); pointer-events: auto;
  min-height: 54px; padding: 10px 22px; font-size: 18px; gap: 10px; background: rgba(36, 37, 43, 0.94); }
.tut-skip .ico { width: 22px; height: 22px; }
/* Phones: clear of the big gas button in the corner */
#tut.touch .tut-skip { bottom: calc(var(--safe-b) + 14px); inset-inline-end: calc(var(--safe-r) + min(136px, 26vh) + 34px); }
#tut.duo.touch .tut-skip { inset-inline-end: calc(var(--safe-r) + 120px); }
@media (max-width: 700px) {
  .tut-card { max-width: calc(100% - 80px); padding: 6px 12px 8px; }
  #tut-rows .tut-row { gap: 6px; padding: 6px 8px 4px; }
  .tut-row .key { min-width: 32px; height: 32px; font-size: 15px; }
  .tut-skip { min-height: 44px; padding: 8px 14px; font-size: 15px; }
  .key { min-width: 28px; height: 30px; font-size: 14px; padding: 0 6px; }
  .key.wide { min-width: 60px; font-size: 11px; }
  .tut-row small { font-size: 10px; }
  .tut-row .grp.cue .key { min-width: 42px; height: 42px; font-size: 19px; }
  .tut-row .grp.cue .key.wide { min-width: 90px; font-size: 13px; }
}
/* Landscape phones: less height for the card, keys and Skip. */
@media (max-height: 520px) {
  .tut-card { padding: 7px 18px 9px; gap: 3px; }
  .tut-top { font-size: 12px; }
  .tut-title { font-size: 18px; }
  .tut-combo .sub { font-size: 13px; }
  .tut-skip { min-height: 46px; padding: 8px 16px; font-size: 16px; }
  .tut-row .grp.cue .key { min-width: 46px; height: 44px; font-size: 20px; }
  .tut-row .grp.cue .key.wide { min-width: 100px; font-size: 14px; }
}

/* The ? button's picker */
.tut-pick { text-align: center; }
.tut-pick-btns { display: grid; gap: 10px; margin-top: 12px; }

/* Ride on for coins (CrazyGames): the price beside the words. */
.rv-price { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: 6px; font-variant-numeric: tabular-nums; }
.rv-price .ico { width: 20px; height: 20px; color: var(--gold); }
#rv-coins:disabled { opacity: 0.5; cursor: default; }

/* CrazyGames (its ad rules): a rewarded offer is not pushed, and "continue without
   watching" looks the same as watching. On the revive screen watch, coins and no-thanks
   share size, font and colour, with no glow, breathing or shine; on the earn screen
   watch and no-thanks do too. */
[data-portal="crazygames"] .rv-cta { filter: none; animation: none; }
[data-portal="crazygames"] #rv-watch::before { content: none; animation: none; }
[data-portal="crazygames"] #ov-revive .btn, [data-portal="crazygames"] #ov-earn .btn {
  width: min(92%, 420px); min-height: 52px; padding: 8px 18px; line-height: 1.15; font-size: clamp(16px, calc(2.4 * var(--u)), 20px); font-weight: 800;
  background: var(--btn-bg); color: var(--btn-text); border: var(--btn-border); text-shadow: var(--btn-ts); box-shadow: var(--btn-shadow); }
[data-portal="crazygames"] .rv-cta { width: min(92%, 420px); }
[data-portal="crazygames"] .rv-cta #rv-watch { width: 100%; }
[data-portal="crazygames"] #rv-watch .ico { width: 24px; height: 24px; }
[data-portal="crazygames"] #rv-key { color: var(--btn-text); background: rgba(0, 0, 0, 0.3); }
@media (max-height: 400px) {
  [data-portal="crazygames"] #ov-revive .btn, [data-portal="crazygames"] #ov-earn .btn { min-height: 40px; padding-block: 4px; }
}
