* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #2a1636; color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif; -webkit-user-select: none; user-select: none; touch-action: none; -webkit-tap-highlight-color: transparent; }
#root { position: fixed; inset: 0; overflow: hidden; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#gamearter-toolbar { position: absolute; top: 12px; left: 12px; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
.coin { display: inline-block; width: .9em; height: .9em; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff2a8, #ffc928 55%, #c98a00); vertical-align: -0.1em; box-shadow: 0 0 0 2px rgba(0,0,0,.15); }

#hud { position: absolute; inset: 0; pointer-events: none; text-shadow: 0 2px 6px rgba(0,0,0,.55); }
#hud-left { position: absolute; top: 66px; left: 14px; width: min(38vw, 220px); }
#hud-level { font-weight: 800; font-size: 16px; margin-bottom: 6px; }
.bar { height: 10px; border-radius: 6px; background: rgba(0,0,0,.35); overflow: hidden; position: relative; border: 1px solid rgba(255,255,255,.3); }
#hud-progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, #ffd23f, #ff7a2f); }
#hud-time { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); font-size: clamp(22px, 4.5vmin, 38px); font-weight: 900; font-variant-numeric: tabular-nums; }
#hud-right { position: absolute; top: 66px; right: 16px; font-size: 22px; font-weight: 800; }
#hud-bottom { position: absolute; bottom: 16px; left: 16px; display: flex; align-items: flex-end; gap: 14px; }
#hud-speedo b { font-size: clamp(30px, 6vmin, 52px); font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; display: block; }
#hud-speedo small { opacity: .8; font-weight: 700; }
.bar.nitro { width: 140px; height: 16px; margin-bottom: 6px; }
#hud-nitro-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #2fd6ff, #9b5cff); }
.bar.nitro span { position: absolute; inset: 0; font-size: 10px; font-weight: 900; text-align: center; line-height: 15px; letter-spacing: 2px; }
#popup { position: absolute; top: 24%; left: 50%; transform: translate(-50%, -50%) scale(.6); font-size: clamp(26px, 6vmin, 56px); font-weight: 900; opacity: 0; pointer-events: none;
  text-shadow: 0 3px 0 rgba(0,0,0,.35), 0 0 20px rgba(0,0,0,.35); white-space: nowrap; transition: opacity .15s, transform .2s; }
#popup.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

#buttons { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; z-index: 6; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(255,255,255,.5); background: rgba(30,14,40,.55); color: #fff; font-size: 18px; font-weight: 900; }
.icon-btn.muted { opacity: .5; text-decoration: line-through; }

