:root{--red:#d3202a;--yellow:#ffd23f;--ink:#111;--paper:#fff7e6}
*{box-sizing:border-box}
html,body{margin:0;height:100%;overflow:hidden;background:#111;font-family:"Arial Black","Impact","Helvetica Neue",Arial,sans-serif;color:#fff;user-select:none}
canvas#c{position:fixed;inset:0;width:100%;height:100%;display:block}
.hidden{display:none!important}

#hud{position:fixed;inset:0;pointer-events:none}
#top-left{position:absolute;left:24px;top:18px;text-shadow:3px 3px 0 #000}
#score{font-size:48px;line-height:1;color:var(--yellow)}
#kills{font-size:18px;margin-top:4px;color:#fff;opacity:.9}
#top-center{position:absolute;top:14px;left:50%;transform:translateX(-50%);text-align:center;text-shadow:3px 3px 0 #000}
#timer{font-size:44px;line-height:1}
#timer.low{color:var(--red);animation:pulse .5s infinite alternate}
#timer-bonus{font-size:20px;color:#7CFC00;height:24px}
@keyframes pulse{from{transform:scale(1)}to{transform:scale(1.12)}}
#top-right{position:absolute;right:24px;top:18px;width:220px;text-align:right}
#top-right .label{font-size:12px;letter-spacing:2px;text-shadow:2px 2px 0 #000;margin-top:4px}
.bar{height:16px;background:#000a;border:3px solid #000;border-radius:3px;overflow:hidden}
.bar .fill{height:100%;background:linear-gradient(#7CFC00,#2e8b1e);width:100%;transition:width .2s}
.bar.heat .fill{background:linear-gradient(#ff5b5b,#a00);width:0}
#vehicle-name{margin-top:8px;font-size:14px;letter-spacing:1px;text-shadow:2px 2px 0 #000;color:var(--yellow)}

#combo{position:absolute;right:24px;bottom:90px;text-align:right;text-shadow:3px 3px 0 #000}
#combo-num{font-size:72px;line-height:1;color:var(--red);transform-origin:right center}
#combo-num.pop{animation:pop .18s ease-out}
@keyframes pop{0%{transform:scale(1.5) rotate(-6deg)}100%{transform:scale(1)}}
.combo-bar{width:200px;height:10px;background:#000a;border:3px solid #000;margin-left:auto}
#combo-fill{height:100%;background:var(--yellow);width:100%}

#nitro-wrap{position:absolute;left:24px;bottom:24px;width:220px;height:22px;background:#000a;border:3px solid #000;border-radius:3px;overflow:hidden}
#nitro-fill{height:100%;width:100%;background:linear-gradient(90deg,#39c,#9ef)}
#nitro-wrap span{position:absolute;inset:0;font-size:12px;letter-spacing:3px;text-align:center;line-height:16px;text-shadow:1px 1px 0 #000}

#banner{position:absolute;z-index:3;left:50%;top:32%;transform:translate(-50%,-50%) rotate(-4deg);font-size:84px;color:var(--yellow);-webkit-text-stroke:3px #000;text-shadow:6px 6px 0 var(--red);opacity:0;white-space:nowrap}
#banner.show{animation:banner 1.1s ease-out forwards}
/* the BUTT SISTER callout: one line on any desktop (about 17.9 em long: 4.8vw keeps it inside 94vw); the text's no-break
   spaces leave one break, before BUTT, for phones */
#banner.jackpot{font-size:clamp(30px,4.8vw,76px);color:#ff5fb4;text-shadow:6px 6px 0 var(--yellow);white-space:normal;width:94vw;text-align:center;line-height:1.05}
#banner.jackpot.show{animation-duration:2.3s}
#banner.jackpot .sub{display:block;margin-top:.3em;font-size:max(15px,.4em);font-style:italic;color:#fff;-webkit-text-stroke:1.5px #000;text-shadow:3px 3px 0 #ff3fa4;line-height:1.15}
@keyframes banner{0%{opacity:0;transform:translate(-50%,-50%) rotate(-4deg) scale(.4)}15%{opacity:1;transform:translate(-50%,-50%) rotate(-4deg) scale(1.15)}30%{transform:translate(-50%,-50%) rotate(-4deg) scale(1)}80%{opacity:1}100%{opacity:0}}

#popups{position:absolute;inset:0}
.popup{position:absolute;left:0;top:0;will-change:translate,opacity;transform:translate(-50%,-100%);font-size:26px;color:#fff;-webkit-text-stroke:1.5px #000;text-shadow:3px 3px 0 #000;white-space:nowrap;animation:pop .15s ease-out}
.popup b{color:var(--yellow)}
.popup small{display:block;font-size:16px;color:#ffb3b3}
.popup.jackpot{font-size:46px;-webkit-text-stroke:2px #000;text-shadow:4px 4px 0 #ff3fa4;text-align:center;z-index:1}
.popup.jackpot b{color:#ffd21f}
.popup.jackpot small{font-size:20px;color:#ff9fd2}
body.touch .popup.jackpot{font-size:34px}
body.touch .popup.jackpot small{font-size:16px}

#flash{position:absolute;inset:0;background:radial-gradient(ellipse at center,transparent 40%,rgba(180,0,0,.75) 100%);opacity:0;transition:opacity .35s}
#nukeflash{position:absolute;inset:0;background:#fff;opacity:0;pointer-events:none}
#ammo{position:absolute;left:24px;bottom:56px;display:flex;gap:14px;font-size:16px;text-shadow:2px 2px 0 #000}
#ammo span{background:#000a;border:3px solid #000;padding:4px 10px}
#ammo span.ready{color:var(--yellow)}
#ammo span.cool{color:#888}
/* bonus toasts: slide in from the right under the HUD, hold briefly, slide out */
#toasts{position:absolute;right:20px;top:132px;display:flex;flex-direction:column;align-items:flex-end;gap:14px;pointer-events:none}
.bcard{display:none;align-items:center;gap:10px;background:#fff7e6;border:4px solid #000;box-shadow:7px 7px 0 var(--red);padding:8px 14px 8px 8px;opacity:0;pointer-events:none;max-width:min(400px,46vw);transform:translateX(130%) rotate(-2deg)}
.bcard img{width:68px;height:85px;object-fit:cover;border:3px solid #000;transform:rotate(3deg)}
.bcard .gb-title{font-size:26px;color:var(--red);-webkit-text-stroke:1.5px #000;text-shadow:4px 4px 0 var(--yellow);line-height:1}
.bcard .gb-pts{font-size:19px;color:#111;margin-top:4px}
.bcard .gb-sub{font-family:Georgia,serif;font-style:italic;font-size:12px;color:#333;margin-top:4px}
/* slide in from the right under the HUD, hold briefly, slide back out; concurrent cards stack in #toasts */
.bcard.show{display:flex;animation:toast 2.6s ease-in-out forwards}
@keyframes toast{0%{opacity:0;transform:translateX(130%) rotate(-2deg)}12%{opacity:1;transform:translateX(0) rotate(-2deg)}80%{opacity:1;transform:translateX(0) rotate(-2deg)}100%{opacity:0;transform:translateX(130%) rotate(-2deg)}}
/* keffiyeh: fishnet body, bold edge bands, zigzag "olive leaf" border strip */
.bcard.keffiyeh{background-color:#f4f1ea;border-color:#111;box-shadow:7px 7px 0 #111;
  background-image:linear-gradient(#111 0 7px,transparent 7px 12px,#111 12px 15px,transparent 15px calc(100% - 15px),#111 calc(100% - 15px) calc(100% - 12px),transparent calc(100% - 12px) calc(100% - 7px),#111 calc(100% - 7px)),
    repeating-linear-gradient(45deg,transparent 0 8px,#111 8px 10px),repeating-linear-gradient(-45deg,transparent 0 8px,#111 8px 10px)}
.bcard.keffiyeh .kf-band{flex:none;width:32px;align-self:stretch;margin:12px 0;border-left:5px solid #111;border-right:5px solid #111;background-color:#f4f1ea;
  background-image:linear-gradient(135deg,#111 25%,transparent 25%),linear-gradient(225deg,#111 25%,transparent 25%),linear-gradient(315deg,#111 25%,transparent 25%),linear-gradient(45deg,#111 25%,transparent 25%);
  background-size:16px 16px;background-position:-8px 0,-8px 0,0 0,0 0}
.bcard.keffiyeh .gb-text{background:#fff;border:3px solid #111;padding:6px 10px;margin:12px 0}
.bcard.keffiyeh .gb-title{color:#111;-webkit-text-stroke:0;text-shadow:2px 2px 0 #c9c3b6;font-size:22px}
/* phones: the right column holds the combo meter and touch buttons, so toasts use the free strip under the score */
body.touch #toasts{right:auto;left:14px;top:84px;gap:6px;align-items:flex-start}
body.touch .bcard{transform:translateX(-130%) rotate(-2deg)}
body.touch .bcard.show{animation-name:toastL}
@keyframes toastL{0%{opacity:0;transform:translateX(-130%) rotate(-2deg)}12%{opacity:1;transform:translateX(0) rotate(-2deg)}80%{opacity:1;transform:translateX(0) rotate(-2deg)}100%{opacity:0;transform:translateX(-130%) rotate(-2deg)}}
body.touch .bcard{padding:5px 10px 5px 5px;gap:6px;max-width:44vw}
body.touch .bcard img{width:44px;height:55px}
body.touch .bcard .gb-title{font-size:17px}
body.touch .bcard.keffiyeh .gb-title{font-size:15px}
body.touch .bcard .gb-pts{font-size:13px}
body.touch .bcard .gb-sub{font-size:10px}
body.touch .bcard.keffiyeh .kf-band{width:20px;margin:5px 0}
body.touch .bcard.keffiyeh .gb-text{margin:5px 0;padding:3px 8px}
body.touch .bcard .gb-pts{margin-top:1px}
body.touch .bcard .gb-sub{margin-top:1px;line-height:1.15}
/* COP REKT: MLG montage pop, upper third, gone in ~1.3 s */
#rekt{position:absolute;left:50%;top:8%;width:230px;height:290px;margin-left:-115px;pointer-events:none;opacity:0;z-index:4}
#rekt img{position:absolute;left:31px;top:0;width:168px;height:222px;filter:drop-shadow(4px 4px 0 #000)}
#rekt .rekt-burst{position:absolute;left:-35px;top:-40px;width:300px;height:300px;border-radius:50%;
  background:repeating-conic-gradient(rgba(255,214,0,.55) 0 10deg,rgba(255,120,0,0) 10deg 20deg);
  -webkit-mask:radial-gradient(circle,#000 25%,transparent 70%);mask:radial-gradient(circle,#000 25%,transparent 70%)}
#rekt .rekt-text{position:absolute;left:-60px;right:-60px;top:214px;text-align:center;font-family:Impact,"Arial Black",sans-serif;font-size:52px;letter-spacing:2px;color:#fff;-webkit-text-stroke:3px #000;text-shadow:4px 4px 0 #39ff14,-3px -3px 0 #ff00d4}
#rekt .rekt-hit{position:absolute;width:34px;height:34px}
#rekt .rekt-hit::before,#rekt .rekt-hit::after{content:"";position:absolute;left:15px;top:0;width:5px;height:34px;background:linear-gradient(#fff 0 38%,transparent 38% 62%,#fff 62%);transform:rotate(45deg)}
#rekt .rekt-hit::after{transform:rotate(-45deg)}
#rekt .h1{left:-10px;top:40px}#rekt .h2{right:-14px;top:18px}#rekt .h3{right:4px;top:150px}
#rekt.show{animation:rekt 1.35s ease-out forwards}
#rekt.show .rekt-burst{animation:rektspin 1.35s linear}
#rekt.show .rekt-text{animation:rektrgb .2s steps(2) infinite}
#rekt.show .rekt-hit{animation:rekthit .35s ease-out both}
#rekt.show .h2{animation-delay:.08s}#rekt.show .h3{animation-delay:.16s}
@keyframes rekt{0%{opacity:0;transform:scale(2.6) rotate(-14deg)}9%{opacity:1;transform:scale(.92) rotate(6deg)}14%{transform:scale(1.06) rotate(-4deg)}20%,78%{opacity:1;transform:scale(1) rotate(0)}100%{opacity:0;transform:scale(.6) rotate(10deg)}}
@keyframes rektspin{to{transform:rotate(120deg)}}
@keyframes rektrgb{50%{text-shadow:4px 4px 0 #ff00d4,-3px -3px 0 #00e5ff}}
@keyframes rekthit{0%{opacity:0;transform:scale(1.8)}30%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.9)}}
body.touch #rekt{transform-origin:50% 0;top:6%;zoom:.62}
#splatter{position:absolute;inset:0;overflow:hidden}
.splat{position:absolute;transform:translate(-50%,-50%);transition:opacity 2.5s ease-in;opacity:.9}
#touch{position:absolute;inset:0;pointer-events:none;touch-action:none;-webkit-user-select:none}
#steer-zone{position:absolute;left:16px;bottom:16px;width:min(46vw,300px,100vw - 374px);height:64px;border:3px solid #000;border-radius:40px;background:#0009;pointer-events:auto;touch-action:none}
#steer-knob{position:absolute;top:4px;left:calc(50% - 26px);width:52px;height:52px;border-radius:50%;background:var(--yellow);border:3px solid #000}
#touch-right{position:absolute;right:12px;bottom:12px;display:flex;flex-direction:column;gap:8px;align-items:flex-end;pointer-events:none}   /* only its buttons take touches (the box overlaps the steer zone on small landscape phones) */
#touch-right .row{display:flex;gap:8px}
.tbtn{pointer-events:auto;touch-action:none;font-family:inherit;font-size:16px;padding:0;width:74px;height:74px;border-radius:14px;border:3px solid #000;background:#0009;color:#fff;box-shadow:none;transform:none;-webkit-user-select:none;user-select:none}
.tbtn.small{width:auto;height:40px;padding:0 12px;font-size:12px;border-radius:10px}
.tbtn.gas{background:#2e8b1ecc;width:96px;height:96px}
.tbtn.brake{background:#a00c;height:96px}
/* REV: the pedal bank reads REV | BRAKE | GAS (landscape); brakes if rolling forward, then backs up */
.tbtn.rev{background:#1f5bc4cc;width:62px;height:96px;font-size:15px;display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:4px}
.tbtn.rev .rev-arrow{font-size:18px;line-height:1}
.tbtn.held{filter:brightness(1.6);transform:scale(.95)}
.tbtn:hover{transform:none}
#touch-garage{position:absolute;left:16px;bottom:92px}
body.touch #hint,body.touch #nitro-wrap{display:none!important}
/* touch: setupTouch moves #ammo and #combo into #touch-right, so they stack in flow above the weapon row
   (combo on top) however that row wraps, and never overlap a button. Short labels, in button order. */
body.touch #ammo{position:static;flex-wrap:wrap;justify-content:flex-end;gap:5px;font-size:11px;text-shadow:1px 1px 0 #000;pointer-events:none}
body.touch #ammo:empty{display:none}
body.touch #ammo span{padding:3px 7px;border-width:2px}
body.touch #combo{position:static;pointer-events:none}
@media (min-width:700px) and (min-height:700px){body.touch #ammo{font-size:13px}}   /* tablets */
body.touch #top-left #score{font-size:32px}
body.touch #top-center #timer{font-size:32px}
body.touch #top-right{width:150px}
body.touch #vehicle-name{display:none}
body.touch #banner{font-size:44px}
body.touch #banner.jackpot{font-size:clamp(26px,8.4vw,44px);width:90vw}
/* landscape phones: higher, clear of the kill's points popup */
@media (max-height:500px){body.touch #banner.jackpot{top:27%;font-size:34px}}
/* portrait phones: the landscape layout overlaps (DRIFT on the steer zone, GARAGE on ROCKET, NUKE off-screen).
   Bottom: steer zone left, BRAKE + GAS right; DRIFT above the steer zone; the weapon row above the pedals,
   wrapping inside the screen; GARAGE under the health bars (top right); ammo readout above the weapon row.
   REV sits directly above BRAKE (no room beside it next to the steer zone), so the weapon row starts higher. */
@media (orientation: portrait){
  body.touch #steer-zone{width:calc(100vw - 222px);min-width:130px}
  body.touch #touch-right{left:12px;gap:6px;pointer-events:none}   /* full width: only its buttons take touches */
  body.touch #touch-right .row.pedals{margin-top:70px}          /* room for REV above BRAKE */
  body.touch #touch-right .row.weapons{flex-wrap:wrap;justify-content:flex-end;gap:6px}
  body.touch #touch-right .tbtn.small{padding:0 9px}
  body.touch #touch-right .tbtn[data-key="Space"]{position:fixed;left:16px;bottom:88px;width:calc(100vw - 222px);min-width:130px;height:40px;font-size:13px;border-radius:10px}
  body.touch #touch-right .tbtn.rev{position:fixed;right:116px;bottom:116px;width:74px;height:50px;flex-direction:row;gap:5px}
  body.touch #touch-garage{left:auto;right:12px;bottom:auto;top:116px}
}
/* narrow portrait phones (iPhone SE 1st gen 320 px, Fold cover screens): slimmer pedals so the steer zone and
   DRIFT keep a usable width without running under BRAKE / REV (steer + DRIFT end 10 px left of BRAKE) */
@media (orientation: portrait) and (max-width: 359px){
  body.touch .tbtn.gas{width:80px}
  body.touch .tbtn.brake{width:62px}
  body.touch #steer-zone,body.touch #touch-right .tbtn[data-key="Space"]{width:calc(100vw - 188px);min-width:0}
  body.touch #touch-right .tbtn.rev{right:100px;width:62px}
  body.touch #combo-num{font-size:52px}   /* the combo stacks above a two-line ammo readout here; clear GARAGE */
}
@media (orientation: portrait) and (max-width: 299px){
  body.touch .tbtn.gas{width:72px}
  body.touch .tbtn.brake{width:56px}
  body.touch #steer-zone,body.touch #touch-right .tbtn[data-key="Space"]{width:calc(100vw - 174px)}
  body.touch #touch-right .tbtn.rev{right:92px;width:56px;font-size:13px;gap:3px}
}
/* short landscape phones: a smaller combo counter, so less of it rises into the health bars above the control
   column (740x360 and taller clear them; at 568x320 the top of the counter still reaches the HEAT bar) */
@media (orientation: landscape) and (max-height: 420px){
  body.touch #combo-num{font-size:48px}
  body.touch #combo .combo-bar{width:150px}
}
/* hold R to restart: a tap shows the bar, holding fills it (0.9 s, matches RESTART_HOLD in main.js) */
#restart-hold{position:absolute;left:50%;top:22%;transform:translateX(-50%);padding:8px 14px 12px;background:rgba(0,0,0,.6);border:3px solid #000;color:#fff;font-size:18px;letter-spacing:1px;text-shadow:2px 2px 0 #000;opacity:0;pointer-events:none;transition:opacity .15s}
#restart-hold i{position:absolute;left:0;bottom:0;height:5px;width:100%;background:var(--yellow);transform-origin:left;transform:scaleX(0)}
#restart-hold.on{opacity:1}
#restart-hold.on i{animation:rhold .9s linear forwards}
@keyframes rhold{to{transform:scaleX(1)}}
#hint{position:absolute;bottom:26px;left:50%;transform:translateX(-50%);font-size:12px;letter-spacing:1px;opacity:.55;text-shadow:1px 1px 0 #000;font-family:Arial,sans-serif}

.screen{position:fixed;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;background:rgba(15,5,5,.82);text-align:center;padding:24px}
.screen h1{font-size:min(14vw,130px);line-height:.9;margin:0;color:var(--paper);-webkit-text-stroke:4px #000;text-shadow:10px 10px 0 var(--red);transform:rotate(-3deg)}
.screen h1 span{color:var(--yellow)}
.screen h2{font-size:64px;margin:0 0 10px;color:var(--yellow);-webkit-text-stroke:2px #000;text-shadow:6px 6px 0 var(--red)}
.tag{font-family:Georgia,serif;font-style:italic;font-size:20px;color:#ffd;margin:24px 0}
.btns{display:flex;gap:16px;margin:14px 0;flex-wrap:wrap;justify-content:center}
button{font-family:inherit;font-size:20px;padding:14px 28px;border:4px solid #000;background:var(--yellow);color:#000;cursor:pointer;box-shadow:6px 6px 0 #000;transform:rotate(-1deg)}
button.toggle{background:#333;color:#fff;font-size:15px;padding:10px 18px}
button.toggle.dense{background:#7a1010;color:#ffd23f}
button.toggle.town{background:#23405f;color:#fff}
button.toggle.town.santo{background:#2d6a3e;color:#ffd23f}
.credit{font-family:Arial,sans-serif;font-size:11px;color:#bbb;margin:4px 0 0;max-width:640px}
.credit a{color:#ddd}
/* the title on short or narrow screens (phones): smaller title and buttons, no keyboard help on touch, so the
   whole screen (TOWN included) fits without scrolling; it scrolls rather than clips if it still does not */
#title{justify-content:safe center;overflow-y:auto}
/* "Lava Goat presents" over the title (assets/lavagoat.webp: the Lava Goat Software badge as a die-cut sticker) */
#title .presents{display:flex;align-items:center;justify-content:center;gap:12px;margin:0 0 16px;font-family:Georgia,serif;font-style:italic;font-size:21px;color:#ffd;text-shadow:2px 2px 0 #000}
#title .presents img{width:76px;height:auto;transform:rotate(-5deg);filter:drop-shadow(3px 4px 0 rgba(0,0,0,.6))}
/* shorter desktop windows (1280x720 ... 1440x860): a slimmer presents row, title and tagline so nothing scrolls */
@media (min-height:521px) and (max-height:900px) and (min-width:421px){
  #title .presents{font-size:17px;gap:10px;margin:0 0 4px}
  #title .presents img{width:46px}
  #title h1{font-size:min(14vw,15vh,130px)}
  #title .tag{margin:14px 0}
}
body.touch #title .controls{display:none}
@media (pointer:coarse){#title .controls{display:none}}
@media (max-height:520px){
  #title{padding:10px 16px}
  #title h1{font-size:min(10vw,15vh,72px);-webkit-text-stroke:3px #000;text-shadow:6px 6px 0 var(--red)}
  #title .tag{font-size:15px;margin:10px 0 6px}
  #title .btns{margin:6px 0;gap:10px}
  #title button{font-size:16px;padding:9px 18px;box-shadow:4px 4px 0 #000}
  #title button.big{font-size:21px}
  #title button.toggle{font-size:13px;padding:7px 12px}
  #title .controls{font-size:12px;margin:6px 0}
  #title .best{font-size:13px;margin:4px 0}
  #title .toggles{gap:8px}
  #title .toggle .sub,#title .credit .more{display:none}
  #title .credit{font-size:10px;margin:2px 0 0}
  #title .presents{font-size:13px;gap:8px;margin:0 0 4px}
  #title .presents img{width:34px}
}
@media (orientation:portrait) and (max-width:420px){
  #title .presents{font-size:16px;gap:10px;margin:0 0 10px}
  #title .presents img{width:58px}
  #title .tag{font-size:16px;margin:14px 0}
  #title .btns{gap:10px;margin:8px 0}
  #title button.toggle{font-size:13px;padding:8px 12px}
  #title .toggle .sub{display:none}
}
@media (orientation:portrait) and (max-width:359px){
  #title{padding:14px 12px}
  #title .presents{font-size:14px;margin:0 0 6px}
  #title .presents img{width:46px}
  #title .tag{font-size:14px;margin:10px 0}
  #title button{font-size:16px;padding:9px 18px}
  #title button.big{font-size:21px}
  #title button.toggle{font-size:12px;padding:7px 10px}
  #title .best{font-size:13px;margin:6px 0}
}
button.big{font-size:30px;background:var(--red);color:#fff;transform:rotate(1deg)}
button:hover{transform:scale(1.05)}
button:disabled{opacity:.4;cursor:not-allowed}
button.warming{cursor:progress;animation:warmpulse .6s infinite alternate}
@keyframes warmpulse{from{opacity:1}to{opacity:.6}}
/* pressed: :active, and .pressed from index.html's pointerdown handler (shows even when the click itself waits);
   menu screens only (the in-game touch controls, .tbtn, have their own held look) */
.screen button:active,.screen button.pressed{transform:translate(3px,3px) rotate(-1deg);box-shadow:3px 3px 0 #000}
.screen button.big:active,.screen button.big.pressed{transform:translate(3px,3px) rotate(1deg)}
/* a passing label (index.html / main.js data-state: LOADING…, STARTS WHEN READY, OPENING…) drawn over the
   button's own, which stays in place unseen: the button keeps its ready size, so the title never shifts */
#title button[data-state]{position:relative;color:transparent}
#title button[data-state]::after{content:attr(data-state);position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:0 6px;font-size:.78em;line-height:1.05;color:#000;white-space:normal}
#title button.big[data-state]::after{color:#fff}
/* START until the boot prewarm is done (index.html / main.js): LOADING…, then STARTS WHEN READY once clicked */
#btn-start.notready{background:#7d4a4c}
#btn-start.notready[data-state]::after{color:#f3d6d6}
#btn-start.notready:hover{transform:rotate(1deg)}
#btn-start.notready.pressed,#btn-start.notready:active{transform:translate(3px,3px) rotate(1deg);box-shadow:3px 3px 0 #000}
/* the loading bar under START (index.html): a thick-outlined track, a yellow fill moved by transform only (with a
   transition, so it keeps creeping on the compositor while a long task blocks the page), sliding red stripes on
   the fill and a sheen across the track (both transform animations: they keep moving during long tasks too) */
/* (compact, and its margins eat into the gap between the button rows: the title stays about as tall as without it;
   main.js hides it for good once the title first gives way to a run or the garage) */
#loadbar{width:min(460px,86vw);margin:-4px 0 -4px;transition:opacity .4s ease,visibility 0s linear .4s}
#loadbar .lb-track{position:relative;height:16px;border:4px solid #000;background:#3a1416;box-shadow:5px 5px 0 #000;overflow:hidden;transform:rotate(-1deg)}
#loadbar .lb-track::before{content:"";position:absolute;top:0;bottom:0;left:0;width:30%;z-index:2;background:linear-gradient(90deg,transparent,rgba(255,255,255,.28),transparent);animation:lbsheen 1.3s linear infinite;will-change:transform}
#loadbar .lb-fill{position:absolute;inset:0;background:var(--yellow);border-right:3px solid #000;transform:translateX(-100%);transition:transform 1.4s cubic-bezier(.15,.75,.3,1);will-change:transform;overflow:hidden}
#loadbar .lb-fill::after{content:"";position:absolute;top:0;bottom:0;left:-40px;right:0;background:repeating-linear-gradient(-45deg,transparent 0 9px,rgba(211,32,42,.55) 9px 18px);animation:lbstripe .55s linear infinite;will-change:transform}
#loadbar .lb-cap{margin-top:6px;font-size:13px;line-height:16px;letter-spacing:.5px;color:var(--yellow);text-shadow:2px 2px 0 #000;min-height:1.2em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#loadbar.done .lb-fill{transition-duration:.3s}
#loadbar.done .lb-track::before,#loadbar.done .lb-fill::after{animation:none}
#loadbar.gone{opacity:0;visibility:hidden;pointer-events:none}   /* (it keeps its space: the buttons under it do not move) */
@keyframes lbstripe{to{transform:translateX(25.46px)}}
@keyframes lbsheen{from{transform:translateX(-100%)}to{transform:translateX(340%)}}
@media (prefers-reduced-motion:reduce){#loadbar .lb-fill::after{animation-duration:2.2s}#loadbar .lb-track::before{animation-duration:4s}}
@media (max-height:520px){#loadbar{margin:-2px 0 -2px}#loadbar .lb-track{height:12px;border-width:3px;box-shadow:4px 4px 0 #000}#loadbar .lb-cap{margin-top:4px;font-size:12px;line-height:14px}}
.controls{font-family:Arial,sans-serif;font-size:14px;color:#ddd;max-width:640px}
.controls b{color:var(--yellow)}
.best{font-size:16px;color:#ffd}
.cash-row{font-size:28px;color:#7CFC00;margin-bottom:12px;text-shadow:2px 2px 0 #000}
#shop-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:12px;max-width:1000px;width:100%;max-height:55vh;overflow:auto;padding:4px}
/* phones: compact garage buttons (BACK TO THE STREETS + TITLE SCREEN), so the list keeps most of the screen */
@media (orientation:portrait) and (max-width:420px){#shop .btns{gap:8px;margin:10px 0 0}#shop button{font-size:15px;padding:9px 14px;box-shadow:4px 4px 0 #000}#shop button.big{font-size:19px}}
@media (max-height:520px){#shop .btns{gap:10px;margin:6px 0 0}#shop button{font-size:14px;padding:7px 14px;box-shadow:4px 4px 0 #000}#shop button.big{font-size:17px}}
.item{background:#221;border:3px solid #000;box-shadow:5px 5px 0 #000;padding:12px;text-align:left;display:flex;flex-direction:column;gap:6px}
.item h3{margin:0;font-size:20px;color:var(--yellow)}
.item p{margin:0;font-family:Arial,sans-serif;font-size:13px;color:#ddd}
.item .row{display:flex;justify-content:space-between;align-items:center;margin-top:auto}
.item button{font-size:14px;padding:8px 14px;transform:none;box-shadow:3px 3px 0 #000}
.item .lvl{font-size:12px;color:#aaa;font-family:Arial,sans-serif}
.item.owned{border-color:#7CFC00}
.item button.select{background:#7CFC00}
#over-stats{font-size:22px;line-height:1.7;text-shadow:2px 2px 0 #000;margin-bottom:8px}
#over-stats b{color:var(--yellow)}

/* KILODEATH: every 1,000 kills (src/kilodeath.js) */
#kilodeath{position:absolute;inset:0;pointer-events:none;opacity:0;z-index:5;overflow:hidden}
#kilodeath .kd-flash{position:absolute;inset:0;background:radial-gradient(ellipse at 50% 40%,#ff1a1a66,#50000088 55%,#000c)}
#kilodeath .kd-logo{position:absolute;left:50%;top:4%;width:min(94vw,980px);transform:translateX(-50%);overflow:visible;
  filter:drop-shadow(0 0 18px #ff1010) drop-shadow(5px 7px 0 #000)}
#kilodeath .kd-guy{position:absolute;left:50%;bottom:-2%;height:min(52vh,470px);transform:translateX(-50%);overflow:visible;filter:drop-shadow(0 0 24px #ff2020aa)}
#kilodeath .kd-head{transform-box:view-box;transform-origin:150px 200px}
#kilodeath .kd-armL{transform-box:view-box;transform-origin:104px 214px}
#kilodeath .kd-armR{transform-box:view-box;transform-origin:196px 214px}
#kilodeath .kd-text{position:absolute;left:0;right:0;top:calc(4% + min(94vw,980px) * .245);text-align:center;font-family:Impact,"Arial Black",sans-serif;
  color:#fff;-webkit-text-stroke:2px #000;text-shadow:0 0 14px #f00,3px 3px 0 #000;letter-spacing:3px}
#kilodeath .kd-kills{display:block;font-size:clamp(26px,4.4vw,48px)}
#kilodeath .kd-pts{display:block;font-size:clamp(20px,3vw,34px);color:#ffd21f}
#kilodeath.show{animation:kdfade 4.2s linear forwards}
#kilodeath.show .kd-flash{animation:kdflash 4.2s ease-out}
#kilodeath.show .kd-logo{animation:kdslam .42s cubic-bezier(.2,1.6,.4,1) both,kdshake .5s .4s steps(8) 2}
#kilodeath.show .kd-shine{animation:kdshine 1.1s .45s ease-in-out 3}
#kilodeath.show .kd-guy{animation:kdrise .5s .3s cubic-bezier(.2,1.3,.4,1) both}
#kilodeath.show .kd-head{animation:kdbang .32s .8s ease-in-out infinite alternate}
#kilodeath.show .kd-armL{animation:kdpumpL .32s .8s ease-in-out infinite alternate}
#kilodeath.show .kd-armR{animation:kdpumpR .32s .8s ease-in-out infinite alternate}
#kilodeath.show .kd-text{animation:kdrise2 .4s .5s ease-out both}
@keyframes kdfade{0%{opacity:1}88%{opacity:1}100%{opacity:0}}
@keyframes kdflash{0%{opacity:0}4%{opacity:1}12%{opacity:.55}20%{opacity:.9}100%{opacity:.6}}
@keyframes kdslam{0%{transform:translateX(-50%) scale(3.2) rotate(-6deg);opacity:0}100%{transform:translateX(-50%) scale(1);opacity:1}}
@keyframes kdshake{0%,100%{translate:0 0}25%{translate:-7px 4px}50%{translate:6px -5px}75%{translate:-4px -3px}}
@keyframes kdshine{0%{transform:skewX(-20deg) translateX(0)}100%{transform:skewX(-20deg) translateX(1400px)}}
@keyframes kdrise{0%{transform:translateX(-50%) translateY(110%)}100%{transform:translateX(-50%) translateY(0)}}
@keyframes kdrise2{0%{opacity:0;transform:scale(.6)}100%{opacity:1;transform:scale(1)}}
@keyframes kdbang{0%{transform:rotate(-12deg) translateY(-4px)}100%{transform:rotate(14deg) translateY(8px)}}
@keyframes kdpumpL{0%{transform:rotate(-6deg)}100%{transform:rotate(5deg) translateY(10px)}}
@keyframes kdpumpR{0%{transform:rotate(6deg)}100%{transform:rotate(-5deg) translateY(10px)}}
/* TSAR BOMBA (src/tsar.js): Soviet-poster banner over the top of the screen while the city half goes */
#tsar{position:absolute;left:50%;top:84px;transform:translateX(-50%);transform-origin:0 0;z-index:4;pointer-events:none;opacity:0;text-align:center;font-family:Impact,"Arial Black",sans-serif;white-space:nowrap}
#tsar .ts-star{display:inline-block;font-size:56px;line-height:1;color:#ffd21f;-webkit-text-stroke:3px #7a0000;text-shadow:0 0 28px #ff3b1f,4px 4px 0 #7a0000}
#tsar .ts-title{font-size:84px;line-height:.95;letter-spacing:4px;color:#ffd21f;-webkit-text-stroke:4px #000;text-shadow:7px 7px 0 #c8102e,0 0 40px #ff6a00}
#tsar .ts-sub{font-size:22px;letter-spacing:6px;color:#fff;-webkit-text-stroke:1.5px #000;text-shadow:3px 3px 0 #c8102e}
#tsar .ts-count{margin-top:4px;font-size:34px;color:#fff;-webkit-text-stroke:2px #000;text-shadow:4px 4px 0 #000;min-height:1.1em}
#tsar,#tsar-note{display:none}
#tsar.show,#tsar-note.show{display:block}
#tsar.show{animation:tsarfade 4.4s linear forwards}
#tsar.show .ts-star{animation:tsarspin 1s .3s cubic-bezier(.2,1.5,.4,1) both}
#tsar.show .ts-title{animation:tsarslam .45s .3s cubic-bezier(.2,1.6,.4,1) both,kdshake .5s .75s steps(8) 2}
#tsar.show .ts-sub{animation:kdrise2 .4s .6s ease-out both}
/* slams in over the flash, then docks under the score so the fireball and the mushroom cloud stay in view */
@keyframes tsarfade{0%,6%{opacity:0;left:50%;top:84px;transform:translateX(-50%) scale(1)}7%{opacity:1;left:50%;top:84px;transform:translateX(-50%) scale(1)}
  27%{left:50%;top:84px;transform:translateX(-50%) scale(1)}36%{left:24px;top:104px;transform:translateX(0) scale(.56)}88%{opacity:1;left:24px;top:104px;transform:translateX(0) scale(.56)}100%{opacity:0;left:24px;top:104px;transform:translateX(0) scale(.56)}}
@keyframes tsarslam{0%{transform:scale(3.4) rotate(-8deg);opacity:0}100%{transform:scale(1) rotate(-3deg);opacity:1}}
@keyframes tsarspin{0%{transform:scale(0) rotate(-270deg)}100%{transform:scale(1) rotate(0)}}
#tsar-note{position:absolute;left:50%;top:92px;transform:translateX(-50%);z-index:4;pointer-events:none;opacity:0;font-family:Impact,"Arial Black",sans-serif;font-size:22px;letter-spacing:2px;color:#ffd21f;-webkit-text-stroke:1px #000;text-shadow:2px 2px 0 #7a0000}
#tsar-note.show{animation:tsarnote 1.6s ease-out forwards}
@keyframes tsarnote{0%{opacity:0;translate:0 8px}12%{opacity:1;translate:0 0}75%{opacity:1}100%{opacity:0}}
body.touch #tsar .ts-title{font-size:52px}
body.touch #tsar .ts-star{font-size:40px}
body.touch #tsar .ts-sub{font-size:15px;letter-spacing:3px}
body.touch #tsar .ts-count{font-size:24px}

/* ---------------- the HYDRANT jump jet (tools/jumpjet-DESIGN.md 4.2, 7) ---------------- */
/* the flight block: nozzle arc (90 deg = hover, 0 = jet) and readouts; desktop: bottom left above the ammo line */
#flight{position:absolute;left:24px;bottom:96px;display:flex;flex-wrap:wrap;column-gap:12px;align-items:center;width:420px;text-shadow:2px 2px 0 #000;pointer-events:none}
#flight .fl-noz{position:relative;width:48px;height:48px}
#flight .fl-arc{position:absolute;left:0;top:0;width:96px;height:96px;border:4px solid #000;border-radius:50%;clip-path:inset(0 50% 50% 0);background:radial-gradient(circle at 50% 50%,transparent 58%,#ffd23f55 59%)}
#fl-needle{position:absolute;right:-2px;bottom:-2px;width:46px;height:5px;margin-top:-2px;background:var(--yellow);border:2px solid #000;transform-origin:100% 50%}
#flight .fl-read{font-size:16px;line-height:1.25}
#flight .fl-k{font-size:11px;letter-spacing:2px;color:#ffd}
#fl-mode{font-size:12px;letter-spacing:2px;color:var(--yellow)}
#fl-warn{flex-basis:100%;min-height:30px;white-space:nowrap;font-size:26px;color:#ff4040;-webkit-text-stroke:1px #000;letter-spacing:2px}
#fl-hint{flex-basis:100%;white-space:nowrap;font-size:15px;color:#fff}
/* the hover reticle: a DOM ring at the rocket aim point (red when locked on a rider) */
#reticle{position:absolute;z-index:2;left:-19px;top:-19px;width:38px;height:38px;border:3px solid var(--yellow);border-radius:50%;box-shadow:0 0 0 2px #000,inset 0 0 0 2px #000;pointer-events:none;will-change:transform}
#reticle::after{content:"";position:absolute;left:14px;top:14px;width:4px;height:4px;background:var(--yellow);border:1px solid #000}
#reticle.lock{border-color:#ff3030;width:30px;height:30px;left:-15px;top:-15px}
#reticle.lock::after{left:10px;top:10px;background:#ff3030}
#swap-hint{position:absolute;left:50%;bottom:132px;transform:translateX(-50%);background:#000b;border:3px solid #000;padding:6px 16px;font-size:18px;color:var(--yellow);text-shadow:2px 2px 0 #000;animation:warmpulse .7s infinite alternate}
.bcard.jet .jc-badge{flex:none;width:58px;height:58px;border-radius:50%;background:#2e3036;border:4px solid #f7c21a;box-shadow:0 0 0 3px #000;color:#f7c21a;font-size:34px;display:flex;align-items:center;justify-content:center}
body.touch .bcard.jet .jc-badge{width:40px;height:40px;font-size:22px}
/* touch, flying: the 2D stick (a taller steer zone), the jet's pedal row instead of the car's, FLARE / BOOST labels */
.fly-only,#touch-right .row.pedals.fly,.noz-hov{display:none}
/* jet texts: the car hint names ENTER only with a jet in the run; the title shows the jet controls to owners */
.jet-run,.jet-owned{display:none}
body.jetrun .jet-run,body.ownjet .jet-owned{display:inline}
body.flying .fly-only{display:inline}
body.flying .car-only,body.flying #touch-right .row.pedals.car{display:none}
body.flying #touch-right .row.pedals.fly{display:flex}
body.flying #steer-zone{height:150px;border-radius:28px}
body.flying #steer-knob{top:calc(50% - 26px)}
body.flying #touch-garage{bottom:176px}
.tbtn.fbrake{background:#a00c;height:96px}
.tbtn.fdown,.tbtn.fup{height:96px;display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;font-size:15px}
.tbtn.fdown{background:#1f5bc4cc;width:70px}
.tbtn.fup{background:#2e8b1ecc;width:84px}
.tbtn.fdown .rev-arrow,.tbtn.fup .rev-arrow{font-size:18px;line-height:1}
.tbtn.noz{background:#6a3fb5cc;width:84px;height:96px;font-size:14px}
body.noz-jet .noz-jet{display:none}
body.noz-jet .noz-hov{display:inline}
body.noz-swing .tbtn.noz{animation:warmpulse .35s infinite alternate}
#touch-swap{display:none;background:#e0a800;color:#000;font-size:15px;height:44px;padding:0 22px}
body.touch.can-swap #touch-swap{display:block}
body.touch #flight{left:50%;bottom:auto;top:66px;transform:translateX(-50%);width:260px;justify-content:center;column-gap:8px}
body.touch #flight .fl-noz{width:32px;height:32px}
body.touch #flight .fl-arc{width:64px;height:64px;border-width:3px}
body.touch #fl-needle{width:30px;height:4px}
body.touch #flight .fl-read{font-size:12px}
body.touch #fl-warn{font-size:18px;min-height:22px;text-align:center}
body.touch #fl-hint{font-size:12px;text-align:center}
@media (orientation: portrait){
  /* the jet's pedals as a 2 x 2 block to the right of the stick */
  body.touch.flying #touch-right .row.pedals.fly{flex-wrap:wrap;width:188px;justify-content:flex-end;margin-top:0}
  body.touch.flying #touch-right .row.pedals.fly .tbtn{position:static;width:90px;min-width:0;height:62px;border-radius:12px}
  body.touch.flying #steer-zone{height:136px}
  body.touch #flight{top:96px;left:16px;transform:none;width:220px;justify-content:flex-start}   /* under the score, clear of GARAGE */
  body.touch #fl-warn,body.touch #fl-hint{text-align:left}
  /* 2 x 2: BRAKE UP / NOZZLE DOWN (UP above DOWN) */
  body.touch.flying .row.pedals.fly .fbrake{order:1} body.touch.flying .row.pedals.fly .fup{order:2}
  body.touch.flying .row.pedals.fly .noz{order:3} body.touch.flying .row.pedals.fly .fdown{order:4}
}
@media (orientation: portrait) and (max-width: 359px){
  body.touch.flying #touch-right .row.pedals.fly{width:172px}
  body.touch.flying #touch-right .row.pedals.fly .tbtn{width:82px;min-width:0;font-size:12px}
  body.touch #flight{width:190px}
  body.touch.flying #steer-zone{width:calc(100vw - 206px)}
}
@media (orientation: landscape) and (max-height: 420px){
  body.touch.flying #steer-zone{height:128px}
  body.flying #touch-garage{bottom:152px}
  body.touch.flying #touch-right .row.pedals.fly .tbtn{height:84px}
  /* the view is tilted so the jet sits in the band between the top HUD and the controls: the flight block moves
     from the top centre (over the jet) to the left, under the score */
  body.touch #flight{top:92px;left:16px;transform:none;width:210px;justify-content:flex-start}
  body.touch #fl-warn,body.touch #fl-hint{text-align:left}
  /* bonus cards while flying: top right, under the health bars (the left holds the flight block) */
  body.touch.flying #toasts{left:auto;right:14px;top:100px;align-items:flex-end}
  body.touch.flying .bcard{transform:translateX(130%) rotate(-2deg)}
  body.touch.flying .bcard.show{animation-name:toast}
}
/* portrait phones while flying: bonus cards under the flight block (it sits where they would) */
@media (orientation: portrait){
  body.touch.flying #toasts{top:172px}
}
/* narrow phones: a card title ("VERTICAL BIRD") shrinks and wraps between its words inside the card */
@media (max-width: 359px){
  body.touch .bcard{max-width:52vw}
  body.touch .bcard .gb-text{min-width:0}
  body.touch .bcard .gb-title{font-size:13px;overflow-wrap:break-word}
}
