
:root{--bg:#10171d;--panel:#18232b;--line:#34434d;--muted:#92a1aa;--gold:#edc863;--red:#ff554e}
*{box-sizing:border-box}html,body{margin:0;background:var(--bg);color:#f7f9fa;font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}body{min-height:100vh}
.page{width:min(1510px,100%);margin:auto;padding:12px}.topbar{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:9px}.brand{display:flex;gap:10px;align-items:center}.mark{width:42px;height:42px;border-radius:12px;background:#f24b42;color:white;display:grid;place-items:center;font-size:17px;font-weight:950}.brand strong,.brand span{display:block}.brand span{font-size:10px;color:var(--muted);margin-top:2px}.actions{display:flex;gap:6px;align-items:center}.btn{border:1px solid var(--line);background:var(--panel);color:white;border-radius:9px;padding:8px 11px;font-size:11px;font-weight:850;cursor:pointer;text-decoration:none}.btn.primary{background:var(--gold);border-color:var(--gold);color:#222b30}.btn.large{padding:12px 18px}
.ad-slot{display:flex;align-items:center;justify-content:center;background:#152028;border:1px solid #293842;border-radius:9px}.ad-slot:not(.has-ad):before{content:"ADVERTISEMENT";font-size:8px;color:#52636e}.top-ad,.bottom-ad{min-height:90px}.side-ad{min-height:400px}.layout{display:grid;grid-template-columns:160px minmax(0,1fr) 160px;gap:10px;margin-top:10px}.game-column{min-width:0}.game-shell{overflow:hidden;border:1px solid var(--line);border-radius:18px;background:#111a20}
.hud{display:grid;grid-template-columns:repeat(6,1fr);gap:1px;background:#26343d}.hud>div{background:#111a20;padding:12px 15px}.hud small,.hud strong{display:block}.hud small{text-transform:uppercase;letter-spacing:.8px;font-size:8px;color:#8d9ca5}.hud strong{margin-top:3px;font-size:17px;font-variant-numeric:tabular-nums}
.stage{position:relative;aspect-ratio:16/9;min-height:420px;overflow:hidden;background:#71c8ee;touch-action:none;user-select:none}#gameCanvas{display:block;width:100%;height:100%}.speed-lines{position:absolute;inset:0;pointer-events:none;opacity:0;background:repeating-linear-gradient(110deg,transparent 0 49%,rgba(255,255,255,.10) 50%,transparent 51%);mix-blend-mode:screen}.event-toast{position:absolute;top:18%;left:50%;transform:translateX(-50%);padding:8px 12px;border-radius:999px;background:rgba(12,18,22,.82);font-size:12px;font-weight:950;pointer-events:none}.event-toast.hidden,.danger.hidden,.overlay.hidden,.saved.hidden{display:none}.danger{position:absolute;top:10px;left:50%;transform:translateX(-50%);padding:6px 11px;border:1px solid #ff766f;background:rgba(87,17,18,.9);border-radius:999px;color:#ffaaa5;font-size:9px;font-weight:950}
.overlay{position:absolute;inset:0;display:grid;place-items:center;padding:18px;background:rgba(8,12,15,.67);backdrop-filter:blur(5px);z-index:5}.modal{width:min(560px,94%);padding:22px;background:#172229;border:1px solid #43525c;border-radius:18px;box-shadow:0 25px 80px rgba(0,0,0,.42)}.modal.compact{width:min(400px,94%)}.modal em{color:var(--gold);font-size:9px;font-style:normal;font-weight:950;letter-spacing:1.1px}.modal h1{margin:7px 0 8px;font-size:27px}.modal p{margin:0 0 14px;color:#a8b5bc;font-size:11px;line-height:1.55}
.rule-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;margin:12px 0}.rule-grid span{padding:10px;border:1px solid #35454e;border-radius:10px;color:#aeb9bf;font-size:9px}.rule-grid b{display:block;color:#fff;font-size:19px}.controls-card{display:grid;grid-template-columns:auto 1fr;gap:7px 12px;padding:11px;margin:0 0 13px;border-radius:11px;background:#11191e}.controls-card b{font-size:10px}.controls-card span{font-size:9px;color:#aab7bd}
.final-score{font-size:38px;font-weight:950;color:var(--gold);margin:8px 0 13px}.results{display:grid;grid-template-columns:repeat(3,1fr);gap:7px}.results span{padding:9px;border:1px solid #34434c;border-radius:9px}.results small,.results b{display:block}.results small{font-size:8px;color:#8798a2}.results b{font-size:12px;margin-top:3px}
.mobile-drive-controls{display:none;grid-template-columns:100px 1fr 100px;gap:8px;padding:8px;background:#10191f;border-top:1px solid var(--line)}.drive-btn{border:1px solid var(--line);border-radius:12px;padding:13px 8px;color:white;font-size:11px;font-weight:950;touch-action:none}.drive-btn.brake{background:#6c292a}.drive-btn.gas{background:#1f6747}.drive-btn.pressed{filter:brightness(1.35);transform:translateY(1px)}.steer-hint{display:grid;place-items:center;color:#72838d;font-size:8px;font-weight:850;letter-spacing:.6px}
.game-foot{display:flex;justify-content:space-between;gap:10px;padding:8px 12px;border-top:1px solid var(--line);color:#83939c;font-size:9px}.info-grid,.score-grid{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-top:9px}.panel,.leader-panel,.account-panel{border:1px solid var(--line);background:var(--panel);border-radius:13px;padding:13px}.panel strong,.panel span{display:block}.panel strong{font-size:11px}.panel span{margin-top:4px;color:var(--muted);font-size:9px;line-height:1.5}
.leader-head,.account-panel{display:flex;justify-content:space-between;align-items:center;gap:10px}.leader-head strong,.account-panel strong{font-size:11px}.leader-head span,.account-panel span{display:block;color:var(--muted);font-size:9px;margin-top:3px}.leader-row{display:grid;grid-template-columns:28px 1fr auto;gap:8px;padding:7px 0;border-top:1px solid var(--line);font-size:10px}.leader-row:first-child{border-top:0}.empty-leader{padding:8px 0;color:var(--muted);font-size:9px}.saved{margin:9px 0;padding:9px 11px;border:1px solid #3f7458;background:#15281d;color:#9ce1b4;border-radius:9px;font-size:10px}.game-footer{display:flex;justify-content:space-between;gap:10px;padding:13px 3px;color:#6f8089;font-size:9px}.game-footer a{color:#93a6b1;text-decoration:none;margin-left:10px}
@media(max-width:1150px){.layout{grid-template-columns:1fr}.side-ad{display:none}}
@media(max-width:760px){.page{padding:7px}.brand span{display:none}.hud{grid-template-columns:repeat(3,1fr)}.hud>div:nth-child(n+4){display:none}.stage{min-height:430px;aspect-ratio:auto;height:65vh;max-height:720px}.mobile-drive-controls{display:grid}.info-grid,.score-grid{grid-template-columns:1fr}.results{grid-template-columns:repeat(2,1fr)}.game-foot{display:none}.top-ad,.bottom-ad{min-height:70px}}


/* FULL-VIEW PLAY AREA */
.stage{height:min(68vh,calc(100svh - 190px))!important;min-height:360px;aspect-ratio:auto!important}
#gameCanvas{width:100%!important;height:100%!important}
@media(max-width:760px){.stage{height:calc(100svh - 175px)!important;min-height:300px}}


/* LIVE CONSISTENCY FIX — Redline viewport authority */
.stage.sg-gameplay-viewport{
  aspect-ratio:auto!important;
  min-height:0!important;
  height:var(--sg-play-height)!important;
  max-height:var(--sg-play-height)!important;
}
.stage.sg-gameplay-viewport #gameCanvas{
  position:absolute!important;
  inset:0!important;
  width:100%!important;
  height:100%!important;
}


/* REDLINE LAYOUT HOTFIX V5
   Prevent CSS-grid intrinsic sizing from collapsing the game column. */
.layout{
  display:flex!important;
  width:100%!important;
  max-width:100%!important;
  align-items:flex-start!important;
  gap:10px!important;
}
.layout>.side-ad{
  flex:0 0 160px!important;
  width:160px!important;
  min-width:160px!important;
}
.layout>.game-column{
  display:block!important;
  flex:1 1 0!important;
  width:auto!important;
  min-width:0!important;
  max-width:none!important;
}
.game-column>.game-shell{
  width:100%!important;
  max-width:none!important;
}
@media(max-width:1150px){
  .layout>.side-ad{display:none!important}
  .layout>.game-column{
    flex:1 1 100%!important;
    width:100%!important;
  }
}

/* Rebuilt neon highway presentation. Simulation and collision geometry are unchanged. */
:root{--bg:#040611;--panel:#0c1326;--line:#29395d;--muted:#8c99b6;--gold:#6ce9ff;--red:#ff4268}
body{background:radial-gradient(900px 520px at 10% 0,rgba(55,210,255,.11),transparent 65%),radial-gradient(800px 520px at 92% 18%,rgba(222,65,255,.1),transparent 65%),linear-gradient(150deg,#050a18,#04040d 70%)}
.game-shell{background:linear-gradient(145deg,rgba(13,21,42,.98),rgba(6,11,25,.99));border-color:#31446b;box-shadow:0 26px 80px rgba(0,0,0,.44),inset 0 1px rgba(255,255,255,.035)}
.hud{gap:0;background:rgba(5,10,24,.9)}.hud>div{padding:12px 14px;border-right:1px solid rgba(62,82,128,.4);background:transparent}.hud>div:last-child{border-right:0}.hud small{color:#8390ac;font-weight:850;letter-spacing:1.05px}.hud strong{color:#f8faff}.hud>div:first-child strong,.hud>div:nth-child(4) strong{color:#6ce9ff}.hud>div:nth-child(5) strong{color:#ff6683}
.stage{background:#040713;box-shadow:inset 0 0 80px rgba(0,0,0,.4)}.stage:after{content:"";position:absolute;inset:0;pointer-events:none;background:linear-gradient(rgba(255,255,255,.018) 1px,transparent 1px);background-size:100% 4px;mix-blend-mode:screen;opacity:.55}
.speed-lines{z-index:2;background:repeating-linear-gradient(106deg,transparent 0 48.7%,rgba(108,233,255,.12) 49.2%,transparent 50.1%);mix-blend-mode:screen}
.drive-hud{position:absolute;z-index:3;left:14px;right:14px;bottom:13px;display:flex;align-items:end;justify-content:space-between;pointer-events:none}.drive-speed,.drive-redline{padding:8px 10px;border:1px solid rgba(99,141,181,.24);border-radius:10px;background:rgba(3,8,18,.68);backdrop-filter:blur(8px);box-shadow:0 8px 28px rgba(0,0,0,.3)}.drive-speed span,.drive-redline span{display:block;color:#8294b3;font-size:6px;font-weight:950;letter-spacing:1.1px}.drive-speed strong{font-size:25px;line-height:1;color:#eafcff;font-variant-numeric:tabular-nums}.drive-speed small{margin-left:4px;color:#8294b3;font-size:6px}.drive-redline{width:126px}.drive-redline strong{display:block;margin:2px 0 5px;color:#6ce9ff;font-size:17px}.drive-redline b{display:block;position:relative;height:3px;overflow:hidden;border-radius:99px;background:rgba(255,255,255,.09)}.drive-redline b:after{content:"";position:absolute;inset:0 auto 0 0;width:var(--value,10%);border-radius:inherit;background:linear-gradient(90deg,#55ddff,#a66fff,#ff4268);transition:width .15s}.drive-lives{position:absolute;left:50%;bottom:2px;transform:translateX(-50%);color:#ff6683;font-size:12px;letter-spacing:4px;text-shadow:0 0 12px rgba(255,66,104,.5)}
.at-redline .drive-redline{border-color:rgba(255,66,104,.48);box-shadow:0 0 28px rgba(255,66,104,.12)}.at-redline .drive-redline strong{color:#ff6683}
.event-toast{z-index:4;top:16%;border:1px solid rgba(108,233,255,.2);background:rgba(4,9,20,.82);backdrop-filter:blur(8px);box-shadow:0 10px 35px rgba(0,0,0,.35);letter-spacing:.35px}.danger{z-index:4;top:12px;border-color:#ff5574;background:rgba(64,8,25,.84);box-shadow:0 0 20px rgba(255,66,104,.15);letter-spacing:.8px}
.overlay{z-index:6;background:rgba(3,6,16,.79);backdrop-filter:blur(10px)}.modal{background:linear-gradient(145deg,rgba(20,31,59,.98),rgba(8,14,31,.99));border-color:#354a75;box-shadow:0 30px 90px rgba(0,0,0,.58),0 0 45px rgba(108,233,255,.05)}.modal em{color:#6ce9ff;letter-spacing:1.6px}.modal h1{font-size:clamp(28px,4vw,39px);letter-spacing:-.04em}.modal p{color:#9ca9c3;font-size:12px}.rule-grid span,.results span{border-color:#2c3d61;background:rgba(6,12,27,.72)}.rule-grid b{color:#fff}.controls-card{background:#081126;border:1px solid #273859}.controls-card span{color:#93a1bd}.final-score{color:#6ce9ff;text-shadow:0 0 30px rgba(108,233,255,.2)}
.btn{background:#111a31;border-color:#2c3d5f}.btn.primary,.btn.home{background:linear-gradient(135deg,#6ce9ff,#a883ff);border-color:transparent;color:#06101a}.audio-toggle{display:grid;place-items:center;width:38px;height:38px;padding:0}.audio-toggle svg{display:block}
.mobile-drive-controls{background:rgba(5,10,23,.97);border-color:#28395b;grid-template-columns:minmax(82px,112px) 1fr minmax(82px,112px);padding:9px max(10px,env(safe-area-inset-right)) max(9px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left))}.drive-btn{position:relative;overflow:hidden;display:grid;place-content:center;gap:1px;min-height:62px;border-color:#33476c;background:#101a31}.drive-btn i{display:block;width:24px;height:3px;margin:0 auto 5px;border-radius:99px}.drive-btn strong{font-size:10px;letter-spacing:.8px}.drive-btn span{font-size:6px;opacity:.55}.drive-btn.brake{background:linear-gradient(145deg,#3a1527,#201120);color:#ff7890}.drive-btn.brake i{background:#ff5574;box-shadow:0 0 12px #ff5574}.drive-btn.gas{background:linear-gradient(145deg,#10343a,#0b202d);color:#6ce9ff}.drive-btn.gas i{background:#6ce9ff;box-shadow:0 0 12px #6ce9ff}.drive-btn.pressed{filter:brightness(1.4);transform:scale(.98)}.steer-hint{display:grid;place-content:center;text-align:center}.steer-hint i{color:#6ce9ff;font-size:18px;font-style:normal;line-height:1}.steer-hint strong{color:#aebad1;font-size:7px;letter-spacing:.8px}.steer-hint span{color:#657491;font-size:6px;letter-spacing:.7px}
.game-foot{background:rgba(5,10,23,.86);border-color:#28395b;color:#8492ae}.panel,.leader-panel,.account-panel{background:linear-gradient(145deg,#0e172d,#091125);border-color:#293a5c}.leader-row{border-color:#202d49}.game-footer{color:#72809d}.game-footer a{color:#94a3c0}
@media(max-width:760px){
  .actions{gap:5px}.audio-toggle{width:36px;height:36px}.hud{display:none}.stage.sg-gameplay-viewport{height:calc(100svh - 158px)!important;max-height:calc(100svh - 158px)!important;min-height:380px!important}.drive-hud{left:9px;right:9px;bottom:9px}.drive-speed,.drive-redline{padding:6px 8px}.drive-speed strong{font-size:21px}.drive-redline{width:106px}.drive-redline strong{font-size:14px}.drive-lives{bottom:1px}.event-toast{top:12%;max-width:88%;white-space:nowrap;font-size:9px}.modal{padding:20px 15px}.modal h1{font-size:28px}.rule-grid{gap:5px}.rule-grid span{padding:8px 5px}.mobile-drive-controls{display:grid}
}
@media(max-width:430px){.brand strong{font-size:14px}.actions .sg-game-share-top{display:none}.stage.sg-gameplay-viewport{height:calc(100svh - 152px)!important;max-height:calc(100svh - 152px)!important;min-height:390px!important}.drive-btn{min-height:58px}.drive-hud{bottom:7px}.drive-lives{display:none}.results{gap:5px}.results span{padding:8px 6px}}
@media(max-height:540px) and (orientation:landscape){.page{padding:4px}.topbar{margin-bottom:4px}.stage.sg-gameplay-viewport{height:calc(100svh - 130px)!important;max-height:none!important;min-height:250px!important}.info-grid,.score-grid,.game-editorial,.game-footer{display:none}.mobile-drive-controls{grid-template-columns:92px 1fr 92px}.drive-btn{min-height:50px;padding:7px}.modal{max-height:94%;overflow:auto}.rule-grid,.controls-card{margin:7px 0}}
@media(prefers-reduced-motion:reduce){.drive-redline b:after{transition:none}.stage:after{display:none}}

/* Live score remains visible when the desktop HUD is collapsed on mobile. */
.drive-score{position:absolute;left:50%;bottom:0;transform:translateX(-50%);min-width:116px;padding:8px 10px;border:1px solid rgba(99,141,181,.24);border-radius:10px;background:rgba(3,8,18,.68);backdrop-filter:blur(8px);box-shadow:0 8px 28px rgba(0,0,0,.3);text-align:center}
.drive-score span{display:block;color:#8294b3;font-size:6px;font-weight:950;letter-spacing:1.1px}.drive-score strong{display:block;color:#fff;font-size:17px;line-height:1.05;font-variant-numeric:tabular-nums}.drive-score small{display:block;margin-top:3px;color:#6ce9ff;font-size:6px}.drive-lives{bottom:48px}
@media(max-width:760px){.drive-score{min-width:100px;padding:6px 8px}.drive-score strong{font-size:15px}.drive-lives{bottom:41px}}
@media(max-width:430px){.drive-score{min-width:88px}.drive-score strong{font-size:13px}.drive-lives{display:none}}
@media(max-height:600px) and (orientation:portrait){.stage.sg-gameplay-viewport{height:calc(100svh - 145px)!important;max-height:calc(100svh - 145px)!important;min-height:300px!important}.mobile-drive-controls{padding-top:6px}.drive-btn{min-height:52px}}

/* Mobile focus mode: the road and controls become the entire active screen. */
@media(max-width:760px),(hover:none) and (pointer:coarse){
  body.sg-playing .topbar{display:none!important}
  body.sg-playing .page{width:100vw!important;max-width:none!important;height:100dvh!important;padding:0!important;margin:0!important;overflow:hidden!important}
  body.sg-playing .layout,body.sg-playing .game-column,body.sg-playing .game-shell{width:100vw!important;max-width:none!important;height:100dvh!important;margin:0!important;padding:0!important;border:0!important;border-radius:0!important;overflow:hidden!important}
  body.sg-playing .game-shell{position:fixed!important;z-index:9999;inset:0!important;display:grid!important;grid-template-rows:minmax(0,1fr) auto!important;background:#030612!important}
  body.sg-playing .hud,body.sg-playing .game-foot{display:none!important}
  body.sg-playing .stage.sg-gameplay-viewport{position:relative!important;grid-row:1!important;width:100vw!important;height:100%!important;min-height:0!important;max-height:100%!important;margin:0!important;border-radius:0!important;overflow:hidden!important}
  body.sg-playing .mobile-drive-controls{grid-row:2!important;display:grid!important;width:100vw!important;min-height:76px!important;margin:0!important;z-index:1000!important}
}
@media(max-height:540px) and (orientation:landscape){
  body.sg-playing .game-shell{grid-template-columns:minmax(0,1fr) 132px!important;grid-template-rows:1fr!important}
  body.sg-playing .stage.sg-gameplay-viewport{grid-column:1!important;grid-row:1!important;height:100dvh!important;width:auto!important}
  body.sg-playing .mobile-drive-controls{grid-column:2!important;grid-row:1!important;width:132px!important;height:100dvh!important;min-height:0!important;padding:10px!important;grid-template-columns:1fr!important;grid-template-rows:1fr auto 1fr!important}
  body.sg-playing .drive-btn{min-height:72px!important}.steer-hint{min-height:54px}
}
