:root{--ink:#182e43;--sun:#ffdb53;--coral:#f05e44;--paper:#fffbed;--sea:#5bc6d6;--stroke:rgba(24,46,67,.2);font-family:"Segoe UI","Microsoft YaHei","PingFang SC",sans-serif;color:var(--ink);font-synthesis:none}*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#98cfe4}button{font:inherit;cursor:pointer;border:0;-webkit-tap-highlight-color:transparent}button:focus-visible{outline:3px solid #fff;outline-offset:4px}button:disabled{cursor:wait;opacity:.6}[hidden]{display:none!important}#game-shell{position:relative;width:100%;height:100%;overflow:hidden;isolation:isolate}#game{display:block;width:100%;height:100%;outline:none;touch-action:none}.vignette{position:absolute;inset:0;pointer-events:none;background:linear-gradient(180deg,rgba(26,57,77,.14),transparent 25%,transparent 72%,rgba(17,36,50,.32));z-index:1}.topbar{position:absolute;inset:23px 28px auto;display:flex;align-items:flex-start;justify-content:space-between;z-index:7;pointer-events:none}.brand{transform:rotate(-5deg);filter:drop-shadow(2px 3px 0 #fff8)}.brand-main{display:block;font-size:clamp(26px,3.1vw,47px);font-weight:1000;font-style:italic;letter-spacing:-3px;line-height:1.1;-webkit-text-stroke:1.8px var(--ink);paint-order:stroke fill;color:var(--sun);text-shadow:3px 4px 0 var(--ink)}.brand-main span{color:#fff}.brand-main i{font-style:normal;letter-spacing:-8px;margin-left:4px;font-size:.8em}.brand-sub{font-size:11px;font-weight:800;letter-spacing:2px;display:block;color:#fff;background:var(--ink);margin:9px 0 0 8px;padding:4px 10px;width:max-content}.toolbar{display:flex;gap:8px;pointer-events:auto}.icon-button{min-width:42px;height:40px;padding:0 11px;border:2px solid #ffffff90;background:#173149b8;color:#fff;border-radius:8px;font-size:15px;font-weight:800;backdrop-filter:blur(8px)}.icon-button:hover{background:var(--ink)}.overlay{position:absolute;inset:0;z-index:5}.intro{display:flex;align-items:center;background:linear-gradient(90deg,rgba(240,249,245,.98),rgba(240,249,245,.9) 19%,rgba(240,249,245,.65) 34%,transparent 64%)}.intro-panel{margin:45px 0 0 6.5%;max-width:540px}.race-tag{font-size:13px;font-weight:800;letter-spacing:1px;display:flex;gap:8px;align-items:center}.race-tag span{width:9px;height:9px;background:var(--coral);border-radius:50%}h1{margin:22px 0 19px;font-size:clamp(43px,5.8vw,80px);line-height:1.11;letter-spacing:-4px;font-style:italic;font-weight:1000}h1 span{color:var(--coral)}.intro-panel p{font-size:17px;line-height:1.8;font-weight:600;margin:0 0 28px;color:#405464}.primary-button{background:var(--sun);color:var(--ink);border:3px solid var(--ink);box-shadow:5px 6px 0 var(--ink);border-radius:7px;padding:15px 33px;font-size:21px;letter-spacing:1px;font-weight:900;transform:skew(-4deg);transition:transform .15s,box-shadow .15s;min-width:210px}.primary-button:hover{transform:skew(-4deg) translate(-1px,-2px);box-shadow:6px 8px 0 var(--ink)}.primary-button:active{transform:skew(-4deg) translate(3px,3px);box-shadow:2px 3px 0 var(--ink)}.intro-controls{display:flex;gap:20px;margin-top:30px;font-size:12px;font-weight:700}.intro-controls span,footer span{display:flex;align-items:center;gap:4px}kbd{font:700 11px "Segoe UI",sans-serif;border:1px solid currentColor;border-bottom-width:3px;min-width:22px;height:24px;display:inline-flex;align-items:center;justify-content:center;padding:0 5px;border-radius:4px;background:#ffffff70}.best{font-size:12px;opacity:.65;margin-top:18px;font-weight:600}.postcard{position:absolute;right:5%;bottom:11%;background:var(--paper);border:2px solid var(--ink);padding:15px 24px;transform:rotate(6deg);box-shadow:5px 5px 0 #172d4240;text-align:center}.postcard span{font-size:11px;letter-spacing:3px;color:#67757d}.postcard b{font-size:21px;display:block;margin:5px 0}.postcard i{font-size:12px;display:block;font-style:normal}.postcard div{color:var(--coral);font-size:19px;letter-spacing:8px;margin-top:8px}.hud{position:absolute;inset:0;z-index:2;pointer-events:none;color:#fff;text-shadow:0 2px 3px #172d4240}.position{position:absolute;top:24px;left:34%;display:flex;align-items:center;gap:10px;transform:skew(-5deg)}.position small{font-size:12px;font-weight:700;width:24px;line-height:1.4}.position strong{font-size:60px;line-height:1;font-weight:1000;color:var(--sun);-webkit-text-stroke:2px var(--ink);paint-order:stroke fill;text-shadow:3px 4px 0 var(--ink)}.position em{font-size:24px;font-style:normal;color:#fff;-webkit-text-stroke:0;margin-left:6px}.race-progress{position:absolute;top:32px;left:48%;width:25%;max-width:390px}.progress-copy{display:flex;justify-content:space-between;font-size:10px;font-weight:800;color:#fff;text-shadow:1px 1px 2px var(--ink);margin-bottom:8px}.progress-track{position:relative;height:7px;background:#17314966;border:1px solid #fff8;border-radius:8px}.progress-track>div{height:100%;width:0;background:var(--sun);border-radius:8px}.progress-track>b{position:absolute;top:-12px;left:0;font-size:21px;transform:translateX(-50%)}.clock{position:absolute;right:28px;top:80px;text-align:right}.clock small{display:block;font-size:10px;letter-spacing:2px;font-weight:700}.clock strong{font-size:25px;font-weight:850;font-variant-numeric:tabular-nums}.speed{position:absolute;left:34px;bottom:74px;transform:skew(-7deg)}.speed strong{font-size:75px;line-height:1;font-weight:1000;text-shadow:4px 4px 0 var(--ink);-webkit-text-stroke:2px var(--ink);paint-order:stroke fill}.speed>span{font-size:17px;font-weight:800;margin-left:7px}.speed small{display:block;font-size:12px;margin-top:5px;color:var(--sun);font-weight:800}.stamina{position:absolute;bottom:76px;left:50%;transform:translateX(-50%);width:230px}.stamina>div:first-child{display:flex;justify-content:space-between;align-items:center;font-size:12px;margin-bottom:6px;font-weight:800}.stamina-track{height:15px;padding:3px;border:2px solid white;background:#142d43aa;border-radius:20px;box-shadow:0 2px 0 var(--ink)}.stamina-track>div{height:100%;background:var(--sun);border-radius:20px;transition:width .1s linear}.stamina small{display:block;text-align:center;margin-top:8px;font-size:11px;font-weight:700}.hit-count{position:absolute;right:34px;bottom:80px;text-align:center}.hit-count b{font-size:39px;line-height:1;color:var(--sun);-webkit-text-stroke:1px var(--ink);paint-order:stroke fill;font-weight:1000}.hit-count span{display:block;font-size:11px;font-weight:700;margin-top:6px}footer{position:absolute;z-index:3;left:50%;bottom:18px;transform:translateX(-50%);display:flex;align-items:center;justify-content:center;gap:22px;white-space:nowrap;color:#fff;font-size:11px;font-weight:700}footer kbd{background:#142d4388;font-size:10px;min-width:20px;height:21px;border-color:#fff8}#toast{position:absolute;top:21%;left:50%;transform:translate(-50%,-8px);background:var(--ink);border:2px solid #fff;color:#fff;padding:10px 20px;border-radius:6px;box-shadow:3px 4px 0 #142d4344;font-size:15px;font-weight:850;opacity:0;transition:opacity .15s,transform .15s;z-index:4;pointer-events:none;white-space:nowrap}#toast.visible{opacity:1;transform:translate(-50%,0)}#speech-layer{position:absolute;inset:0;z-index:4;pointer-events:none}.speech{position:absolute;font-size:clamp(22px,3.3vw,46px);font-weight:1000;font-style:italic;white-space:nowrap;color:var(--sun);-webkit-text-stroke:2px var(--ink);paint-order:stroke fill;text-shadow:3px 3px 0 #fff;transform:translate(-50%,-50%) rotate(-8deg);will-change:transform,opacity}.speech.hurt{color:#ff8b6d}.speech.miss{color:white;font-size:22px}.dim{background:#14283c99;backdrop-filter:blur(8px);display:flex;align-items:center;justify-content:center;z-index:8}.dialog{max-width:470px;width:calc(100% - 40px);padding:36px;text-align:center;background:var(--paper);border:3px solid var(--ink);box-shadow:9px 10px 0 #13263b80;border-radius:15px}.dialog-tag{font-size:12px;font-weight:800;color:#65707b}.dialog h2{margin:12px 0;font-size:36px;letter-spacing:-1px}.dialog p{font-size:14px;line-height:1.7;color:#536271;margin:8px 0 25px}.dialog .primary-button{width:100%}.secondary-button{background:transparent;color:#546472;font-size:13px;padding:13px;margin-top:10px;font-weight:700;text-decoration:underline;text-underline-offset:4px}.result-place{font-size:22px;font-weight:900}.result-place b{font-size:80px;color:var(--coral);font-style:italic;line-height:1}.result-stats{display:grid;grid-template-columns:1fr 1fr;margin:0 0 25px;padding:16px 0;border-block:1px solid var(--stroke)}.result-stats strong{display:block;font-size:26px}.result-stats small{font-size:11px;color:#6d7882}#countdown{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;pointer-events:none;font-size:140px;font-style:italic;font-weight:1000;color:var(--sun);-webkit-text-stroke:4px var(--ink);paint-order:stroke fill;text-shadow:8px 8px 0 white;z-index:6}#speed-lines{position:absolute;inset:0;pointer-events:none;opacity:0;background:repeating-conic-gradient(from 0deg at 50% 48%,transparent 0deg 14deg,#fff5 14.1deg 14.35deg,transparent 14.5deg 29deg);mask-image:radial-gradient(ellipse,transparent 36%,#000 100%);z-index:2;transition:opacity .2s}#hit-flash{position:absolute;inset:0;pointer-events:none;background:radial-gradient(ellipse,transparent 45%,#ff50385c);z-index:3;opacity:0;transition:opacity .2s}#touch-controls{position:absolute;inset:auto 20px 20px;display:none;z-index:4;justify-content:space-between;pointer-events:none}.steering,.actions{display:flex;gap:10px;align-items:flex-end}#touch-controls button{pointer-events:auto;touch-action:none;user-select:none;background:#172d42ba;border:2px solid #fffc;color:white;border-radius:15px;min-width:62px;height:62px;font-size:25px;box-shadow:0 4px 0 #13263b66}#touch-controls button.active{background:var(--sun);color:var(--ink);transform:translateY(3px);box-shadow:none}#touch-controls .boost-touch{font-size:15px;height:58px;min-width:58px}#touch-controls .slap-touch{background:var(--sun);color:var(--ink);font-weight:1000;font-size:22px;min-width:82px;height:82px;transform:rotate(-7deg);border-color:var(--ink)}
@media(pointer:coarse){#touch-controls:not([hidden]){display:flex}footer{display:none!important}.speed{bottom:113px}.stamina{bottom:120px}.hit-count{bottom:120px}.intro-controls{display:none}.best{margin-top:28px}}
@media(max-width:760px){.topbar{inset:15px 15px auto}.brand-main{font-size:29px;letter-spacing:-2px}.brand-sub{font-size:9px;letter-spacing:1px;padding:3px 6px;margin-top:7px}.icon-button{height:34px;min-width:34px;font-size:12px;padding:0 8px}.toolbar{gap:5px}.intro{background:linear-gradient(90deg,#eff8f0e8,#eff8f0b3 45%,#eff8f02a)}.intro-panel{margin-left:7%;margin-top:45px}.race-tag{font-size:10px}h1{font-size:47px;letter-spacing:-2px;margin:17px 0}.intro-panel p{font-size:14px;margin-bottom:22px}.primary-button{font-size:18px;padding:13px 26px;min-width:190px}.postcard{display:none}.intro-controls{gap:9px;font-size:10px}.best{font-size:10px}.position{top:93px;left:17px}.position strong{font-size:46px}.position small{font-size:9px;width:20px}.position em{font-size:19px}.race-progress{top:72px;left:28%;width:43%}.clock{top:99px;right:16px}.clock strong{font-size:20px}.clock small{font-size:8px}.speed{left:20px}.speed strong{font-size:49px}.speed>span{font-size:12px}.speed small{font-size:10px}.stamina{width:145px;left:52%}.stamina small{font-size:9px}.hit-count{right:20px}.hit-count b{font-size:28px}.hit-count span{font-size:9px}.hud footer{display:none}#toast{font-size:12px;padding:8px 11px;top:26%}.dialog{padding:25px}.dialog h2{font-size:29px}#countdown{font-size:96px}footer{gap:10px;font-size:9px;bottom:14px}footer span:nth-last-child(-n+2){display:none}}
@media(max-height:550px){.intro-panel{margin-top:60px}.intro-panel h1{font-size:40px;margin:10px 0}.intro-panel p{font-size:13px;line-height:1.5;margin-bottom:12px}.intro-controls{margin-top:19px}.best{margin-top:10px}.race-tag{display:none}.postcard{bottom:8%;transform:scale(.8) rotate(6deg);transform-origin:bottom right}.dialog{padding:18px 30px;max-width:430px}.dialog h2{font-size:26px;margin:7px 0}.dialog p{margin:8px 0 15px}.result-place b{font-size:53px}.result-stats{padding:9px 0;margin-bottom:15px}.result-stats strong{font-size:21px}.speed strong{font-size:49px}.position strong{font-size:45px}.topbar{top:13px}.brand-main{font-size:31px}.speed{bottom:62px}.stamina{bottom:64px}.hit-count{bottom:68px}}
@media(prefers-reduced-motion:reduce){button,#toast,#speed-lines{transition:none}#speed-lines{display:none}.vignette{opacity:.6}}

/* The finish card leaves the rider and ribbon burst unobscured. */
#finish-banner{position:absolute;top:24%;left:50%;transform:translateX(-50%) rotate(-4deg);z-index:4;pointer-events:none;text-align:center;white-space:nowrap;color:#ffdf32;text-shadow:3px 3px 0 #182e43;font-weight:950}
#finish-banner>b{display:block;font-size:clamp(32px,5vw,58px);font-style:italic;-webkit-text-stroke:2px #182e43;paint-order:stroke fill}
#finish-banner>strong{display:block;font-size:clamp(24px,3vw,34px);color:#fff;-webkit-text-stroke:1px #182e43;paint-order:stroke fill}
#finish-banner>span{display:block;margin-top:8px;font-size:12px;text-shadow:1px 1px 0 #182e43}
.celebrating .stamina,.celebrating .hit-count{visibility:hidden}
/* One readable impact caption replaces the previous one. */
.speech,.speech.hurt,.speech.miss{color:#ffdf32;text-shadow:2px 3px 0 #182e43;-webkit-text-stroke:2px #182e43;font-size:clamp(24px,3vw,40px)}
.intro-controls{flex-wrap:wrap;max-width:500px;row-gap:10px}
#touch-controls .jump-touch{font-size:15px;height:58px;min-width:58px;background:#347c9ddd}
@media(max-width:760px){footer{gap:9px;font-size:9px}footer span:nth-last-child(-n+2){display:none}}
@media(pointer:coarse) and (max-width:480px){#touch-controls{inset:auto 10px 14px}.steering,.actions{gap:5px}#touch-controls button{min-width:46px;height:54px}#touch-controls .boost-touch,#touch-controls .jump-touch,#touch-controls .brake-touch{min-width:46px;font-size:13px}#touch-controls .slap-touch{min-width:62px;height:66px;font-size:19px}}

/* Phone controls keep the centre of the track clear and follow both thumb arcs. */
:root{--controls-bottom:calc(env(safe-area-inset-bottom,0px) + clamp(32px,6vh,52px))}
@supports(height:100dvh){
  html,body,#game-shell{height:100dvh}
  :root{--controls-bottom:calc(env(safe-area-inset-bottom,0px) + clamp(32px,6dvh,52px))}
}
.mobile-only{display:none}
.toolbar{position:relative}
.portrait-intro-copy,.portrait-guide{display:none}
#touch-controls .slap-touch{padding:0;white-space:nowrap}
#tilt[aria-pressed="true"]{background:var(--sun);color:var(--ink);border-color:var(--ink)}
@media(any-pointer:coarse),(max-width:760px),(max-width:900px) and (max-height:520px),(max-width:900px) and (orientation:portrait){
  html,body{overscroll-behavior:none}
  .mobile-only{display:block}
  .topbar{top:max(10px,env(safe-area-inset-top));left:max(14px,env(safe-area-inset-left));right:max(14px,env(safe-area-inset-right));gap:8px}
  .toolbar{gap:6px;align-items:center;flex-wrap:nowrap;justify-content:flex-end;flex-shrink:0}
  .toolbar .icon-button{display:inline-flex;align-items:center;justify-content:center;flex:0 0 48px;width:48px;min-width:48px;max-width:48px;height:48px;padding:0 8px;font-size:13px;line-height:1.2;text-align:center;white-space:normal;word-break:break-all;touch-action:manipulation}
  .toolbar #tilt{min-width:48px;font-size:12px;padding:0 10px}
  .toolbar #tilt-center{position:static;flex:0 0 32px;width:32px;min-width:32px;max-width:32px;height:32px;padding:0;font-size:22px;line-height:1;border-radius:50%;background:#173149a6;border:1px solid #ffffff90}
  .mobile-guide{margin-top:18px;font-size:12px;line-height:1.6;font-weight:800;color:var(--ink)}
  .tilt-status{margin-top:4px;max-width:330px;font-size:11px;line-height:1.6;color:#405464;font-weight:600}
  .intro-controls,footer{display:none!important}
  .best{margin-top:13px}
  #touch-controls:not([hidden]){display:flex}
  #touch-controls{left:max(18px,env(safe-area-inset-left));right:max(18px,env(safe-area-inset-right));bottom:var(--controls-bottom);align-items:flex-end}
  #touch-controls .steering{display:flex;gap:10px;align-items:flex-end}
  #touch-controls .actions{display:grid;grid-template-columns:64px 88px;grid-template-rows:60px 60px;gap:10px;align-items:end}
  #touch-controls button{display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:64px;width:64px;height:68px;border-radius:18px;background:#173149d9;border:2px solid #fff9;box-shadow:0 4px 0 #13263b99;-webkit-user-select:none;-webkit-touch-callout:none}
  #touch-controls .jump-touch,#touch-controls .boost-touch,#touch-controls .brake-touch{min-width:64px;width:64px;height:60px;font-size:16px}
  #touch-controls .jump-touch{grid-column:1;grid-row:1;background:#276f91e8}
  #touch-controls .boost-touch{grid-column:1;grid-row:2}
  #touch-controls button b{font-size:16px;line-height:1.3}
  #touch-controls button small{font-size:10px;line-height:1.3;margin-top:3px;font-weight:600;opacity:.85;white-space:nowrap}
  #touch-controls .slap-touch{grid-column:2;grid-row:1 / 3;align-self:end;min-width:88px;width:88px;height:94px;font-size:24px;border-radius:26px;background:var(--sun);color:var(--ink);border:3px solid var(--ink);transform:rotate(-5deg)}
  #touch-controls button.active{background:var(--sun);color:var(--ink);transform:translateY(3px);box-shadow:0 1px 0 #13263b99}
  #touch-controls .slap-touch:active{transform:rotate(-5deg) translateY(3px);box-shadow:0 1px 0 #13263b99}
  .speed{left:max(24px,env(safe-area-inset-left));bottom:calc(var(--controls-bottom) + 94px)}
  .stamina{bottom:calc(var(--controls-bottom) + 12px);width:170px;left:50%}
  .hit-count{right:max(26px,env(safe-area-inset-right));bottom:calc(var(--controls-bottom) + 144px)}
  #toast{max-width:calc(100% - 40px);white-space:normal;text-align:center;line-height:1.5}
  .dialog{max-height:calc(100% - 28px);overflow-y:auto}
  .secondary-button{min-height:48px}
}
@media(max-width:900px) and (orientation:portrait){
  :root{--hud-top:max(16px,env(safe-area-inset-top,0px));--steer-size:72px;--steer-gap:26px;--steer-span:calc(var(--steer-size) * 2 + var(--steer-gap))}
  #finish-banner{top:max(24%,calc(var(--hud-top) + 147px))}
  .topbar{flex-wrap:nowrap;gap:8px;align-items:center;top:var(--hud-top);left:16px;right:16px}
  .brand{transform:rotate(-4deg)}
  .brand-main{font-size:clamp(20px,5.5vw,25px);letter-spacing:-2px;text-shadow:2px 3px 0 var(--ink)}
  .brand-sub{font-size:8px;letter-spacing:1px;margin:6px 0 0 3px;padding:3px 5px}
  .toolbar{width:auto;flex-wrap:nowrap;gap:4px}
  .toolbar .icon-button{padding:0 7px;border:1px solid #ffffff80;border-radius:15px;background:#173149b8;font-size:12px}
  .toolbar #tilt{min-width:48px;margin:0;font-size:11px;padding:0 10px;border-radius:15px;background:#173149b8}
  .toolbar #tilt-center{min-width:32px;font-size:22px;border-radius:50%}
  .toolbar #tilt[aria-pressed="true"]{background:var(--sun)}
  .intro{display:flex;align-items:flex-end;padding:0;overflow:hidden;background:linear-gradient(180deg,#1731490a 35%,transparent 57%,#1731491a);pointer-events:none}
  .intro-panel{width:100%;max-width:none;margin:0;padding:23px 24px max(22px,env(safe-area-inset-bottom));background:linear-gradient(145deg,#fffdf1,#f1f8ee);border-radius:28px 28px 0 0;border-top:1px solid #fff;box-shadow:0 -10px 35px #1731491c;pointer-events:auto}
  .intro-panel .race-tag{display:flex;font-size:10px;letter-spacing:.5px;gap:6px;margin:0 0 10px;color:#68776e}
  .intro-panel .race-tag span{width:6px;height:6px}
  .intro-panel h1{font-size:clamp(28px,8vw,34px);line-height:1.12;letter-spacing:-1.4px;margin:0 0 8px;white-space:nowrap}
  .intro-panel h1 br{display:none}
  .intro-panel h1 span{margin-left:3px}
  .intro-panel .wide-intro-copy,.wide-guide{display:none}
  .intro-panel .portrait-intro-copy{display:block;font-size:12px;line-height:1.6;margin:0 0 18px;color:#65736b;font-weight:500}
  .portrait-guide{display:inline}
  .intro-panel .primary-button{width:100%;min-height:58px;padding:12px 20px;font-size:21px;border-width:2px;border-radius:14px;transform:none;box-shadow:0 4px 0 var(--ink)}
  .intro-panel .primary-button:active{transform:translateY(3px);box-shadow:0 1px 0 var(--ink)}
  .mobile-guide{margin-top:14px;font-size:10px;text-align:center;color:#65736b;font-weight:600}
  .tilt-status{max-width:none;margin-top:3px;font-size:10px;line-height:1.5;text-align:center;color:#6c7c72;font-weight:400}
  .best{margin-top:10px;font-size:10px;text-align:center;opacity:.7;color:#66766d}
  .position{top:calc(var(--hud-top) + 65px);left:17px;gap:5px}
  .position small{font-size:8px;width:17px;line-height:1.4}
  .position strong{font-size:33px;-webkit-text-stroke:1.3px var(--ink);text-shadow:2px 2px 0 var(--ink)}
  .position em{font-size:14px;margin-left:3px}
  .clock{top:calc(var(--hud-top) + 66px);right:17px}
  .clock small{font-size:7px;letter-spacing:1px}
  .clock strong{font-size:17px}
  .race-progress{top:calc(var(--hud-top) + 113px);left:18px;width:calc(100% - 36px);max-width:none}
  .race-progress .progress-copy{position:absolute;right:0;top:10px;margin:0;font-size:8px}
  .race-progress .progress-copy span:first-child,.race-progress .progress-copy span:last-child{display:none}
  .progress-track{height:5px;border:0;background:#17314955}
  .progress-track>b{font-size:15px;top:-9px}
  #toast{top:calc(var(--hud-top) + 147px);font-size:11px;padding:7px 12px;border-width:1px;box-shadow:none;border-radius:14px;max-width:calc(100% - 50px)}
  #touch-controls{left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right));bottom:var(--controls-bottom)}
  #touch-controls .steering{gap:var(--steer-gap);pointer-events:auto;touch-action:none}
  #touch-controls .steering button{min-width:var(--steer-size);width:var(--steer-size);height:84px}
  #touch-controls .actions{grid-template-columns:58px 78px;grid-template-rows:58px 58px;gap:9px}
  #touch-controls .jump-touch,#touch-controls .boost-touch,#touch-controls .brake-touch{min-width:58px;width:58px;height:58px}
  #touch-controls .slap-touch{min-width:78px;width:78px;height:88px;font-size:22px}
  .hud{--info-raise:18px}
  .speed{left:18px;bottom:calc(var(--controls-bottom) + 148px + var(--info-raise));height:48px;line-height:30px;transform:none}
  .speed strong{display:inline-block;vertical-align:top;font-size:30px;line-height:30px;-webkit-text-stroke:1px var(--ink);text-shadow:2px 2px 0 var(--ink)}
  .speed>span{font-size:10px;margin-left:3px}
  .speed small{position:absolute;top:34px;left:0;max-width:150px;white-space:nowrap;font-size:9px;line-height:12px;margin-top:0}
  .stamina{left:18px;transform:none;bottom:calc(var(--controls-bottom) + 112px + var(--info-raise));width:calc(var(--steer-span) - 6px);height:27px}
  .stamina>div:first-child{font-size:9px;line-height:12px;margin-bottom:4px}
  .stamina-track{height:11px;padding:2px;border-width:1px}
  .stamina small{display:none}
  .hit-count{right:19px;bottom:calc(var(--controls-bottom) + 140px + var(--info-raise));height:24px;display:flex;gap:5px;align-items:baseline}
  .hit-count b{font-size:24px;line-height:24px}
  .hit-count span{font-size:8px;line-height:12px;margin-top:0}
  #touch-controls .steering button{background:#173149c9;border:1px solid #ffffff8c;border-radius:22px;font-size:24px}
  #touch-controls .jump-touch,#touch-controls .boost-touch,#touch-controls .brake-touch{border:1px solid #ffffff8c;border-radius:18px}
  #touch-controls button b{font-size:14px}
  #touch-controls button small{font-size:9px}
  #touch-controls .slap-touch{border-width:2px;border-radius:25px;transform:rotate(-3deg)}
  #touch-controls .slap-touch:active{transform:rotate(-3deg) translateY(3px)}
}
/* Keep the real cutout inset in standalone/fullscreen modes and on other hosts. */
@media(display-mode:browser) and (max-width:900px) and (orientation:portrait){
  html.android-wechat:not(:fullscreen){--hud-top:16px}
  :fullscreen{--hud-top:max(16px,env(safe-area-inset-top,0px))}
}
@media(orientation:landscape) and (max-height:600px) and (any-pointer:coarse), (orientation:landscape) and (max-width:760px), (orientation:landscape) and (max-width:900px) and (max-height:520px){
  .brand-main{font-size:27px}
  .brand-sub{font-size:8px;margin-top:7px;padding:3px 5px}
  .toolbar{flex-wrap:nowrap}
  .position{top:75px;left:max(20px,env(safe-area-inset-left));gap:6px}
  .position small{font-size:9px;width:20px}
  .position strong{font-size:36px}
  .position em{font-size:17px}
  .race-progress{top:24px;left:26%;width:25%;max-width:220px}
  .clock{top:70px;right:max(18px,env(safe-area-inset-right))}
  .clock strong{font-size:19px}
  .clock small{font-size:8px}
  .speed strong{font-size:40px}
  .speed>span{font-size:11px}
  .speed small{font-size:10px}
  .stamina{left:50%;transform:translateX(-50%);bottom:max(20px,calc(env(safe-area-inset-bottom,0px) + 10px));width:150px;height:auto}
  .stamina>div:first-child{font-size:10px}
  .stamina small{display:none}
  .hit-count b{font-size:26px}
  .hit-count span{font-size:9px}
  #toast{top:86px;font-size:12px;padding:6px 12px;max-width:50%}
  .intro{overflow-y:auto;padding:73px max(24px,env(safe-area-inset-right)) 18px max(24px,env(safe-area-inset-left));align-items:flex-start}
  .intro-panel{margin:0;max-width:410px}
  .intro-panel h1{font-size:34px;line-height:1.05;margin:0 0 10px}
  .intro-panel p{font-size:12px;line-height:1.5;margin:0 0 13px}
  .intro-panel .primary-button{min-height:50px;min-width:180px;font-size:17px;padding:10px 22px}
  .race-tag,.postcard{display:none}
  .mobile-guide{font-size:10px;margin-top:14px}
  .tilt-status{font-size:10px;margin-top:2px;max-width:410px}
  .best{font-size:10px;margin-top:7px}
}
@media(max-width:380px) and (orientation:portrait){
  .brand{width:42px;flex-shrink:0}
  .brand-main{font-size:20px;letter-spacing:-1px;line-height:1}
  .brand-main span{display:block}
  .brand-main i,.brand-sub{display:none}
}
@media(max-width:350px){
  .topbar{left:12px;right:12px;gap:4px}
  .brand-main{font-size:20px;letter-spacing:-1.5px}
  .brand-main i,.brand-sub{display:none}
  .toolbar{gap:4px}
  :root{--steer-size:60px;--steer-gap:18px}
  #touch-controls .steering{gap:18px}
  #touch-controls .steering button{min-width:60px;width:60px;height:76px}
  #touch-controls .actions{grid-template-columns:48px 66px;grid-template-rows:52px 52px;gap:6px}
  #touch-controls .jump-touch,#touch-controls .boost-touch,#touch-controls .brake-touch{min-width:48px;width:48px;height:52px}
  #touch-controls .slap-touch{min-width:66px;width:66px;height:80px;font-size:20px}
  .hud{--info-raise:3px}
}
/* The steering-width energy bar belongs to portrait only. In narrow landscape
   --steer-span is undefined and would shrink/clip the centred bar. */
@media(max-width:350px) and (orientation:portrait){
  .stamina{left:18px;width:calc(var(--steer-span) - 6px)}
}
@media(max-width:300px){
  :root{--steer-size:54px;--steer-gap:16px}
  #touch-controls .steering{gap:16px}
  #touch-controls .steering button{min-width:54px;width:54px;height:74px}
  .topbar{justify-content:flex-end}
  .brand{display:none}
}
@media(min-width:601px) and (max-width:900px) and (orientation:portrait){
  .topbar{left:24px;right:24px;top:var(--hud-top)}
  .brand-main{font-size:31px}
  .brand-sub{font-size:9px}
  .intro-panel{width:calc(100% - 48px);max-width:560px;margin:0 auto max(24px,env(safe-area-inset-bottom));padding:26px 30px 24px;border-radius:28px;border:1px solid #fff}
  .intro-panel h1{font-size:37px}
  .intro-panel .portrait-intro-copy{font-size:14px}
  .mobile-guide,.tilt-status,.best{font-size:11px}
  .position{left:25px}
  .clock{right:25px}
  .race-progress{left:26px;width:calc(100% - 52px)}
  .speed,.stamina{left:24px}
  .stamina{width:var(--steer-span)}
  #touch-controls{left:24px;right:24px;bottom:var(--controls-bottom)}
}
/* Keep speed and hit information raised when landscape has more vertical room. */
@media(orientation:landscape) and (min-height:360px) and (max-height:600px) and (any-pointer:coarse), (orientation:landscape) and (min-height:360px) and (max-width:900px) and (max-height:520px){
  .speed{bottom:calc(var(--controls-bottom) + 141px);height:48px;line-height:32px;transform:none}
  .speed strong{display:inline-block;vertical-align:top;font-size:32px;line-height:32px}
  .speed small{position:absolute;top:35px;left:0;font-size:9px;line-height:12px;white-space:nowrap;margin:0}
  .hit-count{bottom:calc(var(--controls-bottom) + 163px);height:26px;display:flex;align-items:baseline;gap:5px}
  .hit-count b{font-size:26px;line-height:26px}
  .hit-count span{font-size:9px;line-height:12px;margin:0}
}

/* Comic impact: starburst + bigger onomatopoeia, like the key art. */
.comic-burst{position:absolute;width:clamp(64px,min(8vw,15vh),120px);aspect-ratio:1;transform:translate(-50%,-50%);background:#ffe14a;filter:drop-shadow(0 0 0 #182e43) drop-shadow(3px 3px 0 #182e43);clip-path:polygon(50% 0,59% 25%,80% 8%,75% 34%,100% 33%,80% 52%,98% 72%,72% 68%,70% 96%,53% 74%,35% 98%,33% 70%,6% 82%,24% 56%,0% 40%,28% 36%,18% 8%,42% 27%);animation:burst .36s ease-out forwards;pointer-events:none}
@keyframes burst{0%{transform:translate(-50%,-50%) scale(.2) rotate(-20deg);opacity:1}35%{transform:translate(-50%,-50%) scale(1.15) rotate(6deg);opacity:1}100%{transform:translate(-50%,-50%) scale(1.5) rotate(12deg);opacity:0}}
.speech.hit{font-size:clamp(20px,min(2.6vw,5.4vh),40px);-webkit-text-stroke:2px #182e43;text-shadow:2px 3px 0 #182e43;color:#fff8d0;z-index:2}
.speech.hit::first-letter{color:#ffdf32}

/* Light colour grade for a sunnier, punchier picture. */
/* Colour grading now happens in the post-processing pass (post.js); phones keep this lighter CSS grade. */
#game{filter:none}
@media (any-pointer:coarse){#game{filter:saturate(1.18) contrast(1.05)}}

.speech,.speech.hurt,.speech.miss{font-size:clamp(18px,min(2.4vw,5vh),34px)}
.speech.hit{font-size:clamp(20px,min(2.6vw,5.4vh),40px)}

.speech,.speech.hurt,.speech.miss{font-size:clamp(16px,min(1.9vw,4.4vh),28px)}
.speech.hit{font-size:clamp(18px,min(2.1vw,4.8vh),32px)}

.speech.hit{font-size:clamp(23px,min(2.7vw,6.2vh),42px)}
.comic-burst{filter:none}

/* Both finish choices are equally sized, with room for their raised edges. */
.result-dialog{max-height:calc(100% - 28px);overflow-y:auto}
#game.camera-dragging{cursor:grabbing}
.result-actions{display:grid;grid-template-columns:minmax(0,1fr);gap:16px}
.result-actions .primary-button{width:100%;min-width:0;min-height:58px}

/* v0.2 touch layout: [跳跃 | 猛蹬 over 刹车 | 拍他！]; top toolbar 30% smaller. */
#touch-controls .actions{display:grid!important;grid-auto-flow:row;grid-template-columns:auto auto auto!important;align-items:end}
#touch-controls .jump-touch{grid-column:1!important;grid-row:2!important}
#touch-controls .boost-touch{grid-column:2!important;grid-row:1!important}
#touch-controls .brake-touch{grid-column:2!important;grid-row:2!important}
#touch-controls .slap-touch{grid-column:3!important;grid-row:1 / 3!important}
#touch-controls .brake-touch,#touch-controls .jump-touch,#touch-controls .boost-touch,#touch-controls .brake-touch{display:flex;flex-direction:column;align-items:center;justify-content:center}
#touch-controls .brake-touch{background:#8a3b34dd;width:var(--small-btn,auto)}
#touch-controls .brake-touch b,#touch-controls .jump-touch b,#touch-controls .boost-touch b{font-size:1em}
#touch-controls .brake-touch small,#touch-controls .jump-touch small,#touch-controls .boost-touch small{font-size:.62em;opacity:.85}
.toolbar .icon-button{transform:scale(.7);transform-origin:top right;margin-left:-14px}
