:root{--blue:#0d35aa;--navy:#081953;--yellow:#ffd735;--red:#f33943;--cream:#fff0cc;--cyan:#49ecff;--shadow:#040d32}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{width:100%;height:100%;padding:0;margin:0;overflow:hidden;overscroll-behavior:none;background:var(--navy);color:white;font-family:system-ui,-apple-system,'Arial Black',sans-serif;touch-action:manipulation}
button{font-family:inherit;color:inherit;cursor:pointer}button:focus-visible{outline:3px solid var(--cyan);outline-offset:4px}
#app{position:relative;width:100%;height:100%;height:100dvh;overflow:hidden}
.screen{display:none;position:absolute;inset:0}.screen.active{display:block}
#menu{background:radial-gradient(circle at 50% 18%,#205fe1 0%,#102a92 45%,#061547 100%);overflow:hidden}
#menu:before{content:'';position:absolute;inset:0;pointer-events:none;opacity:.16;background:repeating-linear-gradient(0deg,transparent 0 6px,#071146 6px 7px)}
.menu-scroller{position:relative;width:100%;height:100%;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;text-align:center;padding:max(17px,env(safe-area-inset-top)) 14px max(22px,env(safe-area-inset-bottom));scrollbar-width:thin}
.stars{color:var(--yellow);letter-spacing:22px;font-size:13px;opacity:.9}.brand-flag{display:inline-block;background:#071a5c;padding:5px 15px;border:2px solid var(--yellow);font-size:10px;font-weight:900;letter-spacing:1px;box-shadow:4px 4px 0 #050d2b;transform:skew(-4deg)}
.logo{display:flex;flex-direction:column;align-items:center;line-height:.77;margin:18px auto 8px;filter:drop-shadow(5px 7px 0 #07112e);font-style:italic;font-weight:1000;letter-spacing:-4px;text-shadow:2px 2px 0 #fff,-2px 2px 0 #fff,2px -2px 0 #fff,-2px -2px 0 #fff,5px 5px 0 #052157,-5px -5px 0 #052157}
.logo-top{font-size:clamp(21px,4vw,36px);color:#f7fbff;transform:translateX(-56px) rotate(-4deg);letter-spacing:-1px}.logo-main{font-size:clamp(66px,15vw,128px);color:var(--yellow);background:linear-gradient(#ffe46f 20%,#ffa519 62%,#f84032);background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;-webkit-text-stroke:3px #fff}.logo-bottom{font-size:clamp(36px,8vw,70px);color:white;transform:translateX(50px) rotate(-4deg)}.bolt{-webkit-text-fill-color:var(--yellow);text-shadow:none}
.tagline{margin-top:16px;color:var(--cream);font-size:clamp(10px,2vw,13px);font-weight:1000;letter-spacing:1.7px}
.menu-hero{width:min(430px,89vw);height:clamp(175px,29vh,275px);margin:0 auto;position:relative;display:grid;place-items:center;isolation:isolate;overflow:visible}.menu-hero:after{content:'';position:absolute;z-index:-2;width:84%;height:39%;border-radius:50%;bottom:4%;background:#020b37;filter:blur(21px)}
.speed-lines{position:absolute;z-index:-1;inset:10% -6%;background:repeating-conic-gradient(from -2deg at 50% 75%,transparent 0 10deg,#3de2f1 10.5deg 11.3deg,transparent 12deg 24deg);opacity:.45;mask-image:radial-gradient(ellipse at center,transparent 0 20%,#000 40%,transparent 72%)}
.menu-hero img{height:115%;max-width:100%;object-fit:contain;image-rendering:pixelated;filter:drop-shadow(0 11px 0 #102766);animation:bob 2s ease-in-out infinite}@keyframes bob{0%,100%{transform:translateY(1px) rotate(-2deg)}50%{transform:translateY(-6px) rotate(2deg)}}
.hero-sticker{position:absolute;top:22%;left:0;transform:rotate(-12deg);display:flex;flex-direction:column;background:var(--red);border:3px solid white;border-radius:7px;padding:6px;color:white;font-size:10px;font-weight:1000;box-shadow:4px 5px 0 var(--navy)}.hero-sticker strong{font-size:29px;line-height:1}.hero-sticker.other{left:auto;right:0;top:48%;transform:rotate(11deg);background:var(--yellow);color:var(--navy)}
.choose-title{max-width:860px;margin:9px auto 12px;padding:10px;background:var(--yellow);border:3px solid #fff;box-shadow:5px 5px 0 #051746;color:var(--navy);font-weight:1000;text-align:left;font-size:clamp(14px,3vw,20px);font-style:italic}.choose-title span{padding:4px 10px;color:white;background:var(--blue);margin-right:10px}
.track-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;max-width:860px;margin:0 auto}
.track-card{padding:0 0 12px;background:#091b5a;border:3px solid #578fea;border-radius:8px;overflow:hidden;text-align:left;box-shadow:4px 5px 0 #061034;transition:transform .14s,border-color .14s;min-width:0}.track-card:active{transform:translateY(3px)}.track-card.selected{border-color:var(--yellow);background:#1237a0;box-shadow:0 0 0 3px #fcba24,4px 5px 0 #061034}.track-card img{width:100%;aspect-ratio:16/9;object-fit:cover;display:block;image-rendering:auto}.track-name{display:block;font-size:12px;font-weight:1000;padding:9px 8px 2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.track-card small{display:block;padding:0 8px;font-size:10px;color:#cbd9ff;line-height:1.25}
.big-btn{display:block;width:min(540px,95%);margin:19px auto 9px;padding:17px 10px;border:3px solid #fff;border-radius:11px;background:linear-gradient(0deg,#fb6a25,#ffc733 85%);box-shadow:0 7px 0 #b42a31,0 10px 0 #041447;color:var(--navy);font-style:italic;font-weight:1000;font-size:clamp(19px,4vw,28px);text-shadow:1px 1px 0 #fff;letter-spacing:-.4px;transition:transform .15s}.big-btn:active{transform:translateY(5px);box-shadow:0 2px 0 #b42a31,0 4px 0 #041447}
.menu-instructions{display:flex;justify-content:center;gap:20px;flex-wrap:wrap;margin-top:15px;font-size:10px;font-weight:1000;color:var(--cyan)}.byline{color:#94b5fc;font-size:9px;letter-spacing:1px;margin:15px 0 0}
#race{background:#79d9fb;touch-action:none;overflow:hidden}#game{display:block;width:100%;height:100%;image-rendering:pixelated;image-rendering:crisp-edges;touch-action:none}
#race-hud{z-index:3;pointer-events:none;position:absolute;top:max(8px,env(safe-area-inset-top));left:max(8px,env(safe-area-inset-left));right:max(8px,env(safe-area-inset-right));display:grid;grid-template-columns:1fr 1.15fr 1fr;align-items:start;gap:5px;text-shadow:2px 3px 0 #061144}
.hud-left{display:flex;gap:5px;align-items:flex-start}.pos{display:flex;flex-direction:column;align-items:center;min-width:67px;padding:3px 7px 2px;background:var(--navy);border:2px solid var(--yellow);border-radius:6px;box-shadow:3px 3px 0 #072149}.pos strong{font-style:italic;color:var(--yellow);font-size:clamp(24px,5vw,40px);line-height:1}.pos span{font-size:9px;font-weight:1000;letter-spacing:1px}.hud-coins{margin-top:4px;font-size:clamp(15px,2.6vw,21px);font-weight:1000;padding:2px 6px;background:#081b5a99;border-radius:7px;white-space:nowrap}
.hud-center{text-align:center;font-weight:1000;letter-spacing:.3px}.hud-center #track-label{color:var(--yellow);font-size:clamp(9px,2vw,15px);white-space:nowrap}.hud-lap{background:#09286ad6;border:2px solid white;border-radius:7px;display:inline-block;padding:3px 11px;font-size:clamp(10px,2vw,14px);margin-top:3px}.hud-lap strong{color:var(--yellow);font-size:1.2em}.hud-right{display:flex;justify-content:flex-end;gap:6px;align-items:center;font-weight:1000;font-size:clamp(12px,2.7vw,20px)}.hud-icon{pointer-events:auto;background:#071a5fcc;border:2px solid #fff;border-radius:7px;font-size:20px;width:39px;height:36px;touch-action:manipulation}
#race-message{position:absolute;top:28%;left:0;right:0;pointer-events:none;text-align:center;font-size:clamp(32px,10vw,75px);font-weight:1000;font-style:italic;color:var(--yellow);-webkit-text-stroke:2px var(--navy);text-shadow:4px 5px 0 white,7px 8px 0 var(--navy);z-index:5;white-space:nowrap;transition:opacity .2s}
.race-bottom{position:absolute;left:max(13px,env(safe-area-inset-left));right:max(13px,env(safe-area-inset-right));bottom:max(14px,env(safe-area-inset-bottom));display:flex;align-items:flex-end;justify-content:space-between;z-index:4;pointer-events:none}.dpad{display:flex;gap:10px}.control{pointer-events:auto;touch-action:none;user-select:none;-webkit-user-select:none;border:3px solid #faffff;box-shadow:0 5px 0 #071848,0 7px 12px #06103999;background:#112f94da;color:white;font-weight:1000;display:grid;place-items:center}.control.pressed,.control:active{background:#f1ab26;transform:translateY(4px);box-shadow:0 1px 0 #071848}.steer{width:clamp(58px,13vw,91px);height:clamp(58px,13vw,91px);border-radius:15px;font-size:clamp(24px,5vw,40px)}.boost-group{width:clamp(76px,15vw,115px);display:flex;align-items:center;flex-direction:column}.boost{width:clamp(66px,13vw,95px);height:clamp(66px,13vw,95px);border-radius:50%;font-size:clamp(28px,5.4vw,46px);background:linear-gradient(#ffd52a,#f34420)}.boost small{font-size:9px;margin-top:-12px;font-weight:1000;color:#041a62}.boost-label{color:white;font-size:10px;white-space:nowrap;text-shadow:1px 2px 0 #08214d;font-weight:1000}.boost-track{margin:3px 0 7px;width:100%;height:11px;background:#061648;border:2px solid white;border-radius:8px;overflow:hidden}#boost-fill{height:100%;width:100%;background:linear-gradient(90deg,#ff7b17,#f9e44f)}#orientation-tip{display:none;position:absolute;bottom:5px;left:0;right:0;text-align:center;font-size:9px;pointer-events:none;color:#dcf4ff;text-shadow:1px 1px #031042}
.overlay{z-index:10;background:#020b32cf;backdrop-filter:blur(5px);display:none!important;align-items:center;justify-content:center;padding:18px;overflow-y:auto}.overlay.active{display:flex!important}.modal{width:min(450px,96%);border:5px solid white;box-shadow:0 0 0 6px #0d4be0,9px 12px 0 #030c37;text-align:center;background:linear-gradient(135deg,#1948be,#09195f);padding:24px 16px;color:white}.modal-eyebrow{color:var(--yellow);font-size:12px;font-weight:1000;letter-spacing:2px}.modal h2{font-size:clamp(33px,7vw,53px);font-weight:1000;font-style:italic;color:var(--yellow);margin:12px 0;text-shadow:4px 4px 0 #f12f35}.modal p{font-weight:700;font-size:14px}.modal .big-btn{width:100%;font-size:20px}.text-btn{background:none;border:0;color:#d7edff;font-size:13px;font-weight:1000;text-decoration:underline;text-underline-offset:5px;margin:17px 0 0}.result-modal{max-width:430px}.result-modal img{display:block;max-height:145px;max-width:50%;object-fit:contain;margin:4px auto -12px;image-rendering:pixelated}.result-details{display:flex;justify-content:space-around;gap:4px;margin:17px auto 12px}.result-details span{font-size:9px;font-weight:1000;border:2px solid #70a8ff;padding:7px 8px;display:flex;flex-direction:column;gap:3px;flex:1}.result-details strong{color:var(--yellow);font-size:21px}
@media(max-width:700px){.menu-hero{height:190px}.track-grid{grid-template-columns:repeat(2,minmax(0,1fr));max-width:430px;gap:11px}.track-card img{aspect-ratio:16/9}.logo{margin:12px auto}.logo-main{font-size:75px}.logo-bottom{font-size:45px}.choose-title{max-width:430px}.menu-instructions{gap:11px}.track-name{font-size:11px}}
@media(max-height:550px) and (orientation:landscape){.menu-scroller{padding-top:10px}.menu-hero{height:125px}.logo{margin:8px auto}.logo-main{font-size:54px}.logo-bottom{font-size:29px}.tagline{font-size:10px}.stars{display:none}.track-grid{max-width:710px}.track-card img{height:77px}.track-card{padding-bottom:5px}.track-card small{font-size:9px}.choose-title{max-width:710px;padding:7px;margin:5px auto}.big-btn{margin-top:12px;padding:12px 10px}.steer{width:75px;height:75px}.boost{width:77px;height:77px}}
@media(orientation:portrait){#orientation-tip{display:block;bottom:3px}.race-bottom{bottom:max(26px,env(safe-area-inset-bottom))}.steer{width:clamp(66px,18vw,86px);height:clamp(66px,18vw,86px)}.boost{width:clamp(72px,20vw,92px);height:clamp(72px,20vw,92px)}.hud-left{gap:3px}.pos{min-width:56px}.hud-center #track-label{font-size:9px}.hud-right{flex-direction:column-reverse}.hud-icon{width:32px;height:32px;font-size:16px}}
@media(max-width:370px){.dpad{gap:6px}.steer{width:61px;height:61px}.boost{width:69px;height:69px}.track-name{font-size:10px}.logo-main{font-size:64px}}
/* Small-screen polish */
.logo-main{background:none;-webkit-text-fill-color:#ffd12d;color:#ffd12d;-webkit-text-stroke:2px #fff;text-shadow:4px 5px 0 #e94d29,8px 9px 0 #071742}
@media(max-width:700px){.logo{margin:11px auto 7px}.logo-main{font-size:69px}.logo-bottom{font-size:37px}.logo-top{font-size:23px}.tagline{margin-top:12px}.menu-hero{height:155px;margin-bottom:3px}.menu-hero img{height:108%}.hero-sticker{font-size:9px;padding:5px}.hero-sticker strong{font-size:23px}.choose-title{margin:7px auto 9px;padding:8px}.track-grid{gap:9px}.track-card{padding-bottom:8px}.track-card img{aspect-ratio:1.85}.track-name{padding-top:6px;font-size:10px}.track-card small{font-size:9px}.big-btn{margin-top:16px;padding:14px 10px;font-size:20px}}

/* V2 TURBO • tactile drift controls and enhanced mobile landscape */
.boost-area{display:flex;align-items:flex-end;gap:11px;pointer-events:none}
.drift-group{display:flex;flex-direction:column;align-items:center;justify-content:flex-end;width:clamp(64px,12vw,94px)}
.drift-label{font-size:10px;font-weight:1000;color:#ddf8ff;text-shadow:1px 2px #081b4e}.drift-label b{color:#f7d332}
.drift-meter{margin:3px 0 6px;width:100%;height:11px;border:2px solid white;border-radius:8px;background:#061648;overflow:hidden}
#drift-fill{width:0;height:100%;background:linear-gradient(90deg,#ffba40,#54edff);transition:width .08s}
.drift{width:clamp(58px,11vw,84px);height:clamp(58px,11vw,84px);border-radius:17px;background:linear-gradient(150deg,#178df4,#173eaa);font-size:clamp(26px,5vw,36px)}
.drift small{font-size:9px;font-weight:1000;margin-top:-6px;color:white}
.drift.ready{border-color:#ffe15a;box-shadow:0 0 13px #fbdc4bbb,0 4px 0 #071848}
#race-hud{filter:drop-shadow(0 2px 0 #08144d88)}
.track-card[data-track="0"]:after{content:'V2 ★';position:absolute;top:6px;right:6px;border:2px solid #ffefaa;border-radius:3px;color:#16275e;background:#ffdc35;font-size:11px;line-height:1;padding:4px 5px;font-weight:1000;box-shadow:2px 2px 0 #071848}
.track-card{position:relative}
@media(orientation:portrait){.boost-area{gap:7px}.drift-group{width:64px}.drift{width:65px;height:65px}.drift-label{font-size:9px}.race-bottom{bottom:max(31px,env(safe-area-inset-bottom))}}
@media(max-width:370px){.boost-area{gap:5px}.drift-group{width:56px}.drift{width:57px;height:57px}.boost-group{width:70px}.boost{width:67px;height:67px}.dpad{gap:5px}.steer{width:58px;height:58px}}
@media(max-height:490px) and (orientation:landscape){.race-bottom{bottom:max(8px,env(safe-area-inset-bottom))}.drift,.boost{height:65px;width:65px}.steer{height:68px;width:68px}.drift-label,.boost-label{font-size:9px}}

/* Rua da Vila: one featured circuit, no inactive course choices. */
.track-grid.one-track{display:grid;grid-template-columns:minmax(0,1fr);max-width:min(550px,96%);margin:auto}
.track-grid.one-track .track-card img{height:clamp(160px,29vw,256px);aspect-ratio:auto;object-fit:cover}
.track-grid.one-track .track-card{border:3px solid #ffda47;box-shadow:0 5px 0 #06113d}
.track-grid.one-track .track-name{font-size:18px;letter-spacing:.5px}
.track-grid.one-track .track-card small{font-size:10px;letter-spacing:1px;color:#f4e1a6}
.track-card[data-track="0"]:after{display:none}
.circuit-info{display:flex;justify-content:center;gap:11px;flex-wrap:wrap;margin:15px auto 0;color:#fff3ce;font-size:10px;font-weight:900;letter-spacing:.35px}
.circuit-info span{background:#0b235bcc;border:1px solid #6a8bd9;border-radius:5px;padding:5px 8px}
.menu-brief{max-width:550px;margin:17px auto 0;border:3px solid #b9d5ff;padding:10px;background:#0a2272;border-radius:8px;box-shadow:4px 5px 0 #061342}
.menu-brief-heading{display:block;margin-bottom:7px;color:#ffdb55;font-size:13px;font-weight:1000;font-style:italic;letter-spacing:1px}
.mini-map-wrap canvas{width:min(100%,420px);height:auto;aspect-ratio:430/205;image-rendering:pixelated;display:block;margin:auto;border:2px solid #435fb2;border-radius:4px}
.mini-map-tags{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;margin-top:9px}
.mini-map-tags span{font-size:9px;color:#e2ebff;font-weight:900;background:#173ca4;border-radius:4px;padding:6px 2px}
.hud-sector{margin:3px auto 0;display:flex;align-items:center;justify-content:center;gap:6px;color:#fff6d5;white-space:nowrap;font-size:clamp(8px,1.6vw,12px);font-weight:900;text-shadow:1px 2px 0 #06143e}
.hud-sector small{background:#ffda3b;color:#102355;border-radius:3px;font-size:8px;padding:2px 3px;text-shadow:none}
.race-brand{display:grid;justify-items:center;line-height:.86;transform:skewX(-8deg);filter:drop-shadow(0 2px 0 #031437)}
.hud-center .race-brand span{font-size:clamp(10px,1.9vw,18px);font-weight:1000;color:#fff6e7;text-shadow:1px 1px #101d48,-1px -1px #101d48}
.hud-center .race-brand b{font-size:clamp(15px,3vw,29px);letter-spacing:-.6px;font-weight:1000;color:#ffda48;text-shadow:2px 2px #b13828,3px 4px #071739,-1px -1px #071739}
.hud-center .hud-sector{margin-top:7px;width:max-content;max-width:100%;padding:4px 9px;border:1.5px solid #ffdc61;border-radius:4px;background:#07194edb;box-shadow:0 2px #031437}
@media (orientation:portrait){.track-grid.one-track .track-card img{height:160px}.mini-map-tags{grid-template-columns:repeat(2,minmax(0,1fr))}.hud-sector{font-size:9px;white-space:normal;line-height:1.05}.circuit-info{gap:5px}}
@media(max-height:490px) and (orientation:landscape){.track-grid.one-track .track-card img{height:115px}.menu-hero{height:105px}.mini-map-wrap canvas{max-height:140px;object-fit:contain}}

.fast-start{display:none}
@media(max-height:550px) and (orientation:landscape){.fast-start{display:block;width:min(350px,85%);margin:7px auto;padding:8px;font-size:17px;box-shadow:0 4px 0 #b42a31,0 6px 0 #041447}}

/* Rua da Vila — Arcade D: on-track items, race minimap and speedometer */
#race-mini-map{position:absolute;z-index:3;right:max(14px,env(safe-area-inset-right));top:69px;width:136px;height:69px;background:#0515419e;border:2px solid #f6f4e6;border-radius:9px;box-shadow:0 3px 0 #08144d;image-rendering:pixelated;pointer-events:none}
.hud-speed{display:flex;flex-direction:column;line-height:.92;align-items:center;font-style:italic;background:#0a296dc7;border:1px solid #f6f4e6;border-radius:5px;padding:4px 5px}.hud-speed strong{color:#ffde55;font-size:18px}.hud-speed small{font-size:7px;color:#fff8db}
.item-group{display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:5px;pointer-events:none;width:clamp(55px,10vw,75px)}.item-group span{font-size:9px;font-weight:1000;white-space:nowrap;text-shadow:2px 2px #001542}.item-group button{pointer-events:auto;touch-action:none;border:3px solid white;border-radius:15px;background:#193b97;height:61px;width:61px;font-size:28px;font-weight:1000;box-shadow:0 4px 0 #071848}.item-group button.equipped{background:linear-gradient(#fbd84c,#ec8336);color:#06143a;animation:stored-item 1.7s ease-in-out infinite}@keyframes stored-item{50%{box-shadow:0 0 11px #fff3ac,0 4px 0 #071848}}
@media (orientation:portrait){#race-mini-map{right:8px;top:116px;width:111px;height:56px}.hud-speed strong{font-size:13px}.item-group{width:48px;gap:3px}.item-group button{height:47px;width:47px;font-size:23px}.item-group span{font-size:8px}}
@media(max-height:490px) and (orientation:landscape){#race-mini-map{top:65px;width:115px;height:59px}.item-group button{height:55px;width:55px}.item-group{width:55px}}
@media(max-width:370px){.item-group{width:40px}.item-group button{height:42px;width:42px;font-size:20px}.boost-area{gap:4px}.steer{width:55px;height:55px}.drift{width:52px;height:52px}.boost{width:60px;height:60px}}

#race-message.sector-alert{font-size:clamp(19px,4vw,34px);left:50%;right:auto;top:22%;transform:translateX(-50%);width:max-content;max-width:95vw;white-space:normal;line-height:1.05;padding:8px 13px;background:#071f66bc;border:2px solid #ffe15a;border-radius:9px;text-shadow:2px 2px 0 #09143f;-webkit-text-stroke:0;color:#ffe65e}
@media(orientation:portrait){#race-message.sector-alert{top:25%;font-size:23px;max-width:87vw}}

/* Arcade E: rival portrait pops up briefly only on overtakes, never covers steering */
#pass-toast{position:absolute;z-index:6;left:50%;top:clamp(70px,15vh,117px);transform:translate(-50%,-14px) scale(.92);opacity:0;pointer-events:none;display:flex;align-items:center;gap:8px;max-width:260px;border:3px solid #ffdb53;border-radius:13px;background:#071d61eb;padding:5px 11px 5px 5px;box-shadow:0 6px 0 #061444;transition:opacity .16s,transform .16s}#pass-toast.visible{opacity:1;transform:translate(-50%,0) scale(1)}#pass-toast img{width:43px;height:43px;object-fit:cover;image-rendering:pixelated;border:2px solid #fff0d7;border-radius:7px}#pass-toast div{display:flex;flex-direction:column;gap:2px;white-space:nowrap}#pass-toast small{color:#ffe071;font-size:10px;font-weight:1000;letter-spacing:.6px}#pass-toast strong{font-size:13px;color:#fff6e0;font-weight:1000;text-shadow:2px 2px #0b1747}@media (orientation:portrait){#pass-toast{top:183px;max-width:200px}#pass-toast img{width:37px;height:37px}#pass-toast strong{font-size:10px}#pass-toast small{font-size:8px}}@media(max-height:490px) and (orientation:landscape){#pass-toast{top:45px;left:52%;padding:2px 7px 2px 2px;gap:4px}#pass-toast img{width:31px;height:31px}#pass-toast small{font-size:8px}#pass-toast strong{font-size:10px}}

/* Arcade F: character roster, mobile first. */
.pilots-menu{max-width:650px;margin:21px auto 0;padding:4px 7px 15px;border:2px solid #416bc4;border-radius:12px;background:linear-gradient(180deg,#153b9b,#08174f);box-shadow:0 7px 0 #07112e}
.pilot-description{font-weight:900;color:#d9e6ff;font-size:10px;letter-spacing:.6px;margin:4px 0 11px;text-align:center}
.pilot-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;padding:0 5px}
.pilot-card{min-width:0;background:linear-gradient(160deg,color-mix(in srgb,var(--kart-color) 48%,#10204c),#0b1e53 65%);border:2px solid color-mix(in srgb,var(--kart-color) 65%,#ffffff);border-radius:9px;box-shadow:0 4px 0 #070d29;overflow:hidden;display:flex;flex-direction:column;align-items:center;justify-content:end;padding:2px 2px 5px;}
.pilot-card.pilot-main{border-color:#ffda51;box-shadow:0 0 0 2px #d6a834,0 4px 0 #060b2b}
.pilot-thumb{width:100%;aspect-ratio:1/1;display:flex;align-items:center;justify-content:center;overflow:hidden}
.pilot-thumb img{max-width:115%;max-height:100%;width:100%;height:100%;object-fit:contain;image-rendering:pixelated;filter:drop-shadow(0 4px 0 #0005)}
.pilot-name{font-weight:1000;color:#fffdf2;font-size:clamp(8px,1.3vw,13px);letter-spacing:.2px;text-align:center;text-shadow:0 2px #10224b;white-space:nowrap;max-width:100%;overflow:hidden;text-overflow:ellipsis}
.pilot-badge{font-weight:900;color:#ffef9c;font-size:12px;white-space:nowrap}
@media (orientation:portrait){.pilot-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.pilot-name{font-size:11px}.pilots-menu{margin:15px 8px 0}}
@media(max-height:490px) and (orientation:landscape){.pilot-grid{gap:6px}.pilot-thumb{max-height:95px}}

/* V4 — illustrated title, interactive garage and official podium. */
.title-scene{position:relative;height:100%;width:100%;background:#071743;display:flex;align-items:center;justify-content:center;isolation:isolate}
.title-illustration{width:100%;height:100%;object-fit:contain;display:block;image-rendering:auto}
.title-scene:after{content:'';position:absolute;inset:60% 0 0;background:linear-gradient(transparent,#03102cc9);pointer-events:none}
.title-actions{position:absolute;z-index:2;bottom:8%;left:50%;transform:translateX(-50%);display:flex;gap:12px;align-items:center;justify-content:center;width:min(680px,86%)}
.arcade-btn{border:3px solid #fff4d5;border-radius:6px;min-height:44px;padding:9px 18px;box-shadow:0 5px 0 #08143b,0 0 0 2px #0e1b46;color:#fff6db;font-weight:1000;font-style:italic;font-size:clamp(13px,2vw,22px);letter-spacing:.4px;white-space:nowrap;text-shadow:1px 2px #172b60;background:linear-gradient(#2d6edc,#14377f)}
.arcade-btn.primary{background:linear-gradient(#ffea72 0 12%,#ffc132 12% 61%,#f07b18 62%);color:#152044;text-shadow:1px 1px #fff4b2;box-shadow:0 5px 0 #9b3924,0 0 0 2px #111c3d}
.arcade-btn:active{transform:translateY(3px);box-shadow:0 2px 0 #07143d}
.title-actions .primary{flex:1;font-size:clamp(21px,4vw,39px);min-height:54px;display:flex;justify-content:space-around;align-items:center}
.title-actions .secondary{min-height:48px}.check-accent{font-style:normal;color:#4a3315;font-size:.7em}.title-version{position:absolute;bottom:2%;z-index:2;letter-spacing:2px;font-size:10px;font-weight:900;color:#ffedc1}
.garage-screen,.podium-screen,.options-screen{background:#0b1a49 url('assets/garage-art.webp') center/cover no-repeat;isolation:isolate;overflow:auto}
.garage-screen:before,.podium-screen:before,.options-screen:before{content:'';position:absolute;inset:0;background:linear-gradient(#0514387a,#06153918 42%,#05143996);z-index:-1}
.garage-frame{height:100%;max-width:1100px;margin:auto;padding:max(12px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:10px}
.garage-header{display:flex;gap:12px;align-items:center;justify-content:space-between}
.garage-header h1,.options-panel h1,.podium-header h1{font-size:clamp(21px,4vw,45px);color:#ffe14d;font-weight:1000;font-style:italic;text-align:center;margin:0;line-height:1.05;text-shadow:2px 2px #8d341f,4px 4px #071a46;-webkit-text-stroke:.6px #2e1f27}
.garage-kicker,.garage-footer{font-weight:1000;font-size:10px;letter-spacing:.5px;color:#fff0ba;text-shadow:2px 2px #102552}
.compact{min-height:38px;font-size:12px;padding:6px 10px}
.garage-layout{min-height:0;display:grid;grid-template-columns:3fr 1.55fr;gap:15px}
.driver-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:8px;min-height:0}
.driver-card{display:flex;flex-direction:column;min-height:0;min-width:0;align-items:center;justify-content:flex-end;overflow:hidden;padding:3px 2px 6px;border:2px solid #9db3d5;border-radius:6px;background:linear-gradient(150deg,#4172aece,#102b65dc);box-shadow:0 4px 0 #0a183a;color:white}
.driver-card img{display:block;width:100%;flex:1;min-height:0;object-fit:contain;image-rendering:pixelated;filter:drop-shadow(0 4px 0 #050d37a0)}
.driver-card span{font-size:clamp(9px,1.5vw,15px);font-weight:1000;white-space:nowrap;text-shadow:1px 2px #06143a}
.driver-card.selected{border:3px solid #ffde4c;background:linear-gradient(#e8b341d9,#a85f20df);box-shadow:0 0 0 2px #fff3b8,0 4px 0 #57361b;transform:translateY(-1px)}
.driver-detail{min-height:0;display:flex;flex-direction:column;align-items:stretch;padding:8px 11px 10px;background:#07193ac7;border:2px solid #ffe18a;border-radius:7px;box-shadow:4px 5px #04132d;gap:6px}
.driver-title{font-size:clamp(20px,3.3vw,36px);color:#ffe14d;font-weight:1000;font-style:italic;text-align:center;line-height:1.08;text-shadow:2px 3px #a64223}
.driver-platform{flex:1;min-height:0;position:relative;display:flex;align-items:center;justify-content:center;isolation:isolate}
.driver-platform:before{content:'';position:absolute;bottom:4%;width:90%;height:27%;border-radius:50%;background:repeating-conic-gradient(#dce5ee 0 25%,#556783 25% 50%) 0 0/20px 20px;border:3px solid #fff4c7;box-shadow:0 5px #24324c;z-index:-1}
.driver-platform img{height:100%;min-height:0;max-width:100%;object-fit:contain;image-rendering:pixelated;filter:drop-shadow(0 5px 0 #0008)}
.driver-stats{display:grid;gap:4px}.driver-stats>div{display:grid;grid-template-columns:1fr 1.1fr;gap:5px;align-items:center;font-size:10px;font-weight:1000;color:#fff3cf}
.stat-meter{display:grid;grid-template-columns:repeat(5,1fr);gap:3px;height:12px}.stat-meter i{display:block;background:#263b5f;border:1px solid #6180ae;border-radius:2px}.stat-meter i.on{background:#ffcf45;border-color:#fff5b0;box-shadow:inset 0 2px #ffeba3}
.driver-stats>div:nth-child(2) i.on{background:#62db95;border-color:#c5ffe8;box-shadow:inset 0 2px #c5ffe8}.driver-stats>div:nth-child(3) i.on{background:#5bdaf8;border-color:#b9f7ff;box-shadow:inset 0 2px #b9f7ff}
.driver-detail .arcade-btn{font-size:clamp(12px,2vw,18px);padding:7px 5px;min-height:42px}
.garage-footer{display:flex;justify-content:space-between;gap:6px;padding:5px;background:#081b43bb;border-radius:4px}
.options-screen.active{display:grid;place-items:center}.options-panel{width:min(420px,90%);padding:18px;display:grid;gap:13px;background:#102b63e8;border:4px solid #ffe08a;box-shadow:5px 6px #07152e;border-radius:9px;text-align:center}.options-panel p{font-size:13px;line-height:1.35;margin:1px 0;color:#fff0ce}
.options-panel{max-height:94dvh;overflow:auto;overscroll-behavior:contain;gap:clamp(6px,1.5vh,13px)}
.podium-screen{background-image:url('assets/podium-art.webp')}.podium-frame{height:100%;max-width:1000px;margin:auto;display:grid;grid-template-rows:auto minmax(0,1fr) auto;padding:12px max(15px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom));gap:5px}
.podium-header{text-align:center;font-weight:1000;text-shadow:2px 2px #101c48}.podium-header div{font-size:11px;color:#fff0b2;letter-spacing:1px}.podium-header p{font-size:12px;margin:4px 0;color:#fff6d9}
.podium-stage{display:flex;align-items:flex-end;justify-content:center;min-height:0;gap:10px;position:relative}
.podium-slot{width:24%;height:88%;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;position:relative;min-height:0;isolation:isolate}
.podium-slot.gold{height:100%;width:28%}.podium-slot.bronze{height:78%}
.podium-person{width:100%;max-height:73%;min-height:0;flex:1;object-fit:contain;object-position:center bottom;image-rendering:pixelated;filter:drop-shadow(0 3px 0 #0007)}
.podium-block{height:28%;min-height:42px;width:100%;display:flex;align-items:center;justify-content:center;gap:7px;color:#fff9da;border:3px solid #f9e3b5;background:linear-gradient(#a5b6c9,#586b8a);box-shadow:5px 5px 0 #283551;transform:skew(-2deg);font-weight:1000;text-shadow:2px 2px #4a4250}
.podium-block b{font-size:clamp(25px,5vw,49px);line-height:1}.podium-block span{font-size:clamp(9px,1.7vw,16px)}
.gold .podium-block{height:34%;background:linear-gradient(#ffdd66,#d19326);color:#fff6c6}.bronze .podium-block{height:22%;background:linear-gradient(#d59b6e,#9b5331)}
.podium-kart{position:absolute;right:-16%;bottom:-2%;width:43%;height:auto;object-fit:contain;image-rendering:pixelated;filter:drop-shadow(0 3px 0 #00112a8a)}
.podium-trophy{position:absolute;top:0;right:0;font-size:clamp(25px,5vw,52px);filter:drop-shadow(2px 3px 0 #8d4f19)}
.podium-bottom{display:grid;gap:7px;grid-template-columns:1.35fr 1fr;align-items:center;padding:8px;background:#071939de;border:2px solid #ffe4a0;border-radius:7px}
.podium-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:5px;text-align:center}.podium-stats span{font-size:9px;font-weight:900;color:#e2e4e6}.podium-stats strong{display:block;color:#ffdc45;font-size:clamp(15px,2.6vw,24px);line-height:1.11}
.podium-actions{display:flex;gap:8px}.podium-actions .arcade-btn{font-size:12px;padding:5px;flex:1}
@media(orientation:portrait){
 .title-scene{background:linear-gradient(#132d61,#07183c);flex-direction:column;justify-content:center}.title-illustration{height:auto;max-height:65%;object-fit:contain;transform:scale(1.05)}.title-scene:after{inset:68% 0 0}.title-actions{bottom:15%;flex-direction:column;width:80%}.title-actions .arcade-btn{width:100%;min-height:57px}.title-version{bottom:5%;font-size:9px}
 .garage-frame{padding:12px 10px;gap:9px;grid-template-rows:auto minmax(0,1fr) auto}.garage-header{flex-wrap:wrap;justify-content:center;gap:6px}.garage-header h1{font-size:25px;flex:1;white-space:nowrap}.garage-kicker{display:none}.garage-layout{grid-template-columns:1fr;grid-template-rows:minmax(0,1.2fr) minmax(0,1fr);gap:9px}.driver-grid{gap:6px}.driver-card span{font-size:8px;letter-spacing:-.3px}.driver-detail{gap:5px}.driver-title{font-size:25px}.garage-footer{font-size:8px}
 .podium-frame{padding:22px 9px 16px;gap:9px;grid-template-rows:auto minmax(0,1fr) auto}.podium-stage{gap:5px;align-items:center}.podium-slot{width:29%;height:51%}.podium-slot.gold{width:34%;height:62%}.podium-slot.bronze{height:44%}.podium-block{flex-direction:column;gap:1px;min-height:48px}.podium-bottom{grid-template-columns:1fr}.podium-actions .arcade-btn{font-size:14px}.podium-header h1{font-size:32px}
}
@media(max-height:490px) and (orientation:landscape){.garage-frame{gap:6px;padding:8px 12px}.garage-header h1{font-size:27px}.garage-kicker{font-size:9px}.driver-detail{padding:5px 8px;gap:4px}.driver-title{font-size:22px}.garage-layout{gap:9px}.driver-grid{gap:6px}.podium-header h1{font-size:30px}.podium-frame{padding:7px 11px 9px}.title-actions{bottom:7%}.title-version{font-size:8px}}
/* Arcade I: more screen space for the course while maintaining touch targets. */
@media(max-height:490px) and (orientation:landscape){
 .race-bottom{left:max(10px,env(safe-area-inset-left));right:max(10px,env(safe-area-inset-right));gap:6px}
 .steer{width:60px;height:60px;font-size:31px}.drift,.boost{width:58px;height:58px}.dpad{gap:8px}
 .drift-group{width:75px}.boost-group{width:86px}.boost-area{gap:9px}.item-group,.item-group button{width:48px}.item-group button{height:48px;font-size:24px}
 .drift-meter,.boost-track{height:8px;margin:3px 0 5px}.drift-label,.boost-label{font-size:8px}
 #race-message.sector-alert{font-size:20px;padding:5px 10px;top:20%}
 #pass-toast{top:88px;left:50%;max-width:210px}
 .hud-center #track-label{font-size:12px}.hud-lap{font-size:11px;padding:2px 8px}.pos{min-width:57px}.pos strong{font-size:34px}
}
/* V4.1 — lighter race UI, more room for the world, animated celebration. */
#race .control{border-width:2px;box-shadow:0 3px 0 #071848ba,0 4px 9px #06103966;background:#112f94b0}
#race .control.drift{background:linear-gradient(150deg,#1687e2bc,#173eaae3)}
#race .control.boost{background:linear-gradient(#ffd52add,#f34420e8)}
#race .control.pressed,#race .control:active{background:#ffc132;box-shadow:0 1px 0 #071848}
#race .item-group button{border-width:2px;background:#193b97c4}
#race-mini-map{opacity:.87}
.podium-screen.active .podium-person{animation:cheer .58s cubic-bezier(.20,.73,.25,1.3) both;transform-origin:bottom center}
.podium-screen.active .silver .podium-person{animation-delay:.14s}.podium-screen.active .bronze .podium-person{animation-delay:.27s}
.podium-screen.active .podium-trophy{animation:celebrate-trophy 1.7s ease-in-out infinite}
@keyframes cheer{0%{opacity:0;transform:scale(.72) translateY(15px)}100%{opacity:1;transform:scale(1) translateY(0)}}
@keyframes celebrate-trophy{50%{transform:translateY(-5px) rotate(6deg)}}
@media(prefers-reduced-motion:reduce){.podium-screen.active .podium-person,.podium-screen.active .podium-trophy{animation:none}}
/* The posed celebration art has a short entrance and a restrained victory bounce. */
@media(prefers-reduced-motion:no-preference){
 .podium-screen.active .gold .podium-person{animation:cheer .58s cubic-bezier(.20,.73,.25,1.3) both, victory-hop 1.6s .65s ease-in-out infinite}
 .podium-screen.active .silver .podium-person{animation:cheer .58s .14s both, victory-sway 2.15s .9s ease-in-out infinite}
 .podium-screen.active .bronze .podium-person{animation:cheer .58s .27s both, victory-sway 2.15s 1.25s ease-in-out infinite}
}
@keyframes victory-hop{0%,100%{transform:translateY(0) scale(1)}35%{transform:translateY(-5px) scale(1.025,1.015)}70%{transform:translateY(0) scale(1.018,.99)}}
@keyframes victory-sway{0%,100%{transform:rotate(-1deg)}50%{transform:rotate(1.6deg)}}

/* V4.6 — a real character-select screen, styled like a 32-bit arcade roster. */
.garage-screen:before{background:linear-gradient(110deg,#06132bef 0%,#091938d9 47%,#08234878 100%)}
.garage-frame{max-width:1320px;gap:12px;padding:14px 18px}
.garage-heading{text-align:center}.garage-heading>span{display:block;font-size:9px;letter-spacing:2.6px;font-weight:900;color:#99c4f7;margin-bottom:4px}
.garage-header h1{font-style:italic;letter-spacing:-1.2px;color:#fff2cb;text-shadow:3px 3px #0a1944,4px 4px #b16a25}
.garage-kicker{text-align:right;line-height:1.5;letter-spacing:1.2px}
.garage-layout{grid-template-columns:1.54fr 1fr;gap:14px}
.driver-grid{gap:8px;counter-reset:pilot}
.driver-card{--accent:#548cf2;position:relative;isolation:isolate;counter-increment:pilot;border:2px solid #7692ba;border-radius:8px;padding:8px 2px 5px;background:linear-gradient(145deg,color-mix(in srgb,var(--accent) 39%,#101d3e),#0b1a3a 76%);box-shadow:inset 0 0 0 2px #08173099,0 4px 0 #020a1f;transition:transform .12s,border-color .12s,background .12s}
.driver-card:before{content:counter(pilot,decimal-leading-zero);position:absolute;top:3px;left:4px;color:#e1ebffbc;font-size:8px;font-weight:1000;letter-spacing:1px;z-index:2}
.driver-card:after{content:'';position:absolute;top:0;right:-29%;width:67%;height:150%;transform:rotate(24deg);background:repeating-linear-gradient(0deg,transparent 0 11px,var(--accent) 11px 13px);opacity:.19;z-index:-1}
.driver-card:nth-child(2){--accent:#ff9a37}.driver-card:nth-child(3){--accent:#39cd76}.driver-card:nth-child(4){--accent:#b981ef}.driver-card:nth-child(5){--accent:#ff665f}.driver-card:nth-child(6){--accent:#36d8ee}.driver-card:nth-child(7){--accent:#ffc448}.driver-card:nth-child(8){--accent:#ff69b8}.driver-card:nth-child(9){--accent:#d687f4}.driver-card:nth-child(10){--accent:#b39aff}
.driver-card img{width:105%;filter:drop-shadow(0 4px 0 #050d37ab)}
.driver-card span{width:100%;text-align:center;background:#08172bc4;padding:4px 0 2px;letter-spacing:.25px;border-bottom:2px solid var(--accent);border-radius:3px}
.driver-card.selected{background:linear-gradient(155deg,#f7dc80 0%,color-mix(in srgb,var(--accent) 55%,#72572e) 70%);border:2px solid #ffe68a;box-shadow:0 0 0 2px #fff0b6,0 4px 0 #7b4a16;transform:translateY(-2px)}
.driver-card.selected:before{color:#162849}.driver-card.selected:after{opacity:.52}
.driver-detail{--hero:#548cf2;background:linear-gradient(155deg,#102c56f0,#06142dea 77%);position:relative;border:2px solid #e4be62;border-radius:10px;padding:10px 13px;gap:5px;box-shadow:inset 0 0 0 3px #172c4e,5px 6px #020b1e}
.driver-detail[data-pilot='1']{--hero:#ff9a37}.driver-detail[data-pilot='2']{--hero:#39cd76}.driver-detail[data-pilot='3']{--hero:#b981ef}.driver-detail[data-pilot='4']{--hero:#ff665f}.driver-detail[data-pilot='5']{--hero:#36d8ee}.driver-detail[data-pilot='6']{--hero:#ffc448}.driver-detail[data-pilot='7']{--hero:#ff69b8}.driver-detail[data-pilot='8']{--hero:#d687f4}.driver-detail[data-pilot='9']{--hero:#b39aff}
.driver-id{display:flex;justify-content:space-between;align-items:center;font-size:9px;font-weight:1000;letter-spacing:1px;color:#bed9ff}.driver-id span:last-child{background:var(--hero);color:#091b36;border-radius:3px;padding:3px 6px}
.driver-title{text-align:left;letter-spacing:-1.2px;color:#fff4d1;font-size:clamp(26px,5vw,48px);text-shadow:3px 3px #071229,4px 4px var(--hero)}
.driver-platform{background:radial-gradient(ellipse at 50% 76%,color-mix(in srgb,var(--hero) 39%,transparent),transparent 65%);border-radius:6px;overflow:hidden;min-height:70px}
.driver-platform:before{bottom:5%;width:80%;height:20%;border:2px solid #c2d1ed;background:repeating-conic-gradient(#dde6eeb0 0 25%,#526b9170 25% 50%) 0 0/22px 22px;box-shadow:0 4px #172e4d,0 0 15px color-mix(in srgb,var(--hero) 50%,transparent)}
.driver-watermark{position:absolute;z-index:-2;top:0;right:10%;font-size:clamp(60px,15vw,150px);font-weight:1000;font-style:italic;line-height:1;color:color-mix(in srgb,var(--hero) 34%,transparent)}
.driver-platform img{height:95%;width:100%;object-fit:contain;object-position:center;filter:drop-shadow(0 4px 0 #0008);z-index:1}
.pilot-arrow,.pilot-view{position:absolute;z-index:3;border:1px solid #b4d2ff;border-radius:5px;background:#091c43d9;color:#fff;font-size:12px;font-weight:900;box-shadow:0 2px #020b20;min-width:30px;min-height:30px;cursor:pointer}.pilot-arrow{top:42%}.pilot-arrow.prev{left:2px}.pilot-arrow.next{right:2px}.pilot-view{bottom:2px;right:2px;font-size:9px;padding:3px 5px;min-height:24px}
.driver-description{font-size:10px;line-height:1.2;color:#c8ddff;white-space:normal;min-height:12px;font-weight:700}
.driver-stats{gap:5px}.driver-stats>div{font-size:10px;letter-spacing:.35px}.stat-meter{height:10px}.stat-meter i{border-radius:1px;transform:skew(-8deg)}
.driver-detail .arcade-btn{font-size:clamp(11px,1.8vw,17px);min-height:38px;letter-spacing:.15px}.garage-footer{background:#06152bc2;border-top:1px solid #52688a;padding:6px 8px;border-radius:0;color:#c1d5f6}
@media(orientation:portrait){.garage-frame{padding:12px 10px;gap:9px}.garage-layout{grid-template-columns:1fr;grid-template-rows:minmax(0,.88fr) minmax(0,1.12fr);gap:10px}.garage-heading>span{font-size:7px;letter-spacing:1px}.garage-header h1{font-size:22px;letter-spacing:-.7px}.driver-grid{gap:5px}.driver-card{padding:8px 1px 2px}.driver-card span{font-size:8px;letter-spacing:0;padding:2px 0}.driver-detail{padding:8px 10px;gap:5px}.driver-title{font-size:32px}.driver-watermark{font-size:120px}.driver-id{font-size:9px}.driver-description{font-size:11px}.driver-detail .arcade-btn{font-size:15px;min-height:44px}.garage-footer{font-size:8px}}
@media(max-height:490px) and (orientation:landscape){.garage-frame{padding:7px 12px;gap:7px}.garage-heading>span{font-size:7px;line-height:1;margin-bottom:2px;letter-spacing:1.5px}.garage-header h1{font-size:26px}.garage-layout{gap:12px}.driver-detail{padding:6px 9px;gap:3px}.driver-title{font-size:27px}.driver-id{font-size:8px}.driver-description{font-size:9px}.driver-stats{gap:3px}.driver-stats>div{font-size:9px}.stat-meter{height:9px}.driver-detail .arcade-btn{min-height:31px;padding:4px}.driver-grid{gap:6px}.driver-card span{font-size:10px}.garage-footer{padding:3px 6px}}
@media(prefers-reduced-motion:no-preference){.garage-screen.active .driver-card.selected img{animation:garage-focus .22s ease-out both}.garage-screen.active .driver-platform img{animation:garage-focus .27s ease-out both}}@keyframes garage-focus{0%{transform:scale(.94);opacity:.8}100%{transform:scale(1);opacity:1}}

/* V11 Grand Prix — the front end is now a complete racing game flow. */
.title-scene{background:#081b45;overflow:hidden}
.title-illustration{object-fit:cover;object-position:center;max-height:none;transform:none}
.title-scene:after{inset:0;background:linear-gradient(90deg,#05153044,transparent 65%),linear-gradient(0deg,#071434de 0,transparent 30%)}
.title-edition{position:absolute;z-index:2;left:5.5%;bottom:27%;display:flex;flex-direction:column;align-items:flex-start;gap:4px;color:#fff2c5;text-shadow:2px 2px #142044;pointer-events:none}
.title-edition b{font-style:italic;font-size:clamp(15px,2.9vw,31px);letter-spacing:5px;border-top:3px solid #ffe363;border-bottom:2px solid #ffe363;background:#0d2454b3;padding:3px 9px;transform:skew(-7deg)}
.title-edition span{font-size:clamp(8px,1.15vw,12px);font-weight:900;letter-spacing:1.3px}
.title-actions{left:5.5%;transform:none;bottom:10%;width:min(440px,45%);gap:12px}
.title-version{left:5.5%;bottom:2.2%;font-size:9px;letter-spacing:1.5px}
.garage-screen,.options-screen,.circuit-screen{background:#071632 url('assets/paddock-v110.webp') center/cover no-repeat;isolation:isolate}
.garage-screen:before{background:linear-gradient(90deg,#061329cb,#03163333 64%,#00132944)}
.garage-layout{grid-template-columns:1.45fr 1fr;gap:16px}
.driver-detail{background:linear-gradient(#051a3ac2,#07183045 55%,#071830cc);border:2px solid #f5cb65;box-shadow:0 5px 0 #020b1e,0 0 20px #0d173e44}
.driver-platform{background:radial-gradient(ellipse at 50% 80%,#e4bb5a29,transparent 66%);overflow:visible}
.driver-platform:before{height:19%;bottom:5%;background:linear-gradient(170deg,#b5b9bbd9,#505a6de8);border:3px solid #eedba2;box-shadow:0 5px 0 #1b2b49,inset 0 0 0 5px #63728b,0 0 15px #ffcf5e4d}
.driver-platform img{object-position:center bottom;max-height:98%;width:86%;filter:drop-shadow(0 5px 2px #050c25b8)}
.turntable-indicator{position:absolute;left:3px;bottom:1px;font-size:8px;font-weight:900;letter-spacing:.7px;color:#ffde7e;z-index:2}
.pilot-view{z-index:3}
.circuit-screen{overflow:auto;background-position:center}
.circuit-frame{height:100%;max-width:1160px;padding:clamp(8px,1.8vh,18px) max(14px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));margin:auto;display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:10px;background:linear-gradient(180deg,#081838b8,#0816323d);}
.circuit-header{display:flex;align-items:center;justify-content:space-between;gap:10px}
.circuit-header h1{font-size:clamp(26px,4vw,43px);font-weight:1000;font-style:italic;margin:0;text-align:center;color:#fff0c8;line-height:1;text-shadow:3px 3px #0a153f}
.circuit-count{text-align:right;font-size:10px;font-weight:1000;color:#d7e5f7;line-height:1.1;white-space:nowrap}.circuit-count b{color:#ffdd49;font-size:22px}
.circuit-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:11px;min-height:0}
.pista-card{min-width:0;min-height:0;background:#082052;border:3px solid #f4e1a5;border-radius:9px;display:grid;grid-template-rows:auto minmax(0,1fr) auto;overflow:hidden;padding:0;text-align:left;box-shadow:0 4px #041027;position:relative;transition:transform .12s,box-shadow .12s}
.pista-top{display:flex;align-items:center;gap:7px;padding:4px 7px;background:repeating-linear-gradient(135deg,#132a61 0 10px,#0c2053 10px 20px);font-style:italic;font-weight:1000;letter-spacing:.1px;line-height:1;color:#fff1cf;white-space:nowrap}
.pista-top b{background:#ffdd45;color:#112653;padding:4px 8px;transform:skew(-7deg);font-size:clamp(13px,2vw,23px);box-shadow:2px 2px #0b163a}.pista-top strong{font-size:clamp(12px,2.15vw,23px);overflow:hidden;text-overflow:ellipsis}.pista-top>span{margin-left:auto;font-size:clamp(15px,2.1vw,25px);background:#b62e3f;width:34px;text-align:center;line-height:1.2;border:1px solid #ffdd6e;border-radius:4px}
.pista-art{position:relative;overflow:hidden;min-height:0;background:#163066}.pista-art img{width:100%;height:100%;object-fit:cover;object-position:center 51%;display:block;transition:filter .18s}
.pista-lock,.pista-ready{position:absolute;top:8px;right:8px;display:block;color:#fff3d2;background:#081b43df;border:1px solid #f8e4a1;box-shadow:2px 2px #06153a;padding:5px 7px;border-radius:4px;font-weight:1000;font-size:clamp(9px,1.35vw,14px);letter-spacing:.5px}
.pista-lock{background:#08172ce8}.pista-card.locked .pista-art img{filter:saturate(.65) brightness(.66)}.pista-card.locked{border-color:#a8b6c6}.pista-card.locked:hover .pista-art img,.pista-card.locked:focus-visible .pista-art img{filter:saturate(.94) brightness(.86)}
.pista-ready{background:#164f43;color:#ebffde;border-color:#a4ffbd}
.pista-bottom{min-width:0;display:flex;align-items:center;justify-content:space-between;gap:7px;padding:6px 8px;font-weight:800;font-size:clamp(9px,1.25vw,13px);color:#dbe6f4;line-height:1.12;background:#0a1c46}
.pista-bottom b{color:#b3c7e2;font-size:9px;white-space:nowrap}.pista-card.available .pista-bottom b{color:#ffdf4d}
.pista-card.selected{border-color:#ffdd4c;box-shadow:0 0 0 2px #fff2bf,0 4px #5f431e,0 0 21px #ffd43a55}.pista-card.selected .pista-top{background:#123777}.pista-card.available:hover{transform:translateY(-1px)}
.circuit-footer{display:flex;justify-content:space-between;align-items:center;gap:9px;padding:4px 0 1px}.circuit-selection{display:flex;flex-direction:column;font-weight:900;gap:2px;min-width:0}.circuit-selection span{font-size:9px;color:#ffdc72;letter-spacing:.5px}.circuit-selection strong{font-size:clamp(13px,2vw,21px);color:#fff9dc;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.circuit-footer .primary{min-width:34%;font-size:clamp(15px,2.2vw,24px);min-height:42px}
@media(orientation:portrait){.title-scene{justify-content:flex-start}.title-illustration{height:62%;width:100%;object-fit:cover;object-position:58% center}.title-scene:after{inset:0;background:linear-gradient(0deg,#071632 29%,transparent 54%)}.title-edition{left:50%;transform:translateX(-50%);bottom:33%;align-items:center;width:90%;text-align:center}.title-edition b{font-size:25px}.title-edition span{font-size:9px;letter-spacing:.6px}.title-actions{left:10%;width:80%;bottom:12%;transform:none}.title-version{left:0;right:0;bottom:4%;text-align:center}.garage-layout{grid-template-columns:1fr;grid-template-rows:minmax(0,.88fr) minmax(0,1.12fr);gap:10px}.circuit-frame{padding:12px 10px;gap:10px}.circuit-header h1{font-size:20px;letter-spacing:-.5px}.circuit-header{gap:5px}.circuit-count{font-size:8px}.circuit-count b{font-size:16px}.circuit-grid{gap:9px}.pista-top{gap:3px;padding:4px}.pista-top b{font-size:13px;padding:4px}.pista-top strong{font-size:10px}.pista-top>span{width:21px;font-size:13px}.pista-bottom{display:block;font-size:10px;min-height:39px}.pista-bottom b{display:none}.pista-lock,.pista-ready{font-size:8px;top:5px;right:5px;padding:4px}.circuit-footer .primary{min-width:36%;padding:7px 9px}.circuit-selection span{font-size:8px}.circuit-selection strong{font-size:12px}}
@media(max-height:490px) and (orientation:landscape){.title-actions{bottom:9%;width:43%}.title-edition{bottom:29%}.title-edition b{font-size:21px}.title-edition span{font-size:9px;letter-spacing:.6px}.title-actions .arcade-btn{min-height:37px;font-size:17px;padding:5px 10px}.circuit-frame{gap:6px;padding:6px 12px 8px}.circuit-header h1{font-size:24px}.circuit-count{font-size:8px}.circuit-count b{font-size:17px}.circuit-grid{gap:7px}.pista-top{padding:2px 5px}.pista-top b{font-size:14px;padding:3px 6px}.pista-top strong{font-size:15px}.pista-top>span{font-size:16px;width:25px}.pista-bottom{padding:4px 5px;font-size:9px}.pista-lock,.pista-ready{top:5px;right:6px;padding:3px 5px;font-size:9px}.circuit-footer .primary{min-height:33px;padding:4px 10px;font-size:16px}.circuit-selection strong{font-size:13px}.circuit-selection span{font-size:8px}.garage-layout{gap:8px}}
@media(prefers-reduced-motion:no-preference){.screen.active .title-edition{animation:title-reveal .5s ease-out both}.screen.active .title-actions{animation:title-reveal .55s .13s ease-out both}.pista-ready{animation:ready-glow 2.6s ease-in-out infinite}@keyframes title-reveal{from{opacity:0;translate:0 8px}to{opacity:1;translate:0 0}}@keyframes ready-glow{50%{box-shadow:0 0 12px #76ff8055}}}
/* Race messages live in distinct regions, leaving the road and karts visible. */
#race-message:not(.sector-alert){font-size:clamp(24px,4.5vw,45px);top:29%}
#pass-toast{left:12px;right:auto;top:112px;max-width:215px;transform:translate(0,-8px) scale(.92)}
#pass-toast.visible{transform:translate(0,0) scale(1)}
@media(max-height:490px) and (orientation:landscape){#pass-toast{top:83px;left:8px;max-width:180px}#race-message:not(.sector-alert){top:30%;font-size:28px}}
@media(orientation:portrait){#pass-toast{top:155px;left:8px;max-width:175px}#race-message:not(.sector-alert){top:32%;font-size:26px}.title-illustration{object-fit:contain;object-position:center top;height:62%}.title-scene:after{background:linear-gradient(0deg,#071632 40%,transparent 85%)}}
/* V12: a quieter title treatment, grounded turntable and clearer mode choice. */
.title-sparkles{position:absolute;inset:0;pointer-events:none;z-index:2}
.title-sparkles i{position:absolute;width:12px;height:12px;background:#fff5bf;clip-path:polygon(50% 0,60% 40%,100% 50%,60% 60%,50% 100%,40% 60%,0 50%,40% 40%);opacity:0;animation:star-flash 5.2s infinite}
.title-sparkles i:nth-child(1){left:15%;top:15%}.title-sparkles i:nth-child(2){left:43%;top:9%;animation-delay:1s}.title-sparkles i:nth-child(3){left:32%;top:23%;animation-delay:2.2s}.title-sparkles i:nth-child(4){left:76%;top:33%;animation-delay:3.1s}.title-sparkles i:nth-child(5){left:60%;top:43%;animation-delay:4s}
@keyframes star-flash{0%,20%,100%{opacity:0;transform:scale(.3)}8%{opacity:.9;transform:scale(1.5)}}
.sound-pill{position:absolute;z-index:4;top:max(12px,env(safe-area-inset-top));right:max(12px,env(safe-area-inset-right));border:1px solid #ffdb67;background:#081c47dd;color:#fff1b5;border-radius:30px;padding:8px 13px;font:900 11px/1 system-ui;letter-spacing:.5px;box-shadow:0 3px #030d2a}
.kart-turntable{position:absolute;inset:1% 7% 3%;z-index:1;pointer-events:none}
.driver-platform .kart-turntable img{position:absolute;inset:0;width:100%;height:100%;max-width:none;max-height:100%;object-fit:contain;object-position:center bottom;transform-origin:50% 100%;animation:none!important;filter:drop-shadow(0 5px 2px #050c25b8)}
#selected-kart-next{opacity:0}
.kart-turntable{container-type:size;--kart-ratio:1}
.garage-exhaust{position:absolute;left:50%;bottom:0;transform:translateX(-50%);z-index:0;width:100%;height:100%;pointer-events:none;--emit-x:18%;--emit-y:79%;--smoke-drift:-36px;--smoke-lift:-13px;--puff:17px}
@supports(width:1cqw){.garage-exhaust{width:min(100%,calc(100cqh * var(--kart-ratio)));height:min(100%,calc(100cqw / var(--kart-ratio)));--puff:clamp(10px,4.6cqh,24px);--smoke-drift:calc(var(--puff) * -2.4);--smoke-lift:calc(var(--puff) * -.55)}}
.garage-exhaust i{position:absolute;left:var(--emit-x);top:var(--emit-y);width:var(--puff);height:calc(var(--puff) * .72);margin-left:calc(var(--puff) * -.5);margin-top:calc(var(--puff) * -.36);background:#c4d1df;clip-path:polygon(0 33%,16% 33%,16% 12%,42% 12%,42% 0,72% 0,72% 17%,94% 17%,94% 42%,100% 42%,100% 73%,80% 73%,80% 97%,38% 97%,38% 84%,13% 84%,13% 65%,0 65%);opacity:0;animation:garage-puff 1.65s linear infinite}
.garage-exhaust i:nth-child(2){animation-delay:-.33s;background:#9aaec5}.garage-exhaust i:nth-child(3){animation-delay:-.66s}.garage-exhaust i:nth-child(4){animation-delay:-.99s;background:#9aaec5}.garage-exhaust i:nth-child(5){animation-delay:-1.32s}
.kart-turntable[data-view="left"] .garage-exhaust{--emit-x:25%;--emit-y:86%;--smoke-drift:calc(var(--puff) * -2.2);--smoke-lift:calc(var(--puff) * .16)}
.kart-turntable[data-view="right"] .garage-exhaust{--emit-x:75%;--emit-y:86%;--smoke-drift:calc(var(--puff) * 2.2);--smoke-lift:calc(var(--puff) * .16)}
.kart-turntable[data-view="rear"] .garage-exhaust{--emit-x:50%;--emit-y:90%;--smoke-drift:calc(var(--puff) * -1.35);--smoke-lift:calc(var(--puff) * .82)}
.kart-turntable[data-view="rear"] .garage-exhaust i:nth-child(even){--smoke-drift:calc(var(--puff) * 1.35)}
.driver-detail[data-pilot="0"] .kart-turntable[data-view="left"]{--kart-ratio:1.07042}.driver-detail[data-pilot="0"] .kart-turntable[data-view="right"]{--kart-ratio:1.01604}.driver-detail[data-pilot="0"] .kart-turntable[data-view="rear"]{--kart-ratio:.86579}
.driver-detail[data-pilot="0"] .kart-turntable[data-view="left"] .garage-exhaust{--emit-x:76%;--emit-y:88%;--smoke-drift:calc(var(--puff) * 2.2)}
.driver-detail[data-pilot="0"] .kart-turntable[data-view="right"] .garage-exhaust{--emit-x:27%;--emit-y:88%;--smoke-drift:calc(var(--puff) * -2.2)}
@keyframes garage-puff{0%{opacity:0;transform:translate(0,0) scale(.48)}15%{opacity:.65}70%{opacity:.28}100%{opacity:0;transform:translate(var(--smoke-drift),var(--smoke-lift)) scale(1.6)}}
@media(prefers-reduced-motion:reduce){.garage-exhaust i{animation:none}}
.pista-card.locked .pista-lock{top:50%;left:50%;right:auto;transform:translate(-50%,-50%);min-width:53%;padding:7px 12px;text-align:center;line-height:1.2;color:#ffdf79;font-size:clamp(10px,1.6vw,19px);background:#071932ee;border:2px solid #d0c08b;box-shadow:0 4px 0 #07132e}
.pista-lock small{color:#fff5d7;font-size:.74em;letter-spacing:1.5px}
.mode-picker{display:flex;gap:4px;flex:1;justify-content:center;min-width:0}
.mode-picker button{border:1px solid #9eb3dc;background:#0a2a5c;color:#c7d9f5;border-radius:5px;font:900 clamp(9px,1.25vw,12px)/1.2 system-ui;padding:7px 8px;white-space:nowrap}
.mode-picker button.selected{background:#ffda4c;color:#132852;border-color:#fff1bd;box-shadow:0 2px #98732b}
.circuit-footer .primary{min-width:0;max-width:36%;font-size:clamp(12px,1.8vw,20px)}
.track-intro{background:#071632 url('assets/track-vila-v110.webp') center/cover no-repeat;overflow:hidden;isolation:isolate}
.intro-shade{position:absolute;inset:0;background:linear-gradient(90deg,#031329e8,#081e42a3 55%,#04152c55);z-index:-1}
.intro-panel{height:100%;min-height:0;overflow:auto;display:flex;flex-direction:column;align-items:center;justify-content:safe center;gap:clamp(4px,1.45vh,13px);padding:10px 19px;text-align:center;color:#fff5d6}
.intro-panel>span{font-size:11px;font-weight:1000;letter-spacing:2px;color:#f9d44d}
.intro-panel h1{margin:0;font-size:clamp(30px,6vw,60px);font-weight:1000;font-style:italic;text-shadow:4px 4px #06172d;line-height:1}
.intro-panel p{margin:0;font:900 13px/1.1 system-ui;letter-spacing:1px}
.intro-panel canvas{height:clamp(75px,27vh,180px);width:auto;max-width:90%;background:#071937e6;border:2px solid #f0ce65;border-radius:10px}
.intro-sectors{font:800 clamp(8px,1.5vw,12px)/1.4 system-ui;letter-spacing:.3px;color:#d3e4ff}
.intro-panel>strong{font-size:13px;color:#ffdd62}.intro-panel>small{font-size:9px;font-weight:800;color:#d7e5f7}
.intro-panel .primary{max-width:320px;min-height:35px;font-size:19px}
.hud-left{position:relative}
.best-lap-hud{display:block;position:absolute;left:0;top:calc(100% + 3px);padding:4px 6px;border-radius:3px;background:#091d49cc;color:#ffedaa;white-space:nowrap;font:900 8px/1 system-ui;letter-spacing:.2px}
.history-panel{width:min(620px,92%)}.history-list{min-height:70px;max-height:50dvh;overflow:auto;text-align:left;display:grid;gap:5px}
.history-entry{display:flex;justify-content:space-between;gap:12px;background:#061936b8;border:1px solid #6284bd;border-radius:5px;padding:8px 10px}
.history-entry span{display:flex;flex-direction:column;gap:3px}.history-entry span:last-child{text-align:right}.history-entry b{font-size:12px;color:#fff1b7}.history-entry strong{font-size:16px;color:#ffe151}.history-entry small{font-size:9px;color:#c4d5ed}
.time-trial .podium-slot.silver,.time-trial .podium-slot.bronze{display:none}
.time-trial .podium-slot.gold{width:36%;max-width:280px}
.time-trial .podium-block b{display:none}
.time-trial .podium-trophy{display:none}
.podium-person[data-pilot="nuno"],.podium-person[data-pilot="chico"]{animation-duration:1.15s}
.podium-person[data-pilot="fred"],.podium-person[data-pilot="mariah"]{animation-duration:1.8s;animation-delay:.12s}
@media(orientation:portrait){.circuit-footer{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px}.circuit-footer .mode-picker{grid-column:1/-1;grid-row:1;justify-content:stretch}.mode-picker button{flex:1;padding:9px}.circuit-footer .primary{max-width:none}.intro-panel canvas{max-width:95%;height:auto;width:90%}.intro-sectors{max-width:90%}.sound-pill{font-size:10px}}
@media(max-height:490px) and (orientation:landscape){.intro-panel{gap:4px}.intro-panel h1{font-size:32px}.intro-panel canvas{height:25vh}.intro-panel>span,.intro-panel p,.intro-panel>strong{font-size:10px}.intro-panel .primary{min-height:29px;font-size:15px}.mode-picker button{padding:5px}.best-lap-hud{font-size:7px}}
@media(prefers-reduced-motion:reduce){.title-sparkles{display:none}}
/* V13: gameplay polish, assisted mode, records, replay and trophies. */
#track-difficulty{align-self:flex-start;border:1px solid #8fa6d5;border-radius:4px;color:#ffe082;background:#102957;font:900 10px/1.15 system-ui;padding:4px 7px}
#intro-visual{position:absolute;inset:0;background-size:cover;background-position:center;z-index:-2;animation:intro-pan 6s linear both}
@keyframes intro-pan{from{transform:scale(1)}to{transform:scale(1.09)}}
.intro-shade{background:linear-gradient(90deg,#031329eb 0%,#081e42aa 45%,#04152c40)}
.intro-timeline{width:min(230px,70%);height:5px;border-radius:3px;background:#96b5ea43;overflow:hidden}.intro-timeline i{display:block;height:100%;background:#ffdc59;width:0;transition:width .13s linear}
#intro-scene-name{color:#ffdd65;font-size:1.15em}#intro-counter{color:#c0d5ee}
#ghost-status{position:absolute;z-index:3;bottom:22%;left:50%;transform:translateX(-50%);background:#102552cf;color:#b9f3ff;padding:4px 9px;border-radius:4px;font-size:clamp(8px,1.2vw,12px);font-weight:900;white-space:nowrap;pointer-events:none}
#ghost-status:empty{display:none}
.replay-overlay.active{display:flex;align-items:flex-end;justify-content:center;z-index:9;pointer-events:none;padding:10px}
.replay-banner{display:flex;align-items:center;gap:12px;background:#081b46eb;color:#fff1c7;border:2px solid #ffdb54;border-radius:8px;padding:8px 14px;box-shadow:0 4px #081128;letter-spacing:1px;font-size:11px;pointer-events:auto}
.replay-banner b{color:#ffdf54;font-size:14px}.replay-banner button{min-height:29px;font-size:11px}
#race.replaying #race-hud,#race.replaying #race-message,#race.replaying #pass-toast,#race.replaying #race-mini-map,#race.replaying .race-bottom,#race.replaying #orientation-tip,#race.replaying #ghost-status{visibility:hidden}

/* V14 — premium arcade gauges, full-bleed-safe title and paddock motion. */
.title-scene{max-width:min(100%,177.7778dvh);margin:auto;background:#091d43}
.title-illustration{object-fit:contain;object-position:center top;transform:none;height:100%;max-height:none}
.title-scene:after{background:linear-gradient(90deg,#05153015,transparent 55%),linear-gradient(0deg,#061334b8 0,transparent 24%);pointer-events:none}
.title-edition b,.garage-header h1,.driver-title,.arcade-btn,.driver-card span,.hud-center,.pos strong,.hud-speed strong{font-family:Impact,"Arial Black",system-ui,sans-serif;font-weight:1000;font-style:italic;letter-spacing:.025em}
.title-actions .primary,.driver-detail .primary,.circuit-footer .primary{border:3px solid #fff4bd;border-radius:3px;background:linear-gradient(#ffe773 0 10%,#ffd029 10% 68%,#ff9c1f 68%);clip-path:polygon(5% 0,100% 0,95% 100%,0 100%);box-shadow:inset 0 -6px #e9492c,inset 0 3px #fff9d0;text-shadow:1px 1px #fff0b3;min-height:clamp(42px,8vh,74px)}
.title-actions .primary{font-size:clamp(24px,5vw,57px);letter-spacing:.035em}
.title-actions{flex-direction:column;bottom:6%;gap:clamp(5px,1vh,11px)}
.title-actions .primary{width:100%}
.title-actions .secondary{width:65%;align-self:center;clip-path:polygon(7% 0,100% 0,93% 100%,0 100%);border-radius:2px;border:2px solid #dce8ff;background:linear-gradient(#2678f4,#071e77 80%);box-shadow:inset 0 -4px #041642;font-size:clamp(14px,2.4vw,28px)}
.title-edition{bottom:29%}
.garage-header h1{display:block;background:#fff1ce;color:#071b4b;padding:.13em .42em .20em;clip-path:polygon(4% 0,100% 0,96% 100%,0 100%);text-shadow:none;box-shadow:inset 0 -4px #fbc532}
.driver-card{border-radius:3px;border-width:2px;background:linear-gradient(145deg,color-mix(in srgb,var(--accent) 70%,#172849),#10234d 90%);box-shadow:inset 0 0 0 2px #12224599,0 4px 0 #020a1f}
.driver-card.selected{border-color:#fff5bb;box-shadow:0 0 0 3px #ffcf29,0 0 15px #f8ba3880,0 4px #ad6419}
.driver-card.selected span{background:#051a4c;color:#fff4cc;border-bottom-color:#ffc82a}
.driver-detail{border-radius:3px;border-color:#ffe1a3;background:linear-gradient(#071933db,#07183030 55%,#071830ed)}
.driver-platform:before{border:4px solid #dec59a;box-shadow:0 6px #12223e,inset 0 0 0 5px #63738e,0 0 20px #ffe58a66}
.kart-turntable.bounce-in{animation:pilot-bounce .36s cubic-bezier(.22,.72,.22,1) both;transform-origin:50% 100%}
@keyframes pilot-bounce{0%{transform:translateY(0) scale(.98,.97)}42%{transform:translateY(-4%) scale(1.015)}74%{transform:translateY(0) scale(1.008,.99)}100%{transform:translateY(0) scale(1)}}
#race-hud{filter:none;gap:8px;text-shadow:1px 2px #041334}
#race .pos,#race .hud-speed,#race .hud-icon,#race .hud-lap,#race .hud-sector,#race .hud-coins,#race #time{border-radius:3px;background:linear-gradient(155deg,#183e79eb,#061943f2 78%);border:1px solid #95b5e5;box-shadow:inset 0 -3px #030e2c,0 3px 0 #08133290}
#race .pos{border:2px solid #efcb59;border-left:5px solid #ffcd38;min-width:60px;padding:5px 9px}
#race .pos span{font-size:8px;letter-spacing:1.3px}
#race .hud-coins{border-left:3px solid #ffd42d;padding:4px 8px}
#race .hud-center .race-brand b{font-size:clamp(13px,2.45vw,26px);color:#ffe056}
#race .hud-center .hud-sector{border-left:4px solid #ffda49;padding:4px 9px;letter-spacing:.6px}
#race .hud-lap{border-color:#edc74c;padding:3px 9px;font-size:clamp(9px,1.5vw,13px)}
#race .hud-speed{padding:5px 7px;border-left:3px solid #ffd62d}
#race #time{padding:6px 8px;font-variant-numeric:tabular-nums}
#race-mini-map{border-radius:3px;border:1.5px solid #b3c8ed;background:#071a43d9;box-shadow:0 3px #041334}
#race .control,#race #item-btn{border-radius:5px;border:2px solid #dcf0ff;background:linear-gradient(155deg,#3278c9e8,#0b2c78ec 70%);box-shadow:inset 0 4px #8cc7fa33,inset 0 -6px #071948,0 3px 0 #040e2c;clip-path:polygon(10% 0,100% 0,100% 88%,90% 100%,0 100%,0 12%)}
#race .control:active,#race .control.pressed,#race #item-btn:active{background:linear-gradient(#ffdf6c,#e99123);color:#071b48;border-color:#fff0a0;box-shadow:inset 0 -5px #b44f1c}
#race .boost{background:linear-gradient(160deg,#ffe369,#f29b22 70%);color:#06183f;border-color:#fff2b3;box-shadow:inset 0 3px #fff8bc,inset 0 -6px #b95421,0 3px #071334}
#race .drift-meter,#race .boost-track{border-radius:2px;border:1px solid #d5eaff;height:9px;box-shadow:0 2px #06143a}
#race .drift-label,#race .boost-label,#race .item-group span{font-weight:900;letter-spacing:.7px;color:#fff6d8}
#race .race-bottom{gap:6px}
@media(orientation:landscape){#race .steer{width:clamp(45px,7.5vw,80px);height:clamp(45px,7.5vw,80px)}#race .boost,#race .drift{width:clamp(45px,7vw,78px);height:clamp(45px,7vw,78px)}#race #item-btn{width:clamp(39px,5.6vw,62px);height:clamp(39px,5.6vw,62px)}}
@media(orientation:portrait){.title-scene{max-width:100%;width:100%;height:100%}.title-illustration{width:100%;height:56%;object-fit:contain;object-position:center top}.title-scene:after{background:linear-gradient(0deg,#071632 42%,transparent 78%)}.title-edition{bottom:35%}.title-actions{bottom:11%}.title-actions .secondary{width:65%}#race .hud-right{gap:3px;flex-direction:row;flex-wrap:wrap;justify-content:flex-end}#race .pos{min-width:50px;padding:3px 5px}#race #time{font-size:11px;padding:4px}#race .hud-center .hud-sector{padding:3px 4px}#race .hud-coins{padding:3px}#race .control{max-width:76px;max-height:76px}}
@media(prefers-reduced-motion:reduce){.kart-turntable.bounce-in{animation:none}}
@media(max-height:490px) and (orientation:landscape){.title-actions .primary{min-height:36px;font-size:clamp(22px,4.1vw,34px);padding:4px}.title-actions .secondary{min-height:30px;font-size:16px;padding:3px}.title-edition{bottom:32%}.driver-detail .primary,.circuit-footer .primary{min-height:34px}}
.my-rank{border-color:#ffdd55;background:#173a70}.history-entry.earned{border-color:#e2bf50;background:#183653}.locked-award{opacity:.65}
#result-awards{color:#ffde70;font:900 clamp(8px,1.2vw,12px)/1.1 system-ui;text-align:center;min-height:0;max-height:2.4em;overflow:hidden;grid-column:1/-1;grid-row:2}
#result-awards:empty{display:none}
.podium-actions{flex-wrap:wrap;gap:5px}.podium-actions .arcade-btn{flex:1 1 20%;min-width:0;white-space:normal;min-height:30px;line-height:1.1}
@media(orientation:portrait){.podium-actions .arcade-btn{flex:1 1 42%}#ghost-status{bottom:20%}.replay-banner{gap:7px;letter-spacing:.25px}.replay-banner span{font-size:9px}}
@media(max-height:490px) and (orientation:landscape){.podium-actions .arcade-btn{min-height:26px;font-size:10px}.intro-timeline{height:4px}#track-difficulty{font-size:8px;padding:3px 5px}}
@media(prefers-reduced-motion:reduce){#intro-visual{animation:none}}
/* V15 — race telemetry and podium refinement */
@font-face{font-family:Vila Arcade;src:url('assets/vila-arcade.ttf') format('truetype');font-weight:400;font-display:swap}
.garage-header h1,.circuit-header h1,.driver-title,.title-actions .primary,.driver-detail .primary,.circuit-footer .primary,.podium-header h1{font-family:Vila Arcade,Impact,sans-serif;font-weight:400;font-style:italic;letter-spacing:-.035em;-webkit-text-stroke:0}
.garage-header h1,.circuit-header h1{font-size:clamp(18px,3.2vw,38px)}
.driver-title{font-size:clamp(23px,3.5vw,39px)}
.driver-detail .primary,.circuit-footer .primary{font-size:clamp(13px,2vw,23px)}
.title-actions .primary{font-size:clamp(27px,4.7vw,51px)}
@media(orientation:portrait){.garage-header h1,.circuit-header h1{font-size:clamp(13px,4.3vw,23px)}.driver-title{font-size:26px}}
@media(max-height:490px) and (orientation:landscape){.garage-header h1,.circuit-header h1{font-size:clamp(15px,3vw,25px)}.title-actions .primary{font-size:clamp(21px,4vw,32px)}.driver-detail .primary,.circuit-footer .primary{font-size:clamp(12px,1.85vw,20px)}}
.garage-kicker b{display:block;color:#ffcf48;font-size:clamp(11px,1.7vw,21px);font-style:italic;white-space:nowrap}
.driver-card:not(.selected){transition:filter .14s,transform .14s}
.driver-card.selected:after{content:"";position:absolute;inset:3px;border:2px solid #fff2a866;pointer-events:none}
#stat-control i.on{background:#28de9d;border-color:#abffcf;box-shadow:inset 0 3px #afffcd66}
#stat-turbo i.on{background:#2dd5ff;border-color:#b3f5ff;box-shadow:inset 0 3px #e2ffff66}
#stat-speed i.on{background:#ffcb27;border-color:#fff6c3}
.driver-id{letter-spacing:1.1px}
#race .race-progress{height:3px;margin-top:4px;background:#7794c34d;overflow:hidden}
#lap-progress-fill{height:100%;width:0;display:block;background:#ffd141;transition:width .12s linear}
.sector-changed{animation:sector-shimmer .52s ease-out}
@keyframes sector-shimmer{0%{filter:brightness(1.8);transform:translateY(-3px)}100%{filter:brightness(1);transform:none}}
#drive-feedback{position:absolute;z-index:5;right:max(14px,env(safe-area-inset-right));bottom:clamp(115px,15vw,155px);font:900 clamp(10px,1.5vw,15px)/1.1 Impact,"Arial Black",sans-serif;letter-spacing:1px;color:#baf8ff;background:#071e4ce6;border-left:3px solid #3de1ff;padding:5px 9px;text-shadow:1px 2px #07152c;pointer-events:none}
#drive-feedback:empty{display:none}
#race.replaying #drive-feedback{visibility:hidden}
#race[data-drift="2"] .drift-meter{box-shadow:0 0 10px #1de5ff,0 2px #06143a}
#race[data-drift="1"] #drift-fill{background:#ffc74c}
#race[data-drift="2"] #drift-fill{background:#56eaff}
#race[data-drift="3"] #drift-fill{background:#f5a0ff}
#race[data-drift="3"] .drift-meter{box-shadow:0 0 12px #e993ff,0 2px #06143a}
#race[data-boost="1"] #boost-btn{filter:brightness(1.15);box-shadow:inset 0 -6px #a95b10,0 0 16px #ffd84e}
.podium-frame{position:relative;isolation:isolate}
.podium-header h1{font-family:Impact,"Arial Black",sans-serif;letter-spacing:.035em}
#result-laps{font:800 clamp(9px,1.2vw,12px)/1.15 system-ui;letter-spacing:.45px;color:#e4efff;background:#071b42b3;display:inline-block;padding:3px 9px;border-radius:3px}
.podium-confetti{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:-1;display:none}
#result[data-outcome="victory"] .podium-confetti,#result[data-outcome="podium"] .podium-confetti,#result[data-outcome="record"] .podium-confetti{display:block}
.podium-confetti i{position:absolute;left:var(--x);top:-10px;background:var(--c,#ffd741);width:8px;height:4px;animation:confetti-fall 3.5s linear infinite;animation-delay:var(--d,0s)}
.podium-confetti i:nth-child(1){--x:5%;--d:-1.2s}.podium-confetti i:nth-child(2){--x:13%;--c:#38bfff;--d:-.2s}.podium-confetti i:nth-child(3){--x:21%;--c:#ff6389;--d:-2.2s}.podium-confetti i:nth-child(4){--x:29%;--d:-.7s}.podium-confetti i:nth-child(5){--x:38%;--c:#62ffb5;--d:-3s}.podium-confetti i:nth-child(6){--x:47%;--d:-1.6s}.podium-confetti i:nth-child(7){--x:56%;--c:#ff6389;--d:-2.4s}.podium-confetti i:nth-child(8){--x:65%;--c:#38bfff;--d:-.4s}.podium-confetti i:nth-child(9){--x:73%;--d:-2.9s}.podium-confetti i:nth-child(10){--x:81%;--c:#62ffb5;--d:-1.2s}.podium-confetti i:nth-child(11){--x:89%;--c:#ff6389;--d:-.9s}.podium-confetti i:nth-child(12){--x:96%;--d:-2.6s}
@keyframes confetti-fall{from{transform:translateY(-20px) rotate(0)}to{transform:translateY(105vh) rotate(540deg)}}
@media(max-height:490px) and (orientation:landscape){#drive-feedback{bottom:103px;font-size:9px;padding:3px 6px}#result-laps{font-size:9px;padding:2px 6px}.podium-header p{margin:2px 0}}
@media(orientation:portrait){#drive-feedback{bottom:130px;right:12px;font-size:10px}}
@media(prefers-reduced-motion:reduce){.sector-changed{animation:none}.podium-confetti{display:none!important}}
/* V16: short race cinematics, records and individual podium performances. */
#intro-visual.scene-cut{animation:sector-cinematic 1s ease-out both}
@keyframes sector-cinematic{0%{transform:scale(1.055);filter:brightness(.74)}100%{transform:scale(1.09);filter:brightness(1)}}
.records-tabs,#record-filters{display:flex;gap:6px;justify-content:center}
#record-filters[hidden]{display:none}
.records-tabs .arcade-btn,#record-filters .arcade-btn{flex:1 1 50%;min-height:29px;font-size:clamp(10px,1.5vw,13px);padding:5px}
.records-tabs button[aria-pressed="true"]{background:#fbd141;color:#071a46;border-color:#fff4bb}
.finish-cinematic{display:none;position:absolute;inset:0;z-index:12;pointer-events:none;overflow:hidden;background:#101d3f;color:#fff5d2;text-align:center}
.finish-cinematic.play{display:grid;align-content:center;justify-items:center;animation:finish-reveal 2.2s ease-in-out both}
.finish-cinematic canvas{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;image-rendering:pixelated;filter:brightness(.72);animation:finish-zoom 2.2s ease-out both}
.finish-cinematic strong,.finish-cinematic span{position:relative;z-index:2;text-shadow:3px 4px #071b43,-2px -2px #071b43;line-height:1}
.finish-cinematic strong{font:900 italic clamp(34px,8vw,80px)/1 Impact,sans-serif;color:#ffd545}
.finish-cinematic span{font:900 clamp(14px,3.4vw,30px)/1.35 system-ui;margin-top:12px}
.finish-stripe{position:absolute;inset:0;border-top:10px solid #ffd545;border-bottom:10px solid #ffd545;background:linear-gradient(transparent 38%,#061632a6 38%,#061632a6 63%,transparent 63%)}
@keyframes finish-zoom{from{transform:scale(1)}to{transform:scale(1.085)}}
@keyframes finish-reveal{0%{opacity:1}65%{opacity:1}99%{opacity:0}100%{opacity:0;visibility:hidden}}
.podium-person[data-pilot="nuno"]{animation:podium-celebrate 1.15s ease-in-out infinite}
.podium-person[data-pilot="chico"],.podium-person[data-pilot="tutu"]{animation:podium-wiggle 1.45s ease-in-out infinite}
.podium-person[data-pilot="guilherme"],.podium-person[data-pilot="tomas"],.podium-person[data-pilot="helena"]{animation:podium-nod 1.7s ease-in-out infinite}
.podium-person[data-pilot="fred"],.podium-person[data-pilot="chimi"]{animation:podium-celebrate .95s ease-in-out infinite}
.podium-person[data-pilot="catarina"],.podium-person[data-pilot="mariah"]{animation:podium-wiggle 1.8s ease-in-out infinite}
@keyframes podium-celebrate{0%,100%{transform:translateY(0)}45%{transform:translateY(-5%) rotate(-2deg)}}
@keyframes podium-wiggle{0%,100%{transform:rotate(-2deg)}50%{transform:translateY(-3%) rotate(2deg)}}
@keyframes podium-nod{0%,100%{transform:translateY(0) scaleY(1)}50%{transform:translateY(-1.5%) scaleY(.985)}}
@media(prefers-reduced-motion:reduce){.finish-cinematic.play{display:none}#intro-visual.scene-cut,.podium-person[data-pilot]{animation:none}}

/* V16.1 — a dedicated portrait composition and invisible steering surface. */
@media(orientation:portrait){
 .title-scene{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:clamp(9px,1.7dvh,16px);padding:max(44px,calc(env(safe-area-inset-top) + 34px)) 0 max(12px,env(safe-area-inset-bottom));overflow:auto;background:#071632}
 .title-scene:before{content:'';position:absolute;inset:0;z-index:-2;background:linear-gradient(180deg,#07163266,#071632d9 44%,#06142bf5 100%),url('assets/vila-cenario.webp') 55% center/cover no-repeat;filter:saturate(.82);pointer-events:none}
 .title-scene:after{inset:0;z-index:-1;background:linear-gradient(145deg,transparent 52%,#3875bd20 52%,#3875bd20 54%,transparent 54%);pointer-events:none}
 .title-illustration{width:100%;height:auto!important;max-height:46dvh;object-fit:contain;object-position:center;flex:0 0 auto;mask-image:linear-gradient(#000 88%,transparent);-webkit-mask-image:linear-gradient(#000 88%,transparent)}
 .title-edition{position:relative;left:auto;bottom:auto;transform:none;width:95%;align-items:center;gap:3px;margin-top:-6px}
 .title-edition b{font-size:clamp(21px,6vw,30px);letter-spacing:1.3px}
 .title-edition span{font-size:clamp(9px,2.5vw,12px);letter-spacing:.5px}
 .title-actions{position:relative;left:auto;bottom:auto;transform:none;width:min(84%,365px);gap:8px}
 .title-actions .primary{flex:none;min-height:clamp(52px,9dvh,72px);font-size:clamp(27px,8vw,39px)}
 .title-actions .secondary{min-height:44px;font-size:clamp(15px,4vw,21px)}
 .title-version{position:relative;left:auto;right:auto;bottom:auto;align-self:center;margin-top:3px;font-size:9px;letter-spacing:1.2px}
 .title-sparkles{display:none}

 .garage-frame{min-height:500px;padding:max(9px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(9px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));gap:7px;grid-template-rows:auto minmax(0,1fr) auto}
 .garage-header{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:7px}
 .garage-header .compact{font-size:11px;padding:5px 8px;min-height:37px}
 .garage-heading>span{font-size:8px;letter-spacing:.8px;margin-bottom:3px}
 .garage-header h1{font-size:clamp(13px,4.25vw,22px);letter-spacing:-.04em;white-space:nowrap;line-height:1.1}
 .garage-layout{grid-template-columns:1fr;grid-template-rows:minmax(145px,37%) minmax(0,1fr);gap:9px}
 .driver-grid{gap:5px;padding:1px 2px 3px}
 .driver-card{padding:7px 1px 2px}
 .driver-card img{width:100%;object-fit:contain}
 .driver-card span{font-family:Impact,"Arial Narrow",system-ui,sans-serif;font-size:clamp(8px,2.35vw,11px);letter-spacing:-.15px;padding:3px 0 2px}
 .driver-card:before{font-size:7px;top:2px;left:3px}
 .driver-card.selected{transform:none;box-shadow:0 0 0 2px #ffcf29,0 4px #ad6419}
 .driver-detail{padding:8px 9px;gap:5px;background:linear-gradient(#071933ef,#102448ad 55%,#071830f0)}
 .driver-id{font-size:9px;line-height:1}
 .driver-title{font-size:clamp(26px,7.8vw,38px);line-height:1.05}
 .driver-platform{min-height:80px}
 .kart-turntable{inset:0 10% 3%}
 .driver-platform:before{width:78%;height:18%;bottom:3%}
 .driver-watermark{font-size:clamp(85px,30vw,150px)}
 .driver-platform .pilot-arrow{top:50%;transform:translateY(-50%);min-width:36px;min-height:36px}
 .driver-platform .pilot-view{min-height:28px;font-size:8px;bottom:0;right:1px}
 .turntable-indicator{font-size:7px}
 .driver-description{font-size:10px;line-height:1.2;min-height:0}
 .driver-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
 .driver-stats>div{display:flex;flex-direction:column;align-items:stretch;gap:4px;font-size:8px;letter-spacing:.2px}
 .stat-meter{height:8px;gap:2px}
 .driver-detail .primary{min-height:46px;font-size:clamp(14px,4.2vw,20px);padding:5px}
 .garage-footer{font-size:8px;line-height:1;padding:4px 6px}
 .garage-footer>span:nth-child(2){display:none}

 /* Full left/right touch regions; buttons have no persistent visual chrome. */
 #race .race-bottom{inset:0;display:block;z-index:4;pointer-events:none}
 #race .dpad{position:absolute;inset:0;display:flex;gap:0;pointer-events:none}
 #race .control.steer{position:relative;flex:1 0 50%;width:50%;height:100%;max-width:none;max-height:none;min-width:0;margin:0;padding:0;color:transparent;font-size:0;border:0;border-radius:0;clip-path:none;box-shadow:none;background:none;transform:none;pointer-events:auto;touch-action:none}
 #race .control.steer.pressed,#race .control.steer:active{background:none;box-shadow:none;transform:none;border:0}
 #race .control.steer.pressed:after{content:'';position:absolute;inset:12% 0 10%;background:linear-gradient(90deg,#4e9cff25,transparent 13%);pointer-events:none}
 #race #right-btn.pressed:after{background:linear-gradient(270deg,#4e9cff25,transparent 13%)}
 #race .control.steer:focus-visible{outline:2px solid #9bdcff;outline-offset:-3px}
 #race-hud{z-index:6}
 #race #pause-btn{font-size:0;display:grid;place-items:center}
 #race #pause-btn:before{content:'';display:block;width:10px;height:14px;border-left:3px solid #fff4d2;border-right:3px solid #fff4d2}
 #race .boost-area{position:absolute;bottom:max(9px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);display:flex;align-items:flex-end;justify-content:center;gap:10px;pointer-events:none;padding:0 5px 3px}
 #race .boost-group,#race .drift-group,#race .item-group{width:clamp(42px,13vw,56px);gap:1px;min-width:0}
 #race .control.boost,#race .control.drift,#race #item-btn{width:clamp(42px,13vw,56px);height:clamp(42px,13vw,56px);max-height:none;max-width:none;border-width:1.5px;font-size:23px;box-shadow:inset 0 -3px #061331b8,0 2px #030d2c;background:linear-gradient(155deg,#194b92d9,#071b45e0)}
 #race .control.boost{background:linear-gradient(155deg,#ffdd5ded,#f09c22);color:#17274a;border-color:#ffec9c}
 #race .control.pressed,#race .control:active{background:#ffd35a;color:#06183f}
 #race .control.steer.pressed,#race .control.steer:active{background:none;color:transparent}
 #race .control small{font-size:8px;margin-top:-7px;line-height:1}
 #race .boost-label{font-size:0;height:10px;line-height:10px}
 #race #boost-pct{font-size:9px}
 #race .drift-label{display:none}
 #race .drift-meter,#race .boost-track{height:5px;margin:1px 0 4px;border-radius:2px}
 #race .item-group span{font-size:7px;letter-spacing:0;max-width:65px;overflow:hidden;text-overflow:ellipsis}
 #race .item-group button:not(.equipped){opacity:.5}
 #race .item-group button.equipped{color:#0d2044;background:#ffcd46;border-color:#fff2b1}
 #race #drive-feedback{bottom:calc(max(9px,env(safe-area-inset-bottom)) + 67px);right:7px;font-size:9px}
 #orientation-tip{display:block;bottom:calc(max(9px,env(safe-area-inset-bottom)) + 78px);left:50%;right:auto;width:max-content;max-width:92%;transform:translateX(-50%);padding:5px 9px;font-size:8px;font-weight:900;letter-spacing:.4px;line-height:1.2;background:#071632d9;border:1px solid #e8d18d;border-radius:3px;z-index:5;pointer-events:none}
 #race.active #orientation-tip{animation:touch-tip 5s both}
 #orientation-tip.dismissed{display:none!important}
 #race.replaying .race-bottom{pointer-events:none}
 #race.replaying .race-bottom *{pointer-events:none}
 #race-mini-map{pointer-events:none;top:105px;width:94px;height:49px;opacity:.8}
}
@keyframes touch-tip{0%,80%{opacity:1}100%{opacity:0;visibility:hidden}}
@media(orientation:portrait) and (max-height:540px){
 .title-scene{gap:5px;padding-top:37px}.title-illustration{max-height:39dvh}.title-edition b{font-size:20px}.title-actions .primary{min-height:44px;font-size:25px}.title-actions .secondary{min-height:36px}.title-version{font-size:8px}
 .garage-frame{grid-template-rows:auto minmax(0,1fr);min-height:460px}.garage-footer{display:none}.garage-layout{grid-template-rows:minmax(130px,35%) minmax(0,1fr)}
}

/* V16.3: notifications are compact and stay out of the racing line. */
#race-message:not(.sector-alert){font-size:clamp(20px,3.6vw,36px);-webkit-text-stroke:1.35px var(--navy);text-shadow:2px 3px 0 white,4px 5px 0 var(--navy);max-width:96%;margin-inline:auto;white-space:normal;line-height:1.05}
#pass-toast{max-width:185px;gap:6px;padding:4px 8px 4px 4px;border-width:2px;border-radius:9px;box-shadow:0 3px 0 #061444}
#pass-toast img{width:34px;height:34px}#pass-toast small{font-size:8px}#pass-toast strong{font-size:11px}
@media(orientation:portrait){#race-message:not(.sector-alert){font-size:clamp(17px,5.4vw,23px);top:32%}#pass-toast{max-width:155px}#pass-toast img{width:30px;height:30px}#pass-toast strong{font-size:9px}#pass-toast small{font-size:7px}}
@media(max-height:490px) and (orientation:landscape){#race-message:not(.sector-alert){font-size:22px}#pass-toast img{width:26px;height:26px}#pass-toast small{font-size:7px}#pass-toast strong{font-size:9px}}

/* V17.3: a true paddock showroom. Ten readable cards, one hero, no
   automatically changing poses or competing chrome. */
.garage-screen:before{background:linear-gradient(135deg,#07152de8,#102747b5 50%,#06152deb)}
.garage-layout{gap:16px;grid-template-columns:1.28fr 1fr}
.driver-grid{gap:8px;align-content:stretch}
.driver-card{border:1px solid #6782ad;border-bottom:3px solid var(--accent);border-radius:5px;background:linear-gradient(155deg,color-mix(in srgb,var(--accent) 30%,#1a3758),#07162e 86%);box-shadow:0 3px 0 #020b1d,inset 0 0 0 1px #ffffff12;padding:11px 3px 4px}
.driver-card:after{opacity:.075}
.driver-card img{width:100%;object-fit:contain;filter:drop-shadow(0 4px 2px #030c23b0)}
.driver-card span{font-size:clamp(9px,1.4vw,15px);border-bottom:0;background:#06142dcb;border-radius:2px;padding:5px 1px 3px}
.driver-card.selected{border:2px solid #ffda55;border-bottom:4px solid #ffbf31;background:linear-gradient(150deg,#ffe6a4 0%,color-mix(in srgb,var(--accent) 40%,#446285) 72%,#173452);box-shadow:0 0 0 2px #ffdf75,0 4px #8d5a1c;transform:none}
.driver-card.selected:after{content:'✓';position:absolute;right:3px;top:3px;width:15px;height:15px;background:#ffda55;color:#10233f;border-radius:2px;font:900 11px/15px system-ui;text-align:center;transform:none;opacity:1;z-index:2}
.driver-detail{background:linear-gradient(155deg,#142e52f5,#08162eef 72%);border:1px solid #d8b76d;border-top:3px solid var(--hero);border-radius:6px;box-shadow:0 5px #020b1e,inset 0 0 0 1px #ffffff12;padding:12px;gap:6px}
.driver-id span:last-child{border-radius:2px;padding:4px 8px;letter-spacing:1px}
.driver-title{line-height:1.05;text-shadow:2px 3px #071229,4px 4px var(--hero)}
.driver-platform{overflow:hidden;background:radial-gradient(ellipse at 50% 70%,color-mix(in srgb,var(--hero) 28%,transparent),transparent 68%);border-bottom:1px solid #8399b832}
.driver-platform:before{width:80%;bottom:6%;height:17%;border:2px solid #c3d3e7;background:linear-gradient(170deg,#3a5878,#182c48 60%);box-shadow:inset 0 0 0 4px #8da5be66,0 4px 0 #020c22,0 0 16px color-mix(in srgb,var(--hero) 40%,transparent)}
.kart-turntable{inset:0 9% 6%}
.driver-platform .kart-turntable img{image-rendering:auto;filter:drop-shadow(0 5px 2px #0009)}
.driver-platform .pilot-arrow{background:#132d50ed;border-color:#758fb5;border-radius:4px;top:50%;transform:translateY(-50%)}
.driver-platform .pilot-view{background:#132d50ed;border-color:#9bb1cb;color:#fff1b7;min-height:29px;font-size:10px;right:3px;bottom:3px}
.turntable-indicator{bottom:4px;color:#acc4e5}
.driver-description{color:#c8def6;font-weight:700}
@media(orientation:portrait){.garage-layout{grid-template-columns:1fr;grid-template-rows:minmax(140px,35%) minmax(0,1fr);gap:10px}.driver-grid{gap:6px}.driver-card{padding:9px 1px 2px}.driver-card span{font-size:clamp(8px,2.4vw,11px);padding:4px 0 2px}.driver-card:before{font-size:8px}.driver-detail{padding:9px 11px;gap:6px}.driver-title{font-size:clamp(27px,8vw,38px)}.kart-turntable{inset:0 11% 7%}.driver-platform{min-height:82px}.driver-detail .primary{min-height:46px}.driver-stats{gap:8px}}
@media(max-height:490px) and (orientation:landscape){.garage-layout{gap:11px}.driver-detail{padding:7px 9px;gap:4px}.driver-card{padding:8px 2px 3px}.driver-card span{padding:3px 0 2px}.driver-detail .primary{min-height:33px}.kart-turntable{inset:0 12% 6%}}

/* Grand Prix finish: actual winning pilot and their own kart. */
.finish-cinematic.play{animation-duration:2.8s;gap:5px}
.finish-cinematic canvas{animation-duration:2.8s;filter:brightness(.58)}
.finish-winner{position:relative;z-index:2;width:clamp(145px,33vw,280px);height:clamp(100px,34vh,280px);isolation:isolate;animation:winner-enter .38s cubic-bezier(.18,.8,.27,1.3) both}
.finish-winner img{position:absolute;object-fit:contain;image-rendering:pixelated;filter:drop-shadow(0 4px 0 #07162e)}
#finish-winner-pilot{height:100%;width:67%;left:0;bottom:0;animation:podium-celebrate 1.1s ease-in-out infinite}
#finish-winner-kart{height:70%;width:68%;right:-5%;bottom:-8%;transform:rotate(-4deg)}
@keyframes winner-enter{from{transform:translateY(24px) scale(.78);opacity:0}to{transform:translateY(0) scale(1);opacity:1}}
.finish-cinematic span{margin-top:6px;font-weight:1000;letter-spacing:.06em;color:#fff7dd}
#pass-toast{border-left:4px solid var(--rival-color,#ffdb53)}
#pass-toast[data-passed="0"]{border-color:#a4bed7;border-left-color:var(--rival-color,#a4bed7)}
#race[data-final="1"] #lap-progress-fill{background:#ff9153}
@media(orientation:portrait){.finish-winner{width:62vw;height:28vh;max-width:270px}.finish-cinematic strong{font-size:clamp(30px,8vw,52px)}}
@media(prefers-reduced-motion:reduce){.finish-winner,#finish-winner-pilot{animation:none}}

/* V24 — live Grand Prix presentation. All race overlays stay in screen space. */
/* V25.1: roulette stays inside the existing button, no layout or font resizing. */
#race #item-btn.rolling{animation:power-roulette .16s steps(2,end) infinite;border-color:#ffed94;background:#6a43a5;color:#fff}
@keyframes power-roulette{50%{background:#2879bf;box-shadow:inset 0 0 8px #fff9c5,0 0 6px #ffd959}}
@media(prefers-reduced-motion:reduce){#race #item-btn.rolling{animation:none}}
#launch-panel{display:none;position:absolute;left:50%;top:49%;transform:translateX(-50%);width:clamp(150px,31%,245px);padding:7px 10px;background:#071937eb;border:2px solid #ffcf49;box-shadow:0 4px #071124;text-align:center;pointer-events:none;z-index:5;color:#fff3d1;font-size:clamp(10px,1.5vw,14px);font-weight:900;letter-spacing:.06em}
#race[data-start="ready"] #launch-panel,#race[data-start="charge"] #launch-panel,#race[data-start="charged"] #launch-panel{display:block}
#launch-panel small{display:block;font-size:9px;color:#e1b95e;margin-top:4px}
.launch-track{height:6px;background:#253e60;overflow:hidden;margin-top:5px}
.launch-track i{display:block;height:100%;width:0;background:#ffc94c;transition:width .07s linear}
#race[data-start="charged"] #launch-panel{border-color:#8affab;color:#8affab}
#race[data-start="charged"] .launch-track i{background:#8affab}
#battle-status{position:absolute;right:12px;top:19%;max-width:32%;padding:6px 8px;background:#091e42e8;border-right:3px solid #8cbbf6;color:#e1f2ff;letter-spacing:.06em;font-size:clamp(8px,1.15vw,12px);font-weight:900;opacity:0;pointer-events:none;z-index:4;transition:opacity .18s}
#battle-status.visible{opacity:1}#battle-status[data-duel="1"]{border-color:#ffd44c;color:#ffd44c}
#race[data-final="1"] .hud-lap{border-color:#ff9855;box-shadow:inset 0 -3px #431722,0 0 8px #ff925374}
#race.replaying #battle-status,#race.replaying #launch-panel{display:none}
.replay-caption{display:grid;gap:2px;min-width:0}.replay-caption small{color:#98b9e6;font-size:9px}
.replay-banner{max-width:96%;gap:8px}.replay-banner button{flex-shrink:0}
#result-highlights{display:block;font-size:8px;letter-spacing:.04em;font-weight:700;color:#e1c675;margin-top:2px}
.finish-flag{position:absolute;z-index:1;left:-10%;top:5%;width:31%;height:18%;transform-origin:left center;transform:rotate(12deg);background:repeating-conic-gradient(#f9f0da 0% 25%,#0d234a 0% 50%) 0 0/22px 22px;filter:drop-shadow(2px 4px 0 #001436);animation:flag-wave .42s alternate ease-in-out infinite}
#finish-player-result{position:relative;z-index:3;background:#081b40dd;border:1px solid #ffe093;padding:6px 10px;font-weight:900;letter-spacing:.06em;color:#fff3c6}
.podium-fans{position:absolute;inset:18% 0 20%;overflow:hidden;pointer-events:none;z-index:-1}
.fan-group{position:absolute;bottom:19%;width:22%;max-width:180px;aspect-ratio:250/121;isolation:isolate;filter:drop-shadow(1px 2px #071a34)}
.fan-left{left:-3%;transform:rotate(-2deg)}.fan-right{right:-3%;transform:rotate(2deg) scaleX(-1)}
.fan-group i{position:absolute;inset:0;background:url('assets/harmonia-crowd.webp') center/contain no-repeat;image-rendering:pixelated}
.fan-group i:first-child{clip-path:inset(52% 0 0 0)}
.fan-group i:last-child{clip-path:inset(0 0 48% 0);transform-origin:50% 52%;animation:fan-cheer .7s ease-in-out infinite alternate}
.fan-right i:last-child{animation-delay:-.3s}
.fan-flag{position:absolute;width:4.2%;height:9%;min-width:18px;min-height:12px;border-left:2px solid #ffe3a0;transform-origin:0 100%;background:repeating-conic-gradient(#f9f0da 0% 25%,#214c93 0% 50%) 0 0/12px 12px;animation:flag-wave .65s alternate ease-in-out infinite;filter:drop-shadow(1px 2px #07162c)}
.fan-flag.one{left:4%;top:26%;animation-delay:-.3s}.fan-flag.two{left:17%;top:31%;background-color:#f8cf4a;animation-delay:-.2s}.fan-flag.three{right:7%;top:27%;animation-delay:-.45s}.fan-flag.four{right:18%;top:34%;animation-delay:-.05s}
@keyframes fan-cheer{0%{transform:rotate(-1deg)}100%{transform:rotate(1deg) translateY(-1px)}}
@keyframes flag-wave{0%{transform:rotate(-9deg) skewY(-5deg)}100%{transform:rotate(6deg) skewY(5deg)}}
@media(orientation:portrait){#launch-panel{top:44%;width:55%}#battle-status{top:25%;max-width:42%;right:7px;font-size:9px}.replay-banner{gap:5px;padding:6px}.replay-banner b{font-size:10px}.replay-banner button{font-size:8px}.replay-caption{font-size:8px}.fan-group{width:27%;bottom:25%}.fan-flag{top:35%}}
@media(max-height:490px) and (orientation:landscape){#launch-panel{top:51%;padding:4px 7px}#launch-panel small{font-size:7px}#battle-status{top:22%;font-size:8px}#result-highlights{font-size:7px}}
@media(prefers-reduced-motion:reduce){.fan-group i,.fan-flag,.finish-flag{animation:none}}

/* V26 — podium only. Stable stage, independent crowd layers, pilot-specific
   choreography and rank-dependent energy. No change to the road renderer. */
#result{background-position:center 58%;background-color:#14284d;overflow:hidden}
#result::before{content:'';position:absolute;inset:0;background:linear-gradient(#08152cb8,transparent 27%,transparent 70%,#071329c9);pointer-events:none}
#result .podium-frame{max-width:1180px;padding:clamp(9px,2vh,25px) clamp(10px,2.5vw,30px);gap:8px}
#result .podium-header{position:relative;z-index:4;align-self:start}
#result .podium-header h1{margin:3px 0;color:#ffe15b;line-height:.96;font-family:Vila Arcade,Impact,sans-serif;font-size:clamp(28px,5.6vw,66px);font-weight:400;font-style:italic;letter-spacing:-.02em;text-shadow:3px 4px #132247,5px 6px #132247}
#result .podium-header p{margin:5px 0;color:#fff7dc;font-size:clamp(10px,1.4vw,15px)}
#result-eyebrow{display:inline-block;border:1px solid #ffe2a2;border-left:5px solid #ffd94b;background:#0b1b39e8;padding:4px 10px;letter-spacing:.09em;font-size:clamp(9px,1.3vw,13px)}
#result .podium-stage{z-index:3;align-items:flex-end;gap:clamp(5px,1.2vw,16px);padding:0 min(2vw,20px) 6px;max-width:740px;width:100%;margin:auto;height:100%;isolation:isolate}
#result .podium-slot{--metal:#bcc9d9;--metal-shadow:#60738d;--metal-edge:#e6eef8;--rise:28%;--dance:stage-hop;--tempo:1.6s;--phase:0s;width:30%;height:91%;justify-content:flex-end}
#result .podium-slot.gold{--metal:#ffc942;--metal-shadow:#a25d1b;--metal-edge:#fff1a6;--rise:40%;width:34%;height:100%;z-index:2}
#result .podium-slot.bronze{--metal:#cf895f;--metal-shadow:#834626;--metal-edge:#ffdeb3;--rise:23%;height:86%}
#result .podium-character{position:relative;min-height:0;flex:1;width:100%;display:flex;align-items:flex-end;justify-content:center;isolation:isolate}
#result .podium-person{position:relative;z-index:2;display:block;flex:none;width:100%;height:100%;max-height:none;object-fit:contain;object-position:center bottom;transform-origin:center bottom;filter:drop-shadow(1px 3px 0 #1820396b);animation:none}
#result.active .podium-person{animation:var(--dance) var(--tempo) var(--phase) ease-in-out infinite}
#result .podium-shadow{position:absolute;bottom:-2px;left:21%;width:58%;height:5%;background:#20253580;border-radius:50%;z-index:0;transform-origin:center}
#result.active .podium-shadow{animation:stage-shadow var(--tempo) var(--phase) ease-in-out infinite}
#result .podium-block{position:relative;height:var(--rise);min-height:45px;flex-shrink:0;display:grid;grid-template-columns:auto minmax(0,1fr);grid-template-rows:1fr auto;align-items:center;justify-items:center;gap:1px 5px;padding:4px 6px 6px;border:2px solid var(--metal-edge);border-top:7px solid var(--metal-edge);border-bottom:6px solid var(--metal-shadow);border-right:5px solid var(--metal-shadow);transform:none;border-radius:0;color:#fff9df;background:linear-gradient(155deg,var(--metal),var(--metal-shadow));box-shadow:4px 5px 0 #17213a99;text-shadow:2px 2px #583c43;overflow:hidden}
#result .podium-block::before{content:'';position:absolute;left:0;right:0;top:0;height:4px;background:#ffffff6b}
#result .podium-block b{grid-row:1/3;font-family:Vila Arcade,Impact,sans-serif;font-size:clamp(29px,6vw,76px);font-weight:400;line-height:1;margin:0;z-index:1}
#result .podium-block span{font-size:clamp(10px,1.6vw,18px);align-self:end;white-space:nowrap;max-width:100%;overflow:hidden;text-overflow:ellipsis;z-index:1;color:#fff8df}
#result .podium-kart{position:static;width:auto;height:clamp(16px,5vh,43px);max-width:92%;object-fit:contain;filter:none;align-self:start}
#result .podium-you{display:none;position:absolute;bottom:91%;left:50%;transform:translateX(-50%);z-index:4;background:#17284a;color:#ffed91;font-size:clamp(9px,1.2vw,12px);font-weight:1000;letter-spacing:.09em;padding:3px 7px;border:1px solid #ffe27a;box-shadow:2px 2px #0c1833;white-space:nowrap}
#result .podium-slot[data-player="1"] .podium-you{display:block}
#result .podium-slot[data-player="1"] .podium-block{outline:2px solid #fff0aa;outline-offset:2px}
#result .podium-slot[hidden]{display:none!important}
#result .podium-trophy{z-index:3;top:7%;right:-5%;width:clamp(32px,6vw,68px);height:auto;filter:drop-shadow(2px 3px #824a20);transform-origin:bottom center}
#result.active .podium-trophy{animation:stage-trophy 1.8s .4s ease-in-out infinite}
.podium-sparks{position:absolute;z-index:3;right:1%;top:5%;font-size:clamp(18px,3vw,32px);color:#fff7bd;opacity:0;text-shadow:0 0 7px #fff5b8;pointer-events:none}
#result.active .podium-sparks{animation:stage-spark 1.8s .4s steps(5,end) infinite}
#result .podium-fans{inset:21% 0 15%;z-index:0;overflow:hidden}
#result .fan-group{width:23%;max-width:235px;bottom:10%;filter:drop-shadow(1px 3px 0 #17274775);transform:none;aspect-ratio:250/121}
#result .fan-left{left:-4%;--fan-beat:.63s;--fan-wait:-.13s}
#result .fan-right{right:-4%;transform:scaleX(-1);--fan-beat:.76s;--fan-wait:-.43s}
#result .fan-back-left{left:9%;bottom:32%;width:16%;--fan-beat:.92s;--fan-wait:-.2s;aspect-ratio:365/380}
#result .fan-back-right{right:9%;bottom:31%;width:15%;--fan-beat:.81s;--fan-wait:-.51s;aspect-ratio:365/380;transform:scaleX(-1)}
#result .fan-back-left i,#result .fan-back-right i{background-image:url('assets/street-fans.webp')}
#result .fan-group i:first-child{clip-path:inset(47% 0 0 0)}
#result .fan-group i:last-child{clip-path:inset(0 0 50% 0);transform-origin:50% 50%;animation:stage-fans var(--fan-beat,.7s) var(--fan-wait,0s) ease-in-out infinite alternate}
#result .fan-back-left i:first-child,#result .fan-back-right i:first-child{clip-path:inset(46% 0 0 0)}
#result .fan-back-left i:last-child,#result .fan-back-right i:last-child{clip-path:inset(0 0 51% 0)}
#result .fan-flag{width:5%;height:10%;z-index:3;top:auto;bottom:29%;box-shadow:1px 2px #442d28;animation-duration:.6s}
#result .fan-flag.one{left:4%;bottom:35%}#result .fan-flag.two{left:15%;bottom:48%}#result .fan-flag.three{right:6%;bottom:34%}#result .fan-flag.four{right:16%;bottom:48%}
.fan-banner{position:absolute;z-index:4;bottom:24%;padding:6px 8px;color:#1d2b50;background:#ffde65;border:2px solid #fff4ba;box-shadow:3px 3px #30324e;transform:rotate(-5deg);font:1000 clamp(8px,1.25vw,15px)/1 system-ui;text-align:center;white-space:nowrap}
.fan-banner-left{left:1%;transform:rotate(-6deg)}.fan-banner-right{right:2%;background:#b9eeff;border-color:#e8fbff;transform:rotate(6deg)}
.fan-flash{position:absolute;width:7px;height:7px;background:#fffbd7;box-shadow:0 0 7px 3px #fffbd7;opacity:0;animation:stage-flash 3.5s infinite;z-index:2}
.flash-left{left:9%;bottom:36%}.flash-right{right:11%;bottom:40%;animation-delay:1.3s}
#result .podium-confetti{z-index:4;pointer-events:none}
#result .podium-confetti i{width:clamp(4px,1vw,9px);height:clamp(3px,.6vw,6px);animation-duration:2.9s;box-shadow:1px 1px #102c554d}
#result[data-outcome="victory"] .podium-confetti i{animation-duration:2.2s}
#result[data-outcome="finish"] .podium-confetti{display:none}
#result .podium-bottom{z-index:6;position:relative;box-shadow:0 4px #08152d;border:1px solid #f4d784;border-top:3px solid #f4d784;background:#091b38f5;gap:6px;border-radius:3px}
#result .podium-stats strong{font-size:clamp(14px,2.5vw,26px);font-variant-numeric:tabular-nums;white-space:nowrap}
#result .podium-actions .arcade-btn{font-size:clamp(9px,1.15vw,13px)}
#result[data-demo="1"] #replay-btn{display:none}
#result.time-trial .podium-slot.gold{width:40%;max-width:280px;--rise:28%}
#result.time-trial .podium-block{grid-template-columns:1fr;grid-template-rows:auto auto}
#result.time-trial .podium-sparks{display:none}
@keyframes stage-hop{0%,100%{transform:translateY(0)}20%{transform:translateY(-7%) rotate(-3deg)}38%{transform:translateY(0)}50%{transform:translateY(-3%) rotate(2deg)}70%{transform:translateY(0)}}
@keyframes stage-dance{0%,100%{transform:translateY(0) rotate(-2deg)}25%{transform:translateY(-3%) rotate(3deg)}45%{transform:translateY(0) rotate(2deg)}70%{transform:translateY(-2%) rotate(-4deg)}}
@keyframes stage-stomp{0%,100%{transform:translateY(0)}25%{transform:translateY(-5%) rotate(2deg)}50%{transform:translateY(0) rotate(-2deg)}70%{transform:translateY(-2%)}}
@keyframes stage-salute{0%,100%{transform:rotate(0)}32%{transform:rotate(-4deg) translateY(-1%)}70%{transform:rotate(3deg) translateY(-2%)}}
@keyframes stage-shadow{0%,100%{transform:scaleX(1);opacity:.85}25%{transform:scaleX(.82);opacity:.55}50%{transform:scaleX(.98);opacity:.8}}
@keyframes stage-trophy{0%,100%{transform:translateY(0) rotate(-7deg)}35%{transform:translateY(-11%) rotate(7deg)}65%{transform:translateY(-4%) rotate(-3deg)}}
@keyframes stage-spark{0%,100%{opacity:0;transform:scale(.6)}40%{opacity:1;transform:scale(1.2)}65%{opacity:0;transform:scale(.7)}}
@keyframes stage-flash{0%,10%,100%{opacity:0}4%,7%{opacity:.85}}
@keyframes stage-fans{from{transform:rotate(-1.5deg)}to{transform:rotate(1.5deg) translateY(-2%)}}
@media(orientation:portrait){#result{background-position:center}#result .podium-frame{grid-template-rows:auto minmax(0,1fr) auto;padding:18px 10px max(14px,env(safe-area-inset-bottom));gap:8px}#result .podium-stage{padding:0 0 7px;max-height:40vh;align-self:end;gap:4px}#result .podium-slot{height:90%;width:31%}#result .podium-slot.gold{height:100%;width:35%}#result .podium-slot.bronze{height:85%}#result .podium-block{padding:3px;grid-template-columns:1fr;grid-template-rows:auto auto;gap:1px;min-height:48px;border-top-width:4px}#result .podium-block b{font-size:26px;grid-row:1;line-height:.85}#result .podium-block span{font-size:clamp(8px,2.5vw,11px)}#result .podium-kart{display:none}#result .podium-trophy{right:-10%;top:2%}#result .podium-fans{inset:30% 0 28%}#result .fan-group{width:30%;bottom:29%}#result .fan-back-left,#result .fan-back-right{width:22%;bottom:51%}#result .fan-banner{bottom:45%}#result .fan-flag{bottom:51%}#result .podium-bottom{grid-template-columns:1fr}#result .podium-actions .arcade-btn{min-height:38px;font-size:11px}}
@media(max-height:490px) and (orientation:landscape){#result .podium-frame{padding:5px 12px;gap:3px}#result .podium-header h1{font-size:clamp(24px,5vw,39px)}#result .podium-header p{margin:2px 0;font-size:10px}#result .podium-block{min-height:35px;padding:2px 3px;border-top-width:4px;border-bottom-width:3px}#result .podium-block b{font-size:clamp(29px,5vw,45px)}#result .podium-kart{height:18px}#result .podium-bottom{padding:4px;gap:3px}#result .podium-actions .arcade-btn{min-height:25px;font-size:9px}#result .podium-you{font-size:8px;padding:2px 4px}}
@media(prefers-reduced-motion:reduce){#result.active .podium-person,#result.active .podium-shadow,#result.active .podium-trophy,#result.active .podium-sparks,#result .fan-group i,#result .fan-flag,#result .fan-flash{animation:none!important}#result .podium-confetti{display:none!important}}
/* The actual platforms have a finite height rather than stretching with a
   tall desktop viewport. Their tops, shadows and sprite contact stay aligned. */
#result .podium-slot{height:auto;max-height:100%;--platform:clamp(53px,9.8vh,99px)}
#result .podium-slot.gold{height:auto;--platform:clamp(67px,14vh,139px)}
#result .podium-slot.bronze{height:auto;--platform:clamp(46px,7vh,72px)}
#result .podium-character{height:clamp(94px,31vh,285px);flex:0 1 auto;aspect-ratio:1/1.18;max-width:100%;max-height:calc(100% - var(--platform))}
#result .gold .podium-character{height:clamp(106px,35vh,320px)}
#result .podium-block{height:var(--platform);grid-template-rows:1fr auto;column-gap:2px;justify-items:center;padding:4px 8px}
#result .podium-block b{font-size:clamp(28px,5vw,58px)}
#result .podium-block span{align-self:center;font-size:clamp(10px,1.35vw,16px)}
#result .podium-kart{height:clamp(14px,3.5vh,30px);max-width:100%}
#result .podium-you{bottom:98%}
#result .podium-trophy{top:12%;right:-4%}
#result .podium-sparks{top:6%}
#result .fan-group{bottom:9%}
#result .fan-back-left,#result .fan-back-right{bottom:23%;width:14%}
#result .fan-flag{width:4%;height:7%;border-left-width:3px;background-size:10px 10px}
#result.time-trial .podium-slot.gold{--platform:clamp(54px,10vh,100px)}
@media(orientation:portrait){#result .podium-stage{max-height:42vh;align-self:end}#result .podium-slot{--platform:58px}#result .podium-slot.gold{--platform:78px}#result .podium-slot.bronze{--platform:48px}#result .podium-character{height:clamp(84px,24vh,180px)}#result .gold .podium-character{height:clamp(100px,27vh,210px)}#result .podium-block{padding:3px;grid-template-columns:1fr;grid-template-rows:1fr auto}#result .podium-block b{font-size:26px;grid-row:1}#result .podium-block span{font-size:clamp(8px,2.5vw,11px)}#result .podium-trophy{right:-9%}#result .fan-group{bottom:28%}#result .fan-back-left,#result .fan-back-right{bottom:44%}}
@media(max-height:490px) and (orientation:landscape){#result .podium-character{height:30vh}#result .gold .podium-character{height:34vh}#result .podium-slot{--platform:46px}#result .podium-slot.gold{--platform:61px}#result .podium-slot.bronze{--platform:38px}#result .podium-block{padding:1px 4px}#result .podium-kart{height:14px}#result .podium-trophy{width:35px}}

/* V26.1 — award show. The city background never moves. */
#result .ceremony-call{display:none;position:absolute;top:9%;left:50%;width:min(90%,460px);transform:translateX(-50%);z-index:8;padding:9px 14px 12px;text-align:center;background:#0d203cf0;border:2px solid #ffe794;border-left:7px solid #e8ae42;box-shadow:4px 5px #07132d;pointer-events:auto}
#result[data-reveal="0"] .ceremony-call,#result[data-reveal="1"] .ceremony-call,#result[data-reveal="2"] .ceremony-call{display:grid;gap:3px}
.ceremony-call span{font:1000 11px/1.2 system-ui;letter-spacing:.16em;color:#ffdb67}
.ceremony-call strong{font:400 italic clamp(24px,4.5vw,43px)/1 Vila Arcade,Impact,sans-serif;color:#fff4ce;text-shadow:2px 2px #121c3b}
.ceremony-call button{justify-self:center;background:#243d5f;border:1px solid #c4cee5;color:#fff6d6;font-weight:900;font-size:10px;margin-top:4px;padding:6px 12px;border-radius:2px}
#result[data-reveal="0"] .podium-header h1,#result[data-reveal="1"] .podium-header h1,#result[data-reveal="2"] .podium-header h1,#result[data-reveal="0"] .podium-header p,#result[data-reveal="1"] .podium-header p,#result[data-reveal="2"] .podium-header p{visibility:hidden}
#result .podium-slot{transition:opacity .24s ease-out,transform .34s cubic-bezier(.16,.7,.28,1.1)}
#result[data-reveal="0"] .podium-slot,#result[data-reveal="1"] .podium-slot:not(.bronze),#result[data-reveal="2"] .podium-slot.gold{opacity:0;transform:translateY(24px);visibility:hidden}
#result[data-reveal="0"] .podium-confetti,#result[data-reveal="1"] .podium-confetti,#result[data-reveal="2"] .podium-confetti{visibility:hidden}
#result .podium-rig{position:absolute;inset:0;display:none;width:100%;height:100%;object-fit:contain;object-position:center bottom;image-rendering:pixelated;z-index:2;transform-origin:center bottom;filter:drop-shadow(1px 3px 0 #1820396b)}
#result .rig-ready .podium-rig{display:block}
#result .rig-ready .podium-person{opacity:0;animation:none!important}
#result .rig-ready .podium-trophy{display:none}
#result.active .podium-rig{animation:var(--dance) var(--tempo) var(--phase) ease-in-out infinite}
/* V31 — distinct celebration silhouettes, keeping the feet aligned to the stage. */
@keyframes nuno-hop{0%,42%,100%{transform:translateY(0)}18%{transform:translateY(-9%) rotate(-3deg)}64%{transform:translateY(-5%) rotate(3deg)}}
@keyframes chico-shuffle{0%,100%{transform:translateX(0)}25%{transform:translateX(-5%) rotate(-6deg)}75%{transform:translateX(5%) rotate(6deg)}}
@keyframes gui-salute{0%,100%{transform:rotate(0)}25%,55%{transform:translateY(-2%) rotate(-5deg)}}
@keyframes tomas-bow{0%,100%{transform:rotate(0)}35%,55%{transform:translateY(3%) scaleY(.94) rotate(4deg)}}
@keyframes fred-stomp{0%,100%{transform:scaleY(1)}25%{transform:translateY(-6%) scaleY(1.03)}45%{transform:scaleY(.92)}65%{transform:scaleY(1.02)}}
@keyframes chimi-jump{0%,100%{transform:translateY(0)}38%{transform:translateY(-12%) rotate(5deg)}65%{transform:translateY(0) scaleY(.96)}}
@keyframes tutu-swing{0%,100%{transform:rotate(-3deg)}50%{transform:rotate(3deg) translateY(-2%)}}
@keyframes cata-twirl{0%,100%{transform:rotate(0)}25%{transform:rotate(-7deg) translateY(-4%)}75%{transform:rotate(7deg) translateY(-4%)}}
@keyframes helena-cheer{0%,100%{transform:translateY(0)}35%,55%{transform:translateY(-6%) scale(1.03)}}
@keyframes mariah-wave{0%,100%{transform:rotate(-2deg)}40%{transform:rotate(5deg)}65%{transform:rotate(0)}}
#result.active .podium-slot:not(.gold) .podium-rig{animation-name:stage-salute}
#result .gold .podium-shadow{width:66%;left:17%}
#result .podium-block{border:0;border-bottom:7px solid #252638;box-shadow:7px 9px 0 #24182d60;overflow:visible;background:linear-gradient(115deg,var(--metal) 0 65%,var(--metal-shadow) 65%);grid-template-columns:auto minmax(0,1fr);grid-template-rows:1fr;padding:7px 12px;isolation:isolate}
#result .podium-block::before{content:'';position:absolute;left:0;right:0;top:-11px;height:12px;clip-path:polygon(8% 0,100% 0,92% 100%,0 100%);background:var(--metal-edge);border-bottom:3px solid #fff3aa8c;z-index:-1}
#result .podium-block::after{content:'';position:absolute;top:-11px;bottom:-7px;right:-12px;width:12px;clip-path:polygon(0 11px,100% 0,100% calc(100% - 9px),0 100%);background:var(--metal-shadow);z-index:-1}
#result .podium-block b{grid-row:auto;text-shadow:3px 3px var(--metal-shadow),-1px -1px #fff4c9;font-size:clamp(29px,5.5vw,61px);text-align:center}
#result .podium-block span{font-size:clamp(10px,1.5vw,19px);align-self:center;text-shadow:2px 2px #2d2d40}
#result .podium-kart{display:none}
#result .podium-slot[data-player="1"] .podium-block{outline:0;box-shadow:0 0 0 2px #fff0b4,7px 9px 0 #24182d60}
#result .fan-group i:first-child{clip-path:inset(47% 0 0 0)}
#result .fan-group i:nth-of-type(2){display:none}
#result .individual-fan{position:absolute;inset:0;clip-path:var(--cut);background:url('assets/harmonia-crowd.webp') center/contain no-repeat;transform-origin:var(--fan-origin);image-rendering:pixelated;animation:individual-cheer var(--tempo) var(--offset) ease-in-out infinite}
#result .fan-back-left .individual-fan,#result .fan-back-right .individual-fan{background-image:url('assets/street-fans.webp')}
@keyframes individual-cheer{0%,100%{transform:translateY(0) rotate(-1deg)}35%{transform:translateY(-3%) rotate(2deg)}65%{transform:translateY(-.8%) rotate(-1.5deg)}}
#result .champion-kart{position:absolute;right:0;bottom:17%;width:clamp(88px,13vw,165px);z-index:3;text-align:center;pointer-events:none}
.champion-kart svg{width:100%;height:auto;display:block;filter:drop-shadow(2px 3px #151f36aa)}
.champion-kart span{display:inline-block;background:#091d3bdf;border:1px solid #ffe496;padding:3px 6px;color:#fff5cd;font-size:clamp(8px,1vw,11px);font-weight:900;letter-spacing:.025em}
#result[data-reveal="0"] .champion-kart,#result[data-reveal="1"] .champion-kart,#result[data-reveal="2"] .champion-kart,#result.time-trial .champion-kart{display:none}
.personal-reaction{display:none;position:absolute;z-index:4;left:0;bottom:17%;width:clamp(132px,19vw,235px);background:#0e2346ed;border:1px solid #e5c77a;border-left:5px solid #f3c748;padding:7px;gap:6px;align-items:center;box-shadow:3px 4px #071d37}
.personal-reaction img{width:34%;height:auto;object-fit:contain;image-rendering:pixelated;animation:little-reaction 1.75s ease-in-out infinite}
.personal-reaction strong,.personal-reaction span{display:block;color:#ffdc69;font-weight:1000;font-size:clamp(10px,1.4vw,15px);line-height:1.15}.personal-reaction span{color:#fff4d0;font-size:clamp(8px,1vw,11px);margin-top:4px}
#result[data-outcome="finish"][data-reveal="3"]:not(.time-trial) .personal-reaction{display:flex}
@keyframes little-reaction{0%,100%{transform:rotate(-3deg)}50%{transform:translateY(-3px) rotate(3deg)}}
@media(orientation:portrait){#result .ceremony-call{top:9%;width:94%}#result .podium-stage{padding-right:8px}#result .podium-block{grid-template-columns:1fr;grid-template-rows:1fr auto;padding:4px;border-bottom-width:5px}#result .podium-block b{font-size:27px}#result .podium-block span{font-size:clamp(8px,2.4vw,11px)}#result .podium-block::after{width:7px;right:-7px}#result .podium-block::before{height:7px;top:-6px}#result .champion-kart{bottom:36%;right:3%;width:78px}#result .personal-reaction{bottom:42%;left:1%;width:133px;padding:4px}#result .personal-reaction img{width:30%}}
@media(max-height:490px) and (orientation:landscape){#result .ceremony-call{top:2%;padding:5px 8px;width:38%}.ceremony-call strong{font-size:23px}.ceremony-call span{font-size:9px}.ceremony-call button{padding:3px 7px;font-size:9px}#result .podium-block{padding:2px 5px;border-bottom-width:4px}#result .podium-block b{font-size:33px}#result .podium-block span{font-size:10px}#result .podium-block::before{top:-6px;height:7px}#result .podium-block::after{top:-6px;width:7px;right:-7px;bottom:-4px}#result .champion-kart{width:88px;bottom:22%}#result .personal-reaction{bottom:22%;width:123px;padding:3px}}
@media(prefers-reduced-motion:reduce){#result .podium-slot,#result .podium-rig,#result .individual-fan,#result .personal-reaction img{animation:none!important;transition:none!important}#result .fan-group i:nth-of-type(2){display:block;animation:none!important}}
