@font-face { font-family: "Lilita One"; src: url(../assets/fonts/lilita-one-latin.woff2?v=20261105190838) format("woff2"); font-display: swap; }
:root { --gold: #ffcd3c; --ink: #1b130c; --panel: rgba(14, 16, 14, 0.58); --red: #d42a1e; --hudfont: "Lilita One", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d1a10; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #fff;
  touch-action: none; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; position: fixed; inset: 0; }
#c { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; background: #0d1a10; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
.hide { display: none !important; }
.pill { background: var(--panel); border: 1px solid rgba(255,255,255,0.15); border-radius: 999px; padding: 6px 14px 6px 8px; font-weight: 700; font-size: 18px; display: inline-flex; align-items: center; gap: 8px; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); text-shadow: 0 1px 2px #000; }
.pill.small { font-size: 13px; padding: 5px 10px; font-weight: 600; }
.pill b { color: var(--gold); }
.coinicon { width: 30px; height: 30px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6)); }
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud button, #hud canvas { pointer-events: auto; }
#tl { position: absolute; left: calc(10px + env(safe-area-inset-left)); top: calc(10px + env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
#tr { position: absolute; right: calc(10px + env(safe-area-inset-right)); top: calc(10px + env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 6px; align-items: center; }
#minimap { border-radius: 50%; background: rgba(0,0,0,0.3); box-shadow: 0 3px 10px rgba(0,0,0,0.45); }
#wallet { max-width: 200px; white-space: nowrap; }
#wallet .dot { width: 9px; height: 9px; border-radius: 50%; background: #888; display: inline-block; }
#wallet .dot.ok { background: #46d160; box-shadow: 0 0 6px #46d160; } #wallet .dot.idle { background: #f0c040; } #wallet .dot.off { background: #d04040; }
#wallet i { font-style: normal; font-size: 10px; background: #f0a020; color: #000; border-radius: 4px; padding: 1px 4px; margin-left: 4px; }
#mute { position: absolute; right: calc(10px + env(safe-area-inset-right)); bottom: calc(10px + env(safe-area-inset-bottom)); }
#boost { width: 150px; height: 14px; border-radius: 8px; background: rgba(0,0,0,0.45); position: relative; overflow: hidden; border: 1px solid rgba(255,255,255,0.2); }
#boostFill { position: absolute; inset: 0 auto 0 0; width: 100%; background: linear-gradient(90deg, #ff8a1a, #ffd23a); transition: width .1s; }
#boostFill.active { background: linear-gradient(90deg, #4fd2ff, #c6f3ff); }
#boost span { position: absolute; inset: 0; font-size: 9px; font-weight: 800; letter-spacing: 2px; text-align: center; line-height: 14px; color: rgba(0,0,0,0.65); }
#toast { position: absolute; left: 50%; top: 18%; transform: translate(-50%, -10px); background: rgba(20,14,6,0.78); border: 1px solid rgba(255,205,60,0.5); padding: 10px 16px; border-radius: 12px; font-weight: 700; opacity: 0; transition: all .25s; max-width: min(80vw, 560px); text-align: center; font-size: 15px; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#testbadge { position: absolute; left: 50%; bottom: calc(6px + env(safe-area-inset-bottom)); transform: translateX(-50%); font-size: 11px; background: rgba(240,160,32,0.85); color: #000; padding: 2px 8px; border-radius: 6px; font-weight: 700; }

