:root {
  --bg: #0f1117;
  --panel: #181b24;
  --panel2: #20242f;
  --line: #2c3140;
  --text: #e7e9ee;
  --muted: #8b93a5;
  --accent: #ffcc33;
  --ok: #4cbb6c;
  --err: #ef4444;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1, h2, h3 { margin: 0 0 12px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=color] { height: 42px; padding: 4px; cursor: pointer; }
button { font: inherit; cursor: pointer; color: inherit; }
.btn { border: 1px solid var(--line); background: var(--panel2); padding: 8px 14px; border-radius: 8px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: #1a1a1a; border-color: var(--accent); font-weight: 600; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--err); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.big { padding: 14px 40px; font-size: 18px; }
.btn:disabled { opacity: .5; cursor: default; }
.stack { display: grid; gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.card.narrow { max-width: 420px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 8px; }
.toolbar select { width: auto; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.auth-card h1 { color: var(--accent); }
.auth-card form { display: grid; gap: 10px; margin-top: 12px; }
.auth-tabs { display: flex; gap: 6px; margin-top: 16px; }
.auth-tabs button { flex: 1; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: none; }
.auth-tabs button.on { background: var(--panel2); border-color: var(--muted); }

/* header */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.logo { font-weight: 800; color: var(--accent); font-size: 18px; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; padding: 8px 12px; border-radius: 8px; color: var(--muted); white-space: nowrap; position: relative; }
.tabs button.on { background: var(--panel2); color: var(--text); }
.dot { display: none; width: 8px; height: 8px; border-radius: 50%; background: var(--err); position: absolute; top: 6px; right: 4px; }
.dot.on { display: block; }
.me { display: flex; align-items: center; gap: 8px; }
.balance { font-weight: 700; font-variant-numeric: tabular-nums; background: var(--panel2); padding: 6px 12px; border-radius: 8px; }
.bell, .who, .bonus { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; position: relative; }
.bonus { border-color: var(--accent); color: var(--accent); }
.badge { position: absolute; top: -6px; right: -6px; background: var(--err); color: #fff; font-size: 11px; border-radius: 10px; padding: 1px 6px; }
.notes { position: fixed; right: 16px; top: 64px; z-index: 6; width: min(360px, calc(100vw - 32px)); max-height: 60vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: 0 10px 30px #0008; }
.note { padding: 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.note:last-child { border: 0; }
.note time { display: block; color: var(--muted); font-size: 12px; }

main { padding: 16px; max-width: 1200px; margin: 0 auto; }

/* plate */
/* Все размеры внутри номера — в долях его шрифта (em): маленький и большой номер — точные копии друг друга.
   Поэтому анимация мутации, выставленная на большом номере в админке, стоит так же и на маленьком в игре. */
.plate {
  --tc: #999;
  display: inline-flex; align-items: stretch; background: #fafafa; color: #111;
  border: .09em solid #111; border-radius: .27em; box-shadow: 0 0 0 3px var(--tc);
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif; font-weight: 700;
  font-size: 22px; letter-spacing: .045em; line-height: 1; white-space: nowrap; overflow: hidden;
}
.plate .main { padding: .32em .45em; text-transform: uppercase; }
.plate .strip { background: #1d4fbf; color: #fff; font-size: .46em; letter-spacing: 0; padding: .4em; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: .3em; }
.flag { display: inline-block; width: 1.6em; height: 1.05em; border: .06em solid #0004; vertical-align: middle; flex: none; }
.plate .reg { border-left: .09em solid #111; padding: .14em .32em; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.plate .reg b { font-size: .77em; }
.plate.lg { font-size: 34px; }
.plate.sm { font-size: 15px; box-shadow: 0 0 0 2px var(--tc); }
.tier { font-size: 12px; font-weight: 600; }

/* ящики и барабаны */
.center { text-align: center; }
.stage { background: radial-gradient(ellipse at center, #232838, var(--panel)); border: 1px solid var(--line); border-radius: 14px; padding: 28px 16px; display: flex; flex-direction: column; align-items: center; gap: 14px; min-height: 200px; justify-content: center; }
#reelPlate { max-width: 100%; padding: 6px; }
.idle { opacity: .45; }
.plate.xl { font-size: clamp(26px, 7vw, 54px); box-shadow: 0 0 0 4px var(--tc); transition: box-shadow .4s; }
.plate.won { box-shadow: 0 0 0 4px var(--tc), 0 0 50px -4px var(--tc); animation: pop .4s; }
.reel { display: inline-block; height: 1.1em; overflow: hidden; vertical-align: top; }
.reel-in { display: flex; flex-direction: column; transition-property: transform; transition-timing-function: cubic-bezier(.12,.7,.18,1); }
.reel-in > span { height: 1.1em; line-height: 1.1em; text-align: center; }
.plate.reels .main, .plate.reels .reg b { line-height: 1.1em; }
.result { text-align: center; }
.win { display: flex; flex-direction: column; align-items: center; gap: 10px; animation: pop .4s; }
.tier-big { font-size: 22px; font-weight: 800; }
.traits { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.trait { font-size: 12px; background: var(--panel2); border: 1px solid var(--line); border-radius: 20px; padding: 2px 10px; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }
.cases { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-top: 8px; }
@media (max-width: 900px) { .cases { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .cases { grid-template-columns: repeat(2, 1fr); } .case:last-child:nth-child(odd) { grid-column: 1 / -1; } }
.case.ultra { background: linear-gradient(160deg, #2a1830, var(--panel) 60%); border-color: #ff4fd855; }
.case.ultra .case-box { animation: ultra-pulse 1.6s ease-in-out infinite; }
@keyframes ultra-pulse { 50% { transform: scale(1.12); } }

/* чат */
.chat { display: flex; flex-direction: column; gap: 6px; height: 260px; overflow-y: auto; padding: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.msg { max-width: 80%; align-self: flex-start; background: var(--panel2); border-radius: 12px 12px 12px 4px; padding: 6px 10px; font-size: 14px; overflow-wrap: anywhere; }
.msg.mine { align-self: flex-end; background: #3a3214; border-radius: 12px 12px 4px 12px; }
.msg time { display: block; font-size: 11px; color: var(--muted); text-align: right; }
.chat-form { display: flex; gap: 6px; margin-top: 8px; }
.chat-form input { flex: 1; min-width: 0; }
#chatPeople .row { margin-top: 4px; }
.case { --cc: #999; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--cc); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.case-box { font-size: 40px; filter: drop-shadow(0 0 12px var(--cc)); }
.case .btn { width: 100%; margin-top: 4px; }
table.odds { font-size: 13px; background: none; }
table.odds th, table.odds td { padding: 5px 6px; text-align: right; }
table.odds th:first-child, table.odds td:first-child { text-align: left; }
table.odds tr.sep td { padding: 2px; border-bottom: 1px solid var(--muted); }
.feed { max-height: 300px; overflow: auto; font-size: 14px; }
.feed div { padding: 5px 0; border-bottom: 1px solid var(--line); }

/* inventory */
.plates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.pcard { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 12px 12px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pcard .count { position: absolute; top: 8px; right: 10px; background: var(--panel2); border-radius: 8px; padding: 2px 8px; font-weight: 700; }
.pcard .star { position: absolute; top: 6px; left: 8px; background: none; border: 0; font-size: 20px; color: var(--muted); }
.pcard .star.on { color: var(--accent); }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* auction */
.lot { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 10px; }
.lot.mine { border-color: #3d4a66; }
.lot .info { font-size: 14px; }
.lot .price { font-size: 18px; font-weight: 700; }
.lot .bidbox { display: flex; gap: 6px; align-items: center; }
.lot .bidbox input { width: 110px; }
.timer { font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .lot { grid-template-columns: 1fr; } }

/* trades */
.trade { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; font-size: 14px; }
.trade .sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0; }
.trade .sides > div { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.status { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--panel2); }
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; margin: 8px 0; }
.pick-list label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.pick-list input { width: auto; }
.tf-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
@media (max-width: 500px) { .tf-cols, .trade .sides { grid-template-columns: 1fr; } }

/* players */
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 12px; overflow: hidden; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
tr.click { cursor: pointer; }
tr.click:hover { background: var(--panel2); }
.online { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #555; margin-right: 6px; }
.online.on { background: var(--ok); }

/* modal & toasts */
.modal { position: fixed; inset: 0; background: #000a; z-index: 20; display: grid; place-items: center; padding: 16px; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: min(560px, 100%); max-height: 90vh; overflow: auto; }
.showcase { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0 16px; }
.showcase .pcard { flex: 0 0 auto; }
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 30; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--ok); padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 20px #0008; animation: pop .25s; }
.toast.err { border-left-color: var(--err); }
.tabs i { font-style: normal; margin-right: 6px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* мини-игра «Радар» */
.game-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.game-head h2 { margin-bottom: 4px; }
.game-head p { margin: 0; }
.rule { color: var(--accent); }
.game-stats { display: flex; gap: 10px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.road {
  position: relative; height: 270px; border-radius: 14px; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation;
  background: linear-gradient(#3a3f4a 0 4px, #2b2f38 4px calc(100% - 4px), #3a3f4a calc(100% - 4px));
}
.road .lane { position: absolute; left: 0; right: 0; top: 0; height: 50%; border-bottom: 3px dashed #ffffff40; }
.road .lane + .lane { display: none; }
.road-msg { position: absolute; inset: 0; display: grid; place-items: center; z-index: 3; pointer-events: none; padding: 12px; }
.road-msg > * { pointer-events: auto; }
.car { position: absolute; left: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0; padding: 4px; will-change: transform; touch-action: manipulation; cursor: pointer; }
.car-emoji { font-size: 56px; line-height: 1; }
.car .plate { box-shadow: none; }
.car.hit .plate { box-shadow: 0 0 0 3px var(--ok), 0 0 18px var(--ok); }
.car.miss .plate { box-shadow: 0 0 0 3px var(--err), 0 0 18px var(--err); }
.car.hit::after, .car.miss::after { position: absolute; top: 0; right: 0; font-weight: 800; font-size: 18px; animation: pop .3s; }
.car.hit::after { content: '+2'; color: var(--ok); }
.car.miss::after { content: '−1'; color: var(--err); }
.game-result { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; background: #000b; padding: 20px; border-radius: 14px; }
.case-won { color: var(--cc); font-weight: 800; font-size: 17px; animation: pop .4s; }
.case { position: relative; }
/* машины */
.car-pic { display: inline-flex; align-items: center; justify-content: center; width: 2.2em; height: 1.5em; font-size: 48px; line-height: 1; }
.car-pic .car-emo { font-size: 1em; }
.car-pic img { max-width: 100%; max-height: 100%; object-fit: contain; }
.car-pic.sm { font-size: 26px; }
.car-pic.lg { font-size: 64px; }
.car-pic.xl { font-size: clamp(64px, 20vw, 120px); }
.car-card { border-top: 3px solid var(--tc); }
/* заказы дня и аукцион */
.orders { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 10px; }
.order { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.order.done { opacity: .6; }
.order-text { font-weight: 700; }
.order-reward { font-size: 22px; font-weight: 800; color: var(--ok); }
.ok-tag { color: var(--ok); font-size: 13px; font-weight: 700; }
.lot.system { border-color: var(--accent); box-shadow: 0 0 22px -10px var(--accent); }
.sys-tag { display: inline-block; background: #3a3214; color: var(--accent); font-size: 12px; font-weight: 700; border-radius: 6px; padding: 1px 6px; }
.fit-tag { display: inline-block; background: #12351f; color: #6ee7b7; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 1px 6px; margin-left: 4px; }
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; background: var(--panel2); border: 1px solid var(--accent); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; font-size: 14px; }
.hot-banner { width: 100%; margin: 12px 0 0; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--accent); background: linear-gradient(90deg, #3a3214, var(--panel)); color: var(--text); font-weight: 700; text-align: left; cursor: pointer; }
.tab-count { position: absolute; top: 2px; right: 0; background: var(--err); color: #fff; font-size: 10px; font-weight: 800; border-radius: 8px; padding: 0 5px; line-height: 15px; font-style: normal; }
.tabs button { position: relative; }
.brand-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; vertical-align: middle; box-shadow: inset 0 0 0 1px #ffffff22; }
.brand-badge img { height: 1.3em; width: auto; }
.car-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.pm > .car-pic { position: relative; z-index: 1; }
/* анимация мутации не должна закрывать подписи и кнопки карточки */
.pcard > :not(.pm):not(.star):not(.count) { position: relative; z-index: 2; }
.pcard > .star, .pcard > .count { z-index: 3; }
.car-card select { width: 100%; max-width: 220px; padding: 6px 8px; font-size: 13px; }
.car-plate { min-height: 30px; display: flex; align-items: center; }
.car-roll { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 20px; border-radius: 16px; }
.car-roll.won { box-shadow: 0 0 0 3px var(--tc), 0 0 50px -6px var(--tc); animation: pop .4s; }
.car-name { font-weight: 800; font-size: 18px; }
.car-odds { display: grid; gap: 6px; }
.car-odd { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; font-size: 13px; padding: 2px 0; border-bottom: 1px solid var(--line); }
.pcard .star { font-size: 13px; padding: 3px 8px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); }
.pcard .star.on { color: var(--accent); border-color: var(--accent); }
/* тапер */
.tap-area { position: relative; height: 340px; border-radius: 14px; overflow: hidden; background: radial-gradient(circle at center, #2a2f3d, var(--panel)); border: 1px solid var(--line); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.tap-coin { position: absolute; left: 40%; top: 40%; width: 84px; height: 84px; border-radius: 50%; border: 0; font-size: 56px; line-height: 84px; padding: 0; background: radial-gradient(circle at 35% 30%, #ffe680, #f0b400); box-shadow: 0 6px 20px #f0b40066; transition: left .12s, top .12s; touch-action: manipulation; }
.tap-coin:active { transform: scale(.92); }
.tap-pop { position: absolute; pointer-events: none; color: var(--accent); font-weight: 800; animation: tap-up .6s ease-out forwards; }
@keyframes tap-up { to { transform: translateY(-40px); opacity: 0; } }
.tap-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--muted); pointer-events: none; }
.tap-msg:empty { display: none; }
/* лидерборд */
.top-tabs { flex-wrap: wrap; }
.top-tabs button { flex: 1 1 auto; max-width: none; }
.top-table td { vertical-align: middle; }
.top-table .place { width: 48px; font-size: 18px; text-align: center; }
.top-table .score { text-align: right; font-weight: 700; white-space: nowrap; }
.top-table tr.me-row { background: #3a321455; }
img.flag { object-fit: cover; }
.item-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }

/* мутации: анимация поверх номера */
.pm { position: relative; display: inline-flex; vertical-align: middle; } /* ровно по размеру номера — иначе проценты высоты «плывут» */
.pm > .mut { position: absolute; transform: translate(-50%, -50%); pointer-events: none; z-index: 2; max-width: none; height: auto; }
.pm > .plate { position: relative; z-index: 1; }
.pm > .mut.back { z-index: 0; }  /* за номером: видна только вокруг */
/* фоном внутри номера: вместо белого фона, под буквами; края обрезаются по номеру */
.plate.mut-bg { position: relative; background: #111; text-shadow: 0 0 3px #fff, 0 0 6px #fff; }
.plate.mut-bg > .mut { position: absolute; transform: translate(-50%, -50%); pointer-events: none; z-index: 0; max-width: none; height: auto; }
.plate.mut-bg > span { position: relative; z-index: 1; }
.trait.mut-tag { border-color: #34d399; color: #6ee7b7; }
.mut-won { color: #6ee7b7; font-weight: 800; animation: pop .4s; }

/* баннер нового аккаунта */
.limit-banner { background: #3a3214; color: #ffe08a; font-size: 13px; padding: 8px 16px; text-align: center; border-bottom: 1px solid var(--line); }

/* переключатель игр */
.subtabs { display: flex; gap: 6px; margin-bottom: 12px; }
.subtabs button { flex: 1; max-width: 200px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; color: var(--muted); font-weight: 600; }
.subtabs button.on { background: var(--panel2); border-color: var(--accent); color: var(--text); }

/* «Оценщик» */
.ap-board { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; min-height: 240px; display: grid; place-items: center; }
.ap-plates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; }
.ap-card { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 8px; background: var(--panel2); border: 2px solid var(--line); border-radius: 12px; min-width: 0; transition: transform .15s, border-color .2s; }
.ap-card:not(:disabled):hover { border-color: var(--accent); transform: translateY(-2px); }
.ap-card:disabled { cursor: default; }
.ap-card.best { border-color: var(--ok); box-shadow: 0 0 20px -6px var(--ok); }
.ap-card.wrong { border-color: var(--err); }
.ap-card.dim { opacity: .55; }
.ap-card .plate { max-width: 100%; }
.ap-tier { font-size: 13px; color: var(--muted); min-height: 18px; }
.ap-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; margin-top: 14px; }
.game-result.static { background: none; }
@media (max-width: 700px) {
  .ap-plates { grid-template-columns: 1fr; gap: 8px; }
  .ap-card { flex-direction: row; justify-content: space-between; padding: 10px 12px; }
  .ap-board { padding: 10px; }
  .subtabs button { max-width: none; }
}
.case-tokens { position: absolute; top: 8px; right: 8px; font-size: 12px; font-weight: 700; background: var(--panel2); border: 1px solid var(--cc); padding: 2px 6px; border-radius: 8px; }

/* телефон: нижняя панель вкладок, окна снизу, крупные кнопки */
@media (max-width: 700px) {
  body { -webkit-tap-highlight-color: transparent; }
  input, select, textarea { font-size: 16px; } /* иначе iOS приближает страницу при вводе */
  .top { gap: 8px; flex-wrap: nowrap; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; }
  .logo { font-size: 16px; }
  .me { gap: 6px; margin-left: auto; min-width: 0; }
  .balance { padding: 6px 8px; font-size: 14px; white-space: nowrap; }
  .who { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .who-country { display: none; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; gap: 0; overflow: visible;
    background: var(--panel); border-top: 1px solid var(--line); padding: 4px 2px calc(4px + env(safe-area-inset-bottom));
  }
  .tabs button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 0; font-size: 10px; border-radius: 10px; }
  .tabs button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .tabs i { margin: 0; font-size: 21px; line-height: 1.1; }
  .tabs button.on { background: none; color: var(--accent); }
  .dot { top: 3px; right: calc(50% - 18px); }
  main { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }
  h2 { font-size: 18px; }
  .card { padding: 12px; }
  .btn { min-height: 42px; }
  .btn.sm { min-height: 36px; }
  .btn.big { padding: 12px 28px; }
  .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .notes { top: 58px; left: 8px; right: 8px; width: auto; }
  .modal { place-items: end stretch; padding: 0; }
  .modal-box { width: 100%; border-radius: 18px 18px 0 0; max-height: 88vh; padding-bottom: calc(20px + env(safe-area-inset-bottom)); animation: sheet .25s ease-out; }
  .stage { padding: 20px 8px; min-height: 150px; }
  .cases { gap: 8px; }
  .case { padding: 10px; }
  .case-box { font-size: 32px; }
  .plates-grid { grid-template-columns: 1fr; }
  .lot { padding: 12px; gap: 10px; }
  .lot .bidbox input { flex: 1; width: auto; min-width: 0; }
  table.odds { font-size: 12px; }
  th, td { padding: 8px; }
  .game-head { flex-direction: column; gap: 6px; }
  .road { height: 250px; }
  .car-emoji { font-size: 48px; }
}
@media (max-width: 420px) { .bonus-text { display: none; } }
@media (max-width: 340px) { .logo { display: none; } }
@keyframes sheet { from { transform: translateY(40%); opacity: .5; } }

/* экономика */
.econ { margin-top: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.econ-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.econ-rate { font-size: 20px; }
.econ .up { color: var(--err); }
.econ .down { color: var(--ok); }
.spark { width: 160px; max-width: 45%; height: 34px; flex-shrink: 0; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.case s { opacity: .6; }

.low-tag { display: inline-block; background: #3a2a14; color: #fbbf24; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 1px 6px; margin-top: 2px; }

/* галочка и автографы */
.verified { display: inline-flex; align-items: center; justify-content: center; width: 1.15em; height: 1.15em; margin-left: 4px; border-radius: 50%; background: #1d9bf0; color: #fff; font-size: .75em; font-weight: 900; vertical-align: .05em; line-height: 1; }
.sign-tag { background: #2a2140; color: #d8b4fe; font-style: italic; }
.sign-btn { border-color: #a78bfa; }

/* гонки */
.race-head { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; }
.race-timer { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.race-enter { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.race-enter select { max-width: 220px; }
.racers { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.racer { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.racer.me { border-color: var(--accent); }
.racer-odds { display: flex; flex-direction: column; align-items: flex-end; min-width: 80px; }
.racer-odds b { font-size: 18px; }
.racer .bidbox input { width: 80px; }
@media (max-width: 640px) { .racer { grid-template-columns: auto 1fr auto; } .racer .bidbox { grid-column: 1 / -1; } }
.track { position: relative; background: repeating-linear-gradient(90deg, #262b38 0 40px, #232734 40px 80px); border: 1px solid var(--line); border-radius: 12px; padding: 6px 0; margin-top: 12px; overflow: hidden; }
.rlane { position: relative; height: 58px; border-bottom: 1px dashed #ffffff18; margin-right: 70px; margin-left: 4px; }
.rlane:last-of-type { border-bottom: 0; }
.rlane.me { background: #f5c54214; }
.rlane-name { position: absolute; left: 6px; top: 2px; font-size: 11px; color: var(--muted); z-index: 1; white-space: nowrap; }
.rlane-car { position: absolute; top: 16px; left: 0; transform: translateX(0); transition: none; }
.rlane-car .car-pic { transform: scaleX(-1); }
.rlane-place { position: absolute; right: -64px; top: 22px; font-weight: 800; color: var(--accent); }
.finish-line { position: absolute; top: 0; bottom: 0; right: 66px; width: 6px; background: repeating-linear-gradient(0deg, #fff 0 6px, #000 6px 12px); opacity: .7; }
.rlane-car { margin-left: 0; }
.race-res { margin-top: 0; }
.race-hist { margin-top: 10px; }

/* магазин, тюнинг, трасса */
.shop { margin-top: 0; }
.shop-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.shop-items { display: flex; flex-wrap: wrap; gap: 6px; }
.shop-chip { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; color: var(--text); font-weight: 700; cursor: pointer; }
.shop-chip.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.tune-tag { display: inline-block; background: #1e2b3a; color: #93c5fd; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 1px 6px; }
.track-name { position: absolute; right: 80px; top: 4px; font-size: 11px; color: var(--muted); z-index: 2; }

/* обновления и новости */
.update-banner { display: block; width: 100%; border: 0; background: linear-gradient(90deg, #1d4ed8, #7c3aed); color: #fff; font-weight: 800; font-size: 14px; padding: 10px 16px; cursor: pointer; text-align: center; }
.update-banner:hover { filter: brightness(1.1); }
.news-text { white-space: pre-wrap; line-height: 1.5; margin-top: 10px; font-size: 15px; }

/* огонёк */
.streak-chip { display: inline-flex; align-items: center; gap: 3px; background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; color: var(--text); font-weight: 800; cursor: pointer; }
.streak-chip .flame { font-size: 16px; transition: transform .3s; }
.streak-chip.tier0 .flame { filter: grayscale(1); opacity: .45; }
.streak-chip.tier2 .flame { font-size: 18px; filter: drop-shadow(0 0 4px #fb923c); }
.streak-chip.tier3 .flame { font-size: 20px; filter: drop-shadow(0 0 6px #ef4444); }
.streak-chip.tier4 .flame { font-size: 22px; filter: hue-rotate(250deg) drop-shadow(0 0 7px #a855f7); }
.streak-chip.tier5 .flame { font-size: 24px; filter: hue-rotate(180deg) drop-shadow(0 0 9px #38bdf8); animation: flame 1.2s ease-in-out infinite; }
.streak-chip.waiting { border-color: var(--accent); animation: pulseBorder 1.6s ease-in-out infinite; }
@keyframes flame { 0%, 100% { transform: scale(1) rotate(-3deg); } 50% { transform: scale(1.15) rotate(3deg); } }
@keyframes pulseBorder { 0%, 100% { box-shadow: 0 0 0 0 #f5c54200; } 50% { box-shadow: 0 0 0 4px #f5c54255; } }
.flame.big { font-size: 28px; }
.flame.big.tier0 { filter: grayscale(1); opacity: .5; }
.flame.big.tier4 { filter: hue-rotate(250deg); }
.flame.big.tier5 { filter: hue-rotate(180deg); }
.sdays { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-top: 10px; }
.sday { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.sday.gift { border-color: var(--accent); box-shadow: 0 0 12px -4px var(--accent); }
@media (prefers-reduced-motion: reduce) { .streak-chip.tier5 .flame, .streak-chip.waiting { animation: none; } }
@media (max-width: 420px) { .streak-chip { padding: 4px 7px; } }

/* задания дня */
.daily { margin-bottom: 12px; }
.quests { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin-top: 10px; }
.quest { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.quest.done { opacity: .6; }
.q-text { font-weight: 700; }
.q-bar { height: 8px; border-radius: 4px; background: #ffffff14; overflow: hidden; }
.q-bar i { display: block; height: 100%; background: linear-gradient(90deg, #f59e0b, #f5c542); border-radius: 4px; }
.chest { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--panel2); border: 1px dashed var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chest.ready { border: 1px solid var(--accent); box-shadow: 0 0 18px -6px var(--accent); }
.push-btn { margin-top: 10px; }
/* запчасти */
.part-card { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 18px; border-radius: 14px; border: 2px solid var(--tc); background: var(--panel2); min-width: 150px; }
.part-emo { font-size: 42px; line-height: 1; }
.slot .part-emo { font-size: 22px; }
.part-pcard { align-items: center; }
.car-parts { display: flex; gap: 4px; align-items: center; justify-content: center; flex-wrap: wrap; }
.car-parts span { font-size: 16px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 3px; background: var(--panel2); }
.car-parts .empty-slot { opacity: .25; }
.slots { display: flex; flex-direction: column; gap: 8px; }
.slot { border: 1px solid var(--tc); border-radius: 10px; padding: 8px 10px; background: var(--panel2); display: flex; flex-direction: column; gap: 6px; }
.slot-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* схема сборки машины */
.asm-board { width: 100%; max-width: 420px; display: block; margin: 6px auto 0; touch-action: manipulation; }
.asm-car { fill: var(--panel2); stroke: var(--line); stroke-width: 2; stroke-dasharray: 6 6; }
.asm-line { stroke-width: 4; stroke-linecap: round; }
.asm-line.on { stroke: #22c55e; }
.asm-line.off { stroke: #94a3b8; stroke-dasharray: 2 6; }
.asm-line.bad { stroke: #ef4444; stroke-dasharray: 8 5; }
.asm-node circle { fill: var(--panel); stroke: var(--tc); stroke-width: 3; }
.asm-node[data-act] { cursor: pointer; }
.asm-node.frame circle { stroke: var(--text); }
.asm-node.empty { opacity: .35; }
.asm-node.empty circle { stroke-dasharray: 4 4; }
.asm-node.loose circle { fill: #f59e0b22; }
.asm-node.ok circle { fill: #22c55e1f; }
.asm-node.sel circle { stroke: var(--accent); stroke-width: 5; filter: drop-shadow(0 0 6px var(--accent)); }
.asm-node.hint circle { stroke: #22c55e; stroke-width: 4; animation: asmPulse 1s ease-in-out infinite; }
.asm-label { font-size: 10px; fill: var(--muted); }
@keyframes asmPulse { 50% { stroke-opacity: .35; } }
.asm-stat { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 14px; }
.asm-stat .bad, .asm-stat b.bad { color: #ef4444; }
.asm-stat .good { color: #22c55e; font-weight: 700; }
.car-parts span.loose { opacity: .45; border-style: dashed; }
@media (prefers-reduced-motion: reduce) { .asm-node.hint circle { animation: none; } }
