:root {
  --accent: #ff5a3c;
  --accent-2: #ffb648;
  --red: #e01f2d;
  --ink: #050a10;
  --text: #f4f8fb;
  --muted: rgba(212, 226, 236, 0.62);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: #060b11;
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

#shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  max-width: calc(100dvh * 0.5625);
  overflow: hidden;
  background: var(--ink);
  container-type: size;
  isolation: isolate;
}

@media (min-width: 760px) {
  #shell {
    height: min(100dvh, 980px);
    border-radius: 22px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 40px 130px rgba(0, 0, 0, 0.65);
  }
}

canvas#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

#fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(120% 55% at 74% 10%, rgba(255, 238, 202, 0.14), transparent 55%),
    radial-gradient(130% 70% at 50% 108%, rgba(0, 0, 0, 0.28), transparent 60%);
}

/* ---------------- HUD ---------------- */

#hud {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
}

#hud.on { opacity: 1; }

.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 2.2cqh) 5cqw 0;
}

.stat { display: flex; flex-direction: column; gap: 0.5cqh; }

.stat-label {
  font-size: 2.5cqw;
  font-weight: 700;
  letter-spacing: 0.26em;
  color: rgba(236, 245, 250, 0.68);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.stat-value {
  font-size: 7.4cqw;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.55);
}

.stat-right { text-align: right; }
.stat-right .stat-value { color: #fff; }

.stat-right .stat-value i {
  font-style: normal;
  font-size: 2.8cqw;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(236, 245, 250, 0.68);
  margin-left: 0.8cqw;
}

.icon-btn {
  pointer-events: auto;
  width: 11cqw;
  height: 11cqw;
  min-width: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(8, 14, 20, 0.4);
  color: var(--text);
  padding: 0;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 0.12s ease, background 0.2s;
}

.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 46%; height: 46%; fill: currentColor; }

.hud-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  gap: 4cqw;
  padding: 0 5cqw calc(env(safe-area-inset-bottom, 0px) + 2.8cqh);
}

.nitro { flex: 1; padding-bottom: 1cqh; }

.nitro-head {
  display: flex;
  justify-content: space-between;
  font-size: 2.4cqw;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: rgba(255, 214, 168, 0.92);
  margin-bottom: 1cqh;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

.nitro-head span:last-child { color: rgba(255, 255, 255, 0.6); letter-spacing: 0.12em; }

.nitro-track {
  height: 1.9cqh;
  min-height: 7px;
  border-radius: 99px;
  background: rgba(8, 12, 18, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.16);
  overflow: hidden;
  box-shadow: inset 0 1px 6px rgba(0, 0, 0, 0.5);
}

.nitro-fill {
  height: 100%;
  width: 100%;
  border-radius: 99px;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, #ffd36e, var(--accent-2) 38%, var(--accent) 74%, var(--red));
  box-shadow: 0 0 18px rgba(255, 122, 64, 0.6);
  transition: filter 0.2s, transform 0.1s linear;
}

.nitro-fill.active { filter: brightness(1.35) saturate(1.2); }

.nitro-btn {
  pointer-events: auto;
  flex: 0 0 auto;
  width: 16cqw;
  height: 16cqw;
  min-width: 56px;
  min-height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(255, 170, 110, 0.7);
  background: radial-gradient(circle at 35% 28%, rgba(255, 160, 90, 0.4), rgba(24, 14, 10, 0.78) 72%);
  color: #fff3e6;
  font: inherit;
  font-weight: 900;
  font-size: 3.6cqw;
  letter-spacing: 0.06em;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), inset 0 0 16px rgba(255, 150, 80, 0.18);
  transition: transform 0.1s ease, box-shadow 0.2s;
}

