:root { --bg: #1b2a3a; --acc: #ffb703; --acc2: #fb5607; --ink: #f1f5f9; --mut: #9fb3c8; --glass: rgba(15, 25, 38, .72); --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
button { font-family: inherit; cursor: pointer; }
#cv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 4; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { position: absolute; }
.hb { pointer-events: auto; top: calc(var(--sat) + 10px); left: calc(var(--sal) + 10px); width: 44px; height: 40px; border: 0; border-radius: 12px; background: var(--glass); color: #fff; font-weight: 800; }
.chip { background: var(--glass); border-radius: 12px; padding: 7px 12px; font-weight: 800; font-size: 15px; top: calc(var(--sat) + 10px); white-space: nowrap; }
#h-pos { left: calc(var(--sal) + 62px); font-size: 18px; } #h-pos b { font-size: 26px; color: var(--acc); }
#h-lap { left: calc(var(--sal) + 62px); top: calc(var(--sat) + 58px); }
#h-time { left: calc(var(--sal) + 62px); top: calc(var(--sat) + 98px); font-variant-numeric: tabular-nums; }
#h-time:empty { display: none; }
.stars { top: calc(var(--sat) + 172px); right: calc(var(--sar) + 10px); color: #556; letter-spacing: 2px; font-size: 18px; }
.stars.hot { color: #ffd60a; animation: blink .5s infinite alternate; }
@keyframes blink { to { color: #ff006e; } }
#h-msg { left: 50%; top: 30%; transform: translateX(-50%); background: rgba(0,0,0,.55); padding: 10px 18px; border-radius: 16px; font-weight: 800; font-size: 18px; opacity: 0; transition: opacity .2s; text-align: center; max-width: 86vw; }
#h-msg.show { opacity: 1; }
#h-msg.big { font-size: 90px; background: none; color: var(--acc); text-shadow: 0 6px 20px #000a; top: 22%; }
#itemslot { pointer-events: auto; left: 50%; top: calc(var(--sat) + 8px); transform: translateX(-50%); width: 84px; height: 84px; border-radius: 22px; border: 4px solid #ffffffaa; background: radial-gradient(circle at 35% 30%, #ffffff55, rgba(15,25,38,.8)); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 6px 20px #0006; transition: transform .15s; }
#itemslot b { font-size: 40px; line-height: 1; font-weight: 400; } #itemslot small { font-size: 10px; font-weight: 800; color: var(--acc); margin-top: 2px; }
#itemslot.empty { opacity: .45; transform: translateX(-50%) scale(.8); }
#itemslot.ready { border-color: var(--acc); animation: glow 0.9s infinite alternate; }
#itemslot.roll { transform: translateX(-50%) scale(1.1) rotate(-4deg); border-color: #fff; }
@keyframes glow { to { box-shadow: 0 0 26px var(--acc); transform: translateX(-50%) scale(1.06); } }
#speedo { right: calc(var(--sar) + 14px); bottom: calc(var(--sab) + 150px); text-align: right; text-shadow: 0 2px 8px #000c; }
#speedo b { font-size: 46px; font-variant-numeric: tabular-nums; } #speedo span { display: block; font-size: 13px; color: var(--mut); font-weight: 700; }
#attrib { left: calc(var(--sal) + 8px); bottom: calc(var(--sab) + 4px); font-size: 10px; color: #fffa; text-shadow: 0 1px 2px #000; }
#minimap { position: fixed; top: calc(var(--sat) + 10px); right: calc(var(--sar) + 10px); width: 150px; height: 150px; z-index: 5; pointer-events: none; }

#touch { position: fixed; left: 0; right: 0; bottom: calc(var(--sab) + 14px); z-index: 6; display: flex; justify-content: space-between; padding: 0 calc(var(--sar) + 14px) 0 calc(var(--sal) + 14px); pointer-events: none; }
#touch button { pointer-events: auto; border: 0; border-radius: 22px; background: rgba(255,255,255,.18); color: #fff; font-weight: 900; font-size: 26px; backdrop-filter: blur(4px); box-shadow: 0 4px 14px #0005; }
#touch button.on { background: rgba(255,183,3,.75); color: #1a1100; transform: scale(.96); }
.tl, .tr { display: flex; gap: 12px; align-items: flex-end; }
.tr { position: relative; }
#t-left, #t-right { width: clamp(60px, 18vw, 84px); height: clamp(64px, 18vw, 84px); }
#t-gas { width: clamp(70px, 21vw, 92px); height: 120px; background: rgba(46, 204, 113, .45) !important; }
#t-brake { width: clamp(62px, 18vw, 80px); height: 84px; font-size: 16px !important; line-height: 1.1; }
#t-brake small { font-size: 11px; opacity: .8; }
/* item sits above the brake so the row always fits on narrow phones */
#t-item { position: absolute; right: calc(clamp(70px, 21vw, 92px) + 12px); bottom: 96px; min-width: 70px; height: 64px; padding: 0 10px; white-space: nowrap; font-size: 22px !important; }
#t-item.ready { background: rgba(255,183,3,.8) !important; color: #1a1100; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

.screen { position: fixed; inset: 0; z-index: 20; display: flex; padding: calc(var(--sat) + 14px) 14px calc(var(--sab) + 14px); background: radial-gradient(circle at 30% 10%, rgba(251,86,7,.35), rgba(27,42,58,.94) 60%); overflow-y: auto; }
.panel { margin: auto; width: 100%; max-width: 560px; background: rgba(12,20,30,.86); border: 1px solid #ffffff22; border-radius: 24px; padding: 20px; box-shadow: 0 20px 60px #0008; }
.small-p { max-width: 360px; text-align: center; }
.logo { font-size: 36px; font-weight: 900; letter-spacing: -1px; } .logo span { background: linear-gradient(90deg, var(--acc), var(--acc2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--mut); margin: 4px 0 8px; }
h2 { margin: 4px 0 12px; } h3 { margin: 14px 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; color: var(--mut); }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opts button { text-align: left; border: 2px solid #ffffff22; background: #ffffff0d; color: #fff; border-radius: 16px; padding: 10px 12px; }
.opts button.on { border-color: var(--acc); background: rgba(255,183,3,.15); }
.opts b { display: block; font-size: 16px; } .opts small { color: var(--mut); font-size: 12px; }
.cars .bars { display: flex; gap: 6px; margin-top: 6px; font-size: 10px; color: var(--mut); }
.cars .bars i { display: block; height: 4px; border-radius: 2px; background: var(--acc); margin-top: 2px; }
.go { display: block; width: 100%; margin: 16px 0 8px; padding: 15px; border: 0; border-radius: 16px; font-size: 21px; font-weight: 900; background: linear-gradient(90deg, var(--acc), var(--acc2)); color: #1a0d00; }
.panel > button:not(.go), .small { display: block; width: 100%; padding: 12px; margin: 6px 0; border: 1px solid #ffffff33; border-radius: 14px; background: #ffffff10; color: #fff; font-size: 16px; font-weight: 700; }
.row { display: flex; gap: 8px; } .row .small { margin: 0; font-size: 14px; }
.foot { font-size: 11px; color: var(--mut); margin: 12px 0 0; }
.muted { color: var(--mut); }
.place { font-size: 70px; font-weight: 900; color: var(--acc); }
#help li { margin-bottom: 8px; line-height: 1.4; }
/* Extras, Strecken, Lackierungen, Tagesziele */
.opts button { position: relative; }
.lockb { position: absolute; top: 6px; right: 6px; font-size: 12px; background: #00000066; border-radius: 8px; padding: 1px 4px; }
.opts button.lk { padding-right: 30px; }
.route3 { grid-template-columns: 1fr 1fr 1fr; } .route3 button { padding: 9px 8px; } .route3 b { font-size: 14px; }
.pname { text-transform: none; letter-spacing: 0; color: var(--ink); }
.paints { display: flex; flex-wrap: wrap; gap: 8px; }
.paints button { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 3px solid #ffffff33; background: #ffffff10; padding: 4px; }
.paints button i { display: block; width: 100%; height: 100%; border-radius: 50%; box-shadow: inset 0 -4px 8px #0004; }
.paints button.on { border-color: var(--acc); transform: scale(1.08); }
.paints button em { position: absolute; right: -4px; bottom: -4px; font-style: normal; font-size: 13px; background: #0c141e; border-radius: 8px; padding: 0 2px; }
.left { text-align: center; color: var(--mut); font-size: 13px; margin: 0 0 8px; } .left:empty { display: none; }
.grid2 { flex-wrap: wrap; } .grid2 .small { flex: 1 1 45%; margin: 0 0 8px; }
.nb { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--acc2); color: #fff; font-size: 12px; margin-left: 4px; }
.turbo { border-color: var(--acc) !important; color: var(--acc) !important; } .turbo.armed { background: rgba(255,183,3,.2) !important; }
.rank { text-align: center; font-size: 13px; color: var(--mut); margin: 8px 0 0; } .rank:empty { display: none; }
.daily { background: rgba(46,204,113,.18) !important; border-color: #2ecc71 !important; }
.sf-ov { z-index: 60; }
#shopx h3, #dyw h3, #adsx h3 { text-transform: none; letter-spacing: 0; color: #22263a; }
.lk-i { font-size: 54px; }
#unlk p { color: var(--mut); line-height: 1.4; }
.dg-top { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; }
.dg-rk { margin: 6px 0 10px; font-size: 14px; }
.dg { display: flex; align-items: center; gap: 10px; border: 1px solid #ffffff22; background: #ffffff0a; border-radius: 14px; padding: 10px 12px; margin: 8px 0; }
.dg.ok { opacity: .6; } .dg-t { flex: 1; } .dg-t b { display: block; font-size: 15px; } .dg-t small { color: var(--mut); font-size: 12px; }
.dg-bar { height: 6px; border-radius: 3px; background: #ffffff1a; margin: 6px 0 3px; overflow: hidden; } .dg-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--acc), var(--acc2)); }
.dg-b { border: 0; border-radius: 12px; padding: 9px 12px; font-weight: 900; background: linear-gradient(90deg, var(--acc), var(--acc2)); color: #1a0d00; animation: pulse 1s infinite; }
.dg-r { color: var(--mut); font-weight: 800; font-size: 13px; white-space: nowrap; } .dg-c { color: #2ecc71; font-size: 22px; font-weight: 900; }
.bdgs { display: flex; flex-wrap: wrap; gap: 6px; } .bdg { font-size: 20px; padding: 4px 8px; border-radius: 12px; background: #ffffff10; filter: grayscale(1); opacity: .45; } .bdg.on { filter: none; opacity: 1; background: rgba(255,183,3,.18); }
.tg { display: flex; align-items: center; gap: 10px; margin: 12px 0; font-weight: 700; text-align: left; } .tg input { width: 22px; height: 22px; accent-color: var(--acc); flex: none; }
@media (max-height: 500px) { #t-left, #t-right { width: 70px; height: 70px; } #t-gas { height: 96px; } #speedo { bottom: calc(var(--sab) + 110px); } .stars { top: calc(var(--sat) + 10px); right: calc(var(--sar) + 170px); } }