/* touch controls */
#touch { position: fixed; inset: 0; pointer-events: none; display: none; }
body.touch #touch { display: block; }
body.touch #mute { bottom: auto; top: calc(10px + env(safe-area-inset-top)); right: auto; left: 50%; transform: translateX(-50%); }
.cluster { position: absolute; bottom: calc(18px + env(safe-area-inset-bottom)); display: flex; gap: 14px; align-items: flex-end; pointer-events: auto; }
.cluster.left { left: calc(18px + env(safe-area-inset-left)); }
.cluster.right { right: calc(18px + env(safe-area-inset-right)); }
.tbtn { width: 92px; height: 92px; border-radius: 50%; background: rgba(15,15,15,0.42); border: 2px solid rgba(255,255,255,0.55); font-weight: 800; font-size: 19px; touch-action: none; box-shadow: 0 3px 10px rgba(0,0,0,0.35); text-shadow: 0 1px 2px #000; }
.tbtn.steer { font-size: 34px; width: 96px; height: 96px; }
.tbtn.gas { width: 108px; height: 108px; background: rgba(40,140,60,0.5); }
.tbtn.brake { background: rgba(160,40,30,0.45); width: 84px; height: 84px; }
.tbtn.boost { width: 80px; height: 80px; font-size: 15px; background: rgba(230,150,20,0.55); margin-bottom: 70px; }
.tbtn.reset { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(30px + env(safe-area-inset-bottom)); width: auto; height: 40px; border-radius: 20px; padding: 0 14px; font-size: 14px; pointer-events: auto; }
.tbtn.on { background: rgba(255,205,60,0.75); color: #000; border-color: #fff; transform: scale(0.95); }
.tbtn.reset.on { transform: translateX(-50%) scale(0.95); }
@media (max-height: 420px) { .tbtn { width: 76px; height: 76px; font-size: 16px; } .tbtn.steer { width: 82px; height: 82px; } .tbtn.gas { width: 92px; height: 92px; } .tbtn.brake { width: 70px; height: 70px; } .tbtn.boost { width: 68px; height: 68px; margin-bottom: 58px; } .pill { font-size: 15px; } .coinicon { width: 24px; height: 24px; } #boost { width: 120px; } }

/* overlays */
#loading { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(#1d3b24, #0a150c); z-index: 50; transition: opacity .4s; }
#loading.hide { opacity: 0; pointer-events: none; }
#loading img { width: 120px; } #loading .bar { width: 220px; height: 8px; background: #223; border-radius: 4px; margin: 14px; overflow: hidden; } #loading .bar i { display: block; height: 100%; width: 8%; background: var(--gold); transition: width .25s ease; animation: ld 1.2s infinite alternate; }
@keyframes ld { to { margin-left: 0; filter: brightness(1.15); } }
#loadSafeTip { display: none; margin-top: 10px; color: #ffd84a; font: 600 14px system-ui,sans-serif; text-decoration: underline; text-underline-offset: 3px; padding: 8px 12px; }
#loadSafeTip.show { display: inline-block; }
#loading.hide #loadSafeTip { pointer-events: none; }
#start, .modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 30; }
#start { background: url(../assets/keyart.jpg?v=20261105190838) center/cover no-repeat, #10301a; }
#start::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(5,12,6,0.15), rgba(5,12,6,0.55)); }
.modal { background: rgba(0,0,0,0.5); }
.card { position: relative; background: rgba(16,22,14,0.86); border: 1px solid rgba(255,205,60,0.35); border-radius: 18px; padding: 18px 22px; width: min(560px, 92vw); max-height: 92vh; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,0.6); -webkit-user-select: text; user-select: text; touch-action: pan-y; }
#start .card { margin-left: auto; margin-right: 4vw; }
h1 { margin: 0 0 6px; font-size: 30px; color: var(--gold); text-shadow: 0 2px 0 #7a4a06; } h1 span { display: block; font-size: 16px; color: #fff; letter-spacing: 3px; text-transform: uppercase; text-shadow: none; }
.sub { margin: 4px 0 12px; opacity: 0.9; font-size: 14px; }
label { font-size: 13px; opacity: 0.8; }
input { width: 100%; font: 15px ui-monospace, monospace; padding: 11px 12px; border-radius: 10px; border: 1px solid #555; background: #0b0f0a; color: #fff; margin-top: 4px; -webkit-user-select: text; user-select: text; touch-action: manipulation; }
.err { color: #ff9a7a; min-height: 18px; font-size: 13px; margin: 4px 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.card button { background: linear-gradient(#ffd84a, #f0a81a); color: #2a1a04; font-weight: 800; padding: 10px 18px; border-radius: 12px; }
.card button.alt { background: #2c3a2c; color: #fff; border: 1px solid #5a6a5a; }
.card button.big { font-size: 18px; padding: 12px 22px; flex: 1; }
.help { font-size: 12.5px; opacity: 0.85; margin-top: 12px; display: grid; gap: 4px; }
.fine { font-size: 11px; opacity: 0.6; margin: 10px 0 0; }
#clItems { padding-left: 18px; margin: 8px 0 12px; font-size: 14px; } #clItems li { margin-bottom: 8px; } #clItems li.got b { color: #46d160; } #clItems li.got b::after { content: ' ✓'; }
#clItems .diff { color: var(--gold); font-size: 12px; } #clItems em { display: block; color: #c0c0c0; font-size: 12px; }
#coinList h3 { display: flex; align-items: center; gap: 8px; margin: 0; }
#rotate { display: none; position: fixed; inset: 0; z-index: 60; background: #0d1a10; align-items: center; justify-content: center; text-align: center; font-size: 22px; font-weight: 700; }
#rotate div { line-height: 1.6; }
/* v5: portrait is playable; #rotate is now a small non-blocking tip */
@media (orientation: portrait) and (pointer: coarse) { #rotate { display: flex; inset: auto 0 auto 0; top: calc(56px + env(safe-area-inset-top)); background: none; font-size: 13px; pointer-events: none; opacity: .8; } }
body:not(.touch) #rotate { display: none !important; }

/* ---- v2 HUD skin (concept style: dark translucent pills, chunky type, gold ring minimap, ringed touch buttons) ---- */
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,0) 58%, rgba(10,6,2,0.38) 100%); }
#hud, #touch, #toast { font-family: var(--hudfont); }
.pill { font-weight: 400; letter-spacing: 0.3px; border: 1px solid rgba(255,255,255,0.10); box-shadow: 0 2px 8px rgba(0,0,0,0.35); }
#coinsPill { font-size: 21px; padding: 5px 16px 5px 6px; }
#coinsPill b { font-weight: 400; color: #fff; }
.pill.small { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-weight: 700; }
#wallet { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-weight: 700; background: rgba(14,16,14,0.7); border-radius: 8px; }
.coinicon { width: 34px; height: 34px; filter: drop-shadow(0 0 6px rgba(255,200,60,0.55)) drop-shadow(0 1px 2px rgba(0,0,0,0.6)); }
#minimap { width: 128px; height: 128px; border: 3px solid #f2c23a; box-shadow: 0 0 0 2px rgba(60,36,4,0.7), 0 4px 14px rgba(0,0,0,0.5), inset 0 0 12px rgba(0,0,0,0.5); background: #1d2a1a; }
#boost { height: 12px; border-radius: 7px; background: rgba(10,10,10,0.55); }
#boost span { font-family: var(--hudfont); font-size: 9px; letter-spacing: 3px; line-height: 12px; }
#toast { font-weight: 400; font-size: 17px; background: rgba(14,16,14,0.72); border-color: rgba(255,205,60,0.55); }
#testbadge { font-family: system-ui, sans-serif; }
.tbtn { font-family: var(--hudfont); font-weight: 400; font-size: 22px; background: rgba(12,14,12,0.42); border: 2.5px solid rgba(255,255,255,0.88); box-shadow: 0 4px 14px rgba(0,0,0,0.35), inset 0 0 16px rgba(0,0,0,0.25); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); text-shadow: 0 1px 3px rgba(0,0,0,0.8); letter-spacing: 0.5px; }
.tbtn.steer { font-size: 30px; }
.tbtn.gas { background: rgba(12,14,12,0.42); }
.tbtn.brake { background: rgba(12,14,12,0.42); }
.tbtn.boost { width: 112px; height: 112px; font-size: 26px; background: rgba(12,14,12,0.5); border-width: 3px; margin-bottom: 0; order: 3; }
.cluster.right { gap: 12px; }
.cluster.right .gas { margin-bottom: 0; }
.cluster.right .brake { margin-bottom: 0; }
.tbtn.reset { font-size: 16px; }
.tbtn.on { background: rgba(255,205,60,0.78); color: #1b130c; text-shadow: none; }
@media (max-height: 420px) { .tbtn.boost { width: 90px; height: 90px; font-size: 21px; margin-bottom: 0; } #minimap { width: 100px; height: 100px; } #coinsPill { font-size: 17px; } .coinicon { width: 26px; height: 26px; } }
h1 { font-family: var(--hudfont); font-weight: 400; font-size: 38px; letter-spacing: 0.5px; color: #ffcf3a; text-shadow: 0 3px 0 #9a4a06, 0 5px 10px rgba(0,0,0,0.5); }
h1 span { font-family: var(--hudfont); font-size: 17px; }
.card button { font-family: var(--hudfont); font-weight: 400; letter-spacing: 0.4px; }
.qrow { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.qrow select { flex: 1; font: 14px system-ui, sans-serif; padding: 7px 8px; border-radius: 8px; background: #0b0f0a; color: #fff; border: 1px solid #555; }

#errbox { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: rgba(8,12,8,0.86); font-family: system-ui, sans-serif; }
#errbox .card { width: min(620px, 94vw); }
#errbox h3 { margin: 0 0 8px; color: #ffcd3c; }
#errbox pre { white-space: pre-wrap; word-break: break-word; max-height: 40vh; overflow: auto; font-size: 11px; background: #0b0f0a; padding: 8px; border-radius: 8px; color: #ffb39a; margin: 0 0 8px; }
@media (max-width: 800px) and (max-height: 420px) { .tbtn { width: 66px; height: 66px; font-size: 15px; } .tbtn.steer { width: 72px; height: 72px; } .tbtn.gas { width: 80px; height: 80px; } .tbtn.brake { width: 62px; height: 62px; } .tbtn.boost { width: 78px; height: 78px; font-size: 18px; } .cluster { gap: 10px; } .tbtn.reset { height: 34px; font-size: 13px; } }
/* v4: hunter camera flash + "Bigfoot!" speech bubbles */
#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 40; }
#flash.go { animation: camflash .7s ease-out; }
@keyframes camflash { 0% { opacity: 0; } 8% { opacity: .9; } 100% { opacity: 0; } }
.bubble { position: fixed; left: 0; top: 0; z-index: 30; pointer-events: none; background: #fff; color: #2a1a08; font: 900 17px/1 var(--hudfont, system-ui); padding: 7px 11px; border-radius: 14px; border: 3px solid #ff7a1a; white-space: nowrap; box-shadow: 0 3px 8px rgba(0,0,0,.35); transform-origin: 50% 100%; }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -10px; margin-left: -7px; border: 7px solid transparent; border-top-color: #ff7a1a; border-bottom: 0; }
.bubble.photo { background: #fff8c8; border-color: #e0301a; }

/* v5 virtual joystick (left side); old steer buttons only with ?steer=buttons */
.steerbtns { display: none; }
body.steerbtns .steerbtns { display: flex; }
body.steerbtns #stickZone { display: none; }
#stickZone { position: absolute; left: 0; bottom: 0; width: 45%; height: 62%; pointer-events: auto; touch-action: none; }
#stickBase { position: absolute; left: calc(30px + env(safe-area-inset-left)); bottom: calc(26px + env(safe-area-inset-bottom)); width: 140px; height: 140px; border-radius: 50%; background: rgba(12,14,12,0.35); border: 2.5px solid rgba(255,255,255,0.75); box-shadow: 0 4px 14px rgba(0,0,0,0.35); pointer-events: none; }
#stickKnob { position: absolute; left: 50%; top: 50%; width: 62px; height: 62px; margin: -31px 0 0 -31px; border-radius: 50%; background: rgba(255,255,255,0.55); border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.4); transition: transform .12s ease-out; }
#stickZone.on #stickKnob { background: rgba(255,205,60,0.85); transition: none; }
@media (max-height: 420px) { #stickBase { width: 116px; height: 116px; bottom: calc(18px + env(safe-area-inset-bottom)); } #stickKnob { width: 52px; height: 52px; margin: -26px 0 0 -26px; } }
@media (orientation: portrait) { #stickZone { width: 50%; height: 45%; } #stickBase { left: calc(18px + env(safe-area-inset-left)); } .cluster.right { right: calc(10px + env(safe-area-inset-right)); flex-direction: column-reverse; align-items: flex-end; gap: 10px; } .tbtn.reset { bottom: auto; top: calc(90px + env(safe-area-inset-top)); } }

/* v6: camera, mud splat, warm hint, ouch bubbles, leaderboard */
#camBtn { position: absolute; right: calc(10px + env(safe-area-inset-right)); bottom: calc(52px + env(safe-area-inset-bottom)); opacity: 0.72; font-size: 16px; padding: 4px 8px; }
body.touch #camBtn { bottom: auto; top: calc(48px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); left: auto; transform: none; }
.iconbtn { line-height: 1; }
#warmHint { font-size: 12px; padding: 3px 8px; }
#warmHint.hot b { color: #ff6a2a; } #warmHint.warm b { color: #ffb03a; } #warmHint.cool b { color: #9ec7ff; } #warmHint.cold b { color: #c8d6e5; }
#mudSplat { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 8;
  background:
    radial-gradient(circle at 18% 22%, rgba(70,40,18,0.55) 0 18px, transparent 40px),
    radial-gradient(circle at 78% 18%, rgba(90,50,22,0.5) 0 22px, transparent 48px),
    radial-gradient(circle at 30% 78%, rgba(60,32,14,0.55) 0 26px, transparent 55px),
    radial-gradient(circle at 70% 70%, rgba(80,45,20,0.45) 0 20px, transparent 46px),
    radial-gradient(circle at 50% 40%, rgba(55,28,12,0.35) 0 14px, transparent 36px); }
#mudSplat.on { opacity: 1; }
.bubble.ouch { background: rgba(255, 230, 180, 0.92); color: #3a1e00; border-color: #f0a020; }
.board { text-align: left; padding-left: 1.2em; margin: 8px 0 14px; max-height: 180px; overflow: auto; }
.board li { margin: 4px 0; font-size: 14px; }
.board .me { color: var(--gold); font-weight: 700; }

/* v6.1: desktop reset + controls help */
#hudBtns { position: absolute; right: calc(10px + env(safe-area-inset-right)); bottom: calc(10px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: auto; }
#hudBtns .pill { opacity: 0.85; }
#resetBtn { font-size: 13px; padding: 5px 12px; font-weight: 700; }
#helpBtn { font-weight: 800; min-width: 34px; justify-content: center; }
#camBtn, #mute { position: static; right: auto; bottom: auto; opacity: 0.85; }
body.touch #hudBtns { top: calc(10px + env(safe-area-inset-top)); bottom: auto; right: calc(10px + env(safe-area-inset-right)); }
body.touch #mute { top: auto; left: auto; transform: none; }
body.touch #camBtn { top: auto; }
body.touch #resetBtn { display: none; } /* phone already has on-screen Reset */
.boostTip { margin: 10px 0 6px; padding: 10px 12px; border-radius: 10px; background: rgba(230,150,20,0.22); border: 1px solid rgba(255,205,60,0.55); font-size: 14px; line-height: 1.35; }
.boostTip b { color: #ffd23a; }
kbd { display: inline-block; padding: 1px 6px; margin: 0 1px; border-radius: 5px; border: 1px solid rgba(255,255,255,0.35); background: rgba(0,0,0,0.35); font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.controlsCard { max-width: min(560px, 94vw); }
.controlsCard h3 { margin: 0 0 10px; font-family: var(--hudfont); font-size: 28px; color: var(--gold); }
.controlsCard h4 { margin: 0 0 6px; font-size: 15px; color: #ffd23a; }
.ctlGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .ctlGrid { grid-template-columns: 1fr; } }
.ctlList { margin: 0; padding-left: 1.1em; font-size: 13.5px; line-height: 1.55; }
.ctlList .boostRow { color: #ffe08a; font-size: 14.5px; }
.ctlNote { font-size: 12.5px; opacity: 0.85; margin: 12px 0 14px; line-height: 1.4; }
#controlsGotIt { width: 100%; }

/* public leaderboard */
.lbrow { margin-top: 8px; }
.btnlink { display: inline-block; padding: 9px 16px; border-radius: 12px; background: #2c3a2c; color: #ffd84a; border: 1px solid #5a6a5a; font-weight: 800; text-decoration: none; }
.lbcard h2 { margin: 0 0 4px; color: var(--gold); } .lbcard h3 { margin: 12px 0 6px; font-size: 16px; } .lbcard h3 a { margin-left: 8px; color: #ffd84a; }
.wintime { font-size: 18px; margin: 2px 0 10px; } .wintime b { color: var(--gold); font-size: 22px; }
.lbform { display: flex; gap: 8px; } .lbform input { margin: 0; flex: 1; min-width: 0; }
.lbmsg { min-height: 18px; font-size: 13px; margin: 6px 0; opacity: .9; } .lbmsg.ok { color: #9be38a; } .lbmsg.err { color: #ff9a7a; }
.lbboard { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow: auto; font-size: 14px; }
.lbboard li { display: grid; grid-template-columns: 2.2em 1fr auto 6.2em; gap: 8px; padding: 5px 6px; border-bottom: 1px solid rgba(255,255,255,.07); }
.lbboard li.me { background: rgba(255,205,60,.16); border-radius: 6px; }
.lbboard li.empty { display: block; opacity: .7; }
.lbboard .rk { color: var(--gold); font-weight: 800; } .lbboard .nk { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbboard .tm { font-variant-numeric: tabular-nums; font-weight: 700; } .lbboard .dt { opacity: .55; font-size: 12px; text-align: right; }

.lbcard .lbpost { width: 100%; margin: 8px 0 2px; font-size: 18px; }
.lbcard #lbNick { margin-top: 4px; }
