:root {
  color-scheme: dark;
  --ink: #050712;
  --panel: #10162a;
  --panel-strong: #19233c;
  --cream: #f7fbff;
  --muted: #a8b8d1;
  --jade: #62eaff;
  --jade-deep: #138fb7;
  --gold: #ffc95c;
  --orange: #ff6f91;
  --red: #ff5d63;
  --line: rgba(255,255,255,.14);
  --shadow: 0 18px 46px rgba(0,0,0,.32);
  --radius: 22px;
  font-family: Inter, ui-rounded, "Arial Rounded MT Bold", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { min-width: 0; min-height: 100%; margin: 0; background: var(--ink); }

body {
  color: var(--cream);
  background:
    radial-gradient(circle at 72% -10%, rgba(98,234,255,.17), transparent 35rem),
    radial-gradient(circle at -10% 60%, rgba(139,105,255,.14), transparent 30rem),
    var(--ink);
  overscroll-behavior: none;
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
}

button, canvas { -webkit-user-select: none; user-select: none; }
button { color: inherit; font: inherit; }
button:focus-visible, canvas:focus-visible, dialog:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed; z-index: 1000; left: 12px; top: 12px; transform: translateY(-150%);
  padding: 10px 14px; color: var(--ink); background: var(--gold); border-radius: 10px; font-weight: 900;
}
.skip-link:focus { transform: none; }

.app-shell { min-height: 100dvh; }
.app-shell[data-screen="game"] .topbar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
  min-height: 72px; padding: calc(8px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(6,21,27,.97), rgba(6,21,27,.82));
  border-bottom: 1px solid rgba(255,255,255,.08); backdrop-filter: blur(14px);
}

.brand-button { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
.brand-badge {
  display: grid; place-items: center; width: 44px; height: 44px; border: 3px solid #041116; border-radius: 15px 11px 15px 11px;
  color: #092229; background: linear-gradient(145deg, var(--gold), var(--orange)); box-shadow: 0 0 0 2px var(--gold), 5px 5px 0 rgba(64,227,154,.25);
  font-size: .92rem; font-weight: 1000; letter-spacing: -.06em; transform: rotate(-3deg);
}
.brand-copy { display: grid; line-height: 1; }
.brand-copy strong { color: var(--gold); font-size: .72rem; letter-spacing: .17em; text-transform: uppercase; }
.brand-copy span { margin-top: 4px; font-size: 1rem; font-weight: 950; letter-spacing: -.03em; }

.top-actions { display: flex; gap: 8px; }
.icon-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 46px; min-height: 46px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 15px; color: var(--cream); background: rgba(255,255,255,.055); cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08); font-size: 1.15rem; font-weight: 900;
}
.icon-button:hover { border-color: rgba(64,227,154,.6); background: rgba(64,227,154,.12); }
.help-button { color: var(--ink); background: var(--gold); border-color: var(--gold); }
.button-label { font-size: .78rem; }