.nitro-btn:active { transform: scale(0.92); box-shadow: 0 0 34px rgba(255, 130, 70, 0.5); }
.nitro-btn sub { font-size: 0.6em; line-height: 0; }
.nitro-btn.firing { border-color: #ffd9a8; box-shadow: 0 0 32px rgba(255, 150, 80, 0.7); }

.hint {
  position: absolute;
  left: 50%;
  bottom: 25cqh;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
  font-size: 3cqw;
  line-height: 1.7;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(245, 250, 253, 0.85);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.hint b { color: var(--accent-2); font-weight: 800; }
.hint.show { opacity: 1; }

/* ---------------- Screens ---------------- */

.screen {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3cqh;
  padding: calc(env(safe-area-inset-top, 0px) + 5cqh) 7cqw calc(env(safe-area-inset-bottom, 0px) + 5cqh);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  background:
    radial-gradient(110% 55% at 50% 0%, rgba(20, 44, 66, 0.32), transparent 60%),
    linear-gradient(180deg, rgba(4, 9, 14, 0.42) 0%, rgba(4, 9, 14, 0.72) 38%, rgba(4, 8, 13, 0.94) 66%, #04080d 100%);
}

.screen.open { opacity: 1; pointer-events: auto; }

#screen-menu { justify-content: space-between; }

.brand { display: flex; flex-direction: column; align-items: center; gap: 1.6cqh; padding-top: 4cqh; }

.brand-kicker {
  font-size: 2.7cqw;
  font-weight: 800;
  letter-spacing: 0.32em;
  color: rgba(240, 246, 250, 0.8);
  text-align: center;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}

.title {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 18cqw;
  font-weight: 900;
  font-style: italic;
  line-height: 0.78;
  letter-spacing: -0.045em;
}

.title span {
  background: linear-gradient(180deg, #ffffff 8%, #eef4f7 42%, #9fb4c4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 22px rgba(0, 0, 0, 0.55));
}

/* The Russian part is longer: keep it inside the phone width. */
.title .main {
  font-size: 0.82em;
  letter-spacing: -0.02em;
}

.title .alt {
  background: linear-gradient(180deg, #ffd9b4 4%, #ff7a4a 38%, #dd1f2c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 8px 26px rgba(0, 0, 0, 0.5));
  margin-top: 0.1em;
}

.tagline {
  margin: 0;
  font-size: 3.3cqw;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(232, 242, 248, 0.78);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.menu-actions { width: 100%; display: flex; flex-direction: column; gap: 1.8cqh; }

.row { display: flex; gap: 3cqw; }
.row .btn-ghost { flex: 1; }

.menu-foot {
  display: flex;
  align-items: baseline;
  gap: 2.4cqw;
  font-size: 2.8cqw;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.menu-foot b {
  font-size: 6cqw;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 3px 16px rgba(0, 0, 0, 0.6);
}

.btn {
  pointer-events: auto;
  font: inherit;
  font-weight: 800;
  font-size: 4.3cqw;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(10, 18, 26, 0.5);
  color: var(--text);
  padding: 2.3cqh 5cqw;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: transform 0.12s ease, background 0.2s, box-shadow 0.2s;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  border: none;
  color: #fff;
  font-weight: 900;
  text-shadow: 0 1px 6px rgba(60, 0, 0, 0.35);
  background: linear-gradient(135deg, #ff9a63 0%, #ff5a3c 34%, #e0222e 70%, #a8121d 100%);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4), 0 0 26px rgba(255, 90, 60, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-ghost { background: rgba(10, 18, 26, 0.6); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }

.btn-icon {
  flex: 0 0 auto;
  width: 13cqw;
  height: 13cqw;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 50%;
  font-size: 5cqw;
  display: grid;
  place-items: center;
  letter-spacing: 0;
}

.panel {
  width: 100%;
  max-width: 88cqw;
  max-height: 92cqh;
  display: flex;
  flex-direction: column;
  gap: 2.4cqh;
  padding: 4.4cqh 5.4cqw;
  border-radius: 26px;
  border: 1px solid rgba(224, 238, 246, 0.14);
  background: linear-gradient(180deg, rgba(16, 26, 36, 0.95), rgba(6, 12, 18, 0.97));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
}

.panel-narrow { max-width: 80cqw; }
.panel-over { max-width: 88cqw; }

.panel-head { display: flex; flex-direction: column; gap: 0.8cqh; }
.panel-head.center { align-items: center; text-align: center; }

.panel-head h2 {
  margin: 0;
  font-size: 8cqw;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.01em;
  line-height: 1;
}

.panel-head p {
  margin: 0;
  font-size: 2.9cqw;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-foot { display: flex; flex-direction: column; }

.stack { display: flex; flex-direction: column; gap: 1.6cqh; width: 100%; }

.records {
  list-style: none;
  margin: 0;
  padding: 0.4cqh 0;
  display: flex;
  flex-direction: column;
  gap: 1.1cqh;
  max-height: 46cqh;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 150, 110, 0.4) transparent;
}

.records li {
  display: grid;
  grid-template-columns: 8cqw 1fr auto;
  align-items: center;
  gap: 3cqw;
  padding: 1.7cqh 3.4cqw;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.045);
  font-variant-numeric: tabular-nums;
}

.records li .pos {
  font-size: 3.2cqw;
  font-weight: 900;
  color: var(--muted);
}

.records li .score { font-size: 4.6cqw; font-weight: 800; }

.records li .date {
  font-size: 2.6cqw;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.records li.top {
  background: linear-gradient(90deg, rgba(255, 160, 90, 0.24), rgba(224, 31, 45, 0.18));
  border-color: rgba(255, 160, 90, 0.45);
  box-shadow: 0 0 24px rgba(255, 120, 70, 0.14);
}

.records li.top .pos { color: #ffc07a; }

.records li.empty {
  display: block;
  text-align: center;
  padding: 5cqh 3cqw;
  font-size: 3.2cqw;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border-style: dashed;
}

.over-kicker {
  font-size: 2.9cqw;
  font-weight: 800;
  letter-spacing: 0.3em;
  color: rgba(255, 138, 105, 0.95);
}

.over-title {
  margin: 0;
  font-size: 11cqw;
  font-weight: 900;
  font-style: italic;
  line-height: 0.95;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #fff, #ffc6b4 45%, #ff5a3c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.45));
}

.over-title.record {
  background: linear-gradient(180deg, #fff, #ffe1a8 45%, #ffb648);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.4));
}

.over-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6cqh;
  padding: 1.6cqh 0 2.2cqh;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.over-score span {
  font-size: 2.8cqw;
  letter-spacing: 0.3em;
  color: var(--muted);
}

.over-score b {
  font-size: 15cqw;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.over-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2cqw;
  text-align: center;
}

.over-stats div { display: flex; flex-direction: column; gap: 0.6cqh; }

.over-stats span {
  font-size: 2.3cqw;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.over-stats b {
  font-size: 3.6cqw;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.over-rank {
  text-align: center;
  font-size: 3cqw;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-2);
  min-height: 1em;
}

.noscript {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #04080d;
  z-index: 20;
  font-size: 16px;
  padding: 24px;
  text-align: center;
}

@media (max-height: 640px) {
  .title { font-size: 15cqw; }
  .brand { padding-top: 1cqh; }
  .panel { gap: 1.6cqh; padding: 3.2cqh 5cqw; }
  .btn { padding: 1.9cqh 4cqw; }
}

/* ---------------- coins, garage, tracks (v2) ---------------- */

.hidden { display: none !important; }

.coin-ico {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fff7cf 0%, #ffdc7a 38%, #f6b93b 66%, #b87a17 100%);
  box-shadow: inset 0 -0.12em 0 rgba(110, 64, 0, 0.35), 0 0 0.5em rgba(255, 201, 92, 0.45);
  vertical-align: -0.08em;
}

.stat-coins {
  display: flex;
  align-items: center;
  gap: 0.8cqw;
  margin-top: 0.7cqh;
  font-size: 3.1cqw;
  font-weight: 800;
  color: #ffe0a0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.stat-coins .coin-ico { width: 2.9cqw; height: 2.9cqw; }

.menu-actions { gap: 1.3cqh; }

.selected-line {
  display: flex;
  justify-content: center;
  gap: 1.6cqw;
  font-size: 2.4cqw;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 0.3cqh;
}

.selected-line i { font-style: normal; color: rgba(255, 255, 255, 0.28); }

.menu-foot {
  display: flex;
  align-items: center;
  gap: 6cqw;
  font-size: 2.5cqw;
}

.foot-item {
  display: flex;
  align-items: center;
  gap: 1.2cqw;
  font-size: 2.5cqw;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.foot-item b {
  font-size: 4.4cqw;
  letter-spacing: 0;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.menu-foot .coin-ico { width: 3.2cqw; height: 3.2cqw; }

/* ---------------- garage ---------------- */

.screen-garage {
  justify-content: flex-start;
  padding: 0;
  background: linear-gradient(180deg,
    rgba(4, 9, 14, 0) 0%,
    rgba(4, 9, 14, 0.04) 34%,
    rgba(4, 9, 14, 0.66) 45%,
    rgba(4, 9, 14, 0.95) 55%,
    #04080d 100%);
}

.garage-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3cqw;
  padding: calc(env(safe-area-inset-top, 0px) + 2.4cqh) 5cqw 0;
}

.garage-head .icon-btn { flex: 0 0 auto; font-size: 5cqw; }

.garage-title {
  font-size: 4.4cqw;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
}

.wallet {
  display: flex;
  align-items: center;
  gap: 1.2cqw;
  padding: 1cqh 2.6cqw;
  border-radius: 99px;
  border: 1px solid rgba(255, 210, 130, 0.28);
  background: rgba(10, 16, 22, 0.55);
  color: #ffe3a0;
  font-size: 3.5cqw;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(8px);
}

.wallet .coin-ico { width: 3cqw; height: 3cqw; }

.garage-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 53%;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(11, 20, 28, 0.78), rgba(5, 10, 15, 0.98) 26%);
  backdrop-filter: blur(18px);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.35);
}

.garage-tabs {
  display: flex;
  gap: 2cqw;
  padding: 2.2cqh 5cqw 0;
}

.g-tab {
  flex: 1;
  padding: 1.2cqh 2cqw;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font: inherit;
  font-size: 3.1cqw;
  font-weight: 800;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.g-tab.active {
  color: #1a0b05;
  border-color: transparent;
  background: linear-gradient(135deg, #ffe3b0, #ff9a63);
}

.garage-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 2cqh 5cqw 1cqh;
}

.car-cards {
  display: flex;
  gap: 2.6cqw;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  padding-bottom: 1cqh;
  scrollbar-width: none;
}

.car-cards::-webkit-scrollbar { display: none; }

.car-card {
  flex: 0 0 35cqw;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.7cqh;
  padding: 1.6cqh 2.6cqw;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.12s;
}

.car-card:active { transform: scale(0.98); }

.car-card.selected {
  border-color: rgba(255, 170, 100, 0.7);
  background: rgba(255, 150, 90, 0.12);
  box-shadow: 0 0 22px rgba(255, 140, 70, 0.16);
}

.car-card.locked { opacity: 0.72; }

.car-swatch {
  width: 100%;
  height: 3.6cqh;
  min-height: 18px;
  border-radius: 9px;
  background: linear-gradient(102deg, #15171b, var(--c) 34%, rgba(255, 255, 255, 0.55) 50%, var(--c) 66%, #101216);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.car-card-name { font-size: 2.8cqw; font-weight: 900; letter-spacing: 0.06em; }

.car-card-meta {
  display: flex;
  align-items: center;
  gap: 0.8cqw;
  font-size: 2.3cqw;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.car-card-meta .coin-ico { width: 2.2cqw; height: 2.2cqw; }

.tune-group { margin-bottom: 2.2cqh; }

.tune-label {
  font-size: 2.4cqw;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: var(--muted);
  margin-bottom: 1.1cqh;
}

.tune-grid { display: flex; flex-wrap: wrap; gap: 2cqw; }

.tune-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5cqh;
  min-width: 15cqw;
  padding: 1.1cqh 1.8cqw;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.tune-opt.selected {
  border-color: rgba(255, 170, 100, 0.72);
  background: rgba(255, 150, 90, 0.13);
}

.tune-opt.equipped { border-color: rgba(255, 209, 102, 0.6); }

.tune-dot {
  width: 5.2cqw;
  height: 5.2cqw;
  border-radius: 50%;
  box-shadow: inset 0 -0.5cqw 0 rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.tune-name { font-size: 2.2cqw; white-space: nowrap; }

.tune-price {
  display: flex;
  align-items: center;
  gap: 0.5cqw;
  font-size: 2cqw;
  color: var(--muted);
  white-space: nowrap;
}

.tune-price .coin-ico { width: 1.9cqw; height: 1.9cqw; }
.tune-opt.equipped .tune-price { color: var(--accent-2); }

.garage-foot { padding: 1cqh 5cqw 2cqh; }
.garage-foot .btn { width: 100%; }

.btn:disabled { opacity: 0.42; filter: saturate(0.45); }

/* ---------------- tracks ---------------- */

.panel-track { max-width: 92cqw; }

.track-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 3cqw;
  width: 100%;
  padding: 1.8cqh 3cqw;
  padding-right: 9cqw;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.track-card.selected {
  border-color: rgba(255, 170, 100, 0.7);
  background: linear-gradient(90deg, rgba(255, 150, 90, 0.16), rgba(255, 90, 60, 0.07));
}

.track-thumb {
  flex: 0 0 23cqw;
  border-radius: 10px;
  overflow: hidden;
  line-height: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.track-thumb svg { width: 100%; height: auto; display: block; }

.track-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4cqh;
}

.track-info b { font-size: 3.4cqw; letter-spacing: 0.06em; }

.track-info span {
  font-size: 2.35cqw;
  line-height: 1.35;
  color: var(--muted);
}

.track-info em {
  font-style: normal;
  font-size: 2.35cqw;
  letter-spacing: 0.06em;
  color: var(--accent-2);
}

.track-check {
  position: absolute;
  right: 3.2cqw;
  top: 50%;
  width: 3.8cqw;
  height: 3.8cqw;
  margin-top: -1.9cqw;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.track-card.selected .track-check {
  background: var(--accent);
  border-color: transparent;
  box-shadow: 0 0 14px rgba(255, 120, 70, 0.5);
}

.track-card.selected .track-check::after {
  content: "";
  position: absolute;
  left: 1.15cqw;
  top: 0.55cqw;
  width: 0.9cqw;
  height: 1.9cqw;
  border: solid #1b0a05;
  border-width: 0 0.5cqw 0.5cqw 0;
  transform: rotate(45deg);
}

/* ---------------- over screen coins + toast ---------------- */

.over-coins {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.6cqw;
  font-size: 2.7cqw;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.over-coins b {
  font-size: 4.4cqw;
  color: #ffd166;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.over-coins .coin-ico { width: 3.2cqw; height: 3.2cqw; }

.toast {
  position: absolute;
  left: 50%;
  bottom: 18cqh;
  z-index: 40;
  padding: 1.3cqh 3.4cqw;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 16, 22, 0.94);
  color: #fff;
  font-size: 2.9cqw;
  letter-spacing: 0.06em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-height: 660px) {
  .garage-sheet { height: 56%; }
  .car-card { flex-basis: 38cqw; }
  .garage-tabs { padding-top: 1.4cqh; }
  .garage-content { padding-top: 1.4cqh; }
  .garage-foot { padding-bottom: 1.2cqh; }
}


/* ---------------- combo, nitro state, responsive screens ---------------- */

.stat-combo {
  display: flex;
  align-items: center;
  gap: 1.2cqw;
  margin-top: 0.6cqh;
  font-size: 4.4cqw;
  font-weight: 900;
  line-height: 1;
  color: #ffd166;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}

.stat-combo[hidden] { display: none; }

.combo-track {
  width: 13cqw;
  height: 0.55cqh;
  min-height: 3px;
  border-radius: 99px;
  background: rgba(8, 12, 18, 0.5);
  overflow: hidden;
}

.combo-track i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 99px;
  transform-origin: left center;
  background: linear-gradient(90deg, #ffd166, #ff7a45);
  box-shadow: 0 0 8px rgba(255, 170, 80, 0.6);
  transition: transform 0.06s linear;
}

.nitro-btn.empty {
  opacity: 0.4;
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: none;
}

/* Screens can scroll if a phone viewport is short. */
.screen {
  justify-content: flex-start;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.panel {
  margin: auto 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#screen-menu { justify-content: flex-start; }
.menu-actions { margin-top: auto; margin-bottom: auto; }

.btn, .icon-btn, .g-tab, .car-card, .tune-opt, .track-card {
  touch-action: manipulation;
}

.screen-garage { overflow: hidden; }

@media (max-height: 760px) {
  #screen-menu {
    padding-top: calc(env(safe-area-inset-top, 0px) + 2.4cqh);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 2.4cqh);
  }
  .brand { padding-top: 0; gap: 1.1cqh; }
  .title { font-size: 15.5cqw; }
  .tagline { font-size: 2.8cqw; }
  .menu-actions { gap: 1cqh; }
  .btn { padding: 1.7cqh 4cqw; font-size: 3.9cqw; }
  .btn-icon { padding: 0; font-size: 4.6cqw; }
  .selected-line { font-size: 2.2cqw; }
  .menu-foot { gap: 4cqw; }
  .stat-combo { font-size: 4cqw; }
}


/* A closed screen must never intercept taps, even through its buttons. */
.screen:not(.open) * { pointer-events: none !important; }


/* ---------------- difficulty ---------------- */

.difficulty {
  display: flex;
  gap: 1.2cqw;
  width: 100%;
}

.diff-btn {
  flex: 1;
  padding: 1.05cqh 0.4cqw;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 14, 20, 0.5);
  color: var(--muted);
  font: inherit;
  font-size: 2.55cqw;
  font-weight: 800;
  letter-spacing: 0.1em;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.diff-btn.active {
  color: #1a0b05;
  border-color: transparent;
  background: linear-gradient(135deg, #ffe3b0, #ff9a63);
}


.tune-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 5.2cqw;
  font-size: 4.6cqw;
  line-height: 1;
}


/* ---------------- car grid ---------------- */

.car-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2cqw;
  overflow: visible;
  padding-bottom: 1cqh;
  touch-action: auto;
}

.car-card {
  flex: none;
  width: 100%;
  min-width: 0;
  align-items: center;
  text-align: center;
  gap: 0.4cqh;
  padding: 1.1cqh 0.8cqw;
}

.car-card.locked { opacity: 1; }

.car-icon {
  width: 94%;
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.35));
}

.car-card-name {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.4em;
  white-space: normal;
  text-align: center;
  line-height: 1.1;
  font-size: 2.05cqw;
}

.car-card-meta {
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5cqw;
  font-size: 1.9cqw;
}

.car-card-meta .coin-ico { width: 1.9cqw; height: 1.9cqw; }


/* Night track: cooler vignette instead of the daytime sun glow. */
#shell.night #fx {
  background:
    radial-gradient(120% 60% at 74% 8%, rgba(90, 120, 255, 0.16), transparent 60%),
    radial-gradient(120% 75% at 50% 108%, rgba(0, 0, 0, 0.5), transparent 62%);
}