#touch { position: absolute; inset: auto 0 0 0; height: 0; z-index: 5; }
.tleft, .tright { position: absolute; bottom: 18px; display: flex; gap: 12px; align-items: flex-end; }
.tleft { left: 14px; bottom: 90px; } .tright { right: 14px; }
.tbtn { width: 76px; height: 76px; border-radius: 50%; border: 3px solid rgba(255,255,255,.6); background: rgba(20,10,30,.45); color: #fff; font-size: 28px; font-weight: 900; touch-action: none; }
.tbtn.gas { width: 92px; height: 92px; background: rgba(40,170,80,.55); }
.tbtn.brake { background: rgba(200,50,50,.5); }
.tbtn.small { width: 60px; height: 60px; font-size: 14px; background: rgba(80,60,220,.55); align-self: flex-start; margin-bottom: 60px; }
.tbtn.on { transform: scale(.92); background-color: rgba(255,255,255,.35); }

.screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 70px 16px 16px; background: linear-gradient(180deg, rgba(42,22,54,.15), rgba(42,22,54,.7)); overflow-y: auto; }
.panel { text-align: center; width: 100%; max-width: 560px; margin: auto; }
.logo { display: flex; flex-direction: column; line-height: .9; font-weight: 900; font-style: italic; text-transform: uppercase; font-size: clamp(52px, 13vmin, 110px); letter-spacing: 1px; }
.logo span:first-child { color: #ffd23f; text-shadow: 0 5px 0 #b3361f, 0 10px 24px rgba(0,0,0,.4); }
.logo span:last-child { color: #fff; text-shadow: 0 5px 0 #2a6fd6, 0 10px 24px rgba(0,0,0,.4); }
.tagline { margin-top: 14px; font-size: clamp(15px, 3vmin, 20px); font-weight: 600; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
h2 { font-size: clamp(30px, 7vmin, 52px); font-weight: 900; font-style: italic; text-transform: uppercase; text-shadow: 0 4px 0 #b3361f, 0 8px 20px rgba(0,0,0,.4); margin-bottom: 12px; }
h3 { margin: 16px 0 8px; font-size: 18px; text-transform: uppercase; }
.menu-btns { display: flex; flex-direction: column; gap: 10px; align-items: center; margin-top: 20px; }
.menu-btns button, .btn-back { min-width: 220px; padding: 12px 24px; border-radius: 14px; border: none; background: #fff; color: #2a1636; font-size: 18px; font-weight: 900; text-transform: uppercase; box-shadow: 0 5px 0 #b9a7c4; }
.menu-btns button.big { background: #ffd23f; font-size: 24px; box-shadow: 0 6px 0 #c47b10; min-width: 260px; }
.btn-back { margin-top: 18px; }
button:active { transform: translateY(3px); }
.stats { margin-top: 14px; font-size: 18px; font-weight: 700; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
.hint { margin-top: 12px; font-size: 13px; opacity: .9; text-shadow: 0 1px 4px rgba(0,0,0,.8); max-width: 520px; margin-left: auto; margin-right: auto; }
.small-btn { margin-top: 12px; padding: 6px 14px; border-radius: 16px; border: 2px solid rgba(255,255,255,.5); background: rgba(30,14,40,.55); color: #fff; font-weight: 800; }
#level-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.lvl { aspect-ratio: 1; border-radius: 14px; border: none; background: #fff; color: #2a1636; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; box-shadow: 0 4px 0 #b9a7c4; }
.lvl b { font-size: 26px; font-weight: 900; } .lvl i { font-style: normal; color: #d9cfe0; font-size: 16px; } .lvl i.on { color: #ffb400; }
.lvl.locked { opacity: .5; cursor: default; }
#upgrades { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.up { display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,.95); color: #2a1636; border-radius: 14px; padding: 10px 14px; text-align: left; }
.up-info { flex: 1; } .up-info b { font-size: 18px; display: block; } .up-info small { opacity: .75; }
.pips { display: flex; gap: 4px; margin-top: 6px; } .pips i { width: 22px; height: 8px; border-radius: 4px; background: #ddd3e4; } .pips i.on { background: #ff7a2f; }
.buy { padding: 10px 14px; border-radius: 12px; border: none; background: #ffd23f; font-weight: 900; font-size: 16px; color: #2a1636; min-width: 92px; }
.buy:disabled { opacity: .45; cursor: default; }
#paints { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.paint { width: 54px; height: 54px; border-radius: 50%; border: 3px solid rgba(255,255,255,.6); color: #fff; font-size: 11px; font-weight: 900; }
.paint.sel { border-color: #fff; box-shadow: 0 0 0 4px #ffd23f; } .paint.locked { opacity: .55; }
#c-stars { font-size: 56px; letter-spacing: 6px; } .star { color: rgba(255,255,255,.3); } .star.on { color: #ffd23f; text-shadow: 0 4px 0 #c47b10; }
.row { font-size: 20px; margin-top: 8px; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
.newbest { color: #ffd23f; font-weight: 900; margin-top: 6px; font-size: 18px; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
@media (max-height: 520px) { .logo { font-size: 44px; } .menu-btns { flex-direction: row; flex-wrap: wrap; justify-content: center; } .menu-btns button, .menu-btns button.big { min-width: 150px; font-size: 16px; padding: 10px 16px; } }

body.touch #hud-bottom { bottom: auto; top: 96px; left: 14px; }
body.touch #hud-speedo b { font-size: 30px; }
body.touch .bar.nitro { width: 110px; }
body.touch .tleft { bottom: 22px; left: 12px; gap: 10px; }
body.touch .tright { bottom: 22px; right: 12px; gap: 10px; }
body.touch .tbtn { width: 70px; height: 70px; }
body.touch .tbtn.gas { width: 86px; height: 86px; }
body.touch .tbtn.small { position: absolute; right: 12px; bottom: 100px; width: 62px; height: 62px; margin: 0; }