.menu-panel { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: clamp(28px,5vw,72px) 0 64px; }
.hero-copy { position: relative; z-index: 2; width: min(610px, 58%); padding: 28px 0 62px; }
.eyebrow { margin: 0 0 8px; color: var(--jade); font-size: .74rem; font-weight: 950; letter-spacing: .18em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 620px; margin-bottom: 20px; font-size: clamp(3rem,7vw,6.8rem); line-height: .84; letter-spacing: -.075em; }
h1 span { display: block; color: var(--gold); text-shadow: 4px 5px 0 rgba(255,122,69,.25); }
.hero-copy > p:not(.eyebrow) { max-width: 530px; color: var(--muted); font-size: clamp(1rem,2vw,1.22rem); line-height: 1.65; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 20px; }
.primary-button, .secondary-button, .text-button {
  min-height: 52px; padding: 0 22px; border-radius: 15px; cursor: pointer; font-weight: 950; letter-spacing: -.02em;
}
.primary-button { color: #092229; background: linear-gradient(135deg, var(--gold), #ffb84d); border: 2px solid #ffdd87; box-shadow: 0 7px 0 #ad5b2d, 0 12px 28px rgba(255,122,69,.22); }
.primary-button:active { transform: translateY(4px); box-shadow: 0 3px 0 #ad5b2d; }
.secondary-button { color: var(--cream); background: rgba(255,255,255,.055); border: 2px solid rgba(255,255,255,.2); }
.text-button { color: var(--muted); background: transparent; border: 0; text-decoration: underline; text-underline-offset: 4px; }
.full-button { width: 100%; }
.feature-list { display: flex; flex-wrap: wrap; gap: 16px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: .84rem; font-weight: 800; }
.feature-list span { color: var(--jade); }

.hero-art { position: absolute; z-index: 0; top: 110px; left: 47%; width: min(53vw, 760px); height: 440px; overflow: hidden; pointer-events: none; }
.sun-disc { position: absolute; top: 30px; right: 19%; width: 180px; aspect-ratio: 1; border-radius: 50%; background: linear-gradient(#ffefad,#ff8056); box-shadow: 0 0 70px rgba(255,193,92,.32); }
.mountain { position: absolute; bottom: 78px; width: 340px; height: 230px; background: #123b41; clip-path: polygon(0 100%, 38% 25%, 55% 56%, 70% 34%, 100% 100%); }
.mountain::after { content: ""; position: absolute; inset: 0; background: #1d5b55; clip-path: polygon(38% 25%, 55% 56%, 44% 48%, 31% 74%, 0 100%); }
.mountain-one { left: 3%; }
.mountain-two { right: -7%; bottom: 69px; transform: scale(.77); opacity: .7; }
.trail-line { position: absolute; left: -3%; right: -2%; bottom: 52px; height: 92px; background: #0b2e31; border-top: 11px solid #44b686; clip-path: polygon(0 55%,18% 28%,32% 55%,49% 12%,63% 58%,80% 35%,100% 55%,100% 100%,0 100%); }
.menu-bike { position: absolute; left: 38%; bottom: 128px; width: 230px; height: 130px; transform: rotate(-13deg); filter: drop-shadow(10px 14px 9px rgba(0,0,0,.38)); }
.menu-wheel { position: absolute; bottom: 0; width: 62px; height: 62px; border: 12px solid #061114; border-radius: 50%; background: repeating-conic-gradient(#39545a 0 10deg,#172d33 10deg 20deg); box-shadow: inset 0 0 0 4px var(--gold), 0 0 0 3px #78f3b8; }
.wheel-a { left: 14px; } .wheel-b { right: 8px; }
.menu-frame { position: absolute; left: 47px; top: 49px; width: 130px; height: 19px; border: 7px solid var(--orange); border-radius: 50%; transform: rotate(-8deg); }
.menu-frame::before { content: ""; position: absolute; left: 31px; bottom: -4px; width: 64px; height: 54px; border-left: 8px solid var(--jade); border-bottom: 8px solid var(--jade); transform: skewX(-25deg); }
.menu-rider { position: absolute; left: 91px; top: 2px; width: 55px; height: 55px; border: 5px solid #351c1c; border-radius: 45% 50% 48% 48%; background: #ffc888; box-shadow: inset 0 17px 0 #172129; }
.menu-rider::before { content: ""; position: absolute; left: 4px; top: -9px; width: 50px; height: 25px; border-radius: 60% 60% 25% 25%; background: var(--gold); transform: rotate(-7deg); }
.menu-rider::after { content: ""; position: absolute; left: 14px; top: 32px; width: 25px; height: 9px; border-bottom: 4px solid #462019; border-radius: 50%; }
.menu-rider i { position: absolute; left: 15px; top: 26px; width: 5px; height: 5px; border-radius: 50%; background: #291918; box-shadow: 22px 0 #291918; }

.level-section { position: relative; z-index: 4; padding: clamp(24px,4vw,44px); border: 1px solid var(--line); border-radius: 28px; background: linear-gradient(145deg,rgba(17,52,61,.96),rgba(8,31,39,.96)); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section-heading h2 { margin: 0; font-size: clamp(1.8rem,4vw,3.1rem); letter-spacing: -.055em; }
.progress-summary { margin: 0; padding: 8px 12px; border-radius: 999px; color: var(--gold); background: rgba(255,211,110,.09); font-size: .82rem; font-weight: 900; }
.level-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 12px; }
.level-card { position: relative; min-height: 190px; padding: 16px; overflow: hidden; border: 1px solid rgba(255,255,255,.13); border-radius: 19px; color: var(--cream); background: #08242b; text-align: left; cursor: pointer; }
.level-card::before { content: ""; position: absolute; width: 130px; height: 130px; right: -32px; top: -36px; border: 24px solid var(--card-accent); border-radius: 50%; opacity: .14; }
.level-card:hover { transform: translateY(-4px); border-color: var(--card-accent); }
.level-number { display: block; margin-bottom: 33px; color: var(--card-accent); font-size: .7rem; font-weight: 950; letter-spacing: .14em; text-transform: uppercase; }
.level-card strong { display: block; font-size: 1.06rem; line-height: 1.05; }
.level-card small { display: block; min-height: 34px; margin-top: 6px; color: var(--muted); line-height: 1.25; }
.level-distance { display: inline-flex; margin-top: 9px; padding: 4px 7px; border: 1px solid color-mix(in srgb,var(--card-accent) 45%,transparent); border-radius: 999px; color: var(--card-accent); background: color-mix(in srgb,var(--card-accent) 8%,transparent); font-size: .62rem; font-weight: 900; letter-spacing: .04em; }
.level-stars { display: block; margin-top: 13px; color: var(--gold); font-size: 1.14rem; letter-spacing: .09em; }
.level-best { display: block; margin-top: 4px; color: var(--muted); font-size: .69rem; }

.game-panel { position: fixed; z-index: 20; inset: 0; display: grid; grid-template-rows: 1fr auto auto; min-height: 100dvh; padding: max(6px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); background: #041317; }
.game-stage { position: relative; align-self: center; width: 100%; min-height: 0; aspect-ratio: 16/9; overflow: hidden; border: 1px solid rgba(255,255,255,.14); border-radius: 18px; background: #103748; box-shadow: var(--shadow); touch-action: none; }
#gameCanvas { display: block; width: 100%; height: 100%; min-height: 220px; background: #123b4c; touch-action: none; }
.canvas-vignette { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 60px rgba(0,15,20,.26); }
.hud { position: absolute; z-index: 4; top: 10px; left: 10px; right: 10px; display: grid; grid-template-columns: 1fr auto 1fr; pointer-events: none; }
.hud-block { width: max-content; padding: 7px 10px; border: 1px solid rgba(255,255,255,.18); border-radius: 12px; background: rgba(3,18,23,.72); backdrop-filter: blur(6px); box-shadow: 0 5px 16px rgba(0,0,0,.18); }
.hud-block span { display: block; color: #b8d3d4; font-size: .58rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.hud-block strong { display: block; margin-top: 2px; font-variant-numeric: tabular-nums; font-size: clamp(.88rem,2vw,1.12rem); }
.hud-center { justify-self: center; text-align: center; }.hud-right { justify-self: end; text-align: right; }
.dual-stat { display: flex!important; align-items: center; justify-content: flex-end; gap: 6px; }
.dual-stat b { min-width: 1.5ch; font: inherit; }.dual-stat i { color: rgba(255,255,255,.35); font-style: normal; }
.race-progress { position: absolute; z-index: 4; left: 11px; right: 11px; bottom: 10px; height: 11px; overflow: hidden; border: 1px solid rgba(255,255,255,.24); border-radius: 999px; background: rgba(2,8,16,.62); box-shadow: 0 4px 15px rgba(0,0,0,.28); pointer-events: none; }
.race-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--jade),var(--gold)); box-shadow: 0 0 16px var(--jade); transition: width .12s linear; }
.race-progress strong { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); color: white; font-size: .48rem; line-height: 1; letter-spacing: .05em; text-shadow: 0 1px 3px #000; }
.stage-actions { position: absolute; z-index: 5; top: 68px; right: 10px; display: grid; gap: 7px; }
.stage-button { display: grid; place-items: center; width: 48px; min-height: 48px; padding: 4px; border: 1px solid rgba(255,255,255,.2); border-radius: 13px; color: var(--cream); background: rgba(3,18,23,.68); cursor: pointer; font-size: 1rem; font-weight: 900; }
.stage-button span { font-size: .48rem; line-height: 1; }
.toast { position: absolute; z-index: 6; left: 50%; top: 26%; transform: translate(-50%,-10px) scale(.92); opacity: 0; min-width: 150px; padding: 10px 16px; border: 2px solid var(--gold); border-radius: 14px; color: var(--ink); background: var(--cream); text-align: center; font-weight: 950; pointer-events: none; transition: opacity .17s,transform .17s; }
.toast.is-visible { transform: translate(-50%,0) scale(1); opacity: 1; }
.countdown { position: absolute; z-index: 8; inset: 0; display: grid; place-items: center; color: var(--gold); background: rgba(3,18,23,.18); font-size: clamp(4rem,18vw,10rem); font-weight: 1000; text-shadow: 6px 7px 0 rgba(0,0,0,.35); }
.orientation-hint { display: none; }

.touch-controls { display: flex; justify-content: space-between; gap: 18px; padding: 8px 4px 2px; touch-action: none; }
.control-cluster { display: grid; grid-template-columns: repeat(2,minmax(68px,104px)); gap: 10px; }
.control-button { min-width: 68px; min-height: 68px; border: 1px solid rgba(255,255,255,.17); border-radius: 20px; color: var(--cream); background: linear-gradient(145deg,#143d45,#09232a); box-shadow: inset 0 2px 0 rgba(255,255,255,.08),0 6px 0 #020c10; cursor: pointer; touch-action: none; }
.control-button span { display: block; font-size: 1.45rem; font-weight: 1000; line-height: 1; }
.control-button small { display: block; margin-top: 4px; color: var(--muted); font-size: .59rem; font-weight: 900; text-transform: uppercase; }
.control-button.is-active { transform: translateY(4px); border-color: var(--gold); box-shadow: inset 0 2px 8px rgba(0,0,0,.15),0 2px 0 #020c10; }
.gas-control { color: var(--ink); background: linear-gradient(145deg,var(--gold),#ff9d4c); border-color: #ffdc83; }
.gas-control small { color: #442f16; }
.brake-control { border-color: rgba(255,93,99,.55); }
.keyboard-hint { margin: 2px 0 0; color: #789a9b; text-align: center; font-size: .67rem; }
kbd { display: inline-block; min-width: 19px; margin: 0 2px; padding: 2px 4px; border: 1px solid #456064; border-radius: 5px; color: #cce1e0; background: #10272d; box-shadow: inset 0 -2px rgba(0,0,0,.25); font: inherit; }

.result-overlay { position: fixed; z-index: 80; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(1,11,14,.78); backdrop-filter: blur(10px); }
.result-card { width: min(440px,100%); padding: clamp(26px,6vw,44px); border: 1px solid rgba(255,255,255,.16); border-radius: 26px; background: linear-gradient(155deg,#123943,#071e25); box-shadow: 0 30px 80px rgba(0,0,0,.5); text-align: center; }
.result-card h2 { margin-bottom: 10px; font-size: clamp(2rem,8vw,3.4rem); line-height: .92; letter-spacing: -.06em; }
.result-card > p:not(.eyebrow):not(.finish-time):not(.finish-detail) { color: var(--muted); line-height: 1.5; }
.result-actions { display: grid; gap: 12px; margin-top: 24px; }
.finish-stars { margin: 8px 0; color: var(--gold); font-size: clamp(2.4rem,10vw,4.2rem); letter-spacing: .08em; text-shadow: 3px 4px 0 rgba(255,122,69,.22); }
.finish-time { margin: 0; font-size: clamp(2rem,9vw,3.8rem); font-weight: 1000; font-variant-numeric: tabular-nums; letter-spacing: -.05em; }
.finish-detail { color: var(--jade); font-weight: 850; }

dialog { color: var(--cream); }
dialog::backdrop { background: rgba(1,11,14,.82); backdrop-filter: blur(8px); }
.help-dialog { width: min(640px,calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; overflow: auto; border: 1px solid rgba(255,255,255,.17); border-radius: 25px; background: linear-gradient(150deg,#123942,#071e25); box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.help-dialog form { padding: clamp(20px,5vw,36px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-heading h2 { margin: 0; font-size: clamp(1.7rem,5vw,2.6rem); letter-spacing: -.045em; }
.dialog-close { display: grid; flex: 0 0 auto; place-items: center; width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 14px; color: var(--cream); background: rgba(255,255,255,.06); cursor: pointer; font-size: 1.7rem; }
.help-body { margin: 22px 0; color: var(--muted); line-height: 1.55; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.help-grid article { display: flex; align-items: center; gap: 12px; min-height: 92px; padding: 12px; border: 1px solid rgba(255,255,255,.11); border-radius: 16px; background: rgba(255,255,255,.035); }
.help-grid h3 { margin: 0 0 2px; color: var(--cream); font-size: .92rem; }.help-grid p { margin: 0; font-size: .76rem; line-height: 1.35; }
.help-symbol { display: grid; flex: 0 0 auto; place-items: center; width: 48px; height: 48px; border-radius: 15px; color: var(--gold); background: rgba(255,211,110,.1); font-size: 1.15rem; font-weight: 1000; }
.gas-symbol { color: var(--ink); background: var(--gold); }
.help-note { padding: 12px; border-left: 3px solid var(--jade); background: rgba(64,227,154,.06); }
.visually-hidden { position: fixed!important; width: 1px!important; height: 1px!important; padding: 0!important; margin: -1px!important; overflow: hidden!important; clip: rect(0 0 0 0)!important; white-space: nowrap!important; border: 0!important; }
.noscript-message { max-width: 600px; margin: 30px auto; padding: 20px; color: #201b0f; background: var(--gold); border-radius: 16px; font-weight: 800; }

/* v6: cinematic trial presentation */
.topbar { background: linear-gradient(180deg,rgba(5,7,18,.98),rgba(5,7,18,.84)); border-color: rgba(98,234,255,.16); }
.brand-badge { color: #030711; background: linear-gradient(145deg,#62eaff,#9b84ff); box-shadow: 0 0 0 2px #62eaff,5px 5px 0 rgba(155,132,255,.24); }
.brand-copy strong { color: #62eaff; }
.help-button { color: #050712; background: #62eaff; border-color: #62eaff; }
.eyebrow { color: #62eaff; }
h1 span { color: #62eaff; text-shadow: 4px 5px 0 rgba(155,132,255,.22); }
.primary-button { color: #050712; background: linear-gradient(135deg,#62eaff,#a78cff); border-color: #c8f8ff; box-shadow: 0 7px 0 #493d8f,0 14px 32px rgba(98,234,255,.18); }
.primary-button:active { box-shadow: 0 3px 0 #493d8f; }
.hero-art { border-radius: 34px; background: radial-gradient(circle at 70% 20%,rgba(98,234,255,.16),transparent 28%),linear-gradient(150deg,rgba(16,25,57,.05),rgba(5,7,18,.42)); }
.sun-disc { background: linear-gradient(#effdff,#71dff5); box-shadow: 0 0 80px rgba(98,234,255,.35); }
.mountain { background: #192a4b; }.mountain::after { background: #233b63; }
.trail-line { background: #090f22; border-color: #62eaff; filter: drop-shadow(0 -7px 15px rgba(98,234,255,.25)); }
.menu-wheel { border-color: #050712; background: repeating-conic-gradient(#61738e 0 10deg,#1b2740 10deg 20deg); box-shadow: inset 0 0 0 4px #a78cff,0 0 0 3px #62eaff; }
.menu-frame { border-color: #ff6f91; }.menu-frame::before { border-color: #62eaff; }
.menu-rider::before { background: #62eaff; }
.level-section { border-color: rgba(98,234,255,.15); background: linear-gradient(145deg,rgba(18,25,49,.97),rgba(7,10,25,.97)); }
.level-card { min-height: 218px; border-color: rgba(255,255,255,.12); background: linear-gradient(155deg,#111a32,#080d20); box-shadow: inset 0 1px rgba(255,255,255,.05); transition: transform .2s,border-color .2s,box-shadow .2s; }
.level-card:hover { box-shadow: 0 14px 30px color-mix(in srgb,var(--card-accent) 16%,transparent); }
.progress-summary { color: #62eaff; background: rgba(98,234,255,.08); }
.game-panel { background: #02040c; }
.game-stage { border-color: rgba(98,234,255,.24); border-radius: 20px; background: #081327; box-shadow: 0 24px 70px rgba(0,0,0,.6),0 0 0 1px rgba(155,132,255,.12); }
#gameCanvas { min-height: 230px; background: #081327; }
.canvas-vignette { box-shadow: inset 0 0 80px rgba(1,4,12,.38),inset 0 -30px 50px rgba(1,4,12,.22); }
.hud-block { border-color: rgba(255,255,255,.22); background: rgba(3,7,18,.72); }
.stage-button { border-color: rgba(98,234,255,.24); background: rgba(3,7,18,.78); backdrop-filter: blur(8px); }
.stage-button:hover { border-color: #62eaff; color: #62eaff; }
.touch-controls { width: min(100%,900px); margin-inline: auto; gap: clamp(12px,5vw,48px); }
.control-cluster { grid-template-columns: repeat(2,minmax(68px,108px)); }
.control-button { min-height: 72px; border-color: rgba(255,255,255,.18); background: linear-gradient(145deg,#17223e,#090e21); box-shadow: inset 0 2px 0 rgba(255,255,255,.08),0 6px 0 #01030a,0 10px 20px rgba(0,0,0,.25); }
.control-button.is-active { border-color: #62eaff; box-shadow: inset 0 2px 10px rgba(0,0,0,.25),0 2px 0 #01030a,0 0 24px rgba(98,234,255,.2); }
.lean-back,.lean-forward { color: #b9a7ff; }
.gas-control { color: #050712; background: linear-gradient(145deg,#62eaff,#7ea9ff); border-color: #c4f7ff; }
.gas-control small { color: #102340; }.brake-control { border-color: rgba(255,111,145,.65); color: #ff92ae; }
.result-card,.help-dialog { background: linear-gradient(155deg,#18213d,#070b1c); border-color: rgba(98,234,255,.18); }
.finish-detail { color: #62eaff; }

@media (max-width: 900px) {
  .hero-copy { width: 64%; }
  .hero-art { left: 42%; width: 61vw; opacity: .72; }
  .level-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .level-card:nth-last-child(-n+2) { min-height: 160px; }
}

@media (max-width: 620px) {
  .topbar { min-height: 64px; padding-left: 12px; padding-right: 12px; }
  .brand-copy span { font-size: .84rem; }.brand-badge { width: 39px; height: 39px; }.brand-copy strong { font-size: .61rem; }
  .top-actions { gap: 5px; }.icon-button { min-width: 44px; min-height: 44px; padding: 0 9px; }.button-label { display: none; }
  .menu-panel { width: min(100% - 24px,1180px); padding-top: 22px; }
  .hero-copy { width: 100%; padding-bottom: 12px; }
  h1 { max-width: 420px; font-size: clamp(3.2rem,17vw,5.4rem); }
  .hero-art { position: relative; top: auto; left: auto; width: 100%; height: 285px; margin: 0 0 22px; opacity: .88; }
  .sun-disc { width: 130px; }.menu-bike { left: 34%; transform: scale(.82) rotate(-13deg); transform-origin: center bottom; }
  .level-section { padding: 20px 14px; border-radius: 22px; }
  .level-grid { grid-template-columns: 1fr 1fr; }
  .level-card { min-height: 194px; }
  .level-card:last-child { grid-column: 1/-1; min-height: 174px; }
  .level-number { margin-bottom: 18px; }
  .game-panel { display: flex; flex-direction: column; }
  .game-stage { flex: 0 0 auto; align-self: flex-start; height: min(60dvh,470px); aspect-ratio: auto; }
  .touch-controls { margin-top: auto; }
  .keyboard-hint { display: none; }
  .touch-controls { padding-top: 6px; }
  .control-cluster { grid-template-columns: repeat(2,minmax(62px,88px)); gap: 8px; }
  .control-button { min-width: 62px; min-height: 68px; border-radius: 18px; }
  .hud { top: 7px; left: 7px; right: 7px; }.hud-block { padding: 6px 8px; }.hud-block span { font-size: .5rem; }
  .stage-actions { top: 57px; right: 7px; grid-template-columns: repeat(2,45px); }.stage-button { width: 45px; min-height: 45px; }
  .race-progress { bottom: 8px; }
  .help-grid { grid-template-columns: 1fr; }
}

@media (max-width: 370px) {
  .brand-copy { display: none; }
  .hero-actions { display: grid; }.hero-actions button { width: 100%; }
  .feature-list { gap: 9px; font-size: .73rem; }
  .section-heading { align-items: start; flex-direction: column; }
  .touch-controls { gap: 8px; padding-inline: 0; }
  .control-cluster { grid-template-columns: repeat(2,minmax(58px,74px)); gap: 5px; }
  .control-button { min-width: 58px; min-height: 64px; }
  .control-button small { font-size: .51rem; }
}

@media (orientation: portrait) and (max-width: 620px) {
  .orientation-hint { display: block; position: absolute; z-index: 5; left: 50%; bottom: 27px; transform: translateX(-50%); width: max-content; max-width: 80%; padding: 6px 10px; border-radius: 999px; color: #dcefff; background: rgba(3,7,18,.68); font-size: .59rem; font-weight: 800; text-align: center; }
}

@media (max-height: 480px) and (orientation: landscape) {
  .game-panel { grid-template-columns: minmax(0,1fr) minmax(156px,180px); grid-template-rows: 1fr; gap: 6px; }
  .game-stage { align-self: stretch; height: auto; aspect-ratio: auto; }
  .touch-controls { align-content: space-between; display: grid; width: 100%; min-width: 0; padding: 0; }
  .control-cluster { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .control-button { min-width: 0; }
  .control-button { min-height: 62px; }
  .keyboard-hint { display: none; }
}

@media (pointer: fine) and (min-width: 760px) {
  .game-panel { grid-template-rows: 1fr auto; }
  .touch-controls { width: min(620px,80%); margin: 0 auto; opacity: .88; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto!important; transition-duration: .01ms!important; animation-duration: .01ms!important; animation-iteration-count: 1!important; }
  .level-card:hover { transform: none; }
}
