/* ТАЧКИ-ТЯН — стили. Mobile-first. */
:root {
  --bg: #070a12;
  --panel: #0f1420;
  --panel-2: #151c2b;
  --line: #222c40;
  --txt: #e8eefc;
  --dim: #8792a8;
  --pink: #ff2e7e;
  --cyan: #35d6ff;
  --gold: #ffc638;
  --violet: #b06cff;
  --green: #52e39a;
  --red: #ff4d5e;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --hud-h: 56px;
  --tab-h: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
body {
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(255,46,126,.16), transparent 60%),
    radial-gradient(90% 50% at 90% 100%, rgba(53,214,255,.12), transparent 60%),
    var(--bg);
  overflow: hidden;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -.02em; }
p { margin: 0; }
.muted { color: var(--dim); }
.small { font-size: 12px; line-height: 1.45; }

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

/* ---------- HUD ---------- */
.hud {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas: "brand" "res" "debt";
  align-items: center;
  gap: 7px;
  padding: calc(var(--safe-t) + 8px) 12px 9px;
  background: linear-gradient(180deg, rgba(9,12,20,.98), rgba(9,12,20,.82));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  z-index: 30;
}
.hud-brand { grid-area: brand; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.logo { font-weight: 900; font-size: 17px; letter-spacing: -.03em; flex: 0 0 auto; }
.logo-accent { color: var(--pink); }
.hud-sub {
  font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.hud-res { grid-area: res; display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 6px; }
.res {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 9px; padding: 5px 6px; font-size: 12px;
  min-width: 0;
}
.res-ico { font-size: 11px; opacity: .85; }
.res b { font-variant-numeric: tabular-nums; font-weight: 700; }
.res.is-empty b { color: var(--red); }
.hud-debt {
  grid-area: debt; font-size: 11px; color: var(--red);
  display: flex; gap: 6px; align-items: center;
  font-weight: 700;
}
.hud-debt::before { content: "долг: "; color: var(--dim); }

/* ---------- экраны ---------- */
.screen-area {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 12px 12px calc(var(--tab-h) + var(--safe-b) + 16px);
  scrollbar-width: none;
}
.screen-area::-webkit-scrollbar { display: none; }
.screen { animation: fadeUp .22s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 18px 0 10px;
}
.section-head h2 { font-size: 15px; letter-spacing: .01em; }

/* ---------- баннер ---------- */
.banner {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #1a1030, #0c1220 60%);
  min-height: 176px;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.banner-art { position: absolute; inset: 0; opacity: .9; }
.banner-art svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-copy { position: relative; padding: 14px; background: linear-gradient(0deg, rgba(7,10,18,.96) 20%, rgba(7,10,18,.2)); }
.banner-tag {
  display: inline-block; font-size: 9px; letter-spacing: .16em; font-weight: 800;
  color: #0a0d15; background: var(--gold); padding: 3px 7px; border-radius: 4px; margin-bottom: 6px;
}
.banner-title { font-size: 24px; line-height: 1; }
.banner-sub { font-size: 11.5px; color: #b8c2d6; margin-top: 5px; line-height: 1.4; }
.banner-rates { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }
.rate-chip {
  font-size: 10px; font-weight: 800; padding: 3px 6px; border-radius: 5px;
  border: 1px solid currentColor; letter-spacing: .03em;
}
.banner-pity {
  position: absolute; top: 10px; right: 10px;
  width: 128px; padding: 8px; border-radius: 10px;
  background: rgba(6,9,16,.78); border: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.pity-row { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--dim); }
.pity-row b { color: var(--txt); font-variant-numeric: tabular-nums; }
.pity-bar { height: 3px; background: #1c2436; border-radius: 2px; margin: 4px 0 7px; overflow: hidden; }
.pity-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--gold)); width: 0; transition: width .3s; }

/* ---------- кнопки ---------- */
.btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
  border-radius: 12px;
  padding: 11px 14px;
  font-weight: 800;
  border: 1px solid var(--line);
  transition: transform .08s, filter .15s;
  user-select: none;
}
.btn:active { transform: scale(.975); }
.btn-main { font-size: 14px; }
.btn-cost { font-size: 10.5px; opacity: .8; font-weight: 700; font-variant-numeric: tabular-nums; }
.btn-block { width: 100%; }
.btn-primary {
  background: linear-gradient(135deg, var(--pink), #ff5f9e);
  border-color: #ff6ba5;
  box-shadow: 0 6px 20px -8px rgba(255,46,126,.9);
  color: #fff;
}
.btn-ghost { background: var(--panel-2); }
.btn[disabled] { opacity: .42; filter: grayscale(.5); pointer-events: none; }

.pull-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.pull-actions .btn { padding: 13px 10px; }
.pull-note { font-size: 10.5px; color: var(--dim); margin-top: 7px; text-align: center; }

/* ---------- сетка карточек ---------- */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}
.grid-cards--list { grid-template-columns: repeat(2, 1fr); }
.card .card-name { font-size: 12.5px; }
.card .card-sub { font-size: 10px; }
.card-meta { padding: 6px 7px 7px; }
.card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  text-align: left;
  transition: transform .12s, border-color .15s;
}
.card:active { transform: scale(.965); }
.card-art { position: relative; aspect-ratio: 3/3.4; background: #0a0e17; }
.card-art svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.card-meta { padding: 5px 6px 6px; }
.card-name { font-size: 10.5px; font-weight: 800; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-sub { font-size: 9px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .lvl {
  position: absolute; left: 5px; top: 5px; z-index: 2;
  font-size: 9px; font-weight: 800; padding: 2px 5px; border-radius: 4px;
  background: rgba(6,9,16,.82); border: 1px solid var(--line);
}
.card .new {
  position: absolute; right: 5px; top: 5px; z-index: 2;
  font-size: 8.5px; font-weight: 900; padding: 2px 5px; border-radius: 4px;
  background: var(--green); color: #06170e; letter-spacing: .06em;
}
.card.is-locked .card-art { filter: grayscale(1) brightness(.34); }
.card.is-locked .card-meta { opacity: .5; }
.card-name-wrap { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.card.is-team { border-color: var(--cyan); box-shadow: inset 0 0 0 1px rgba(53,214,255,.35); }
.team-mark {
  position: absolute; bottom: 5px; right: 5px; z-index: 2;
  font-size: 8px; font-weight: 900; letter-spacing: .05em;
  background: var(--cyan); color: #04121a; padding: 2px 5px; border-radius: 4px;
}

.tier {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 8.5px; font-weight: 900; letter-spacing: .04em;
  padding: 1px 4px; border-radius: 3px;
  color: #060a12; background: var(--tier, #8ea3bb);
}

/* ---------- команда / гараж ---------- */
.team-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot {
  border: 1px dashed var(--line); border-radius: 12px; min-height: 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 8px; text-align: center; background: rgba(20,26,40,.5);
  font-size: 10px; color: var(--dim);
}
.slot.filled { border-style: solid; border-color: var(--cyan); background: var(--panel); }
.slot svg { width: 70px; height: 79px; }
.slot-name { font-weight: 800; color: var(--txt); font-size: 10.5px; line-height: 1.1; }

/* ---------- гонки ---------- */
.chapter-card {
  border-radius: 14px; padding: 14px; border: 1px solid var(--line);
  background: linear-gradient(150deg, #191129, #0d1320);
  position: relative; overflow: hidden;
}
.chapter-card::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(70% 60% at 100% 0%, rgba(255,46,126,.2), transparent 70%);
  pointer-events: none;
}
.chapter-num { font-size: 10px; letter-spacing: .16em; color: var(--pink); font-weight: 900; }
.chapter-title { font-size: 20px; margin-top: 3px; }
.chapter-hook { font-size: 12px; color: #b5c0d4; margin-top: 6px; line-height: 1.45; }
.chapter-rival {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  padding-top: 10px; border-top: 1px solid var(--line); font-size: 11.5px;
}
.rival-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.rival-name { font-weight: 800; }
.rival-motto { color: var(--dim); font-size: 10.5px; }

.tracks { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.track {
  display: flex; gap: 10px; align-items: center; padding: 10px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
}
.track-art { width: 66px; height: 46px; flex: 0 0 auto; border-radius: 8px; overflow: hidden; background: #0a0e17; }
.track-art svg { display: block; width: 100%; height: 100%; }
.track-info { min-width: 0; flex: 1 1 auto; }
.track-name { font-size: 12.5px; font-weight: 800; }
.track-tag { font-size: 9px; letter-spacing: .1em; color: var(--dim); font-weight: 700; }
.track-desc { font-size: 10.5px; color: #9daabd; margin-top: 3px; line-height: 1.35; }
.track-fatigue { font-size: 9.5px; color: var(--gold); margin-top: 3px; font-weight: 700; }
.race-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

/* ---------- донат ---------- */
.warn-box {
  border-radius: 14px; padding: 14px; border: 1px solid rgba(255,77,94,.4);
  background: linear-gradient(150deg, rgba(255,77,94,.14), rgba(255,77,94,.03));
}
.warn-box h2 { font-size: 14px; color: #ff8d99; }
.warn-box p { font-size: 11.5px; color: #d5b9bd; margin-top: 5px; line-height: 1.45; }
.debt-box { margin-top: 10px; font-size: 11.5px; }
.debt-row {
  display: flex; justify-content: space-between; padding: 7px 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px; margin-bottom: 6px;
}
.debt-row b { color: var(--red); font-variant-numeric: tabular-nums; }
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.shop-item {
  position: relative; border-radius: 12px; padding: 11px; border: 1px solid var(--line);
  background: linear-gradient(160deg, #1a2030, #0e131e); text-align: left;
  display: flex; flex-direction: column; gap: 5px;
}
.shop-item:active { transform: scale(.98); }
.shop-tag {
  position: absolute; top: 0; right: 0; font-size: 8px; font-weight: 900; letter-spacing: .07em;
  background: var(--pink); color: #fff; padding: 2px 6px; border-radius: 0 12px 0 8px;
}
.shop-title { font-size: 12px; font-weight: 800; padding-right: 34px; }
.shop-desc { font-size: 10px; color: var(--dim); line-height: 1.35; min-height: 27px; }
.shop-price {
  font-size: 13px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums;
  margin-top: auto;
}
.shop-cost { font-size: 9px; color: var(--red); font-weight: 700; }
.shop-foot { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.shame-meter { display: flex; align-items: center; gap: 8px; font-size: 10.5px; color: var(--dim); }
.shame-meter i { flex: 1 1 auto; height: 4px; border-radius: 2px; background: #1c2436; overflow: hidden; }
.shame-meter i::after { content: ""; display: block; height: 100%; width: var(--w, 0%); background: linear-gradient(90deg, var(--gold), var(--red)); }
.shame-meter b { font-variant-numeric: tabular-nums; color: var(--txt); }

/* ---------- tabbar ---------- */
.tabbar {
  flex: 0 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr);
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 560px; margin: 0 auto;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(9,12,20,.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
  z-index: 40;
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 9.5px; font-weight: 700; color: var(--dim); letter-spacing: .02em;
  position: relative;
}
.tab-ico { font-size: 16px; line-height: 1; }
.tab.is-active { color: var(--txt); }
.tab.is-active::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 2px; background: var(--pink); border-radius: 0 0 2px 2px;
}
.tab-badge {
  position: absolute; top: 6px; right: 50%; margin-right: -22px;
  background: var(--pink); color: #fff; font-size: 8px; font-weight: 900;
  min-width: 14px; height: 14px; border-radius: 7px; display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

/* ---------- оверлеи ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(4,6,11,.86);
  backdrop-filter: blur(10px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .18s ease both;
}
.overlay[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.overlay-inner {
  width: 100%; max-width: 560px; max-height: 92dvh;
  background: linear-gradient(180deg, #101725, #0a0e17);
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column;
  padding: 12px 12px calc(12px + var(--safe-b));
  animation: sheetUp .26s cubic-bezier(.2,.9,.3,1) both;
}
@keyframes sheetUp { from { transform: translateY(30px); opacity: .4 } to { transform: none; opacity: 1 } }
.overlay-inner--sheet { max-height: 88dvh; }

/* на высоких экранах — по центру, а не прижатым к низу */
@media (min-height: 700px) {
  .overlay:not(.overlay--story):not(.overlay--intro) { align-items: center; padding: 14px; }
  .overlay:not(.overlay--story):not(.overlay--intro) .overlay-inner {
    border-radius: 18px; border-bottom: 1px solid var(--line); max-height: 88dvh;
  }
}
.overlay-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.overlay-head h2 { font-size: 15px; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; background: var(--panel-2);
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--dim);
}
.overlay-foot { margin-top: auto; padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }

/* крут */
.pull-stage {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px;
  align-content: start; overflow-y: auto; padding: 4px 0;
}
@media (max-width: 350px) { .pull-stage { grid-template-columns: repeat(3, 1fr); } }
.pull-stage.is-single { display: block; }
.pull-card {
  position: relative; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #0b0f19;
  animation: none;
}
.pull-card svg { display: block; width: 100%; aspect-ratio: 3/3.4; }
.pull-card .pc-tier {
  position: absolute; top: 3px; left: 3px; font-size: 8px; font-weight: 900;
  padding: 1px 4px; border-radius: 3px; color: #060a12; background: var(--tier);
}
.pull-card.is-sr { box-shadow: 0 0 0 1px var(--violet), 0 0 16px -4px var(--violet); }
.pull-card.is-ssr { box-shadow: 0 0 0 1px var(--gold), 0 0 20px -2px var(--gold); }
.pull-card.is-ur { box-shadow: 0 0 0 1.5px var(--red), 0 0 26px -2px var(--red); }
.pull-card .pc-new {
  position: absolute; bottom: 3px; left: 3px; right: 3px;
  font-size: 8px; font-weight: 900; text-align: center; padding: 2px 0;
  background: var(--green); color: #06170e; border-radius: 3px;
}
.pull-card .pc-dup {
  position: absolute; bottom: 3px; left: 3px; right: 3px;
  font-size: 8px; font-weight: 800; text-align: center; padding: 2px 0;
  background: rgba(6,9,16,.8); color: var(--dim); border-radius: 3px;
}
.single-reveal { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0 4px; text-align: center; }
.single-reveal .sr-art {
  width: 74%; max-width: 250px; border-radius: 16px; overflow: hidden;
  box-shadow: 0 0 46px -10px var(--tier); border: 1px solid var(--tier);
}
.single-reveal .sr-art svg { display: block; width: 100%; height: auto; }
.single-reveal .sr-name { font-size: 18px; font-weight: 900; }
.single-reveal .sr-tier { font-size: 11px; font-weight: 900; letter-spacing: .1em; color: var(--tier); }
.single-reveal .sr-quote { font-size: 11.5px; color: var(--dim); text-align: center; max-width: 280px; font-style: italic; }

/* карточка детально */
.card-detail { overflow-y: auto; }
.cd-hero { display: flex; gap: 10px; }
.cd-art { width: 132px; flex: 0 0 auto; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #0b0f19; }
.cd-art svg { display: block; width: 100%; }
.cd-info { min-width: 0; flex: 1 1 auto; }
.cd-name { font-size: 17px; font-weight: 900; line-height: 1.05; }
.cd-sub { font-size: 11px; color: var(--dim); margin-top: 3px; }
.cd-parody { font-size: 10px; color: var(--dim); margin-top: 6px; line-height: 1.4; }
.cd-quote { font-size: 11.5px; font-style: italic; color: #c3ccdd; margin-top: 8px; line-height: 1.45; }
.cd-bio { font-size: 11px; color: #9daabd; margin-top: 8px; line-height: 1.5; }
.cd-stats { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.stat { display: grid; grid-template-columns: 64px 1fr 34px; align-items: center; gap: 8px; font-size: 10.5px; }
.stat-bar { height: 5px; border-radius: 3px; background: #1b2334; overflow: hidden; }
.stat-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--violet)); width: 0; }
.stat b { text-align: right; font-variant-numeric: tabular-nums; }
.cd-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.cd-up { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--dim); margin-bottom: 2px; }
.cd-up b { color: var(--txt); }
.cd-car { margin-top: 12px; border-radius: 12px; background: #0b0f19; border: 1px solid var(--line); padding: 6px; }
.cd-car svg { display: block; width: 100%; }

/* гонка */
.race-body { overflow-y: auto; }
.timing { margin: 4px 0 2px; }
.timing-label { font-size: 11px; color: var(--dim); margin-bottom: 7px; text-align: center; }
.timing-bar {
  position: relative; height: 26px; border-radius: 8px; overflow: hidden;
  background: #141a26; border: 1px solid var(--line); margin-bottom: 10px;
}
.timing-zone {
  position: absolute; left: 33%; width: 34%; top: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(82,227,154,.12), rgba(82,227,154,.4), rgba(82,227,154,.12));
  border-left: 1px solid rgba(82,227,154,.55); border-right: 1px solid rgba(82,227,154,.55);
}
.timing-needle {
  position: absolute; top: -3px; bottom: -3px; width: 4px; left: 0;
  background: var(--pink); border-radius: 2px; box-shadow: 0 0 12px var(--pink);
  transform: translateX(-2px);
}
.story-portrait {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; height: 88%; padding: 0 6px;
  filter: drop-shadow(0 0 26px rgba(0,0,0,.8));
}
.story-portrait::before {
  content: ""; position: absolute; inset: -6% -20% 0;
  background: radial-gradient(closest-side, rgba(5,7,12,.92), rgba(5,7,12,.55) 55%, rgba(5,7,12,0) 78%);
  z-index: -1;
}
.story-portrait svg { width: 100%; height: 100%; display: block; position: relative; }
.story-scene::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 90px;
  background: linear-gradient(0deg, #05070c, transparent); pointer-events: none;
}

.race-stage {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); margin-bottom: 6px; font-size: 11.5px;
}
.race-stage .rs-name { font-weight: 700; }
.race-stage .rs-gap { font-variant-numeric: tabular-nums; font-weight: 800; }
.race-stage.is-win { border-color: rgba(82,227,154,.4); background: rgba(82,227,154,.07); }
.race-stage.is-loss { border-color: rgba(255,77,94,.35); background: rgba(255,77,94,.06); }
.rs-wait { color: var(--dim); }

/* сюжет */
.overlay--story { align-items: stretch; }
.overlay-inner--story {
  max-width: 560px; border-radius: 0; border: 0; padding: 0;
  height: 100dvh; max-height: none; justify-content: flex-end; position: relative;
  background: #05070c;
}
.story-scene { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.story-scene > svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.story-box {
  position: relative; margin: 10px 10px calc(10px + var(--safe-b));
  padding: 14px; border-radius: 14px;
  background: rgba(7,10,18,.93); border: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.story-speaker { font-size: 11px; font-weight: 900; letter-spacing: .05em; color: var(--pink); margin-bottom: 5px; }
.story-text { font-size: 13.5px; line-height: 1.5; min-height: 62px; }
.story-actions { display: flex; gap: 8px; margin-top: 12px; }
.story-actions .btn { flex: 1 1 auto; }

/* стартовый экран */
.overlay--intro {
  align-items: center; padding: 20px;
  background:
    radial-gradient(80% 50% at 50% 0%, rgba(255,46,126,.25), transparent 60%),
    #05070c;
}
.overlay--intro[hidden] { display: none; }
.intro { width: 100%; max-width: 360px; text-align: center; }
.intro-logo { font-size: 40px; font-weight: 900; letter-spacing: -.05em; line-height: .95; }
.intro-logo span { color: var(--pink); }
.intro-tag { font-size: 10px; letter-spacing: .28em; color: var(--dim); margin-top: 8px; text-transform: uppercase; }
.intro-text { font-size: 12.5px; color: #b9c3d6; margin-top: 22px; line-height: 1.5; }
.intro-text--dim { color: #6f7b90; margin-top: 8px; font-size: 11px; }
.intro .btn { margin-top: 22px; }
.intro-reset { margin-top: 12px; font-size: 10.5px; color: #5d687c; text-decoration: underline; }

/* тост */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 14px);
  transform: translateX(-50%);
  max-width: 90vw; padding: 9px 14px; border-radius: 10px;
  background: rgba(16,22,34,.97); border: 1px solid var(--line);
  font-size: 12px; z-index: 90; text-align: center;
  animation: toastIn .2s ease both;
  box-shadow: 0 10px 30px -12px #000;
}
.toast.is-bad { border-color: rgba(255,77,94,.5); color: #ffb3ba; }
.toast.is-good { border-color: rgba(82,227,154,.45); color: #b6f7d4; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px) } to { opacity: 1; transform: translate(-50%, 0) } }
.toast[hidden] { display: none; }

.screen[hidden] { display: none; }
.empty-hint {
  margin-top: 14px; padding: 11px 12px; border-radius: 10px;
  border: 1px dashed var(--line); font-size: 11px; color: var(--dim); line-height: 1.5;
}
.empty-hint b { color: var(--txt); }

/* блокировка */
.is-locked-ui { pointer-events: none; opacity: .5; }
.lock-note {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(255,198,56,.4); background: rgba(255,198,56,.08);
  font-size: 11.5px; color: #ffe1a0; line-height: 1.45;
}
@media (min-width: 480px) {
  .grid-cards { grid-template-columns: repeat(3, 1fr); }
  .grid-cards--list { grid-template-columns: repeat(3, 1fr); }
  .shop-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- визуализация езды ---------- */
.road-wrap {
  position: relative; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line); background: #06090f; margin-bottom: 10px;
}
.road-scene { display: block; width: 100%; height: auto; }
.road-lines { animation: roadRun .55s linear infinite; }
@keyframes roadRun { from { transform: translateY(0) } to { transform: translateY(21px) } }
.road-wrap.is-fast .road-lines { animation-duration: .28s; }
.player-car { transition: transform .18s ease-out; }
.road-wrap.is-hit { animation: shake .32s linear; }
@keyframes shake {
  0%,100% { transform: translateX(0) } 25% { transform: translateX(-5px) }
  50% { transform: translateX(4px) } 75% { transform: translateX(-3px) }
}

/* ---------- мини-игры ---------- */
.mg-wrap { margin-top: 4px; }
.mg-title { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.mg-title b { font-size: 13px; }
.mg-title span { font-size: 10.5px; color: var(--dim); }
.mg-bar {
  position: relative; height: 30px; border-radius: 9px; overflow: hidden;
  background: #131a26; border: 1px solid var(--line);
}
.mg-zone {
  position: absolute; left: 32%; width: 36%; top: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(82,227,154,.1), rgba(82,227,154,.45), rgba(82,227,154,.1));
  border-left: 1px solid rgba(82,227,154,.6); border-right: 1px solid rgba(82,227,154,.6);
}
.mg-needle {
  position: absolute; top: -3px; bottom: -3px; width: 4px; left: 0;
  background: var(--pink); border-radius: 2px; box-shadow: 0 0 12px var(--pink);
  transform: translateX(-2px);
}
.mg-readout { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--dim); margin: 8px 2px; }
.mg-readout b { color: var(--txt); font-variant-numeric: tabular-nums; }
.mg-apex {
  position: relative; height: 74px; border-radius: 10px; overflow: hidden;
  background: linear-gradient(180deg, #101725, #0a0e17); border: 1px solid var(--line);
  touch-action: none;
}
.mg-corridor {
  position: absolute; top: 0; bottom: 0; left: 32%; width: 36%;
  background: linear-gradient(90deg, rgba(53,214,255,.08), rgba(53,214,255,.28), rgba(53,214,255,.08));
  border-left: 2px solid rgba(53,214,255,.55); border-right: 2px solid rgba(53,214,255,.55);
  transition: left .12s linear, width .12s linear;
}
.mg-racer {
  position: absolute; top: 50%; left: 50%; width: 22px; height: 34px;
  transform: translate(-50%, -50%);
  background: linear-gradient(180deg, #ff5f9e, #ff2e7e);
  border-radius: 6px 6px 4px 4px;
  box-shadow: 0 0 14px rgba(255,46,126,.7);
  transition: left .05s linear;
}
.mg-racer::after {
  content: ""; position: absolute; left: 50%; top: 6px; width: 8px; height: 10px;
  transform: translateX(-50%); border-radius: 2px; background: #0a0e17;
}
.mg-revs {
  position: relative; height: 34px; border-radius: 9px; overflow: hidden;
  background: #131a26; border: 1px solid var(--line);
}
.mg-red {
  position: absolute; left: 62%; width: 28%; top: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(255,77,94,.15), rgba(255,77,94,.5), rgba(255,77,94,.15));
  border-left: 1px solid rgba(255,77,94,.7); border-right: 1px solid rgba(255,77,94,.7);
}
.mg-needle2 {
  position: absolute; top: -3px; bottom: -3px; width: 4px; left: 10%;
  background: var(--gold); border-radius: 2px; box-shadow: 0 0 12px var(--gold);
}
.mg-ticks {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.16) 0 1px, transparent 1px 10%);
}
.mg-go { margin-top: 10px; }
.mg-hint { font-size: 10px; color: var(--dim); text-align: center; margin-top: 6px; }

/* ---------- анимация круток ---------- */
.pull-fx { position: relative; }
.pull-fx::before {
  content: ""; position: absolute; inset: -10% -20%; pointer-events: none;
  background: conic-gradient(from 0deg, transparent, var(--tier, #fff), transparent 40%);
  opacity: 0; animation: spinGlow 1.6s linear infinite;
}
.pull-fx.is-ssr::before, .pull-fx.is-ur::before { opacity: .35; }
@keyframes spinGlow { to { transform: rotate(360deg) } }
.pull-card { transform-origin: 50% 60%; perspective: 700px; }
.pull-card.flip { animation: cardFlip .55s cubic-bezier(.2,.8,.3,1) both; }
.pull-card.flip .pc-tier, .pull-card.flip .pc-new, .pull-card.flip .pc-dup {
  animation: badgeIn .3s ease-out .32s both;
}
@keyframes badgeIn { from { opacity: 0; transform: translateY(3px) } to { opacity: 1; transform: none } }
@keyframes cardFlip {
  0% { transform: rotateY(0deg) scale(.6); opacity: 0 }
  55% { transform: rotateY(90deg) scale(1.05); opacity: 1 }
  100% { transform: rotateY(0deg) scale(1); opacity: 1 }
}
/* редкая карта светится — без transform, чтобы не спорить с flip */
.pull-card.rare-glow, .single-reveal.rare-glow { animation: rareGlow .8s ease-out both; }
@keyframes rareGlow {
  0% { box-shadow: 0 0 0 1px var(--tier), 0 0 6px -2px var(--tier) }
  45% { box-shadow: 0 0 0 2px var(--tier), 0 0 38px 6px var(--tier) }
  100% { box-shadow: 0 0 0 1px var(--tier), 0 0 20px -2px var(--tier) }
}
.screen-flash {
  position: fixed; inset: 0; pointer-events: none; z-index: 95;
  background: radial-gradient(circle at 50% 45%, #fff, transparent 65%);
  opacity: 0;
}
.screen-flash.go { animation: flash .55s ease-out; }
@keyframes flash { 0% { opacity: .85 } 100% { opacity: 0 } }
.spark {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  pointer-events: none; opacity: 0;
}
.spark.go { animation: sparkFly .8s ease-out forwards; }
@keyframes sparkFly {
  0% { opacity: 1; transform: translate(0,0) scale(1) }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.2) }
}
.overlay-inner--pull { max-height: 90dvh; }
.pull-stage.is-single { display: flex; justify-content: center; }
.pull-card.is-pending { opacity: 0 !important; animation: none !important; transform: scale(.94); }
.pull-card.is-pending::after { content: ""; position: absolute; inset: 0; background: #0b0f19; }
.shop-grant { font-size: 10px; color: var(--green); font-weight: 700; }
.cd-up-note { margin: -4px 0 8px; }
