* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; }
body { overflow: hidden; font-family: 'Vazirmatn', system-ui, sans-serif; background: #2b1405; color: #3b1d00; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
canvas { display: block; touch-action: none; }
button { font-family: inherit; border: 0; cursor: pointer; color: inherit; background: none; }
.app { position: fixed; inset: 0; overflow: hidden; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; line-height: 1.7; }
.menu { background: linear-gradient(180deg, rgba(255,190,90,.25), rgba(80,20,0,.55)), url(/assets/bg_menu.webp) center/cover; padding: max(14px, env(safe-area-inset-top)) 16px 16px; justify-content: center; gap: 6px; overflow-y: auto; }
.logo { width: min(64vw, 300px); filter: drop-shadow(0 8px 16px rgba(0,0,0,.35)); animation: bob 3s ease-in-out infinite; }
.title { font-size: clamp(30px, 9vw, 46px); font-weight: 900; color: #fff; text-shadow: 0 4px 0 #b5179e, 0 8px 18px rgba(0,0,0,.4); }
.sub { color: #fff7e6; font-weight: 600; text-align: center; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.hero-car { width: min(52vw, 240px); animation: drive 1.6s ease-in-out infinite; filter: drop-shadow(0 14px 10px rgba(0,0,0,.35)); }
.stack { display: flex; flex-direction: column; gap: 10px; width: min(80vw, 320px); margin-top: 8px; }
.btn { min-height: 52px; padding: 6px 20px; border-radius: 18px; font-size: 18px; font-weight: 800; color: #3b1d00; background: linear-gradient(180deg, #ffe066, #ffb627); box-shadow: 0 5px 0 #c1661c, 0 10px 18px rgba(0,0,0,.25); transition: transform .08s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #c1661c; }
.btn.big { font-size: 22px; min-height: 60px; }
.btn.alt { background: linear-gradient(180deg, #5ee6d8, #2a9d8f); color: #fff; box-shadow: 0 5px 0 #1b6b61, 0 10px 18px rgba(0,0,0,.25); }
.btn.ghost { background: #f3e2c4; box-shadow: 0 4px 0 #c9a77a; color: #7a4b20; }
.btn .ic, .cn img { width: 22px; }
.coins { position: absolute; top: max(12px, env(safe-area-inset-top)); inset-inline-start: 14px; display: flex; align-items: center; gap: 6px; background: rgba(59,29,0,.7); color: #ffe066; font-weight: 800; padding: 2px 14px 2px 10px; border-radius: 99px; }
.coins img { width: 26px; } .coins.s { position: static; }
.bar { width: 100%; max-width: 560px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 0 8px; color: #fff; }
.bar h2 { font-size: 22px; font-weight: 900; text-shadow: 0 3px 0 #b5179e; }
.icon-btn { width: 46px; height: 46px; border-radius: 14px; background: #fff3d6; font-size: 24px; font-weight: 900; color: #7a4b20; box-shadow: 0 4px 0 #c9a77a; }
.map { background: linear-gradient(180deg, #ffb35c, #e76f51 60%, #8c2f39); padding: max(12px, env(safe-area-inset-top)) 14px 12px; }
.path { flex: 1; width: 100%; max-width: 560px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 8px 4px 20px; position: relative; }
.node { display: flex; gap: 12px; align-items: center; background: #fff7e6; border-radius: 22px; padding: 10px; text-align: start; box-shadow: 0 6px 0 #c1661c, 0 12px 20px rgba(0,0,0,.2); width: 88%; position: relative; animation: rise .4s both; }
.node.l { align-self: flex-start; } .node.r { align-self: flex-end; }
.node.cur { outline: 4px solid #ffe066; animation: rise .4s both, glow 1.4s ease-in-out infinite alternate; }
.node.locked { filter: grayscale(.8); opacity: .8; }
.thumb { width: 82px; height: 82px; border-radius: 16px; background-size: cover; flex-shrink: 0; }
.lock { position: absolute; width: 50px; inset-inline-start: 26px; top: 26px; }
.info { min-width: 0; display: flex; flex-direction: column; line-height: 1.6; }
.info b { font-size: 18px; } .info small { color: #b5179e; font-weight: 700; }
.muted { color: #8a6440; font-size: 13px; overflow-wrap: anywhere; }
.stars { display: flex; gap: 2px; } .stars img { width: 24px; } .stars img.off { filter: grayscale(1) brightness(.6); opacity: .5; }
.stars.big { justify-content: center; gap: 8px; } .stars.big img { width: 64px; }
.stars.big img.pop { animation: starpop .5s both cubic-bezier(.3,1.8,.5,1); }
.foot { width: 100%; max-width: 360px; }
.garage { justify-content: flex-start; }
.showcase { position: relative; height: 26vh; min-height: 150px; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.plinth { position: absolute; bottom: 4px; width: 230px; height: 46px; border-radius: 50%; background: radial-gradient(#ffe7b3, #c1661c); box-shadow: 0 8px 20px rgba(0,0,0,.35); }
.show-car { position: relative; height: 100%; max-height: 230px; animation: carin .45s both cubic-bezier(.3,1.5,.5,1), bob 3s 0.5s ease-in-out infinite; }
.panel { background: #fff7e6; border-radius: 26px; padding: 16px 18px; width: min(92vw, 400px); display: flex; flex-direction: column; gap: 8px; box-shadow: 0 8px 0 #c1661c, 0 18px 30px rgba(0,0,0,.3); border: 3px solid #ffd23f; }
.panel h2 { font-size: 24px; font-weight: 900; text-align: center; color: #b5179e; }
.stat { display: flex; align-items: center; justify-content: space-between; font-weight: 700; }
.pips { display: flex; gap: 4px; } .pips i { width: 26px; height: 12px; border-radius: 6px; background: #ead2ab; }
.pips i.on { background: linear-gradient(90deg, #ff9f1c, #e63946); }
.cars { display: flex; gap: 8px; margin-top: 10px; width: min(92vw, 400px); }
.carchip { flex: 1; background: rgba(255,247,230,.85); border-radius: 16px; padding: 4px; position: relative; font-weight: 800; font-size: 13px; border: 3px solid transparent; }
.carchip.sel { border-color: #ffd23f; background: #fff; transform: translateY(-4px); }
.carchip img { width: 100%; } .carchip .lk { position: absolute; width: 26px; top: 2px; inset-inline-end: 2px; }
.overlay { position: absolute; inset: 0; background: rgba(30,10,0,.55); display: flex; align-items: center; justify-content: center; z-index: 20; backdrop-filter: blur(3px); }
.hint { font-size: 12px; color: #8a6440; text-align: center; }
.result { position: relative; padding-top: 70px; margin-top: 50px; }
.res-art { position: absolute; width: 140px; top: -70px; inset-inline-start: calc(50% - 70px); filter: drop-shadow(0 8px 10px rgba(0,0,0,.3)); }
.kv { display: flex; justify-content: space-around; text-align: center; background: #ffeccc; border-radius: 16px; padding: 6px; }
.kv small { display: block; color: #8a6440; } .kv b { font-size: 17px; } .cn { display: inline-flex; align-items: center; gap: 4px; }
.table { list-style: none; font-size: 14px; max-height: 26vh; overflow: auto; }
.table li { display: flex; justify-content: space-between; padding: 2px 10px; border-radius: 8px; }
.table li.me { background: #ffd23f; font-weight: 800; }
.row2 { display: flex; gap: 8px; } .row2 .btn { font-size: 15px; min-height: 46px; padding: 4px 8px; }
.mono { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.pop { animation: popin .35s both cubic-bezier(.3,1.6,.5,1); }

.play .gl { position: absolute; inset: 0; }
.hud { position: absolute; inset: 0; pointer-events: none; color: #fff; }
.hud button, .hud .wheel { pointer-events: auto; touch-action: none; }
.hud-top { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; gap: 8px; align-items: flex-start; }
.chip { background: rgba(59,29,0,.72); border-radius: 16px; padding: 4px 12px; display: flex; align-items: baseline; gap: 2px; border: 2px solid rgba(255,210,63,.6); line-height: 1.4; }
.chip.rank b { font-size: 34px; font-weight: 900; color: #ffd23f; } .chip.rank small { font-size: 16px; } .chip.rank span { font-size: 12px; margin-inline-start: 6px; }
.chip.col { flex-direction: column; align-items: flex-start; } .chip.col span { font-size: 13px; } .chip.col b { font-size: 18px; }
.pausebtn { margin-inline-start: auto; width: 50px; height: 50px; } .pausebtn img { width: 100%; }
.mini { position: absolute; top: calc(max(10px, env(safe-area-inset-top)) + 64px); left: 10px; width: 108px; height: 108px; background: rgba(255,240,210,.55); border-radius: 50%; border: 3px solid #ffd23f; }
.speedo { position: absolute; top: calc(max(10px, env(safe-area-inset-top)) + 64px); right: 10px; width: 116px; text-align: center; background: rgba(59,29,0,.65); border-radius: 18px; padding: 4px 6px 2px; line-height: 1.2; }
.speedo svg { width: 100%; display: block; } .speedo b { font-size: 26px; font-weight: 900; display: block; margin-top: -26px; } .speedo span { font-size: 10px; }
.count { position: absolute; top: 30%; width: 100%; text-align: center; font-size: 110px; font-weight: 900; color: #ffd23f; text-shadow: 0 6px 0 #b5179e, 0 10px 30px rgba(0,0,0,.4); animation: countin .6s both; }
.toast { position: absolute; top: 42%; width: 100%; text-align: center; font-size: 28px; font-weight: 900; text-shadow: 0 3px 0 #b5179e, 0 6px 14px rgba(0,0,0,.5); animation: toast 1.6s both; }
.wrong { position: absolute; top: 24%; left: 50%; transform: translateX(-50%); background: #e63946; padding: 4px 18px; border-radius: 12px; font-weight: 900; animation: blink .5s infinite alternate; }
.controls { position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: flex-end; direction: ltr; }
.wheel { width: 160px; height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.wheel img { width: 128px; transition: transform .05s; filter: drop-shadow(0 6px 8px rgba(0,0,0,.4)); }
.wheel span { font-size: 11px; text-shadow: 0 1px 3px #000; }
.btns { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.btns .row { display: flex; gap: 10px; align-items: flex-end; }
.brake { width: 74px; height: 74px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ff6b6b, #c1121f); box-shadow: 0 5px 0 #7a0c14; font-weight: 900; font-size: 16px; color: #fff; }
.brake:active, .nitro:active, .item:active { transform: translateY(3px); }
.nitro { width: 92px; height: 92px; border-radius: 50%; position: relative; background: conic-gradient(#4cf2ff var(--n), rgba(0,0,0,.45) 0); padding: 6px; box-shadow: 0 5px 0 #0b4f6c; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.nitro::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #4cc9f0, #3a0ca3); }
.nitro img, .nitro span { position: relative; } .nitro img { width: 48px; } .nitro span { font-size: 12px; font-weight: 900; color: #fff; margin-top: -6px; }
.nitro.on { animation: pulse .25s infinite alternate; }
.item { width: 76px; height: 76px; border-radius: 20px; background: rgba(59,29,0,.6); border: 3px dashed rgba(255,210,63,.6); display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 800; }
.item.has { background: radial-gradient(#fff3a8, #ffb627); border: 3px solid #fff; color: #3b1d00; animation: pulse .6s infinite alternate; }
.item img { width: 46px; } .item i { font-size: 30px; font-style: normal; opacity: .6; }
@keyframes bob { 50% { transform: translateY(-8px); } }
@keyframes drive { 50% { transform: translateY(-4px) rotate(-1.5deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(20px); } }
@keyframes glow { to { box-shadow: 0 6px 0 #c1661c, 0 0 30px #ffe066; } }
@keyframes starpop { from { transform: scale(0) rotate(-90deg); } }
@keyframes popin { from { transform: scale(.6); opacity: 0; } }
@keyframes carin { from { transform: translateX(-60px) scale(.7); opacity: 0; } }
@keyframes countin { from { transform: scale(2.4); opacity: 0; } 60% { transform: scale(1); opacity: 1; } }
@keyframes toast { 0% { transform: scale(.4); opacity: 0; } 15% { transform: scale(1.1); opacity: 1; } 25% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-30px); } }
@keyframes blink { to { opacity: .5; } }
@keyframes pulse { to { transform: scale(1.07); } }
