* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #05070a; color: #fff; font-family: "Segoe UI", Arial, sans-serif; user-select: none; }
#game canvas { display: block; }
#stats { left: auto !important; right: 8px !important; top: auto !important; bottom: 8px !important; opacity: 0.7 !important; }

/* menu */
#menu { position: fixed; inset: 0; z-index: 30; display: flex; background: linear-gradient(100deg, rgba(4,6,10,0.95) 45%, rgba(4,6,10,0.55)); }
#menu.clear { background: linear-gradient(90deg, rgba(4,6,10,0.94) 0 min(640px, 62%), rgba(4,6,10,0) 75%); }
.menu-box { width: min(660px, 100vw); height: 100%; padding: 22px 24px; display: flex; flex-direction: column; }
.menu-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.menu-top h1 { font-size: clamp(28px, 4.5vw, 44px); font-weight: 900; text-transform: uppercase; margin-right: auto; }
.menu-top h1 span { color: #ffb52e; }
#menu-money { font-size: 24px; font-weight: 900; color: #7ee08a; }
#menu-back { background: #29313d; color: #fff; border: 0; padding: 8px 14px; cursor: pointer; }
#loading { margin: 30px 0; }
.bar { height: 6px; background: #222a35; margin-bottom: 6px; }
#bar-fill { height: 100%; width: 0; background: #ffb52e; transition: width 0.2s; }
#load-text { font-size: 13px; color: #93a0b2; }
#menu-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 16px 0 12px; border-bottom: 2px solid #29313d; padding-bottom: 8px; }
#menu-tabs button { background: transparent; color: #b9c2cf; border: 0; padding: 7px 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; cursor: pointer; }
#menu-tabs button:hover { background: #1c232d; }
#menu-tabs button.on { background: #ffb52e; color: #15100a; }
#menu-body { flex: 1; overflow-y: auto; padding-right: 8px; }
#menu-body h3 { margin: 14px 0 8px; color: #ffcf73; text-transform: uppercase; font-size: 13px; letter-spacing: 2px; }
.lead { color: #b9c2cf; margin-bottom: 18px; }
.hint { color: #93a0b2; font-size: 14px; margin: 18px 0; }
.big { font-size: 22px; font-weight: 800; letter-spacing: 3px; padding: 14px 54px; border: 0; background: #ffb52e; color: #141008; cursor: pointer; }
.big:hover { background: #ffd070; }
.danger { background: transparent; color: #ff8a80; border: 1px solid #7a2e2a; padding: 8px 14px; cursor: pointer; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 22px; }
.stats div { background: #161c25; padding: 10px; } .stats small { display: block; color: #93a0b2; } .stats strong { font-size: 20px; }
.card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; background: rgba(28,35,46,0.92); padding: 10px 12px; margin-bottom: 6px; border-left: 3px solid transparent; }
.card.active { border-left-color: #ffb52e; }
.card > div:first-child { flex: 1; min-width: 180px; }
.card strong { display: block; font-size: 15px; } .card small { color: #98a5b6; font-size: 12px; }
.buy { background: #2f7d45; color: #fff; border: 0; padding: 8px 14px; font-weight: 700; cursor: pointer; min-width: 110px; }
.buy:hover:not(:disabled) { background: #3a9a55; }
.buy:disabled { background: #333c48; color: #8a94a3; cursor: default; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; width: 100%; }
.chips button { background: #10151d; color: #cfd7e2; border: 1px solid #384354; padding: 4px 9px; font-size: 12px; cursor: pointer; }
.chips button.on { border-color: #ffb52e; color: #ffcf73; }
.chips button:disabled { opacity: 0.4; cursor: default; }
.keys { display: grid; gap: 5px; font-size: 14px; color: #c9d1dc; }
.keys b { display: inline-block; min-width: 170px; color: #ffcf73; }
.guibox .lil-gui { --width: 100%; max-width: 100%; }

/* HUD */
#hud { display: none; position: fixed; inset: 0; z-index: 10; pointer-events: none; text-shadow: 0 1px 3px #000, 0 0 2px #000; }
#minimap { position: absolute; left: 18px; bottom: 18px; line-height: 0; }
#minimap.big { left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); border: 3px solid #000; opacity: 0.96; }
#bars { position: absolute; left: 230px; bottom: 26px; width: 210px; }
.meter { height: 10px; background: rgba(0,0,0,0.55); margin-top: 6px; border: 1px solid rgba(0,0,0,0.8); }
.meter div { height: 100%; width: 0; transition: width 0.15s; }
#health-fill { background: #d8453d; } #armor-fill { background: #4b95e8; } #stamina-fill { background: #e7d36a; }
.meter.thin { height: 4px; }
#top-right { position: absolute; right: 22px; top: 16px; text-align: right; }
#clock { font-size: 20px; font-weight: 600; }
#money { font-size: 32px; font-weight: 900; color: #7ee08a; font-variant-numeric: tabular-nums; }
#weapon-name { font-size: 15px; text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }
#ammo { font-size: 24px; font-weight: 700; }
#grenades { font-size: 13px; color: #cfd6c0; }
#stars { font-size: 28px; margin-top: 4px; letter-spacing: 3px; }
#stars i { font-style: normal; display: inline-block; color: rgba(255,255,255,0.18); }
#stars i.on { color: #ffd23d; }
#evade { display: none; width: 150px; margin-left: auto; }
#evade-fill { background: #fff; }
#mission { position: absolute; left: 18px; top: 16px; max-width: 380px; background: rgba(0,0,0,0.42); padding: 10px 14px; border-left: 3px solid #ffb52e; }
#mission-title { font-weight: 800; color: #ffcf73; text-transform: uppercase; font-size: 14px; letter-spacing: 1px; }
#mission-text { font-size: 14px; margin-top: 2px; }
#toasts { position: absolute; left: 18px; top: 100px; }
.toast { background: rgba(0,0,0,0.5); padding: 5px 12px; margin-bottom: 5px; font-size: 14px; width: max-content; }
#prompt { position: absolute; left: 50%; bottom: 20%; transform: translateX(-50%); font-size: 17px; font-weight: 600; white-space: nowrap; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; transform: translate(-50%, -50%); }
#crosshair::before, #crosshair::after { content: ""; position: absolute; background: #fff; box-shadow: 0 0 2px #000; }
#crosshair::before { left: 10px; top: 0; width: 2px; height: 22px; -webkit-mask: linear-gradient(#000 36%, transparent 36% 64%, #000 64%); mask: linear-gradient(#000 36%, transparent 36% 64%, #000 64%); }
#crosshair::after { top: 10px; left: 0; height: 2px; width: 22px; -webkit-mask: linear-gradient(90deg, #000 36%, transparent 36% 64%, #000 64%); mask: linear-gradient(90deg, #000 36%, transparent 36% 64%, #000 64%); }
#crosshair.enemy::before, #crosshair.enemy::after { background: #ff4038; }
#hitmarker { position: absolute; left: 50%; top: 50%; margin: -18px 0 0 -12px; font-size: 28px; opacity: 0; }
#speedo { display: none; position: absolute; right: 100px; bottom: 28px; text-align: right; }
#speed { font-size: 56px; font-weight: 900; font-variant-numeric: tabular-nums; }
#speedo small { font-size: 15px; margin-left: 4px; }
#speedo .meter { width: 160px; margin-left: auto; }
#car-fill { background: #9fd86b; }
#scope { display: none; position: absolute; inset: 0; background: radial-gradient(circle at center, transparent 0 34vmin, #000 34.5vmin); }
#scope::before, #scope::after { content: ""; position: absolute; background: #000; }
#scope::before { left: 50%; top: 0; bottom: 0; width: 1px; } #scope::after { top: 50%; left: 0; right: 0; height: 1px; }
#vignette { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, transparent 45%, rgba(150,0,0,0.8)); }
#banner { position: absolute; left: 0; right: 0; top: 26%; text-align: center; opacity: 0; }
#banner-title { font-size: clamp(28px, 5vw, 52px); font-weight: 900; color: #ffc14a; text-transform: uppercase; }
#banner-sub { font-size: 20px; }
#wasted { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(40,0,0,0.45); opacity: 0; }
#wasted span { font-size: clamp(50px, 11vw, 130px); font-weight: 900; color: #d4262a; letter-spacing: 6px; }

/* map, wheel, click tip */
#mapscreen { position: fixed; inset: 0; z-index: 28; display: none; flex-direction: column; align-items: center; justify-content: center; background: rgba(3,5,9,0.9); cursor: crosshair; }
.map-head { display: flex; gap: 20px; justify-content: space-between; flex-wrap: wrap; width: min(94vw, 84vh); margin-bottom: 8px; font-size: 13px; color: #cfd7e2; }
.map-head button { background: #ffb52e; border: 0; padding: 5px 12px; font-weight: 700; cursor: pointer; }
#map-canvas { border: 3px solid #000; }
#clicktip { position: fixed; inset: 0; z-index: 27; display: none; align-items: center; justify-content: center; cursor: pointer; background: rgba(0,0,0,0.25); }
#clicktip div { background: #ffb52e; color: #15100a; font-weight: 800; padding: 14px 30px; }
#wheel { display: none; position: absolute; left: 50%; top: 50%; width: min(80vmin, 560px); height: min(80vmin, 560px); transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(0,0,0,0.3) 25%, rgba(0,0,0,0.72) 26% 70%, transparent 71%); }
#wheel-items div { position: absolute; transform: translate(-50%, -50%); width: 104px; padding: 7px 4px; text-align: center; background: rgba(20,26,36,0.92); border: 2px solid #3b4557; font-size: 12px; }
#wheel-items div b, #wheel-items div small { display: block; }
#wheel-items div.on { border-color: #ffb52e; background: #3a2c10; transform: translate(-50%, -50%) scale(1.14); }
#wheel-name { position: absolute; left: 0; right: 0; top: 47%; text-align: center; font-weight: 800; color: #ffcf73; }

/* combat feedback */
#lowhp { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, transparent 35%, rgba(120,0,0,0.85)); }
#splatter i { position: absolute; display: block; border-radius: 45% 55% 60% 40%; transform: translate(-50%, -50%); background: radial-gradient(circle, rgba(110,0,0,0.9) 0 28%, rgba(120,0,0,0.5) 45%, transparent 68%); }
#flash { position: absolute; inset: 0; background: #dce8ff; opacity: 0; }
#hitdir { position: absolute; left: 50%; top: 50%; width: 220px; height: 220px; margin: -110px 0 0 -110px; border-radius: 50%; opacity: 0; border-top: 9px solid rgba(255,40,30,0.9); border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 9px solid transparent; }
#acog { display: none; position: absolute; inset: 0; background: radial-gradient(circle at center, transparent 0 36vmin, rgba(5,8,5,0.96) 37vmin); }
#acog i { position: absolute; left: 50%; top: 50%; width: 26px; height: 20px; margin: 0 0 0 -13px; background: #ff3a28; clip-path: polygon(50% 0, 100% 100%, 84% 100%, 50% 34%, 16% 100%, 0 100%); }
#reddot { display: none; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: #ff2a1a; box-shadow: 0 0 8px 3px rgba(255,40,20,0.7); }
#scope-info { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); font-size: 14px; white-space: nowrap; }
#weapon-bar { position: absolute; right: 20px; top: 232px; display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
#weapon-bar div { background: rgba(0,0,0,0.4); padding: 2px 8px; font-size: 12px; border-right: 3px solid transparent; }
#weapon-bar div i { font-style: normal; color: #ffcf73; margin-right: 7px; }
#weapon-bar div.on { border-right-color: #ffb52e; background: rgba(60,45,12,0.8); }
#distance { position: absolute; left: 18px; bottom: 226px; width: 200px; text-align: center; color: #7fe4ff; font-weight: 700; }
#altitude { font-size: 16px; color: #7fe4ff; }
#nitro-fill { background: #4aa8ff; }

/* touch */
#touch { display: none; }
body.touch #hud ~ #touch { display: block; }
#stick { position: fixed; left: 0; bottom: 0; width: 200px; height: 200px; z-index: 15; }
#look { position: fixed; right: 0; top: 0; width: 60%; height: 100%; z-index: 12; touch-action: none; }
#touch button { position: fixed; z-index: 16; width: 58px; height: 58px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.4); background: rgba(0,0,0,0.4); color: #fff; font-size: 12px; touch-action: none; }
body.touch #minimap { left: 10px; top: 76px; bottom: auto; transform: scale(0.65); transform-origin: top left; }
body.touch #bars { left: 160px; top: 80px; bottom: auto; width: 140px; }
body.touch #toasts { top: 220px; }
body.touch #weapon-bar, body.touch #distance { display: none; }
