:root {
  --asphalt: #0e1014; --asphalt-2: #161920; --panel: #1b1f27; --panel-2: #232833; --line: #2c3240;
  --text: #f3efe7; --muted: #8f96a3; --sodium: #ffb02e; --sodium-deep: #f07c13; --red: #ff4438;
  --green: #35e07c; --nitro: #44c8ff; --violet: #b066ff;
  --display: 'Unbounded', system-ui, sans-serif; --body: 'Manrope', system-ui, sans-serif;
  --radius: 14px; --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--asphalt); color: var(--text); font: 500 15px/1.45 var(--body); }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--sodium); outline-offset: 2px; }
img { display: block; max-width: 100%; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 700; margin: 20px 0 10px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.app { display: grid; grid-template-rows: auto 1fr auto; height: 100dvh; max-width: 560px; margin: 0 auto; position: relative; }

/* Верхняя панель */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 6px; }
.level-chip { display: flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); }
.level-chip img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; object-position: top; }
.level-chip span { display: grid; gap: 3px; }
.level-chip b { font: 800 12px/1 var(--display); }
.xpbar { display: block; width: 38px; height: 4px; border-radius: 2px; background: #2b313d; overflow: hidden; }
.xpbar i { display: block; height: 100%; width: 0; background: var(--sodium); }
.wallet { display: flex; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font: 700 12px/1 var(--display); }
.chip small { font: 600 10px var(--body); color: var(--muted); }
.chip .plus { display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--sodium); color: #241300; font: 900 12px/1 var(--body); }
.cur { font-style: normal; display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: linear-gradient(160deg, var(--sodium), var(--sodium-deep)); color: #2a1600; font: 900 10px/1 var(--display); vertical-align: -3px; }
.cur-img { width: 18px; height: 18px; display: inline-block; vertical-align: -4px; object-fit: contain; }
.cur-star { font-size: 14px; }
.xp { color: var(--nitro); font-weight: 800; }

.screen { overflow-y: auto; overflow-x: hidden; padding: 0 14px 22px; -webkit-overflow-scrolling: touch; }

/* Нижнее меню */
.tabbar { display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; padding: 6px 6px calc(6px + var(--safe-b)); background: linear-gradient(to top, #0b0d10 70%, transparent); border-top: 1px solid #1f232c; }
.tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 48px; padding: 6px 2px; font-size: 11px; font-weight: 700; color: var(--muted); border-radius: 12px; }
.tabbar button svg { width: 22px; height: 22px; }
.tabbar button.active { color: var(--text); }
.tabbar button.active svg { color: var(--sodium); }
.tabbar .tab-race { transform: translateY(-10px); }
.tabbar .tab-race svg { width: 26px; height: 26px; padding: 12px; box-sizing: content-box; border-radius: 50%; background: linear-gradient(160deg, var(--sodium), var(--sodium-deep)); color: #241300; box-shadow: 0 6px 22px rgba(255, 140, 20, .35); }
.tabbar .tab-race.active svg { color: #241300; }
.dot { position: absolute; top: 6px; right: calc(50% - 16px); width: 9px; height: 9px; border-radius: 50%; background: var(--red); border: 2px solid var(--asphalt); }

/* Общие элементы */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px; padding: 0 16px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 800; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary { background: linear-gradient(160deg, var(--sodium), var(--sodium-deep)); color: #251400; border: 0; font-family: var(--display); font-weight: 700; letter-spacing: .02em; box-shadow: 0 8px 24px rgba(240, 124, 19, .28); }
.btn-blue { background: linear-gradient(160deg, #8fe2ff, var(--nitro)); color: #03222f; border: 0; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-wide { width: 100%; }
.row { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card { padding: 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.card + .card { margin-top: 10px; }
.chip-rarity, .chip-class { display: inline-block; padding: 2px 8px; border-radius: 6px; font: 800 11px/1.5 var(--body); color: #0d0f12; background: var(--c); }
.chip-class { font-family: var(--display); }
.pi { font: 700 12px/1 var(--display); padding: 4px 8px; border-radius: 6px; background: #0b0d10; border: 1px solid var(--line); color: var(--sodium); }
.bar { height: 6px; border-radius: 3px; background: #252a35; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--sodium-deep), var(--sodium)); }
.seg { display: flex; gap: 6px; padding: 4px; border-radius: 12px; background: var(--panel); margin: 12px 0; overflow-x: auto; }
.seg button { flex: 1; min-height: 38px; padding: 0 12px; border-radius: 9px; font-weight: 800; font-size: 13px; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--panel-2); color: var(--text); }
.empty { padding: 30px 10px; text-align: center; color: var(--muted); }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); font: 800 11px/1 var(--body); }

/* Гараж */
.garage-stage { position: relative; margin: 0 -14px; height: 290px; background: #090a0d url('/img/ui/garage.webp') center 58% / cover no-repeat; overflow: hidden; }
.garage-stage::after { content: ''; position: absolute; inset: auto 0 0 0; height: 90px; background: linear-gradient(transparent, var(--asphalt)); }
.garage-lera { position: absolute; right: 4%; bottom: 74px; height: 72%; width: auto; z-index: 0; filter: drop-shadow(0 12px 12px rgba(0,0,0,.6)) brightness(.92); }
.garage-car { position: absolute; left: 50%; bottom: 62px; width: 92%; height: auto; transform: translateX(-50%); filter: drop-shadow(0 18px 14px rgba(0, 0, 0, .65)); z-index: 1; }
.stage-nav { position: absolute; top: 46%; z-index: 2; width: 42px; height: 42px; border-radius: 50%; background: rgba(14, 16, 20, .7); border: 1px solid var(--line); display: grid; place-items: center; }
.stage-nav.prev { left: 10px; } .stage-nav.next { right: 10px; }
.stage-count { position: absolute; top: 12px; right: 14px; z-index: 2; font: 700 12px var(--display); color: var(--muted); }
.car-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-top: -24px; position: relative; z-index: 2; }
.car-head h1 { font-size: 23px; font-weight: 900; line-height: 1.1; }
.car-head .sub { color: var(--muted); font-size: 13px; margin-top: 5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stats { display: grid; gap: 8px; margin: 14px 0; }
.stat { display: grid; grid-template-columns: 92px 1fr 66px; align-items: center; gap: 10px; font-size: 13px; }
.stat b { text-align: right; font: 700 12px var(--display); }
.actions { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }
.visit { display: grid; grid-template-columns: 76px 1fr; gap: 12px; padding: 12px; margin-top: 14px; border-radius: var(--radius); background: linear-gradient(120deg, #2a1d08, var(--panel) 65%); border: 1px solid #4a3410; }
.visit img { width: 76px; height: 76px; border-radius: 12px; object-fit: cover; }
.visit b { font-family: var(--display); font-size: 14px; }
.visit p { font-size: 13px; margin: 4px 0 8px; }
.missions { margin-top: 14px; }
.mission { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--panel); margin-top: 6px; }
.mission .bar { margin-top: 6px; }
.mission.done { border: 1px solid #2f6b46; }
.quick-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.quick-links button { display: grid; justify-items: center; gap: 4px; padding: 12px 6px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 12px; font-weight: 800; }
.quick-links svg { color: var(--sodium); }

/* Тюнинг */
.tune-head { display: flex; align-items: center; gap: 12px; padding: 12px 0 4px; }
.tune-head img { width: 132px; height: auto; }
.parts { display: grid; gap: 10px; margin-top: 12px; }
.part { display: grid; grid-template-columns: 60px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px 10px 8px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.part img { width: 60px; height: 60px; object-fit: contain; }
.part h3 { font: 800 15px var(--body); }
.part p { margin: 2px 0 6px; font-size: 12px; color: var(--muted); }
.pips { display: flex; gap: 3px; }
.pips i { width: 11px; height: 5px; border-radius: 3px; background: #2b313d; }
.pips i.on { background: var(--sodium); box-shadow: 0 0 6px rgba(255, 176, 46, .45); }

/* Карьера */
.map { position: relative; margin: 0 -14px; height: 210px; background: url('/img/ui/map.webp') center / cover; }
.map::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 45%, var(--asphalt)); }
.district { margin-top: 14px; border-radius: 16px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); }
.district.locked { opacity: .55; }
.district-head { position: relative; height: 120px; background-size: cover; background-position: center; display: flex; align-items: flex-end; padding: 12px; }
.district-head::before { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 20%, rgba(10, 11, 14, .92)); }
.district-head > * { position: relative; }
.district-head h3 { font-size: 18px; }
.district-head .boss-face { position: absolute; right: 10px; bottom: 10px; width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--sodium); object-fit: cover; }
.district-body { padding: 10px 12px 12px; }
.district-body p { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.career-races { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.career-race { position: relative; display: grid; justify-items: center; gap: 2px; padding: 8px 2px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 11px; font-weight: 800; }
.career-race img { width: 64px; height: auto; }
.career-race.boss { grid-column: span 4; grid-template-columns: 56px 1fr auto; text-align: left; justify-items: start; align-items: center; padding: 10px; gap: 10px; border-color: #5a3b10; background: linear-gradient(120deg, #2a1a08, var(--panel-2)); }
.career-race.boss img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.career-race[disabled] { opacity: .45; }
.stars { color: #4a505c; letter-spacing: 1px; font-size: 12px; }
.stars b { color: var(--sodium); font-weight: 400; }

/* Хаб гонок */
.mode { position: relative; display: block; width: 100%; text-align: left; overflow: hidden; border-radius: 16px; min-height: 118px; padding: 14px; margin-top: 10px; background: var(--panel) center / cover; border: 1px solid var(--line); }
.mode::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10, 11, 14, .95) 35%, rgba(10, 11, 14, .25)); }
.mode > * { position: relative; }
.mode h3 { font-size: 18px; }
.mode p { font-size: 13px; color: #c5c9d1; margin: 4px 0 8px; max-width: 70%; }
.mode .tag { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 800; }
.mode[disabled] { opacity: .5; }
.mode .lock { position: absolute; right: 14px; top: 14px; }

/* Лера */
.lera-hero { display: grid; grid-template-columns: 42% 1fr; gap: 12px; align-items: end; margin-top: 8px; }
.lera-hero img { width: 100%; height: auto; filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .6)); }
.skill { margin-top: 8px; }
.skill .row { justify-content: space-between; font-size: 13px; }
.skill b { font-family: var(--display); font-size: 12px; }
.job { padding: 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); margin-top: 8px; }
.job h3 { font: 800 15px var(--body); }
.ladder { display: flex; gap: 4px; margin: 8px 0; }
.ladder i { flex: 1; height: 5px; border-radius: 3px; background: #2b313d; }
.ladder i.on { background: var(--green); }
.timer-card { padding: 14px; border-radius: 14px; background: linear-gradient(120deg, #0f2a1c, var(--panel)); border: 1px solid #245a3b; }
.outfits { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.outfit { display: grid; gap: 4px; padding: 6px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); text-align: center; font-size: 11px; font-weight: 800; }
.outfit img { width: 100%; aspect-ratio: 2/3; object-fit: cover; object-position: top; border-radius: 8px; }
.outfit.on { border-color: var(--sodium); }

/* Город: чат, поддержка */
.chat { display: flex; flex-direction: column; height: calc(100dvh - 250px); min-height: 300px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 6px 0; }
.msg { max-width: 85%; padding: 8px 11px; border-radius: 14px; background: var(--panel); font-size: 14px; word-wrap: break-word; }
.msg b { display: block; font-size: 12px; color: var(--sodium); }
.msg small { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
.msg.mine { align-self: flex-end; background: #2a2f3c; }
.msg.admin { background: #142a3a; border: 1px solid #23506e; }
.chat-form { display: flex; gap: 8px; padding-top: 8px; }
.chat-form textarea, .input { flex: 1; resize: none; min-height: 44px; max-height: 120px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: 500 15px var(--body); }
.meet-car { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: var(--panel); margin-top: 6px; }
.meet-car img { width: 110px; height: auto; }
.list-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--panel); margin-top: 6px; }
.list-row .place { font: 900 14px var(--display); color: var(--muted); text-align: center; }
.list-row.me { outline: 1px solid var(--sodium); }
.list-row b { font-family: var(--display); }

/* Карточки */
.sets { display: grid; gap: 10px; }
.set { display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: center; padding: 10px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); text-align: left; width: 100%; }
.set img { width: 76px; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px; }
.cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tcard { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 3/4; background: #111; border: 2px solid var(--c, #333); }
.tcard img { width: 100%; height: 100%; object-fit: cover; }
.tcard .ttl { position: absolute; inset: auto 0 0 0; padding: 18px 6px 6px; font-size: 10px; font-weight: 800; background: linear-gradient(transparent, rgba(0, 0, 0, .9)); }
.tcard.missing img { filter: grayscale(1) brightness(.25); }
.tcard .cnt { position: absolute; top: 5px; right: 5px; padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, .7); font-size: 11px; font-weight: 800; }

/* Магазин */
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.product { position: relative; display: grid; gap: 6px; justify-items: center; padding: 14px 10px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); text-align: center; }
.product img { width: 72px; height: 72px; object-fit: contain; }
.product .ribbon { position: absolute; top: 8px; right: 8px; padding: 2px 6px; border-radius: 6px; background: var(--green); color: #052; font: 800 11px var(--body); }
.product.wide { grid-column: span 2; grid-template-columns: 90px 1fr; text-align: left; justify-items: start; }
.crates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.crate { padding: 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); text-align: center; display: grid; gap: 8px; }
.crate img { width: 104px; height: 104px; margin: 0 auto; object-fit: contain; }
.odds { font-size: 11px; color: var(--muted); line-height: 1.5; }
.cars-list { display: grid; gap: 10px; }
.car-row { display: grid; grid-template-columns: 116px 1fr; gap: 12px; align-items: center; padding: 10px 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.car-row img { width: 116px; height: auto; }
.car-row h3 { font: 800 15px var(--body); }
.car-row .meta { display: flex; gap: 6px; align-items: center; margin: 4px 0 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.car-row.locked img { filter: grayscale(1) brightness(.55); }

/* Модальные окна, тосты, диалоги */
.overlay { position: fixed; inset: 0; z-index: 20; background: var(--asphalt); display: flex; flex-direction: column; }
.modal-wrap { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(5, 6, 8, .78); animation: fade .15s ease-out; }
.modal { width: min(100%, 420px); max-height: 86dvh; overflow-y: auto; padding: 20px 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); text-align: center; display: grid; gap: 12px; animation: rise .2s ease-out; }
.modal.wide { width: min(100%, 520px); }
.modal h2 { margin: 0; font-size: 20px; }
.modal img.prize { width: 80%; margin: 0 auto; filter: drop-shadow(0 12px 12px rgba(0, 0, 0, .6)); }
@keyframes fade { from { opacity: 0; } } @keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); z-index: 40; max-width: 88%; padding: 11px 16px; border-radius: 12px; background: #262b36; border: 1px solid var(--line); font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); text-align: center; }
.toast.good { border-color: #2f6b46; } .toast.bad { border-color: #7a2a24; }
.npc-line { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: start; text-align: left; }
.npc-line img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--sodium); }
.npc-line b { font-family: var(--display); font-size: 14px; }
.npc-line p { font-size: 14px; margin-top: 4px; }

/* Сюжет / обучение */
.story { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; background: #000 center / cover no-repeat; }
.story::before { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 35%, rgba(5, 6, 8, .95) 75%); }
.story > * { position: relative; }
.story-text { padding: 20px 18px calc(22px + var(--safe-b)); display: grid; gap: 14px; }
.story-text p { font-size: 17px; line-height: 1.5; }
.story-text .who { font: 700 13px var(--display); color: var(--sodium); }
.story-skip { position: absolute; top: 14px; right: 14px; z-index: 2; padding: 6px 12px; border-radius: 999px; background: rgba(0, 0, 0, .55); font-size: 13px; font-weight: 800; }
.story-dots { display: flex; gap: 6px; }
.story-dots i { width: 22px; height: 4px; border-radius: 2px; background: #3a3f4a; }
.story-dots i.on { background: var(--sodium); }

/* Подготовка к заезду */
.versus { flex: 1; display: grid; grid-template-rows: 1fr auto 1fr auto; padding: 18px 16px calc(18px + var(--safe-b)); gap: 8px; background: radial-gradient(120% 60% at 50% 50%, #2a1a06 0%, var(--asphalt) 70%); }
.vs-side { display: grid; align-content: center; justify-items: start; gap: 6px; }
.vs-side.them { text-align: right; justify-items: end; }
.vs-side img.car { width: 86%; height: auto; filter: drop-shadow(0 14px 10px rgba(0, 0, 0, .6)); }
.vs-side.them img.car { transform: scaleX(-1); }
.vs-side h3 { font-size: 18px; }
.vs-face { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; border: 2px solid var(--sodium); }
.vs-mark { font: 900 44px/1 var(--display); text-align: center; color: var(--sodium); text-shadow: 0 0 24px rgba(255, 140, 20, .5); }
.rule { display: inline-block; padding: 4px 10px; border-radius: 8px; background: #3a1f0f; color: var(--sodium); font-size: 12px; font-weight: 800; }

/* Гонка */
.race { position: relative; flex: 1; display: flex; flex-direction: column; background: #07080a; user-select: none; -webkit-user-select: none; touch-action: none; }
.race canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hud-top { position: relative; z-index: 2; display: grid; gap: 8px; padding: 10px 14px 0; }
.progress { position: relative; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .12); }
.progress i { position: absolute; top: -4px; width: 14px; height: 14px; border-radius: 50%; transform: translateX(-50%); border: 2px solid #07080a; }
.progress i.me { background: var(--sodium); } .progress i.them { background: #c9ced8; opacity: .85; }
.hud-row { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; font-size: 13px; color: var(--muted); }
.hud-row b { font: 900 22px var(--display); color: var(--text); }
.tree { position: absolute; z-index: 3; left: 50%; top: 16%; transform: translateX(-50%); display: grid; gap: 10px; padding: 14px 12px; border-radius: 16px; background: rgba(8, 9, 12, .85); border: 1px solid #262b35; }
.tree i { width: 34px; height: 34px; border-radius: 50%; background: #1d2129; border: 2px solid #2c323d; }
.tree i.amber { background: var(--sodium); box-shadow: 0 0 22px var(--sodium); }
.tree i.go { background: var(--green); box-shadow: 0 0 28px var(--green); }
.callout { position: absolute; z-index: 3; left: 50%; top: 27%; transform: translateX(-50%); font: 900 26px var(--display); text-shadow: 0 4px 20px rgba(0, 0, 0, .8); pointer-events: none; white-space: nowrap; animation: pop .7s ease-out forwards; }
.callout.good { color: var(--green); } .callout.bad { color: var(--red); } .callout.warn { color: var(--sodium); } .callout.blue { color: var(--nitro); }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, 8px) scale(.9); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -10px); } }
.hud-bottom { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px; padding: 0 12px calc(14px + var(--safe-b)); }
.tach { width: 150px; height: 128px; justify-self: center; }
.tach svg { width: 150px; height: 128px; overflow: visible; }
.tach .gear { font: 900 34px var(--display); fill: var(--text); }
.tach .speed { font: 700 12px var(--display); fill: var(--muted); }
.pedal { min-width: 0; min-height: 96px; border-radius: 20px; font: 900 11.5px/1.25 var(--display); letter-spacing: -.01em; display: grid; place-items: center; text-align: center; padding: 8px; }
.pedal:active, .pedal.down { transform: scale(.96); filter: brightness(1.15); }
.pedal-shift { background: linear-gradient(160deg, var(--sodium), var(--sodium-deep)); color: #241300; box-shadow: 0 10px 30px rgba(240, 124, 19, .35); }
.pedal-shift.ready { background: linear-gradient(160deg, #6ff0a5, var(--green)); color: #03200f; }
.pedal-nitro { background: linear-gradient(160deg, #8fe2ff, var(--nitro)); color: #032433; box-shadow: 0 10px 30px rgba(68, 200, 255, .3); }
.pedal-nitro[disabled] { opacity: .3; }
.pedal-nitro.none { visibility: hidden; }
.drift-pads { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 0 12px calc(14px + var(--safe-b)); }
.drift-pads .pedal { min-height: 104px; background: rgba(35, 40, 51, .85); border: 1px solid var(--line); color: var(--text); font-size: 26px; }
.drift-pads .pedal.hb { background: linear-gradient(160deg, #ff8a7a, var(--red)); color: #2a0503; font-size: 13px; }
.drift-score { position: absolute; z-index: 2; top: 54px; left: 0; right: 0; text-align: center; pointer-events: none; }
.drift-score b { font: 900 34px var(--display); text-shadow: 0 4px 18px rgba(0, 0, 0, .8); }
.drift-score span { display: block; font: 900 16px var(--display); color: var(--sodium); }

/* Итог заезда */
.result { margin: auto; width: min(92%, 420px); padding: 20px 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); display: grid; gap: 12px; text-align: center; }
.result h1 { font-size: 32px; font-weight: 900; }
.result h1.win { color: var(--sodium); } .result h1.lose { color: var(--muted); }
.result table { width: 100%; border-collapse: collapse; font-size: 14px; }
.result td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.result td:first-child { text-align: left; color: var(--muted); }
.result td b { font-family: var(--display); }
.result .gain { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; font: 700 15px var(--display); }
.up { color: var(--green); } .down { color: var(--red); }
.big-stars { font-size: 34px; letter-spacing: 6px; color: #3a3f4a; }
.big-stars b { color: var(--sodium); font-weight: 400; text-shadow: 0 0 18px rgba(255, 176, 46, .6); }

/* Покраска, серия входов, достижения */
.paints { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.paint { display: grid; gap: 2px; justify-items: center; padding: 6px 4px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-size: 10px; font-weight: 800; }
.paint img { width: 100%; height: auto; }
.paint small { font-size: 10px; color: var(--muted); font-weight: 600; }
.paint.on { border-color: var(--sodium); }
.streak { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.streak-day { display: grid; gap: 3px; justify-items: center; padding: 8px 4px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 11px; }
.streak-day b { font: 900 16px var(--display); }
.streak-day.done { border-color: #2f6b46; opacity: .6; }
.streak-day.next { border-color: var(--sodium); box-shadow: 0 0 14px rgba(255, 176, 46, .35); }
.streak-day:last-child { grid-column: span 2; }
.ach { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); margin-top: 8px; }
.ach.ready { border-color: var(--sodium); }
.ach .tiers { display: flex; gap: 4px; margin: 4px 0; }
.ach .tiers i { width: 18px; height: 5px; border-radius: 3px; background: #2b313d; }
.ach .tiers i.on { background: var(--sodium); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
