:root {
  color-scheme: dark;
  --ink: #f5f0df;
  --muted: #b8ad94;
  --rust: #d86d32;
  --acid: #9bdc45;
  --blood: #b92c2f;
  --panel: rgba(17, 19, 19, 0.86);
  --panel-strong: rgba(8, 9, 9, 0.94);
  --line: rgba(255, 240, 190, 0.22);
  --ui-amber: #e99a43;
  --ui-gold: #f1c66b;
  --ui-cream: #f4edda;
  --ui-surface: #111617;
  --ui-surface-raised: #1a2020;
  --ui-line: rgba(233, 176, 90, 0.24);
  --ui-muted: #939b9b;
}

/* Premium vehicle-first Home */
.home-command {
  width: min(1240px, calc(100vw - 32px));
  height: min(780px, calc(100dvh - 32px));
  min-height: min(620px, calc(100dvh - 32px));
  max-height: none;
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: 82px minmax(0, 1fr);
  border: 1px solid rgba(236, 180, 86, 0.3);
  border-radius: 16px;
  background: #0a0d0e;
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.78), inset 0 0 70px rgba(0, 0, 0, 0.34);
  isolation: isolate;
}

.home-atmosphere,
.home-atmosphere > * {
  position: absolute;
  pointer-events: none;
}

.home-atmosphere {
  z-index: -1;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(4, 8, 12, 0.2) 0 28%, rgba(18, 13, 10, 0.1) 60%, rgba(4, 5, 5, 0.92) 100%),
    radial-gradient(ellipse at 46% 52%, rgba(239, 129, 55, 0.48), transparent 34%),
    radial-gradient(circle at 78% 22%, rgba(230, 166, 79, 0.18), transparent 18%),
    linear-gradient(145deg, #071017 0%, #182027 38%, #321811 70%, #080a0a 100%);
}

.home-atmosphere::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(112deg, transparent 0 90px, rgba(255, 180, 85, 0.025) 91px 93px, transparent 94px 180px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.4), transparent 35%, transparent 72%, rgba(0, 0, 0, 0.42));
  mix-blend-mode: screen;
}

.home-horizon {
  left: 13%;
  right: 8%;
  top: 42%;
  height: 115px;
  opacity: 0.58;
  filter: blur(13px);
  background: radial-gradient(ellipse, rgba(239, 132, 57, 0.5), transparent 68%);
}

.home-ruins {
  left: -3%;
  right: -3%;
  bottom: 29%;
  height: 34%;
  opacity: 0.56;
  background:
    linear-gradient(90deg,
      transparent 0 3%, #111719 3% 7%, transparent 7% 9%,
      #0c1214 9% 14%, transparent 14% 16%, #111719 16% 22%,
      transparent 22% 25%, #0b1012 25% 29%, transparent 29% 33%,
      #101617 33% 40%, transparent 40% 43%, #0d1314 43% 48%,
      transparent 48% 53%, #101617 53% 58%, transparent 58% 62%,
      #0d1214 62% 69%, transparent 69% 73%, #111719 73% 79%,
      transparent 79% 83%, #0c1213 83% 90%, transparent 90%);
  clip-path: polygon(0 100%, 0 48%, 4% 48%, 4% 15%, 7% 15%, 7% 58%, 11% 58%, 11% 30%, 15% 30%, 15% 72%, 20% 72%, 20% 44%, 23% 44%, 23% 64%, 28% 64%, 28% 18%, 32% 18%, 32% 70%, 38% 70%, 38% 38%, 42% 38%, 42% 65%, 47% 65%, 47% 26%, 51% 26%, 51% 68%, 57% 68%, 57% 45%, 61% 45%, 61% 63%, 67% 63%, 67% 22%, 72% 22%, 72% 66%, 78% 66%, 78% 42%, 83% 42%, 83% 61%, 89% 61%, 89% 32%, 94% 32%, 94% 68%, 100% 68%, 100% 100%);
}

.home-ruins-back {
  transform: translateY(-44px) scale(1.08);
  opacity: 0.24;
  filter: blur(1px);
}

.home-ruins-front {
  bottom: 22%;
  opacity: 0.68;
}

.home-road {
  left: -8%;
  right: -8%;
  bottom: -12%;
  height: 39%;
  transform: rotate(-2deg);
  border-top: 2px solid rgba(190, 133, 69, 0.34);
  background:
    radial-gradient(ellipse at 28% 8%, rgba(177, 119, 63, 0.2), transparent 30%),
    repeating-linear-gradient(104deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 80px),
    linear-gradient(180deg, #171512, #080909 72%);
}

.home-zombie-silhouette {
  bottom: 24%;
  width: 15px;
  height: 64px;
  border-radius: 45% 45% 35% 35%;
  background: #070a09;
  opacity: 0.5;
  transform-origin: bottom;
}

.home-zombie-silhouette::before {
  content: "";
  position: absolute;
  left: 1px;
  top: -13px;
  width: 14px;
  height: 15px;
  border-radius: 50%;
  background: inherit;
}

.home-zombie-silhouette::after {
  content: "";
  position: absolute;
  top: 15px;
  left: -10px;
  width: 34px;
  height: 6px;
  border-radius: 6px;
  background: inherit;
  transform: rotate(15deg);
}

.zombie-one { left: 7%; transform: rotate(-5deg) scale(0.78); opacity: 0.25; }
.zombie-two { right: 24%; transform: rotate(4deg) scale(0.62); opacity: 0.22; }
.zombie-three { right: 8%; transform: rotate(-3deg) scale(0.92); opacity: 0.34; }

.home-topbar {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 13px 20px 10px 24px;
  border-bottom: 1px solid rgba(255, 222, 159, 0.13);
  background: linear-gradient(180deg, rgba(7, 10, 11, 0.88), rgba(7, 10, 11, 0.42));
  backdrop-filter: blur(10px);
}

.home-brand-kicker,
.home-copy-kicker,
.home-progress small,
.home-progress span,
.home-play small,
.home-secondary-actions small,
.home-currency small {
  font-family: Arial, sans-serif;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.home-brand-kicker {
  display: block;
  margin-bottom: 2px;
  color: rgba(238, 215, 170, 0.56);
  font-size: 8px;
  text-transform: uppercase;
}

.home-brand h1 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  line-height: 0.86;
  text-transform: uppercase;
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.62));
}

.home-brand h1 span {
  color: #f1e7ca;
  font-size: clamp(25px, 3.2vw, 42px);
  letter-spacing: 0.015em;
}

.home-brand h1 strong {
  color: #e56831;
  font-size: clamp(19px, 2.4vw, 32px);
  font-weight: inherit;
  text-shadow: 0 2px 0 #6c2118;
}

.home-account {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.home-currency,
.home-settings {
  min-height: 48px;
  border: 1px solid rgba(242, 203, 114, 0.22);
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(42, 43, 37, 0.76), rgba(12, 14, 14, 0.88));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), 0 8px 22px rgba(0, 0, 0, 0.24);
}

.home-currency {
  min-width: 112px;
  padding: 6px 13px 6px 9px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.home-currency > i {
  width: 29px;
  height: 29px;
  border: 2px solid #f0bd54;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ffe7a2 0 12%, #d6952f 35%, #6f3d18 100%);
  box-shadow: 0 0 14px rgba(231, 162, 56, 0.28);
}

.home-currency span {
  display: grid;
}

.home-currency small {
  color: #aa9e83;
  font-size: 8px;
}

.home-currency b {
  color: #f7dfa0;
  font-size: 19px;
  line-height: 1;
}

.home-settings {
  min-width: 92px;
  padding: 0 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.12s ease;
}

.home-settings span {
  color: #d7c79d;
  font-family: Arial, sans-serif;
  font-size: 20px;
}

.home-settings b {
  color: #d9d2be;
  font-family: Arial, sans-serif;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.home-layout {
  position: relative;
  z-index: 2;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 286px;
  gap: clamp(10px, 2vw, 28px);
  padding: clamp(14px, 2vw, 26px);
}

.home-hero {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(245px, 1fr) auto;
  align-items: stretch;
}

.home-copy {
  position: relative;
  z-index: 3;
  max-width: 520px;
  padding-left: 4px;
}

.home-copy-kicker {
  display: block;
  color: #e8a354;
  font-size: 10px;
}

.home-copy p {
  margin: 5px 0 0;
  color: #e0d7c2;
  font: 700 clamp(14px, 1.65vw, 20px)/1.3 Arial, sans-serif;
  text-shadow: 0 3px 10px #000;
}

.home-vehicle-stage {
  position: relative;
  min-height: 245px;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.home-vehicle-stage img {
  position: relative;
  z-index: 3;
  display: block;
  width: min(760px, 88%);
  max-height: 340px;
  object-fit: contain;
  transform: translate(var(--vehicle-x), var(--vehicle-y)) scale(var(--vehicle-scale));
  transform-origin: 50% 60%;
  filter: drop-shadow(0 22px 16px rgba(0, 0, 0, 0.72)) drop-shadow(0 0 25px rgba(238, 120, 47, 0.09));
  animation: homeVehicleArrival 0.58s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.home-vehicle-floor {
  position: absolute;
  z-index: 1;
  left: 8%;
  right: 4%;
  bottom: 15%;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.86), rgba(0, 0, 0, 0.18) 56%, transparent 72%);
  filter: blur(3px);
}

.home-vehicle-glow {
  position: absolute;
  z-index: 0;
  width: 72%;
  height: 64%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(231, 119, 48, 0.22), transparent 68%);
  filter: blur(14px);
}

.home-dust {
  position: absolute;
  z-index: 2;
  bottom: 16%;
  width: 32%;
  height: 30%;
  border-radius: 50%;
  opacity: 0.34;
  filter: blur(16px);
  background: radial-gradient(ellipse, rgba(166, 106, 57, 0.5), transparent 70%);
}

.dust-a { left: 5%; }
.dust-b { right: 3%; transform: scale(0.7); }

.home-ride-tag {
  position: absolute;
  z-index: 4;
  left: 3%;
  bottom: 12%;
  display: grid;
  padding: 8px 12px 7px;
  border-left: 3px solid #e56831;
  background: linear-gradient(90deg, rgba(6, 8, 8, 0.86), rgba(6, 8, 8, 0.15));
  text-shadow: 0 2px 6px #000;
}

.home-ride-tag small {
  color: #b5a78d;
  font: 800 8px/1 Arial, sans-serif;
  letter-spacing: 0.14em;
}

.home-ride-tag b {
  margin-top: 3px;
  font-size: 22px;
  text-transform: uppercase;
}

.home-menu {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(230px, 1.05fr) minmax(260px, 1fr);
  gap: 10px;
  align-items: stretch;
}

.home-play {
  min-height: 82px;
  padding: 11px 18px 10px 22px;
  border: 1px solid rgba(255, 235, 181, 0.6);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  overflow: hidden;
  background:
    linear-gradient(115deg, rgba(255, 211, 114, 0.2), transparent 36%),
    linear-gradient(180deg, #ed7e32, #a93220 70%, #762017);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.28), 0 7px 0 #45140f, 0 18px 34px rgba(0, 0, 0, 0.42);
  transition: filter 0.18s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.home-play span {
  display: grid;
}

.home-play small {
  color: #ffe1af;
  font-size: 8px;
}

.home-play b {
  font-size: clamp(34px, 4.7vw, 54px);
  line-height: 0.85;
  letter-spacing: 0.025em;
  text-shadow: 0 3px 0 #671b14;
}

.home-play > i {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(55, 14, 11, 0.34);
  font-style: normal;
  font-family: Arial, sans-serif;
  font-size: 25px;
}

.home-secondary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.home-secondary-actions button {
  min-width: 0;
  min-height: 78px;
  padding: 10px;
  border: 1px solid rgba(233, 217, 171, 0.22);
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  background: linear-gradient(180deg, rgba(48, 53, 51, 0.88), rgba(15, 18, 18, 0.94));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05), 0 7px 18px rgba(0, 0, 0, 0.28);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.12s ease;
}

.home-secondary-actions i {
  flex: 0 0 30px;
  color: #d8994c;
  font-style: normal;
  font-family: Arial, sans-serif;
  font-size: 24px;
  text-align: center;
}

.home-secondary-actions span {
  min-width: 0;
  display: grid;
}

.home-secondary-actions b {
  font-size: 17px;
}

.home-secondary-actions small {
  overflow: hidden;
  color: #8f9188;
  font-size: 7px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.home-progress {
  align-self: end;
  padding: 17px;
  border: 1px solid rgba(232, 206, 144, 0.2);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), transparent 32%),
    linear-gradient(180deg, rgba(17, 21, 21, 0.9), rgba(7, 9, 9, 0.94));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05), 0 20px 48px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  font-family: Arial, sans-serif;
}

.home-progress-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.home-progress-heading span {
  color: #bcae8e;
  font-size: 9px;
}

.home-progress-heading i {
  width: 34px;
  height: 28px;
  border: 1px solid rgba(229, 104, 49, 0.5);
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: #f2b160;
  background: rgba(136, 44, 23, 0.24);
  font: normal 800 12px/1 Arial, sans-serif;
}

.home-loadout {
  display: grid;
  padding: 0 0 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.home-loadout small,
.home-level-progress span,
.home-progress-grid small {
  color: #858b82;
  font-size: 8px;
}

.home-loadout strong {
  margin-top: 4px;
  color: #f0e6ce;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 31px;
  line-height: 1;
  text-transform: uppercase;
}

.home-loadout span {
  margin-top: 5px;
  color: #d28c45;
  font-size: 9px;
  text-transform: uppercase;
}

.home-level-progress {
  padding: 15px 0;
}

.home-level-progress > div {
  display: flex;
  justify-content: space-between;
  align-items: end;
}

.home-level-progress b {
  color: #e9d9b7;
  font-size: 20px;
}

.home-level-progress b small {
  color: #777b73;
  font-size: 10px;
}

.home-level-progress > i {
  display: block;
  height: 5px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #202321;
}

.home-level-progress > i span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #cf5d2b, #edb358, #9bdc45);
  box-shadow: 0 0 10px rgba(218, 123, 48, 0.38);
}

.home-progress-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.home-progress-grid > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 7px;
  display: grid;
  background: rgba(255, 255, 255, 0.025);
}

.home-progress-grid b {
  margin-top: 4px;
  color: #f0dfb9;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 24px;
}

.home-progress-grid b span {
  color: #686d67;
  font-size: 11px;
}

.home-loadout-link {
  width: 100%;
  min-height: 39px;
  margin-top: 12px;
  padding: 0 10px;
  border: 1px solid rgba(224, 154, 72, 0.2);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #d8c7a2;
  background: rgba(158, 67, 31, 0.13);
  font: 800 9px/1 Arial, sans-serif;
  letter-spacing: 0.1em;
}

.home-command button:focus-visible {
  outline: 3px solid #f5d16f;
  outline-offset: 3px;
}

.home-settings:hover,
.home-secondary-actions button:hover,
.home-loadout-link:hover {
  border-color: rgba(238, 169, 80, 0.58);
  background-color: rgba(97, 58, 31, 0.36);
}

.home-play:hover {
  filter: brightness(1.12) saturate(1.08);
  transform: translateY(-2px);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 9px 0 #45140f, 0 22px 38px rgba(0, 0, 0, 0.46);
}

.home-command button:active {
  transform: translateY(2px);
}

@keyframes homeVehicleArrival {
  from { opacity: 0; transform: translate(calc(var(--vehicle-x) - 28px), calc(var(--vehicle-y) + 5px)) scale(calc(var(--vehicle-scale) * 0.96)); }
  to { opacity: 1; transform: translate(var(--vehicle-x), var(--vehicle-y)) scale(var(--vehicle-scale)); }
}

@media (max-width: 980px) {
  .home-command {
    grid-template-rows: 72px minmax(0, 1fr);
  }

  .home-layout {
    grid-template-columns: minmax(0, 1fr) 238px;
    padding: 16px;
  }

  .home-progress {
    padding: 14px;
  }

  .home-menu {
    grid-template-columns: minmax(200px, 1fr) minmax(220px, 0.9fr);
  }

  .home-secondary-actions small {
    display: none;
  }
}

@media (max-width: 760px) and (orientation: portrait) {
  .overlay {
    padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  }

  .home-command {
    width: 100%;
    height: calc(100dvh - 12px);
    min-height: 0;
    grid-template-rows: 66px minmax(0, 1fr);
    border-radius: 12px;
  }

  .home-topbar {
    padding: 9px 10px 7px 13px;
  }

  .home-brand-kicker {
    display: none;
  }

  .home-brand h1 {
    max-width: 150px;
    display: grid;
    gap: 1px;
  }

  .home-brand h1 span {
    font-size: 25px;
  }

  .home-brand h1 strong {
    font-size: 19px;
  }

  .home-currency {
    min-width: 88px;
    min-height: 43px;
    padding: 5px 8px;
  }

  .home-currency > i {
    width: 24px;
    height: 24px;
  }

  .home-currency b {
    font-size: 16px;
  }

  .home-settings {
    min-width: 43px;
    min-height: 43px;
    padding: 0;
  }

  .home-settings b {
    display: none;
  }

  .home-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px;
    overflow-y: auto;
  }

  .home-hero {
    grid-template-rows: auto minmax(205px, 1fr) auto;
  }

  .home-copy {
    padding-left: 2px;
  }

  .home-copy-kicker {
    font-size: 8px;
  }

  .home-copy p {
    margin-top: 3px;
    max-width: 330px;
    font-size: 13px;
  }

  .home-vehicle-stage {
    min-height: 205px;
  }

  .home-vehicle-stage img {
    width: min(590px, 116%);
    max-height: 265px;
  }

  .home-ride-tag {
    left: 1%;
    bottom: 8%;
    padding: 6px 9px;
  }

  .home-ride-tag b {
    font-size: 18px;
  }

  .home-vehicle-floor {
    left: 2%;
    right: 2%;
    bottom: 12%;
  }

  .home-menu {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .home-play {
    min-height: 69px;
    padding: 9px 14px 8px 18px;
  }

  .home-play b {
    font-size: 40px;
  }

  .home-play > i {
    width: 42px;
    height: 42px;
  }

  .home-secondary-actions button {
    min-height: 52px;
    justify-content: center;
    padding: 7px 9px;
  }

  .home-secondary-actions i {
    flex-basis: 24px;
    font-size: 19px;
  }

  .home-progress {
    display: grid;
    grid-template-columns: minmax(100px, 1.15fr) minmax(120px, 1fr);
    gap: 8px 13px;
    padding: 11px 12px;
  }

  .home-progress-heading {
    grid-column: 1 / -1;
    margin: 0;
  }

  .home-loadout {
    padding: 0;
    border: 0;
  }

  .home-loadout strong {
    font-size: 22px;
  }

  .home-level-progress {
    padding: 0;
  }

  .home-progress-grid {
    grid-column: 1 / -1;
  }

  .home-progress-grid > div {
    padding: 7px 9px;
  }

  .home-progress-grid b {
    font-size: 19px;
  }

  .home-loadout-link {
    display: none;
  }

  .home-ruins-front {
    bottom: 31%;
  }

  .home-road {
    bottom: -3%;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .overlay {
    padding: max(5px, env(safe-area-inset-top)) max(7px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left));
  }

  .home-command {
    width: 100%;
    height: calc(100dvh - 10px);
    min-height: 0;
    grid-template-rows: 52px minmax(0, 1fr);
    border-radius: 10px;
  }

  .home-topbar {
    padding: 6px 10px 5px 15px;
  }

  .home-brand-kicker {
    display: none;
  }

  .home-brand h1 span {
    font-size: 24px;
  }

  .home-brand h1 strong {
    font-size: 18px;
  }

  .home-currency,
  .home-settings {
    min-height: 38px;
  }

  .home-settings {
    min-width: 42px;
  }

  .home-settings b,
  .home-currency small {
    display: none;
  }

  .home-currency {
    min-width: 75px;
    padding: 4px 7px;
  }

  .home-currency > i {
    width: 21px;
    height: 21px;
  }

  .home-layout {
    grid-template-columns: minmax(0, 1fr) 210px;
    gap: 10px;
    padding: 8px 10px;
  }

  .home-hero {
    grid-template-rows: 34px minmax(0, 1fr) 64px;
  }

  .home-copy-kicker {
    font-size: 8px;
  }

  .home-copy p {
    margin-top: 1px;
    font-size: 11px;
  }

  .home-vehicle-stage {
    min-height: 100px;
  }

  .home-vehicle-stage img {
    width: min(600px, 78%);
    max-height: 185px;
  }

  .home-ride-tag {
    bottom: 5%;
    padding: 4px 7px;
  }

  .home-ride-tag small {
    display: none;
  }

  .home-ride-tag b {
    font-size: 15px;
  }

  .home-menu {
    grid-template-columns: minmax(180px, 0.9fr) minmax(210px, 1fr);
    gap: 7px;
  }

  .home-play {
    min-height: 58px;
    padding: 6px 10px 6px 14px;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.28), 0 4px 0 #45140f, 0 12px 20px rgba(0, 0, 0, 0.4);
  }

  .home-play b {
    font-size: 31px;
  }

  .home-play > i {
    width: 35px;
    height: 35px;
  }

  .home-secondary-actions {
    gap: 6px;
  }

  .home-secondary-actions button {
    min-height: 57px;
    padding: 6px;
  }

  .home-secondary-actions small {
    display: none;
  }

  .home-progress {
    align-self: stretch;
    padding: 10px;
  }

  .home-progress-heading {
    margin-bottom: 7px;
  }

  .home-loadout {
    padding-bottom: 7px;
  }

  .home-loadout strong {
    font-size: 21px;
  }

  .home-loadout span {
    display: none;
  }

  .home-level-progress {
    padding: 7px 0;
  }

  .home-progress-grid > div {
    padding: 6px;
  }

  .home-progress-grid b {
    font-size: 18px;
  }

  .home-loadout-link {
    min-height: 28px;
    margin-top: 7px;
    font-size: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-vehicle-stage img {
    animation: none;
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  color-scheme: dark;
  background: #070807;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  color: var(--ink);
  touch-action: none;
  user-select: none;
}

button {
  font: inherit;
  color: inherit;
}

#gameCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  background: #111;
}

.hidden {
  display: none !important;
}

.hud {
  position: fixed;
  inset: 0;
  width: auto;
  transform: none;
  z-index: 5;
  pointer-events: none;
}

.hud-top {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  display: grid;
  grid-template-columns: 118px minmax(150px, 460px) 38px;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.progress-wrap,
.gauge-cluster,
.icon-btn {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(23, 25, 23, 0.76), rgba(5, 6, 6, 0.66));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  border-radius: 7px;
  backdrop-filter: blur(8px);
}

.progress-wrap {
  position: relative;
  height: 14px;
  overflow: visible;
  border-radius: 999px;
  background: rgba(8, 9, 8, 0.58);
}

.progress-wrap i {
  position: absolute;
  inset: 3px auto 3px 3px;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #d86d32, #f2c866, #9bdc45);
  transition: width 0.12s linear;
}

.checkpoint-markers {
  position: absolute;
  inset: 0;
}

.checkpoint-markers span {
  position: absolute;
  top: 50%;
  width: 6px;
  height: 18px;
  border-radius: 5px;
  background: #d7bd50;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 9px rgba(215, 189, 80, 0.3);
}

.checkpoint-markers span.finish {
  width: 8px;
  height: 24px;
  background: #9bdc45;
}

.checkpoint-markers span.passed {
  background: #f5f0df;
  box-shadow: 0 0 14px rgba(245, 240, 223, 0.55);
}

.coin-toast {
  min-height: 24px;
  color: #f2c866;
  font-family: Arial, sans-serif;
  font-size: 13px;
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.coin-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 7px;
  pointer-events: auto;
  cursor: pointer;
}

.gauge-cluster {
  position: absolute;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: end;
  gap: 8px;
  padding: 7px 10px;
  background: linear-gradient(180deg, rgba(13, 15, 15, 0.66), rgba(3, 4, 4, 0.72));
}

.gauge {
  position: relative;
  width: 74px;
  height: 66px;
  display: grid;
  place-items: center;
}

.speed-gauge {
  width: 90px;
  height: 78px;
}

.gauge canvas {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 74px;
  height: 74px;
  transform: translate(-50%, -50%);
}

.speed-gauge canvas {
  width: 90px;
  height: 90px;
}

.gauge span,
.gauge b {
  position: relative;
  z-index: 1;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.gauge span {
  align-self: end;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.gauge b {
  align-self: start;
  margin-top: 3px;
  font-size: 18px;
}

.fuel-gauge.low b {
  color: #f07a41;
  animation: lowFuelPulse 0.9s ease-in-out infinite alternate;
}

.nitro-gauge.active b {
  color: #8ae6ff;
}

@keyframes lowFuelPulse {
  from {
    filter: brightness(1);
  }
  to {
    filter: brightness(1.45);
  }
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  pointer-events: none;
}

.drive-toast {
  align-self: start;
  justify-self: center;
  margin-top: max(54px, calc(env(safe-area-inset-top) + 52px));
  padding: 8px 14px;
  border: 1px solid rgba(255, 240, 190, 0.18);
  border-radius: 7px;
  background: rgba(6, 7, 7, 0.58);
  color: #f5f0df;
  font-size: clamp(22px, 4vw, 38px);
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.85);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
}

.victory-drive-toast {
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  border-color: rgba(242, 193, 95, 0.42);
  background: linear-gradient(180deg, rgba(63, 51, 24, 0.78), rgba(8, 10, 9, 0.72));
  animation: victoryToastArrival 0.42s 0.72s ease-out forwards;
}

@keyframes victoryToastArrival {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.screen {
  position: relative;
  width: min(960px, 100%);
  max-height: 96vh;
  overflow: auto;
  pointer-events: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 72% 14%, rgba(216, 109, 50, 0.22), transparent 28%),
    linear-gradient(180deg, rgba(30, 32, 28, 0.94), rgba(8, 9, 9, 0.96));
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.62);
  padding: clamp(18px, 3vw, 32px);
}

.home-screen {
  min-height: min(620px, 88vh);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  align-items: end;
}

.title {
  font-size: clamp(46px, 9vw, 106px);
  line-height: 0.86;
  margin: 0 0 18px;
  text-shadow: 0 5px 0 #2d110c, 0 18px 38px rgba(0, 0, 0, 0.55);
}

.subtitle {
  font-family: Arial, sans-serif;
  color: var(--muted);
  max-width: 540px;
  margin: 0 0 22px;
}

.menu-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  border: 1px solid rgba(255, 244, 204, 0.28);
  border-radius: 7px;
  background: linear-gradient(180deg, #d97835, #8b2f20);
  min-height: 44px;
  padding: 0 20px;
  cursor: pointer;
  box-shadow: 0 8px 0 #34130e, 0 16px 28px rgba(0, 0, 0, 0.34);
}

.btn.secondary {
  background: linear-gradient(180deg, #384038, #151817);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.stats-box,
.vehicle-card,
.upgrade-row,
.level-tile,
.result-grid > div {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.26);
}

.stats-box {
  padding: 16px;
  font-family: Arial, sans-serif;
}

.stats-box h2,
.screen h2 {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 30px;
  margin: 0 0 12px;
}

.stat-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.garage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.garage-screen {
  width: min(1120px, 100%);
  min-height: min(760px, 94vh);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.34) 1px, transparent 1px) 0 0 / 42px 42px,
    radial-gradient(circle at 52% 18%, rgba(238, 170, 82, 0.18), transparent 31%),
    linear-gradient(180deg, rgba(29, 29, 27, 0.98), rgba(8, 9, 9, 0.98));
  overflow: hidden;
}

.garage-screen::before {
  content: "";
  position: absolute;
}

.garage-topbar {
  display: grid;
  grid-template-columns: 84px 1fr minmax(92px, auto);
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.garage-topbar h2 {
  text-align: center;
  margin: 0;
  font-size: clamp(30px, 5vw, 50px);
  text-shadow: 0 5px 0 #2d110c, 0 12px 24px rgba(0, 0, 0, 0.45);
}

.btn.ghost {
  min-height: 38px;
  padding: 0 14px;
  background: linear-gradient(180deg, #2b302d, #101211);
  box-shadow: 0 5px 0 #080909;
}

.coin-counter {
  justify-self: end;
  min-width: 104px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 240, 190, 0.18);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.26);
  font-family: Arial, sans-serif;
}

.coin-counter span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.coin-counter b {
  color: #f2c866;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 24px;
  line-height: 1;
}

.garage-body {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: clamp(14px, 2.5vw, 26px);
  align-items: stretch;
}

.garage-left,
.garage-right {
  min-width: 0;
}

.garage-stage {
  position: relative;
  min-height: clamp(300px, 45vh, 470px);
  border: 1px solid rgba(255, 240, 190, 0.12);
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(255, 196, 91, 0.2), transparent 33%),
    linear-gradient(180deg, rgba(34, 32, 28, 0.74), rgba(8, 8, 8, 0.9));
  cursor: grab;
}

.garage-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 17%, rgba(255, 203, 118, 0.08) 17% 18%, transparent 18% 100%),
    linear-gradient(180deg, rgba(255, 214, 139, 0.09), transparent 36%);
  pointer-events: none;
}

.garage-stage::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 11%;
  height: 18%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.62), transparent 68%);
  pointer-events: none;
}

#garageVehicleCanvas {
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(94%, 780px);
  height: auto;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.garage-floor {
  position: absolute;
  left: -6%;
  right: -6%;
  bottom: 0;
  height: 31%;
  background:
    repeating-linear-gradient(90deg, rgba(255, 240, 190, 0.08) 0 2px, transparent 2px 70px),
    linear-gradient(180deg, #25231f, #10100f);
  transform: perspective(360px) rotateX(56deg);
  transform-origin: center bottom;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 46px;
  height: 72px;
  border: 1px solid rgba(255, 240, 190, 0.2);
  border-radius: 8px;
  background: rgba(4, 5, 5, 0.46);
  color: #f5f0df;
  font-size: 54px;
  line-height: 0.5;
  cursor: pointer;
  transform: translateY(-50%);
}

.carousel-arrow.left {
  left: 12px;
}

.carousel-arrow.right {
  right: 12px;
}

.vehicle-nameplate {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 2px 10px;
}

.vehicle-nameplate strong {
  display: block;
  font-size: clamp(30px, 4.5vw, 48px);
  line-height: 0.95;
}

.vehicle-nameplate span {
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 13px;
}

.vehicle-nameplate b {
  white-space: nowrap;
  border-radius: 999px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 240, 190, 0.22);
  font-family: Arial, sans-serif;
  font-size: 12px;
}

.vehicle-nameplate b.selected {
  color: #12150f;
  background: #9bdc45;
}

.vehicle-nameplate b.owned {
  color: #f2c866;
  background: rgba(242, 200, 102, 0.12);
}

.vehicle-nameplate b.locked {
  color: #bbb4a2;
  background: rgba(255, 255, 255, 0.08);
}

.vehicle-nameplate b.buy {
  color: #f2c866;
  background: rgba(216, 109, 50, 0.16);
}

.vehicle-action-row {
  display: grid;
  grid-template-columns: minmax(130px, 180px) 1fr;
  gap: 10px;
}

.drive-btn {
  min-height: 54px;
  font-size: 28px;
}

.garage-right {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
}

.stat-bars {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid rgba(255, 240, 190, 0.12);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.garage-stat {
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: center;
  gap: 8px;
  font-family: Arial, sans-serif;
  font-size: 11px;
  font-weight: 900;
  color: var(--muted);
}

.garage-stat i {
  display: block;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.garage-stat b {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #d86d32, #f2c866);
  transition: width 0.25s ease;
}

.upgrade-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.upgrade-tabs button {
  min-height: 38px;
  border: 1px solid rgba(255, 240, 190, 0.14);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.upgrade-tabs button.active {
  color: #11140e;
  background: linear-gradient(180deg, #f2c866, #d86d32);
}

.upgrade-panel {
  padding: 14px;
  border: 1px solid rgba(255, 240, 190, 0.14);
  border-radius: 8px;
  background:
    radial-gradient(circle at 85% 18%, rgba(216, 109, 50, 0.18), transparent 28%),
    rgba(0, 0, 0, 0.26);
}

.upgrade-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.upgrade-panel-head span,
.upgrade-panel p {
  color: var(--muted);
  font-family: Arial, sans-serif;
}

.upgrade-panel-head span {
  display: block;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.upgrade-panel-head strong {
  display: block;
  font-size: 34px;
  line-height: 1;
}

.upgrade-panel-head b {
  color: #f2c866;
  font-family: Arial, sans-serif;
  font-size: 12px;
  white-space: nowrap;
}

.upgrade-dots {
  display: flex;
  gap: 7px;
  margin: 14px 0;
}

.upgrade-dots i {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 240, 190, 0.28);
  background: rgba(0, 0, 0, 0.24);
}

.upgrade-dots i.filled {
  border-color: #f2c866;
  background: #d86d32;
  box-shadow: 0 0 12px rgba(216, 109, 50, 0.36);
}

.upgrade-panel p {
  min-height: 38px;
  margin: 0 0 14px;
  font-size: 13px;
}

.upgrade-cta {
  width: 100%;
}

.garage-bump {
  animation: garageBump 0.18s ease;
}

.garage-upgraded .coin-counter {
  animation: coinSpend 0.35s ease;
}

.garage-upgraded .upgrade-panel {
  box-shadow: inset 0 0 0 1px rgba(242, 200, 102, 0.38), 0 0 24px rgba(216, 109, 50, 0.16);
}

@keyframes garageBump {
  0%,
  100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-7px);
  }
  70% {
    transform: translateX(7px);
  }
}

@keyframes coinSpend {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.08);
    filter: brightness(1.35);
  }
  100% {
    transform: scale(1);
  }
}

.vehicle-card {
  padding: 12px;
  min-height: 120px;
  cursor: pointer;
  font-family: Arial, sans-serif;
}

.vehicle-card.selected {
  outline: 2px solid var(--rust);
}

.vehicle-preview {
  height: 48px;
  margin-bottom: 10px;
  border-radius: 4px;
  background: linear-gradient(165deg, #353c39, #101211);
  position: relative;
}

.vehicle-preview::before {
  content: "";
  position: absolute;
  left: 18%;
  right: 14%;
  top: 18px;
  height: 16px;
  background: #ca5e2b;
  transform: skew(-13deg);
}

.vehicle-preview::after {
  content: "";
  position: absolute;
  left: 23%;
  right: 18%;
  bottom: 5px;
  height: 12px;
  background: radial-gradient(circle at 10% 50%, #050505 0 8px, transparent 9px), radial-gradient(circle at 88% 50%, #050505 0 8px, transparent 9px);
}

.upgrade-list {
  display: grid;
  gap: 8px;
}

.upgrade-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  font-family: Arial, sans-serif;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.level-tile {
  min-height: 94px;
  padding: 10px;
  cursor: pointer;
  font-family: Arial, sans-serif;
}

.level-tile.locked {
  opacity: 0.45;
  cursor: default;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 16px 0;
  font-family: Arial, sans-serif;
}

.result-grid > div {
  padding: 12px;
}

.result-grid b {
  display: block;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 28px;
}

.touch-controls {
  /* One height/width pair drives every pad, so shrinking the row is a two-line change. */
  --pad-height: clamp(46px, 13dvh, 60px);
  --pad-width: clamp(68px, 10.5vw, 92px);
  --pad-icon: clamp(17px, 2.4vw, 21px);
  --pad-label: clamp(8px, 1.15vw, 10px);
  --pad-gap: clamp(6px, 1.1vw, 11px);
  position: fixed;
  inset: auto max(10px, env(safe-area-inset-right)) max(9px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  z-index: 7;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  pointer-events: none;
}

.touch-cluster {
  display: flex;
  align-items: flex-end;
  gap: var(--pad-gap);
}

.touch-btn {
  width: var(--pad-width);
  height: var(--pad-height);
  padding: 0 4px;
  pointer-events: auto;
  display: grid;
  gap: 2px;
  place-content: center;
  place-items: center;
  border: 1px solid rgba(224, 232, 224, 0.16);
  border-radius: 12px;
  color: #dde2da;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 55%),
    linear-gradient(180deg, rgba(38, 44, 43, 0.52), rgba(9, 11, 11, 0.66));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.09), 0 4px 12px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(7px);
  transition: transform 0.08s ease, border-color 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
}

.touch-icon {
  width: var(--pad-icon);
  height: var(--pad-icon);
  /* Keep the button itself the pointer target so press/release never fires on a child. */
  pointer-events: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.touch-label {
  pointer-events: none;
  color: inherit;
  font: 800 var(--pad-label) / 1 Arial, sans-serif;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  opacity: 0.82;
}

.nitro-btn .touch-icon {
  fill: currentColor;
  fill-opacity: 0.22;
}

.nitro-btn {
  color: #bfe7ff;
  border-color: rgba(93, 181, 232, 0.36);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 55%),
    linear-gradient(180deg, rgba(34, 108, 148, 0.55), rgba(10, 40, 60, 0.68));
}

.accel {
  width: calc(var(--pad-width) * 1.24);
  color: #ffd8ab;
  border-color: rgba(255, 168, 74, 0.4);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), transparent 55%),
    linear-gradient(180deg, rgba(206, 100, 36, 0.62), rgba(84, 29, 15, 0.7));
}

.accel .touch-icon {
  stroke-width: 2.1;
}

.touch-btn:hover {
  border-color: rgba(255, 216, 160, 0.4);
}

.touch-btn.is-pressed {
  transform: translateY(2px) scale(0.97);
  border-color: rgba(255, 214, 150, 0.75);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.16), 0 0 0 1px rgba(255, 190, 110, 0.22), 0 2px 7px rgba(0, 0, 0, 0.4);
  filter: brightness(1.28);
}

.nitro-btn.is-pressed {
  border-color: rgba(150, 220, 255, 0.8);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.18), 0 0 0 1px rgba(120, 200, 255, 0.26), 0 2px 7px rgba(0, 0, 0, 0.4);
}

.touch-btn.is-pressed .touch-label {
  opacity: 1;
}

@media (max-width: 760px) {
  .home-screen {
    grid-template-columns: 1fr;
    align-items: end;
  }

  .garage-grid,
  .level-grid,
  .result-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hud-row {
    display: grid;
    grid-template-columns: 0.9fr 1fr 1.2fr 1.2fr 34px;
  }
}

@media (max-width: 860px) {
  .garage-screen {
    width: min(720px, 100%);
    max-height: 96vh;
    overflow: auto;
  }

  .garage-body {
    grid-template-columns: 1fr;
  }

  .garage-stage {
    min-height: 310px;
  }

  .vehicle-action-row {
    grid-template-columns: 1fr;
  }

  .garage-right {
    grid-template-rows: auto auto auto;
  }

  .upgrade-tabs {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .upgrade-tabs button {
    min-width: 86px;
  }
}

@media (max-width: 760px) and (orientation: portrait) {
  .garage-screen {
    padding: 14px;
  }

  .garage-topbar {
    grid-template-columns: 68px 1fr 88px;
  }

  .garage-topbar h2 {
    font-size: 34px;
  }

  .coin-counter {
    min-width: 86px;
    padding: 5px 8px;
  }

  .coin-counter b {
    font-size: 20px;
  }

  .garage-stage {
    min-height: 286px;
  }

  #garageVehicleCanvas {
    width: 112%;
  }

  .carousel-arrow {
    width: 38px;
    height: 58px;
    font-size: 44px;
  }

  .vehicle-nameplate {
    align-items: start;
    flex-direction: column;
  }

  .vehicle-nameplate strong {
    font-size: 34px;
  }

  .stat-bars {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .garage-screen {
    min-height: 0;
    max-height: 94vh;
    padding: 12px;
    overflow: auto;
  }

  .garage-topbar {
    margin-bottom: 6px;
  }

  .garage-topbar h2 {
    font-size: 30px;
  }

  .coin-counter {
    padding: 4px 8px;
  }

  .garage-body {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.88fr);
    gap: 12px;
  }

  .garage-stage {
    min-height: 190px;
  }

  #garageVehicleCanvas {
    width: 96%;
  }

  .vehicle-nameplate strong {
    font-size: 27px;
  }

  .drive-btn {
    min-height: 38px;
    font-size: 22px;
  }

  .vehicle-nameplate {
    padding: 4px 0;
  }

  .vehicle-nameplate span {
    font-size: 11px;
  }

  .vehicle-action-row {
    grid-template-columns: 120px 1fr;
    gap: 7px;
  }

  .garage-right {
    gap: 5px;
  }

  .stat-bars {
    grid-template-columns: 1fr 1fr;
    gap: 4px 8px;
    padding: 7px;
  }

  .garage-stat {
    grid-template-columns: 50px 1fr;
    font-size: 10px;
  }

  .garage-stat i {
    height: 7px;
  }

  .upgrade-tabs {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    overflow: visible;
    padding-bottom: 0;
  }

  .upgrade-tabs button {
    min-width: 0;
    min-height: 28px;
    font-size: 9px;
    padding: 0 2px;
  }

  .upgrade-panel {
    padding: 8px;
  }

  .upgrade-panel-head strong {
    font-size: 22px;
  }

  .upgrade-panel-head b,
  .upgrade-panel-head span {
    font-size: 10px;
  }

  .upgrade-dots {
    gap: 5px;
    margin: 6px 0;
  }

  .upgrade-dots i {
    width: 13px;
    height: 13px;
  }

  .upgrade-panel p {
    min-height: 0;
    margin-bottom: 6px;
    font-size: 11px;
    line-height: 1.15;
  }

  .upgrade-cta {
    min-height: 36px;
  }
}

@media (max-width: 760px) {
  .hud-top {
    grid-template-columns: 86px minmax(120px, 1fr) 36px;
  }

  .gauge-cluster {
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 34vh);
    gap: 4px;
    padding: 5px 7px;
  }

  .gauge {
    width: 58px;
    height: 52px;
  }

  .speed-gauge {
    width: 70px;
    height: 60px;
  }

  .gauge canvas {
    width: 58px;
    height: 58px;
  }

  .speed-gauge canvas {
    width: 70px;
    height: 70px;
  }

  .gauge b {
    font-size: 14px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .screen {
    max-height: 92vh;
    padding: 14px;
  }

  .title {
    font-size: clamp(42px, 9vh, 70px);
  }
}

/* Vehicle-first garage */
.vehicle-garage-screen {
  width: min(1180px, 100%);
  min-height: min(920px, 96vh);
  max-height: 96vh;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 189, 82, 0.22);
  background:
    linear-gradient(180deg, rgba(6, 8, 10, 0.08) 0 58%, rgba(4, 5, 6, 0.9) 100%),
    radial-gradient(circle at 50% 22%, rgba(255, 184, 74, 0.17), transparent 34%),
    linear-gradient(125deg, #11171a 0%, #222629 45%, #0b0d0f 100%);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.68);
}

.garage-shell {
  position: relative;
  display: grid;
  grid-template-rows: 72px minmax(320px, 1fr) auto 22px auto;
  min-height: inherit;
  padding: 0 28px 22px;
  isolation: isolate;
}

.garage-shell::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 58% 0 0;
  background:
    linear-gradient(90deg, transparent 49.5%, rgba(255, 255, 255, 0.04) 50%, transparent 50.5%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 96px),
    linear-gradient(180deg, #16191a, #080a0b);
  transform: perspective(500px) rotateX(28deg);
  transform-origin: top;
}

.garage-hudbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  padding-top: 12px;
}

.garage-mode-buttons {
  display: flex;
  gap: 6px;
  justify-self: start;
}

.garage-mode-buttons button,
.garage-settings-btn {
  min-width: 42px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #d8dcde;
  background: rgba(10, 12, 13, 0.78);
  font: 800 11px/1 var(--font-ui);
  cursor: pointer;
}

.garage-mode-buttons button.active {
  color: #17120b;
  border-color: #ffbe55;
  background: #ffb63d;
}

.garage-settings-btn {
  justify-self: end;
  width: 38px;
  padding: 0;
  font-size: 20px;
}

.garage-title {
  position: absolute;
  top: 42px;
  left: 50%;
  color: rgba(255, 255, 255, 0.46);
  font: 900 14px/1 var(--font-ui);
  letter-spacing: 0;
  transform: translateX(-50%);
}

.garage-money {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 132px;
  padding: 7px 13px;
  border: 1px solid rgba(255, 191, 68, 0.35);
  border-radius: 6px;
  background: rgba(8, 10, 11, 0.82);
  box-shadow: inset 0 0 18px rgba(255, 169, 44, 0.06);
}

.garage-money span {
  color: #b9bec0;
  font: 800 10px/1 var(--font-ui);
}

.garage-money b {
  color: #ffc34f;
  font: 900 22px/1 var(--font-display);
}

.vehicle-carousel-stage {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  min-height: 410px;
  overflow: hidden;
  touch-action: pan-y;
  cursor: grab;
}

.vehicle-carousel-stage:active {
  cursor: grabbing;
}

.vehicle-focus {
  position: relative;
  z-index: 5;
  grid-column: 2;
  justify-self: center;
  width: min(76vw, 830px);
  height: clamp(300px, 44vh, 470px);
  animation: garage-vehicle-enter 380ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.vehicle-focus.slide-prev {
  --enter-x: -42px;
}

.vehicle-focus.slide-next {
  --enter-x: 42px;
}

.garage-vehicle-img {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 28px;
  width: 100%;
  max-height: calc(100% - 22px);
  object-fit: contain;
  object-position: center bottom;
  transform: translate(calc(-50% + var(--vehicle-x)), var(--vehicle-y)) scale(var(--vehicle-scale));
  transform-origin: 50% 88%;
  filter: drop-shadow(0 18px 16px rgba(0, 0, 0, 0.55));
  animation: garage-idle 4.8s ease-in-out infinite;
}

.vehicle-carousel-stage.is-locked .garage-vehicle-img {
  filter: grayscale(0.72) brightness(0.55) drop-shadow(0 18px 16px rgba(0, 0, 0, 0.7));
}

.vehicle-spotlight {
  position: absolute;
  inset: -10% 10% 18%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 196, 98, 0.26), rgba(255, 184, 74, 0.04) 52%, transparent 72%);
  filter: blur(8px);
}

.vehicle-ground-shadow {
  position: absolute;
  z-index: 2;
  left: 12%;
  right: 12%;
  bottom: 14px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  filter: blur(13px);
}

.vehicle-smoke {
  position: absolute;
  z-index: 3;
  left: 12%;
  bottom: 40px;
  width: 55px;
  height: 32px;
  border-radius: 50%;
  background: rgba(190, 202, 207, 0.15);
  filter: blur(10px);
  animation: garage-smoke 4s ease-out infinite;
}

.workshop-depth {
  position: absolute;
  inset: 0;
  opacity: 0.42;
  pointer-events: none;
}

.hanging-light {
  position: absolute;
  top: 0;
  width: 92px;
  height: 10px;
  border-radius: 2px;
  background: #f7cc83;
  box-shadow: 0 0 18px rgba(255, 202, 113, 0.5), 0 80px 90px rgba(255, 186, 80, 0.18);
}

.hanging-light.one { left: 14%; }
.hanging-light.two { right: 12%; width: 70px; }

.chain {
  position: absolute;
  top: 0;
  width: 2px;
  height: 105px;
  background: repeating-linear-gradient(#62676a 0 5px, transparent 5px 9px);
}

.chain.one { left: 7%; }
.chain.two { right: 8%; height: 150px; }

.scrap-pile {
  position: absolute;
  right: 1%;
  bottom: 12%;
  width: 130px;
  height: 58px;
  clip-path: polygon(0 100%, 10% 55%, 27% 68%, 39% 20%, 52% 58%, 72% 8%, 100% 100%);
  background: #34393b;
}

.vehicle-garage-screen .carousel-arrow {
  z-index: 15;
  width: 54px;
  height: 72px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #f2f3f3;
  background: rgba(8, 10, 11, 0.64);
  font: 400 58px/0.7 sans-serif;
  cursor: pointer;
}

.vehicle-garage-screen .carousel-arrow:hover {
  color: #17120b;
  border-color: #ffc458;
  background: #ffc458;
}

.vehicle-selection-panel {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
  width: min(780px, 88%);
  margin: -12px auto 0;
  padding: 0 8px 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.vehicle-identity span,
.vehicle-identity p {
  color: #aab0b2;
  font: 700 11px/1.25 var(--font-ui);
}

.vehicle-identity h2 {
  margin: 2px 0;
  color: #fff;
  font: 900 clamp(34px, 4.4vw, 58px)/0.94 var(--font-display);
}

.vehicle-identity p {
  margin: 0;
  max-width: 560px;
}

.vehicle-state {
  align-self: center;
  padding: 7px 10px;
  border: 1px solid currentColor;
  border-radius: 4px;
  color: #d9dddf;
  font: 900 11px/1 var(--font-ui);
}

.vehicle-state.selected { color: #ffbe4c; }
.vehicle-state.owned { color: #75d8a0; }
.vehicle-state.locked { color: #aaafb2; }
.vehicle-state.buy { color: #77c9ff; }

.vehicle-dots {
  position: relative;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 8px;
}

.vehicle-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #666b6e;
  cursor: pointer;
}

.vehicle-dots button.active {
  width: 22px;
  border-radius: 3px;
  background: #ffb43d;
}

.garage-primary-actions {
  position: relative;
  z-index: 14;
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(150px, 0.7fr) minmax(220px, 1.25fr);
  gap: 10px;
  width: min(780px, 88%);
  margin: 10px auto 0;
}

.garage-primary-actions .btn {
  min-height: 50px;
}

.garage-primary-actions .drive-btn {
  font-size: 28px;
}

.upgrades-toggle.active {
  color: #17120b;
  border-color: #ffc458;
  background: #ffc458;
}

.vehicle-lock-overlay {
  position: absolute;
  z-index: 12;
  left: 50%;
  top: 46%;
  display: grid;
  place-items: center;
  min-width: 180px;
  padding: 18px 24px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  color: #fff;
  background: rgba(7, 9, 10, 0.82);
  transform: translate(-50%, -50%);
}

.vehicle-lock-overlay i {
  position: relative;
  width: 30px;
  height: 24px;
  margin: 11px 0 8px;
  border-radius: 3px;
  background: #d9dcde;
}

.vehicle-lock-overlay i::before {
  content: "";
  position: absolute;
  left: 6px;
  bottom: 16px;
  width: 14px;
  height: 18px;
  border: 3px solid #d9dcde;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}

.vehicle-lock-overlay strong {
  font: 900 19px/1 var(--font-display);
}

.vehicle-lock-overlay span {
  margin-top: 4px;
  color: #b9bec0;
  font: 700 11px/1 var(--font-ui);
}

.garage-upgrade-drawer {
  position: absolute;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: minmax(180px, 0.6fr) minmax(0, 2fr);
  gap: 18px;
  max-height: 43%;
  padding: 18px 28px 24px;
  overflow: auto;
  border-top: 1px solid rgba(255, 190, 76, 0.34);
  background: rgba(8, 10, 11, 0.96);
  box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.5);
}

.drawer-stats {
  display: grid;
  align-content: start;
  gap: 7px;
}

.drawer-upgrades {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 0 16px;
}

.garage-upgrade-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.garage-upgrade-item > div:first-child {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
}

.garage-upgrade-item > div span,
.garage-upgrade-item > div small {
  color: #a9afb1;
  font: 800 9px/1 var(--font-ui);
}

.garage-upgrade-item > div strong {
  color: #fff;
  font: 900 15px/1 var(--font-ui);
}

.garage-upgrade-item > div small {
  grid-column: 1 / -1;
}

.upgrade-level-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.upgrade-level-dots i {
  width: 8px;
  height: 8px;
  border: 1px solid #777d80;
  border-radius: 50%;
}

.upgrade-level-dots i.filled {
  border-color: #ffb53d;
  background: #ffb53d;
}

.garage-upgrade-item p {
  margin: 0;
  color: #c8ccce;
  font: 600 10px/1.2 var(--font-ui);
}

.garage-upgrade-item .upgrade-cta {
  grid-column: 2;
  grid-row: 2;
  min-width: 104px;
  min-height: 32px;
  padding: 4px 8px;
  font-size: 10px;
}

.garage-upgrade-item.insufficient .upgrade-cta {
  color: #ef8c7d;
  border-color: #7e3029;
}

.garage-upgrade-item.flash {
  animation: upgrade-flash 680ms ease-out;
}

.garage-upgrade-drawer .garage-stat {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 8px;
  color: #c8ccce;
  font: 800 9px/1 var(--font-ui);
}

.garage-upgrade-drawer .garage-stat i {
  height: 7px;
  overflow: hidden;
  background: #303537;
}

.garage-upgrade-drawer .garage-stat b {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #f3952e, #ffd35d);
  transition: width 450ms ease;
}

@keyframes garage-vehicle-enter {
  from { opacity: 0; transform: translateX(var(--enter-x)); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes garage-idle {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  45% { translate: 0 -2px; rotate: 0.08deg; }
  55% { translate: 0 -1px; rotate: -0.08deg; }
}

@keyframes garage-smoke {
  0%, 62% { opacity: 0; transform: translate(0, 0) scale(0.65); }
  78% { opacity: 0.55; }
  100% { opacity: 0; transform: translate(-45px, -20px) scale(1.45); }
}

@keyframes upgrade-flash {
  0% { background: rgba(255, 188, 69, 0.36); }
  100% { background: transparent; }
}

@media (max-width: 760px) and (orientation: portrait) {
  .vehicle-garage-screen {
    width: 100%;
    min-height: 100%;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .garage-shell {
    grid-template-rows: 64px minmax(270px, 42vh) auto 22px auto;
    min-height: 100%;
    padding: 0 12px 18px;
  }

  .garage-mode-buttons button {
    min-width: 34px;
    padding: 0 7px;
    font-size: 9px;
  }

  .garage-title { display: none; }

  .garage-money {
    min-width: 104px;
    padding: 7px 9px;
  }

  .garage-money b { font-size: 18px; }

  .vehicle-carousel-stage {
    grid-template-columns: minmax(0, 1fr);
    min-height: 270px;
  }

  .vehicle-focus {
    grid-column: 1;
    width: 100%;
    height: clamp(245px, 40vh, 360px);
  }

  .vehicle-garage-screen .carousel-arrow {
    width: 36px;
    height: 54px;
    font-size: 42px;
  }

  .vehicle-selection-panel {
    grid-template-columns: 1fr auto;
    gap: 10px;
    width: 100%;
    margin-top: -4px;
  }

  .vehicle-identity h2 { font-size: 36px; }
  .vehicle-identity p { font-size: 9px; }

  .garage-primary-actions {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .garage-primary-actions .drive-btn {
    grid-column: 1 / -1;
  }

  .garage-upgrade-drawer {
    position: relative;
    grid-template-columns: 1fr;
    max-height: none;
    margin: 16px -12px -18px;
    padding: 16px 14px 22px;
  }

  .drawer-upgrades {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .vehicle-garage-screen {
    min-height: 94vh;
    max-height: 94vh;
    overflow: auto;
  }

  .garage-shell {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.8fr);
    grid-template-rows: 52px minmax(220px, 1fr) 20px auto;
    gap: 0 12px;
    padding: 0 16px 12px;
  }

  .garage-hudbar { grid-column: 1 / -1; padding-top: 8px; }
  .garage-title { display: none; }
  .vehicle-carousel-stage { grid-column: 1; grid-row: 2; min-height: 220px; }
  .vehicle-focus { width: min(62vw, 650px); height: 250px; }
  .vehicle-selection-panel { grid-column: 2; grid-row: 2; align-self: center; width: 100%; margin: 0; }
  .vehicle-identity h2 { font-size: 36px; }
  .vehicle-dots { grid-column: 1; grid-row: 3; }
  .garage-primary-actions { grid-column: 2; grid-row: 3 / span 2; align-self: start; grid-template-columns: 1fr 1fr; width: 100%; margin-top: 4px; }
  .garage-primary-actions .drive-btn { grid-column: 1 / -1; }
  .garage-primary-actions .btn { min-height: 36px; }
  .garage-upgrade-drawer { grid-template-columns: 150px 1fr; max-height: 74%; padding: 12px 16px; }
  .drawer-upgrades { grid-template-columns: repeat(2, minmax(190px, 1fr)); }
}

/* Strict multi-vehicle collection garage */
.collection-garage {
  --garage-amber: #f2ad3b;
  --garage-green: #7dd49b;
  position: relative;
  width: min(1280px, 100%);
  height: min(94vh, 900px);
  min-height: 620px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(242, 173, 59, 0.2);
  border-radius: 12px;
  background: #090c0d;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.72);
}

.collection-shell {
  position: relative;
  display: grid;
  grid-template-rows: 68px minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  isolation: isolate;
}

.collection-topbar {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: max(10px, env(safe-area-inset-top)) 22px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 9, 10, 0.9);
}

.collection-modes {
  display: flex;
  gap: 10px;
  justify-self: start;
}

.collection-modes button,
.collection-settings {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  color: #c5c9ca;
  background: #111516;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.collection-modes button span {
  font: 900 15px/1 var(--font-display);
}

.collection-modes button small {
  font: 700 7px/1 var(--font-ui);
}

.collection-modes button.active {
  color: #15100a;
  border-color: var(--garage-amber);
  background: var(--garage-amber);
}

.collection-settings {
  justify-self: end;
  font: 400 23px/1 sans-serif;
}

.collection-settings:hover,
.collection-settings:focus-visible {
  color: #15100a;
  border-color: var(--garage-amber);
  background: var(--garage-amber);
}

.collection-money {
  position: relative;
  justify-self: center;
  display: grid;
  grid-template-columns: 22px auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  min-width: 132px;
  padding: 6px 14px;
  border: 1px solid rgba(242, 173, 59, 0.32);
  border-radius: 999px;
  background: #111516;
  transition: transform 180ms ease, border-color 180ms ease;
}

.collection-money.changed {
  border-color: var(--garage-amber);
  transform: scale(1.06);
}

.collection-money .coin-mark {
  grid-row: 1 / span 2;
  width: 20px;
  height: 20px;
  border: 3px double #261a07;
  border-radius: 50%;
  background: var(--garage-amber);
}

.collection-money b {
  color: #f6c762;
  font: 900 20px/1 var(--font-display);
}

.collection-money small {
  color: #858d90;
  font: 800 7px/1 var(--font-ui);
  letter-spacing: 1.6px;
}

.collection-workshop {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto 26px;
  min-height: 0;
  padding: 18px 34px 6px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(8, 10, 11, 0.08) 48%, rgba(5, 7, 8, 0.86) 100%),
    radial-gradient(ellipse at 50% 24%, rgba(242, 173, 59, 0.14), transparent 38%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 118px),
    #171c1e;
}

.collection-workshop::after {
  content: "";
  position: absolute;
  z-index: 1;
  right: 0;
  bottom: 0;
  left: 0;
  height: 33%;
  background:
    repeating-linear-gradient(96deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 82px),
    linear-gradient(180deg, #161a1b, #080a0b);
  clip-path: polygon(0 24%, 100% 0, 100% 100%, 0 100%);
}

.workshop-set {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow: hidden;
  opacity: 0.46;
  pointer-events: none;
}

.workshop-lamp {
  position: absolute;
  top: 0;
  width: 82px;
  height: 8px;
  background: #d3af75;
  box-shadow: 0 0 18px rgba(230, 181, 100, 0.42), 0 80px 100px rgba(230, 181, 100, 0.11);
}

.workshop-lamp.left { left: 14%; }
.workshop-lamp.right { right: 12%; width: 58px; }

.workshop-chain {
  position: absolute;
  top: 0;
  width: 3px;
  height: 150px;
  background: repeating-linear-gradient(#5a6264 0 6px, transparent 6px 11px);
}

.workshop-chain.left { left: 5%; }
.workshop-chain.right { right: 6%; height: 112px; }

.workshop-tools {
  position: absolute;
  left: 2%;
  bottom: 19%;
  width: 110px;
  height: 82px;
  border-left: 8px solid #3b4244;
  border-bottom: 11px solid #3b4244;
  transform: skewY(-8deg);
}

.workshop-tires {
  position: absolute;
  right: 2%;
  bottom: 16%;
  width: 82px;
  height: 82px;
  border: 18px solid #222728;
  border-radius: 50%;
  box-shadow: -38px 16px 0 -18px #252a2b, -38px 16px 0 0 #171b1c;
}

.collection-heading {
  position: relative;
  z-index: 8;
  display: grid;
  justify-items: center;
  min-height: 72px;
  text-align: center;
}

.collection-heading span,
.collection-heading small {
  color: #899194;
  font: 800 9px/1 var(--font-ui);
  letter-spacing: 2px;
}

.collection-heading h2 {
  margin: 3px 0 1px;
  color: #f3f4f4;
  font: 900 clamp(34px, 4vw, 56px)/0.92 var(--font-display);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.vehicle-carousel-stage {
  position: relative;
  z-index: 8;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  align-items: center;
  min-height: 0;
  overflow: visible;
  touch-action: pan-y;
  cursor: grab;
}

.vehicle-carousel-stage:active { cursor: grabbing; }

.collection-arrow {
  position: relative;
  z-index: 18;
  width: 58px;
  height: 74px;
  padding: 0 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 8px;
  color: #e8e9e9;
  background: rgba(9, 12, 13, 0.74);
  font: 300 58px/1 sans-serif;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.collection-arrow.left { justify-self: start; }
.collection-arrow.right { justify-self: end; }

.collection-arrow:hover,
.collection-arrow:focus-visible {
  color: #171109;
  border-color: var(--garage-amber);
  background: var(--garage-amber);
  transform: scale(1.05);
}

.collection-vehicle-frame {
  position: relative;
  grid-column: 2;
  justify-self: center;
  width: min(65vw, 860px);
  height: clamp(260px, 43vh, 450px);
  animation: collection-enter 190ms ease-out both;
}

.collection-vehicle-frame.slide-prev { --collection-enter-x: -34px; }
.collection-vehicle-frame.slide-next { --collection-enter-x: 34px; }
.collection-vehicle-frame.exit-left { animation: collection-exit-left 145ms ease-in both; }
.collection-vehicle-frame.exit-right { animation: collection-exit-right 145ms ease-in both; }

.collection-vehicle-img {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: 26px;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  transform: translate(calc(-50% + var(--vehicle-x)), var(--vehicle-y)) scale(var(--vehicle-scale));
  transform-origin: 50% 88%;
  filter: drop-shadow(0 16px 13px rgba(0, 0, 0, 0.62));
  pointer-events: none;
}

.vehicle-carousel-stage.is-locked .collection-vehicle-img {
  opacity: 0.58;
  filter: grayscale(0.82) brightness(0.55) drop-shadow(0 16px 13px rgba(0, 0, 0, 0.7));
}

.collection-spotlight {
  position: absolute;
  inset: 2% 8% 17%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(237, 190, 113, 0.18), rgba(237, 190, 113, 0.03) 58%, transparent 72%);
  filter: blur(9px);
}

.collection-floor-line {
  position: absolute;
  z-index: 3;
  right: -8%;
  bottom: 24px;
  left: -8%;
  height: 2px;
  background: rgba(204, 175, 126, 0.16);
}

.collection-ground-shadow {
  position: absolute;
  z-index: 4;
  right: 8%;
  bottom: 10px;
  left: 8%;
  height: 38px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.73);
  filter: blur(12px);
}

.collection-dust {
  position: absolute;
  z-index: 7;
  left: 13%;
  bottom: 34px;
  width: 46px;
  height: 18px;
  border-radius: 50%;
  background: rgba(176, 164, 142, 0.11);
  filter: blur(7px);
  animation: collection-dust 4.6s ease-out infinite;
}

.collection-status {
  position: relative;
  z-index: 12;
  display: grid;
  grid-template-columns: auto auto;
  justify-content: center;
  align-items: center;
  gap: 4px 12px;
  min-height: 54px;
  text-align: center;
}

.collection-status > b {
  padding: 5px 9px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font: 900 10px/1 var(--font-ui);
  letter-spacing: 1px;
}

.collection-status > b.selected { color: var(--garage-amber); }
.collection-status > b.owned { color: var(--garage-green); }
.collection-status > b.locked { color: #aeb3b5; }
.collection-status > b.buy { color: #77c7f4; }

.collection-status > span {
  color: #bec3c5;
  font: 800 10px/1 var(--font-ui);
  text-transform: uppercase;
}

.collection-status p {
  grid-column: 1 / -1;
  margin: 0;
  color: #818a8d;
  font: 600 10px/1.2 Arial, sans-serif;
}

.collection-feedback {
  position: absolute;
  left: 50%;
  bottom: -19px;
  min-width: 230px;
  color: #d9ddde;
  font: 800 10px/1 var(--font-ui);
  transform: translateX(-50%);
  animation: collection-feedback 220ms ease-out both;
}

.collection-feedback.success { color: var(--garage-green); }
.collection-feedback.error { color: #ee8b7b; }

.collection-dots {
  position: relative;
  z-index: 14;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding-top: 8px;
}

.collection-dots button {
  width: 9px;
  height: 9px;
  padding: 0;
  border: 1px solid #777e80;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: width 170ms ease, border-color 170ms ease, background 170ms ease;
}

.collection-dots button:hover { border-color: #d2d6d7; }

.collection-dots button.active {
  width: 24px;
  border-color: var(--garage-amber);
  border-radius: 6px;
  background: var(--garage-amber);
}

.collection-actions {
  position: relative;
  z-index: 24;
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(150px, 0.8fr) minmax(220px, 1.25fr);
  gap: 10px;
  width: min(780px, calc(100% - 48px));
  padding: 10px 0 max(16px, env(safe-area-inset-bottom));
  margin: 0 auto;
  background: #090c0d;
}

.collection-actions .btn {
  min-height: 48px;
}

.collection-drive {
  font-size: 26px;
}

.collection-select {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.collection-select span { font-size: 12px; }
.collection-select b { color: #f6c762; font-size: 18px; }
.collection-select.insufficient { border-color: rgba(225, 112, 91, 0.6); }

.collection-upgrades-toggle.active {
  color: #171109;
  border-color: var(--garage-amber);
  background: var(--garage-amber);
}

.collection-vehicle-frame .vehicle-lock-overlay {
  top: 48%;
  min-width: 174px;
  padding: 16px 22px;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(7, 9, 10, 0.86);
}

.collection-upgrade-drawer {
  position: absolute;
  z-index: 40;
  top: 68px;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(520px, 48%);
  padding: 20px;
  overflow: auto;
  border-left: 1px solid rgba(242, 173, 59, 0.34);
  background: rgba(8, 10, 11, 0.98);
  animation: collection-drawer-in 240ms ease-out both;
}

.collection-upgrade-drawer > header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.collection-upgrade-drawer header span {
  color: var(--garage-amber);
  font: 800 9px/1 var(--font-ui);
  letter-spacing: 2px;
}

.collection-upgrade-drawer h3 {
  margin: 4px 0 0;
  color: #f0f2f2;
  font: 900 26px/1 var(--font-display);
  text-transform: uppercase;
}

.collection-upgrade-drawer header button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  color: #d5d8d9;
  background: #15191a;
  font-size: 24px;
  cursor: pointer;
}

.collection-drawer-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 16px;
  margin-bottom: 14px;
}

.collection-stat {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 7px;
  color: #bfc4c5;
  font: 800 8px/1 var(--font-ui);
}

.collection-stat i {
  height: 6px;
  overflow: hidden;
  background: #2c3234;
}

.collection-stat b {
  display: block;
  height: 100%;
  background: var(--garage-amber);
  transition: width 300ms ease;
}

.collection-drawer-upgrades {
  display: grid;
  align-content: start;
}

.collection-upgrade-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.collection-upgrade-item > div:first-child {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
}

.collection-upgrade-item > div span,
.collection-upgrade-item > div small {
  color: #91999b;
  font: 800 8px/1 var(--font-ui);
}

.collection-upgrade-item > div strong {
  color: #f1f3f3;
  font: 900 14px/1 var(--font-ui);
}

.collection-upgrade-item > div small { grid-column: 1 / -1; }

.collection-upgrade-level {
  display: flex;
  align-items: center;
  gap: 4px;
}

.collection-upgrade-level i {
  width: 8px;
  height: 8px;
  border: 1px solid #687073;
  border-radius: 50%;
}

.collection-upgrade-level i.filled {
  border-color: var(--garage-amber);
  background: var(--garage-amber);
}

.collection-upgrade-item p {
  margin: 0;
  color: #b6bcbe;
  font: 600 9px/1.2 Arial, sans-serif;
}

.collection-upgrade-cta {
  grid-column: 2;
  grid-row: 2;
  min-width: 110px;
  min-height: 31px;
  padding: 4px 8px;
  font-size: 9px;
}

.collection-upgrade-item.insufficient .collection-upgrade-cta {
  color: #ed8a7a;
  border-color: #79352f;
}

.collection-upgrade-item.flash { animation: upgrade-flash 680ms ease-out; }

@keyframes collection-enter {
  from { opacity: 0; transform: translateX(var(--collection-enter-x)) scale(0.985); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes collection-exit-left {
  to { opacity: 0; transform: translateX(-34px) scale(0.985); }
}

@keyframes collection-exit-right {
  to { opacity: 0; transform: translateX(34px) scale(0.985); }
}

@keyframes collection-dust {
  0%, 68% { opacity: 0; transform: translate(0, 0) scale(0.7); }
  80% { opacity: 0.7; }
  100% { opacity: 0; transform: translate(-38px, -15px) scale(1.5); }
}

@keyframes collection-feedback {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes collection-drawer-in {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 760px) and (orientation: portrait) {
  .collection-garage {
    width: 100%;
    height: 100%;
    min-height: 100%;
    max-height: 100%;
    overflow-y: auto;
    border: 0;
    border-radius: 0;
  }

  .collection-shell {
    grid-template-rows: 64px minmax(570px, auto) auto;
    height: auto;
    min-height: 100%;
  }

  .collection-topbar {
    position: sticky;
    top: 0;
    padding: max(8px, env(safe-area-inset-top)) 12px 7px;
  }

  .collection-modes { gap: 6px; }

  .collection-modes button,
  .collection-settings {
    width: 40px;
    height: 40px;
  }

  .collection-modes button small { display: none; }

  .collection-money {
    min-width: 112px;
    padding: 6px 10px;
  }

  .collection-money b { font-size: 17px; }

  .collection-workshop {
    grid-template-rows: 76px minmax(320px, 44vh) auto 28px;
    padding: 14px 12px 8px;
    overflow: hidden;
  }

  .collection-heading h2 { font-size: clamp(32px, 10vw, 44px); }

  .vehicle-carousel-stage {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }

  .collection-arrow {
    width: 38px;
    height: 58px;
    font-size: 44px;
  }

  .collection-vehicle-frame {
    width: calc(100vw - 104px);
    height: clamp(280px, 42vh, 390px);
  }

  .collection-status {
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 0 6px;
  }

  .collection-status > b { justify-self: center; }
  .collection-status p { max-width: 92vw; }

  .collection-actions {
    grid-template-columns: 1fr 1fr;
    width: calc(100% - 24px);
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  .collection-drive {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .collection-upgrade-drawer {
    position: relative;
    top: auto;
    width: 100%;
    padding: 16px 14px max(20px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(242, 173, 59, 0.34);
    border-left: 0;
    animation-name: collection-drawer-up;
  }

  .collection-drawer-stats { grid-template-columns: 1fr; }
}

@keyframes collection-drawer-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-height: 620px) and (orientation: landscape) {
  .collection-garage {
    width: 100%;
    height: 100%;
    min-height: 100%;
    max-height: 100%;
    border: 0;
    border-radius: 0;
  }

  .collection-shell { grid-template-rows: 52px minmax(0, 1fr) 58px; }

  .collection-topbar {
    padding: max(5px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 5px max(12px, env(safe-area-inset-left));
  }

  .collection-modes button,
  .collection-settings {
    width: 36px;
    height: 36px;
  }

  .collection-modes button small { display: none; }

  .collection-money { padding: 4px 10px; }
  .collection-money b { font-size: 16px; }

  .collection-workshop {
    grid-template-rows: 54px minmax(150px, 1fr) 45px 22px;
    padding: 7px max(12px, env(safe-area-inset-right)) 2px max(12px, env(safe-area-inset-left));
  }

  .collection-heading { min-height: 50px; }
  .collection-heading h2 { font-size: clamp(28px, 5.8vh, 38px); }

  .vehicle-carousel-stage { grid-template-columns: 52px minmax(0, 1fr) 52px; }

  .collection-arrow {
    width: 42px;
    height: 54px;
    font-size: 42px;
  }

  .collection-vehicle-frame {
    width: min(62vw, 700px);
    height: min(44vh, 250px);
  }

  .collection-status p { display: none; }

  .collection-actions {
    grid-template-columns: 0.8fr 0.9fr 1.2fr;
    width: min(720px, calc(100% - 120px));
    padding: 5px 0 max(5px, env(safe-area-inset-bottom));
  }

  .collection-actions .btn { min-height: 38px; }
  .collection-drive { font-size: 21px; }

  .collection-upgrade-drawer {
    top: 52px;
    width: min(480px, 48%);
    padding: 12px 14px;
  }

  .collection-upgrade-drawer h3 { font-size: 20px; }
  .collection-drawer-stats { display: none; }
  .collection-upgrade-item { padding: 7px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .collection-vehicle-frame,
  .collection-feedback,
  .collection-upgrade-drawer,
  .collection-dust {
    animation-duration: 1ms !important;
  }
}

/* Keep the Home shell independent from the shared modal screen rules. */
.screen.home-screen.home-command {
  width: min(1240px, calc(100vw - 32px));
  height: min(780px, calc(100dvh - 32px));
  min-height: min(620px, calc(100dvh - 32px));
  max-height: none;
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 82px minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  border-radius: 16px;
  background: #0a0d0e;
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.78), inset 0 0 70px rgba(0, 0, 0, 0.34);
}

@media (max-width: 980px) {
  .screen.home-screen.home-command {
    grid-template-rows: 72px minmax(0, 1fr);
  }
}

@media (max-width: 760px) and (orientation: portrait) {
  #overlay:has(.home-command) {
    padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  }

  .screen.home-screen.home-command {
    width: 100%;
    height: calc(100vh - 12px);
    height: calc(100dvh - 12px);
    min-height: 0;
    max-height: calc(100vh - 12px);
    grid-template-rows: 66px minmax(0, 1fr);
    border-radius: 12px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  #overlay:has(.home-command) {
    padding: max(5px, env(safe-area-inset-top)) max(7px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left));
  }

  .screen.home-screen.home-command {
    width: 100%;
    height: calc(100vh - 10px);
    height: calc(100dvh - 10px);
    min-height: 0;
    max-height: calc(100vh - 10px);
    padding: 0;
    grid-template-rows: 52px minmax(0, 1fr);
    border-radius: 10px;
  }
}

/* Premium boot/loading composition */
.premium-loader {
  position: fixed;
  z-index: 20;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  pointer-events: auto;
  isolation: isolate;
  background: #080b0d;
}

.loader-atmosphere,
.loader-atmosphere > * {
  position: absolute;
  pointer-events: none;
}

.loader-atmosphere {
  z-index: -1;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(2, 5, 8, 0.26), transparent 45%, rgba(4, 5, 5, 0.82) 100%),
    radial-gradient(ellipse at 50% 61%, rgba(225, 104, 42, 0.44), transparent 34%),
    radial-gradient(circle at 76% 23%, rgba(238, 180, 93, 0.13), transparent 15%),
    linear-gradient(150deg, #070e14 0%, #182126 43%, #321711 76%, #070909 100%);
}

.loader-atmosphere::before {
  content: "";
  position: absolute;
  inset: -20%;
  opacity: 0.5;
  background: repeating-linear-gradient(108deg, transparent 0 108px, rgba(238, 189, 111, 0.04) 109px 111px, transparent 112px 216px);
  animation: loaderStreaks 8s linear infinite;
}

.loader-horizon {
  left: 20%;
  right: 20%;
  top: 48%;
  height: 28%;
  border-radius: 50%;
  opacity: 0.6;
  filter: blur(22px);
  background: radial-gradient(ellipse, rgba(228, 105, 43, 0.42), transparent 68%);
  animation: loaderLight 2.8s ease-in-out infinite alternate;
}

.loader-city {
  left: -3%;
  right: -3%;
  bottom: 20%;
  height: 36%;
  background: #101719;
  clip-path: polygon(0 100%, 0 64%, 4% 64%, 4% 32%, 8% 32%, 8% 72%, 13% 72%, 13% 47%, 17% 47%, 17% 67%, 21% 67%, 21% 20%, 25% 20%, 25% 74%, 31% 74%, 31% 43%, 36% 43%, 36% 66%, 41% 66%, 41% 26%, 46% 26%, 46% 72%, 52% 72%, 52% 49%, 56% 49%, 56% 64%, 61% 64%, 61% 18%, 66% 18%, 66% 70%, 72% 70%, 72% 39%, 77% 39%, 77% 65%, 82% 65%, 82% 29%, 87% 29%, 87% 72%, 92% 72%, 92% 48%, 96% 48%, 96% 68%, 100% 68%, 100% 100%);
}

.loader-city-back {
  bottom: 25%;
  opacity: 0.28;
  transform: translateY(-42px) scale(1.08);
  filter: blur(1px);
}

.loader-city-front {
  opacity: 0.72;
  background: #090d0e;
}

.loader-road {
  left: -8%;
  right: -8%;
  bottom: -9%;
  height: 34%;
  transform: rotate(-1.2deg);
  border-top: 2px solid rgba(206, 143, 70, 0.35);
  background:
    repeating-linear-gradient(104deg, rgba(255, 255, 255, 0.022) 0 2px, transparent 2px 95px),
    linear-gradient(180deg, #191714, #070808 72%);
}

.loader-haze {
  width: 38vw;
  height: 18vw;
  min-height: 100px;
  border-radius: 50%;
  opacity: 0.24;
  filter: blur(28px);
  background: radial-gradient(ellipse, rgba(178, 116, 67, 0.62), transparent 70%);
  animation: loaderHaze 5s ease-in-out infinite alternate;
}

.haze-one {
  left: -8%;
  bottom: 18%;
}

.haze-two {
  right: -9%;
  bottom: 23%;
  animation-delay: -2.4s;
}

.loader-content {
  position: relative;
  z-index: 2;
  width: min(1120px, 100%);
  height: 100%;
  margin: 0 auto;
  padding: clamp(28px, 5vh, 58px) clamp(18px, 4vw, 48px) max(26px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr) auto;
  align-items: center;
}

.loader-brand {
  justify-self: center;
  display: grid;
  justify-items: center;
  text-transform: uppercase;
  filter: drop-shadow(0 9px 18px rgba(0, 0, 0, 0.72));
  animation: loaderBrandIn 0.32s ease-out both;
}

.loader-brand span {
  color: #f0e6cb;
  font-size: clamp(38px, 5.8vw, 72px);
  line-height: 0.84;
  letter-spacing: 0.02em;
}

.loader-brand strong {
  margin-top: 5px;
  color: #e66630;
  font-size: clamp(27px, 4vw, 50px);
  font-weight: inherit;
  line-height: 0.84;
  letter-spacing: 0.055em;
  text-shadow: 0 3px 0 #6f2118;
}

.loader-vehicle-stage {
  position: relative;
  width: 100%;
  min-height: 220px;
  display: grid;
  place-items: center;
}

.loader-vehicle-stage img {
  position: relative;
  top: 3.5vh;
  z-index: 3;
  display: block;
  width: min(780px, 82vw);
  max-height: 41vh;
  object-fit: contain;
  filter: drop-shadow(0 22px 18px rgba(0, 0, 0, 0.78)) drop-shadow(0 0 28px rgba(226, 105, 43, 0.1));
  transform-origin: 50% 70%;
  animation: loaderVehicleIn 0.36s cubic-bezier(0.2, 0.78, 0.2, 1) both, loaderVehicleIdle 1.7s 0.42s ease-in-out infinite alternate;
}

.loader-contact-shadow {
  position: absolute;
  z-index: 1;
  left: 20%;
  right: 20%;
  bottom: 17%;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.14) 62%, transparent 73%);
  filter: blur(4px);
}

.loader-vehicle-glow {
  position: absolute;
  z-index: 0;
  width: 72%;
  height: 72%;
  border-radius: 50%;
  opacity: 0.5;
  background: radial-gradient(ellipse, rgba(222, 104, 43, 0.28), transparent 68%);
  filter: blur(18px);
}

.loader-dust {
  position: absolute;
  z-index: 2;
  left: 18%;
  right: 18%;
  bottom: 12%;
  height: 25%;
  border-radius: 50%;
  opacity: 0.26;
  background: radial-gradient(ellipse, rgba(177, 111, 60, 0.56), transparent 70%);
  filter: blur(20px);
  animation: loaderDust 2.7s ease-in-out infinite alternate;
}

.loader-readout {
  justify-self: center;
  width: min(590px, 86vw);
  padding: 15px 17px 13px;
  border: 1px solid rgba(235, 196, 116, 0.24);
  border-radius: 9px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.04), transparent 38%),
    rgba(7, 10, 10, 0.8);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), 0 16px 40px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px);
}

.loader-status-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

#loadingStatus {
  color: #eadcba;
  font: 900 clamp(10px, 1.4vw, 13px)/1 Arial, sans-serif;
  letter-spacing: 0.14em;
}

#loadingPercent {
  color: #f1ae59;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 0.78;
}

.loader-track {
  position: relative;
  height: 12px;
  margin-top: 11px;
  overflow: hidden;
  border: 1px solid rgba(234, 208, 149, 0.2);
  border-radius: 99px;
  background: linear-gradient(180deg, #070909, #24231f);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8);
}

.loader-track::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  background: repeating-linear-gradient(90deg, transparent 0 24px, rgba(0, 0, 0, 0.15) 24px 26px);
}

#loadingFill {
  position: absolute;
  inset: 2px auto 2px 2px;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #9f321f, #e2692e 58%, #f3b75f);
  box-shadow: 0 0 14px rgba(230, 102, 43, 0.55);
  transition: width 0.22s cubic-bezier(0.2, 0.75, 0.2, 1);
}

.loader-readout > small {
  margin-top: 9px;
  display: flex;
  align-items: center;
  color: #777b73;
  font: 800 7px/1 Arial, sans-serif;
  letter-spacing: 0.15em;
}

.loader-readout > small i {
  flex: 1;
  height: 1px;
  margin: 0 9px;
  background: rgba(234, 190, 107, 0.16);
}

.premium-loader.loading-exit {
  pointer-events: none;
  animation: loaderExit 0.28s ease-in forwards;
}

@keyframes loaderBrandIn {
  from { opacity: 0.35; transform: translateY(-7px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes loaderVehicleIn {
  from { opacity: 0.25; transform: translateY(4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes loaderVehicleIdle {
  from { transform: translateY(0) rotate(-0.08deg); }
  to { transform: translateY(-2px) rotate(0.08deg); }
}

@keyframes loaderDust {
  from { transform: translateX(-2%) scale(0.92); opacity: 0.18; }
  to { transform: translateX(2%) scale(1.05); opacity: 0.3; }
}

@keyframes loaderHaze {
  from { transform: translateX(-4%) scale(0.94); }
  to { transform: translateX(5%) scale(1.08); }
}

@keyframes loaderLight {
  from { opacity: 0.44; }
  to { opacity: 0.68; }
}

@keyframes loaderStreaks {
  from { transform: translateX(-4%); }
  to { transform: translateX(4%); }
}

@keyframes loaderExit {
  0% { opacity: 1; filter: brightness(1); }
  45% { opacity: 1; filter: brightness(1.12); }
  100% { opacity: 0; filter: brightness(0.72); }
}

@media (max-width: 600px) and (orientation: portrait) {
  .loader-content {
    padding: max(28px, env(safe-area-inset-top)) 12px max(22px, env(safe-area-inset-bottom));
    grid-template-rows: auto minmax(250px, 1fr) auto;
  }

  .loader-brand span {
    font-size: clamp(38px, 13vw, 54px);
  }

  .loader-brand strong {
    font-size: clamp(28px, 9vw, 39px);
  }

  .loader-vehicle-stage {
    min-height: 250px;
  }

  .loader-vehicle-stage img {
    width: min(560px, 95vw);
    max-height: 40vh;
    top: 7vh;
  }

  .loader-contact-shadow {
    left: 8%;
    right: 8%;
    bottom: 22%;
  }

  .loader-dust {
    left: 2%;
    right: 2%;
    bottom: 18%;
  }

  .loader-readout {
    width: min(94vw, 520px);
    padding: 13px 13px 11px;
  }

  #loadingStatus {
    font-size: 9px;
    letter-spacing: 0.1em;
  }

  .loader-city {
    bottom: 24%;
  }

  .loader-road {
    bottom: -2%;
    height: 29%;
  }
}

@media (min-width: 601px) and (max-width: 900px) and (min-height: 600px) {
  .loader-vehicle-stage img {
    top: 8vh;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .loader-content {
    width: min(960px, 100%);
    padding: max(10px, env(safe-area-inset-top)) 18px max(10px, env(safe-area-inset-bottom));
    grid-template-columns: minmax(230px, 0.75fr) minmax(330px, 1.25fr);
    grid-template-rows: 1fr auto;
    gap: 4px 20px;
  }

  .loader-brand {
    justify-self: start;
    align-self: center;
    justify-items: start;
  }

  .loader-brand span {
    font-size: clamp(34px, 7vw, 54px);
  }

  .loader-brand strong {
    font-size: clamp(25px, 5vw, 38px);
  }

  .loader-vehicle-stage {
    grid-column: 2;
    grid-row: 1 / 3;
    min-height: 0;
  }

  .loader-vehicle-stage img {
    width: min(600px, 59vw);
    max-height: 68vh;
  }

  .loader-contact-shadow {
    left: 9%;
    right: 9%;
    bottom: 20%;
  }

  .loader-readout {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    align-self: end;
    padding: 10px 11px 9px;
  }

  #loadingStatus {
    font-size: 8px;
    letter-spacing: 0.09em;
  }

  #loadingPercent {
    font-size: 22px;
  }

  .loader-readout > small {
    display: none;
  }

  .loader-track {
    margin-top: 8px;
    height: 10px;
  }

  .loader-city {
    bottom: 12%;
    height: 48%;
  }

  .loader-road {
    bottom: -16%;
    height: 40%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loader-atmosphere::before,
  .loader-horizon,
  .loader-haze,
  .loader-vehicle-stage img,
  .loader-dust {
    animation: none;
  }
}

/* Gameplay HUD integration */
.hud .progress-wrap {
  height: 11px;
  border-color: rgba(226, 172, 83, 0.28);
  background: rgba(6, 8, 8, 0.74);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.72), 0 7px 18px rgba(0, 0, 0, 0.22);
}

.hud .progress-wrap i {
  inset: 2px auto 2px 2px;
  background: linear-gradient(90deg, #b84425, #e58a38 58%, #a8d955);
  box-shadow: 0 0 9px rgba(224, 119, 49, 0.34);
}

.hud .gauge-cluster {
  overflow: hidden;
  border-color: rgba(224, 173, 86, 0.24);
  border-radius: 10px;
  background:
    linear-gradient(90deg, transparent, rgba(222, 139, 55, 0.04), transparent),
    linear-gradient(180deg, rgba(18, 22, 21, 0.84), rgba(4, 6, 6, 0.88));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), 0 12px 28px rgba(0, 0, 0, 0.34);
}

.hud .gauge-cluster::before {
  content: "";
  position: absolute;
  inset: 0 16px auto;
  height: 2px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, transparent, rgba(228, 126, 48, 0.75), transparent);
}

.hud .icon-btn {
  border-color: rgba(224, 173, 86, 0.24);
  background: linear-gradient(180deg, rgba(27, 31, 29, 0.88), rgba(7, 9, 9, 0.92));
}

@media (max-width: 760px) {
  .hud .gauge-cluster {
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 34vh);
  }
}

/* Premium menu system: Result, Campaign, Settings and Garage */
.premium-menu {
  isolation: isolate;
  width: min(1120px, calc(100vw - 32px));
  max-height: min(900px, calc(100dvh - 32px));
  padding: 0;
  overflow: auto;
  border: 1px solid var(--ui-line);
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px) 0 0 / 72px 72px,
    radial-gradient(ellipse at 72% 4%, rgba(226, 117, 47, 0.18), transparent 34%),
    linear-gradient(145deg, rgba(25, 31, 32, 0.98), rgba(7, 10, 11, 0.99) 65%);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.05),
    inset 0 0 70px rgba(0, 0, 0, 0.26),
    0 32px 90px rgba(0, 0, 0, 0.74);
  animation: premium-menu-in 240ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.premium-menu::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: auto 0 0;
  height: 36%;
  opacity: 0.38;
  background:
    linear-gradient(90deg, transparent 0 5%, #0b0f10 5% 11%, transparent 11% 14%, #0b0f10 14% 22%, transparent 22% 31%, #0c1011 31% 39%, transparent 39% 47%, #0b0f10 47% 56%, transparent 56% 65%, #0c1011 65% 73%, transparent 73% 82%, #0b0f10 82% 91%, transparent 91%);
  clip-path: polygon(0 100%, 0 72%, 6% 72%, 6% 25%, 11% 25%, 11% 68%, 17% 68%, 17% 42%, 23% 42%, 23% 75%, 32% 75%, 32% 18%, 39% 18%, 39% 66%, 48% 66%, 48% 36%, 57% 36%, 57% 72%, 66% 72%, 66% 28%, 73% 28%, 73% 65%, 82% 65%, 82% 44%, 91% 44%, 91% 72%, 100% 72%, 100% 100%);
}

.premium-menu-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 112px;
  padding: 22px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(16, 21, 22, 0.92), rgba(10, 13, 14, 0.72));
}

.menu-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--ui-amber);
  font: 800 10px/1 var(--font-ui, Arial, sans-serif);
  letter-spacing: 2.4px;
}

.premium-menu-header h2,
.result-header h2 {
  margin: 0;
  color: var(--ui-cream);
  font: 900 clamp(32px, 4.4vw, 52px)/0.95 var(--font-display, Impact, sans-serif);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.premium-menu-header p {
  margin: 8px 0 0;
  color: var(--ui-muted);
  font: 600 13px/1.45 var(--font-ui, Arial, sans-serif);
}

.premium-menu .btn,
.collection-garage .btn {
  position: relative;
  min-height: 48px;
  border: 1px solid rgba(244, 198, 107, 0.28);
  border-radius: 10px;
  color: #fff8e8;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), transparent 45%),
    linear-gradient(180deg, #df8437, #9e3e23);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.12), 0 8px 20px rgba(0, 0, 0, 0.3);
  font: 900 13px/1 var(--font-ui, Arial, sans-serif);
  letter-spacing: 0.7px;
  transition: transform 140ms ease, border-color 140ms ease, filter 140ms ease, box-shadow 140ms ease;
}

.premium-menu .btn.secondary,
.premium-menu .btn.ghost,
.collection-garage .btn.secondary {
  color: #d9dddd;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent),
    linear-gradient(180deg, #252c2c, #101415);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.06), 0 7px 18px rgba(0, 0, 0, 0.28);
}

.premium-menu .btn.ghost {
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(8, 11, 12, 0.58);
}

.premium-menu .btn:hover,
.premium-menu .btn:focus-visible,
.collection-garage .btn:hover:not(:disabled),
.collection-garage .btn:focus-visible {
  border-color: rgba(255, 205, 116, 0.72);
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.15), 0 11px 25px rgba(0, 0, 0, 0.38), 0 0 18px rgba(225, 126, 49, 0.12);
  outline: none;
}

.premium-menu .btn:active,
.collection-garage .btn:active:not(:disabled) {
  transform: translateY(1px);
}

.premium-menu .btn:disabled,
.collection-garage .btn:disabled {
  opacity: 0.58;
  filter: saturate(0.5);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035);
}

.premium-menu-actions {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 28px max(18px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.075);
  background: rgba(7, 10, 11, 0.88);
}

.premium-menu-actions .btn {
  min-width: 150px;
}

.menu-back span {
  margin-right: 8px;
  color: var(--ui-amber);
}

/* Run Result */
.result-screen {
  width: min(1000px, calc(100vw - 32px));
}

.result-header {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  align-items: center;
  gap: 22px;
  min-height: 152px;
  padding: 24px 30px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(90deg, rgba(9, 13, 14, 0.94), rgba(22, 19, 16, 0.72)),
    radial-gradient(circle at 78% 50%, rgba(232, 139, 61, 0.17), transparent 32%);
}

.result-header p {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 0;
  color: #b4bbbb;
  font: 700 13px/1.3 var(--font-ui, Arial, sans-serif);
}

.result-header p b {
  padding: 4px 7px;
  border: 1px solid rgba(242, 198, 103, 0.46);
  border-radius: 4px;
  color: var(--ui-gold);
  font-size: 9px;
  letter-spacing: 1.2px;
}

.result-screen.victory .menu-eyebrow {
  color: #a9dc67;
}

.result-vehicle-badge {
  position: relative;
  display: grid;
  justify-items: center;
  min-height: 90px;
  border-bottom: 1px solid rgba(239, 169, 75, 0.34);
}

.result-vehicle-badge::after {
  content: "";
  position: absolute;
  right: 12%;
  bottom: 5px;
  left: 12%;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.68);
  filter: blur(7px);
}

.result-vehicle-badge img {
  z-index: 1;
  width: 190px;
  height: 76px;
  object-fit: contain;
  filter: drop-shadow(0 8px 7px rgba(0, 0, 0, 0.7));
}

.result-vehicle-badge span {
  z-index: 2;
  color: #aab0b0;
  font: 800 9px/1 var(--font-ui, Arial, sans-serif);
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.result-screen main {
  position: relative;
  z-index: 2;
  padding: 24px 30px 18px;
}

.result-screen .result-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.result-screen .result-grid article {
  position: relative;
  display: grid;
  min-height: 138px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.095);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 48%),
    rgba(9, 13, 14, 0.78);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035), 0 9px 24px rgba(0, 0, 0, 0.2);
  animation: result-card-in 280ms ease-out both;
}

.result-screen .result-grid article:nth-child(2) { animation-delay: 40ms; }
.result-screen .result-grid article:nth-child(3) { animation-delay: 80ms; }
.result-screen .result-grid article:nth-child(4) { animation-delay: 120ms; }

.result-screen .result-grid article.reward {
  border-color: rgba(235, 166, 70, 0.42);
  background: radial-gradient(circle at 85% 15%, rgba(235, 157, 61, 0.19), transparent 42%), rgba(17, 14, 10, 0.88);
}

.result-grid article > i {
  position: absolute;
  top: 12px;
  right: 13px;
  color: rgba(232, 157, 71, 0.5);
  font: normal 18px/1 Arial, sans-serif;
}

.result-grid article > span {
  align-self: start;
  color: var(--ui-muted);
  font: 800 9px/1 var(--font-ui, Arial, sans-serif);
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.result-screen .result-grid b {
  align-self: end;
  color: var(--ui-cream);
  font: 900 clamp(31px, 4vw, 45px)/0.9 var(--font-display, Impact, sans-serif);
}

.result-screen .result-grid .reward b {
  color: var(--ui-gold);
}

.result-grid article > small {
  margin-top: 8px;
  color: #687171;
  font: 800 8px/1 var(--font-ui, Arial, sans-serif);
  letter-spacing: 0.8px;
}

.result-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 12px 15px;
  border-left: 3px solid var(--ui-amber);
  color: #a8afaf;
  background: rgba(255, 255, 255, 0.025);
  font: 600 12px/1.3 var(--font-ui, Arial, sans-serif);
}

.result-summary b {
  color: var(--ui-gold);
  letter-spacing: 3px;
  white-space: nowrap;
}

.result-actions {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 1.35fr 1fr 0.7fr;
  gap: 11px;
  padding: 16px 30px max(20px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(6, 9, 10, 0.94);
}

.result-actions .result-primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding-inline: 22px;
  font-size: 17px;
}

.result-actions .result-primary span {
  font-size: 24px;
}

/* Campaign */
.campaign-screen {
  width: min(1180px, calc(100vw - 32px));
  height: min(760px, calc(100dvh - 32px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.campaign-summary {
  display: grid;
  justify-items: end;
  min-width: 110px;
  padding-left: 24px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.campaign-summary strong {
  color: var(--ui-gold);
  font: 900 34px/0.9 var(--font-display, Impact, sans-serif);
}

.campaign-summary span {
  margin-top: 6px;
  color: var(--ui-muted);
  font: 800 8px/1 var(--font-ui, Arial, sans-serif);
  letter-spacing: 1.4px;
}

.campaign-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 22px 28px;
  overflow: auto;
}

.campaign-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  min-width: 0;
  min-height: 154px;
  padding: 15px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #d9dddd;
  text-align: left;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.045), transparent 44%),
    linear-gradient(180deg, #182021, #0c1011);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035), 0 8px 20px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}

.campaign-card::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -40px;
  width: 100px;
  height: 100px;
  border: 16px solid rgba(255, 255, 255, 0.018);
  border-radius: 50%;
}

.campaign-card:hover:not(:disabled),
.campaign-card:focus-visible {
  z-index: 2;
  border-color: rgba(233, 160, 67, 0.65);
  transform: translateY(-3px);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05), 0 13px 28px rgba(0, 0, 0, 0.32), 0 0 20px rgba(224, 124, 47, 0.1);
  outline: none;
}

.campaign-card.current {
  border-color: rgba(238, 166, 71, 0.72);
  background:
    radial-gradient(circle at 90% 8%, rgba(235, 143, 50, 0.25), transparent 38%),
    linear-gradient(180deg, #25241e, #121313);
  box-shadow: inset 0 0 0 1px rgba(235, 159, 61, 0.12), 0 0 23px rgba(219, 111, 39, 0.12);
}

.campaign-card.completed {
  border-color: rgba(144, 190, 92, 0.28);
}

.campaign-card.locked {
  opacity: 1;
  color: #697071;
  border-color: rgba(255, 255, 255, 0.055);
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.012) 0 6px, transparent 6px 12px),
    #0b0e0f;
  cursor: not-allowed;
}

.campaign-index {
  color: var(--ui-gold);
  font: 900 23px/1 var(--font-display, Impact, sans-serif);
}

.campaign-card.locked .campaign-index {
  color: #555c5d;
}

.campaign-state {
  position: absolute;
  top: 17px;
  right: 14px;
  color: #889091;
  font: 800 7px/1 var(--font-ui, Arial, sans-serif);
  letter-spacing: 1px;
}

.campaign-card.current .campaign-state { color: var(--ui-amber); }
.campaign-card.completed .campaign-state { color: #9bc46b; }

.campaign-card > strong {
  align-self: end;
  margin: 16px 0 9px;
  overflow: hidden;
  color: #eef0ea;
  font: 900 16px/1.04 var(--font-display, Impact, sans-serif);
  letter-spacing: 0.35px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.campaign-card.locked > strong {
  color: #727879;
}

.campaign-stars {
  display: flex;
  gap: 3px;
  color: #394040;
  font: 12px/1 Arial, sans-serif;
}

.campaign-stars i {
  font-style: normal;
}

.campaign-stars i.earned {
  color: var(--ui-gold);
  text-shadow: 0 0 8px rgba(239, 184, 83, 0.28);
}

.campaign-progress {
  height: 4px;
  margin: 10px 0 7px;
  overflow: hidden;
  border-radius: 4px;
  background: #272d2d;
}

.campaign-progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #bf552d, var(--ui-amber));
}

.campaign-card > small {
  color: #747c7d;
  font: 800 7px/1 var(--font-ui, Arial, sans-serif);
  letter-spacing: 0.8px;
}

.campaign-card > em {
  position: absolute;
  right: 12px;
  bottom: 11px;
  color: var(--ui-gold);
  font: normal 800 7px/1 var(--font-ui, Arial, sans-serif);
  letter-spacing: 0.7px;
}

/* Settings */
.settings-screen {
  width: min(720px, calc(100vw - 32px));
}

.settings-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--ui-line);
  border-radius: 14px;
  color: var(--ui-gold);
  background: linear-gradient(145deg, #232a2a, #0e1213);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);
  font: 27px/1 Arial, sans-serif;
}

.settings-content {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 14px;
  padding: 20px 24px;
}

.settings-group {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 11px;
  background: rgba(8, 12, 13, 0.76);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

.settings-group > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.022);
}

.settings-group > header span {
  color: var(--ui-amber);
  font: 800 9px/1 var(--font-ui, Arial, sans-serif);
  letter-spacing: 1.5px;
}

.settings-group > header small {
  color: #646d6e;
  font: 600 9px/1 var(--font-ui, Arial, sans-serif);
}

.setting-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 66px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  color: #e7e9e4;
  text-align: left;
  background: transparent;
  cursor: pointer;
  transition: background 140ms ease;
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row:hover,
.setting-row:focus-visible {
  background: rgba(231, 148, 57, 0.055);
  outline: none;
}

.setting-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  color: var(--ui-gold);
  background: #171c1d;
  font: 20px/1 Arial, sans-serif;
}

.setting-copy {
  display: grid;
  gap: 5px;
}

.setting-copy b,
.settings-danger-row b {
  font: 800 13px/1 var(--font-ui, Arial, sans-serif);
}

.setting-copy small,
.settings-danger-row small {
  color: #747d7e;
  font: 600 10px/1.25 var(--font-ui, Arial, sans-serif);
}

.premium-switch {
  position: relative;
  display: grid;
  grid-template-columns: 20px 32px;
  align-items: center;
  width: 58px;
  height: 29px;
  padding: 3px;
  border: 1px solid #454d4d;
  border-radius: 999px;
  color: #767f80;
  background: #171c1d;
  transition: border-color 160ms ease, background 160ms ease;
}

.premium-switch i {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #697172;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45);
  transition: transform 180ms ease, background 180ms ease;
}

.premium-switch em {
  font: normal 800 7px/1 var(--font-ui, Arial, sans-serif);
  text-align: center;
}

.premium-switch.on {
  border-color: rgba(231, 155, 60, 0.58);
  color: #25170b;
  background: var(--ui-amber);
}

.premium-switch.on i {
  background: #fff1cf;
  transform: translateX(29px);
}

.premium-switch.on em {
  transform: translateX(-23px);
}

.setting-slider {
  display: grid;
  gap: 7px;
  padding: 11px 15px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-slider.muted {
  opacity: 0.42;
}

.setting-slider label {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.setting-slider label b {
  color: #d5dcdd;
  font: 800 11px/1 var(--font-ui, Arial, sans-serif);
  letter-spacing: 0.4px;
}

.setting-slider label span {
  color: var(--ui-amber);
  font: 800 10px/1 var(--font-ui, Arial, sans-serif);
  font-variant-numeric: tabular-nums;
}

.setting-slider input[type="range"] {
  width: 100%;
  height: 20px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.setting-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: #171c1d;
  box-shadow: inset 0 1px rgba(0, 0, 0, 0.5);
}

.setting-slider input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: #171c1d;
}

.setting-slider input[type="range"]::-webkit-slider-thumb {
  width: 17px;
  height: 17px;
  margin-top: -6px;
  border: 0;
  border-radius: 50%;
  background: var(--ui-amber);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  -webkit-appearance: none;
  appearance: none;
}

.setting-slider input[type="range"]::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border: 0;
  border-radius: 50%;
  background: var(--ui-amber);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.setting-slider input[type="range"]:focus-visible {
  outline: 2px solid rgba(231, 155, 60, 0.6);
  outline-offset: 3px;
}

.settings-danger-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 15px;
}

.settings-danger-row > div {
  display: grid;
  gap: 6px;
}

.danger-button,
.reset-confirm button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(211, 91, 71, 0.4);
  border-radius: 8px;
  color: #e79b8e;
  background: rgba(86, 28, 23, 0.28);
  font: 800 9px/1 var(--font-ui, Arial, sans-serif);
  letter-spacing: 0.7px;
  cursor: pointer;
}

.danger-button:hover,
.danger-button:focus-visible {
  border-color: #dd7563;
  color: #fff2ef;
  background: rgba(133, 42, 33, 0.5);
  outline: none;
}

.reset-confirm {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  padding: 12px 15px;
  border-top: 1px solid rgba(213, 89, 70, 0.25);
  background: rgba(81, 24, 20, 0.22);
  animation: reset-confirm-in 180ms ease-out both;
}

.reset-confirm > div {
  display: grid;
  gap: 4px;
}

.reset-confirm b {
  color: #f0d8d3;
  font: 800 11px/1 var(--font-ui, Arial, sans-serif);
}

.reset-confirm span {
  color: #aa7770;
  font: 600 9px/1 var(--font-ui, Arial, sans-serif);
}

.reset-confirm button {
  color: #aab1b1;
  border-color: rgba(255, 255, 255, 0.12);
  background: #171b1c;
}

.reset-confirm button.confirm {
  color: #fff2ef;
  border-color: rgba(225, 92, 72, 0.58);
  background: #812f26;
}

.settings-actions {
  justify-content: flex-start;
}

/* Garage refinement */
.collection-garage {
  border-radius: 16px;
  border-color: rgba(235, 170, 74, 0.28);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), 0 34px 100px rgba(0, 0, 0, 0.78);
}

.collection-topbar {
  padding-inline: 24px;
  border-bottom-color: rgba(235, 170, 74, 0.13);
  background:
    linear-gradient(180deg, rgba(24, 29, 29, 0.96), rgba(7, 10, 11, 0.94));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
}

.collection-modes button {
  grid-template-columns: 24px 1fr;
  gap: 5px;
  width: auto;
  min-width: 88px;
  height: 42px;
  padding: 0 11px;
  border-radius: 10px;
  background: linear-gradient(180deg, #202627, #101415);
}

.collection-modes button span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
}

.collection-modes button small {
  display: block;
  font-size: 8px;
  letter-spacing: 1px;
}

.collection-modes button.active span {
  border-color: rgba(31, 20, 8, 0.22);
}

.collection-settings {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(180deg, #202627, #101415);
}

.collection-money {
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    #111617;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), 0 7px 17px rgba(0, 0, 0, 0.24);
}

.collection-workshop {
  background:
    linear-gradient(180deg, rgba(8, 10, 11, 0.04) 42%, rgba(5, 7, 8, 0.92) 100%),
    radial-gradient(ellipse at 50% 23%, rgba(242, 173, 59, 0.18), transparent 39%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 118px),
    #171c1e;
}

.collection-identity {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: end;
  min-width: min(390px, 70vw);
  padding: 0 22px 9px;
}

.collection-identity::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(236, 172, 80, 0.6), transparent);
}

.collection-identity span {
  grid-column: 1 / -1;
}

.collection-identity h2 {
  justify-self: end;
  margin-right: 12px;
}

.collection-identity small {
  align-self: end;
  padding-bottom: 4px;
  color: var(--ui-gold);
  font-size: 10px;
}

.collection-spotlight {
  background: radial-gradient(ellipse, rgba(244, 192, 105, 0.24), rgba(237, 190, 113, 0.04) 58%, transparent 72%);
}

.collection-arrow {
  width: 54px;
  height: 68px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    rgba(9, 12, 13, 0.84);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), 0 9px 22px rgba(0, 0, 0, 0.28);
}

.collection-status > b {
  border-radius: 6px;
  background: rgba(5, 8, 9, 0.56);
}

.collection-actions {
  grid-template-columns: minmax(150px, 0.8fr) minmax(170px, 0.9fr) minmax(240px, 1.3fr);
  width: min(820px, calc(100% - 48px));
  padding: 12px;
  margin-bottom: max(10px, env(safe-area-inset-bottom));
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(20, 25, 25, 0.98), rgba(7, 10, 11, 0.98));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34);
}

.collection-select.is-active {
  opacity: 1;
  border-color: rgba(139, 187, 88, 0.3);
  color: #9fca70;
  background: rgba(73, 104, 46, 0.15);
}

.collection-select.is-active b {
  color: #b6db8d;
  font-size: 12px;
}

.collection-drive:not(:disabled) {
  border-color: rgba(255, 210, 124, 0.42);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.12), 0 9px 24px rgba(144, 55, 25, 0.42), 0 0 22px rgba(225, 126, 48, 0.1);
}

@keyframes premium-menu-in {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes result-card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes reset-confirm-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
  .campaign-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .result-screen .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-screen .result-grid article {
    min-height: 112px;
  }
}

@media (max-width: 600px) {
  .premium-menu,
  .result-screen,
  .campaign-screen,
  .settings-screen {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 13px;
  }

  .premium-menu-header {
    min-height: 96px;
    padding: 17px 18px;
  }

  .premium-menu-header h2,
  .result-header h2 {
    font-size: clamp(29px, 9vw, 39px);
  }

  .premium-menu-header p {
    font-size: 11px;
  }

  .campaign-summary {
    min-width: 78px;
    padding-left: 14px;
  }

  .campaign-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 14px;
  }

  .campaign-card {
    min-height: 130px;
    padding: 12px;
  }

  .campaign-card > strong {
    font-size: 14px;
  }

  .premium-menu-actions {
    padding: 12px 14px max(14px, env(safe-area-inset-bottom));
  }

  .premium-menu-actions .btn {
    min-width: 0;
    flex: 1;
  }

  .result-header {
    grid-template-columns: 1fr 112px;
    min-height: 118px;
    padding: 18px;
  }

  .result-vehicle-badge img {
    width: 110px;
    height: 54px;
  }

  .result-screen main {
    padding: 14px 16px 12px;
  }

  .result-screen .result-grid {
    gap: 8px;
  }

  .result-screen .result-grid article {
    min-height: 103px;
    padding: 12px;
  }

  .result-screen .result-grid b {
    font-size: 29px;
  }

  .result-actions {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px 16px max(15px, env(safe-area-inset-bottom));
  }

  .result-actions .result-primary {
    grid-column: 1 / -1;
    min-height: 50px;
  }

  .settings-mark {
    width: 46px;
    height: 46px;
  }

  .settings-content {
    padding: 14px;
  }

  .settings-danger-row {
    grid-template-columns: 1fr;
  }

  .danger-button {
    justify-self: start;
  }

  .reset-confirm {
    grid-template-columns: 1fr 1fr;
  }

  .reset-confirm > div {
    grid-column: 1 / -1;
  }

  .collection-modes button {
    min-width: 42px;
    width: 42px;
    padding: 0;
    grid-template-columns: 1fr;
  }

  .collection-modes button small {
    display: none;
  }

  .collection-modes button span {
    border: 0;
  }

  .collection-topbar {
    grid-template-columns: auto minmax(104px, 1fr) auto;
  }

  .collection-modes {
    grid-column: 1;
  }

  .collection-money {
    grid-column: 2;
    justify-self: center;
  }

  .collection-settings {
    grid-column: 3;
  }

  .collection-workshop {
    width: 100%;
  }

  .collection-heading {
    width: 100%;
  }

  .collection-identity {
    width: min(310px, 100%);
    min-width: 0;
    padding-inline: 10px;
  }

  .collection-identity h2 {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .vehicle-carousel-stage {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    width: 100%;
  }

  .collection-arrow.left {
    grid-column: 1;
  }

  .collection-vehicle-frame {
    grid-column: 2;
    width: 100%;
    max-width: calc(100vw - 128px);
  }

  .collection-arrow.right {
    grid-column: 3;
  }

  .collection-actions {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: calc(100% - 20px);
    padding: 8px;
  }

  .collection-drive {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .premium-menu,
  .result-screen,
  .campaign-screen,
  .settings-screen {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 12px);
  }

  .premium-menu-header {
    min-height: 62px;
    padding: 10px 18px;
  }

  .premium-menu-header h2,
  .result-header h2 {
    font-size: 29px;
  }

  .premium-menu-header p {
    display: none;
  }

  .campaign-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
    padding: 10px 16px;
  }

  .campaign-card {
    min-height: 106px;
    padding: 10px;
  }

  .campaign-card > strong {
    margin: 8px 0 5px;
    font-size: 12px;
  }

  .campaign-progress {
    margin: 6px 0 5px;
  }

  .premium-menu-actions {
    padding: 7px 16px max(8px, env(safe-area-inset-bottom));
  }

  .premium-menu-actions .btn {
    min-height: 38px;
  }

  .result-header {
    grid-template-columns: 1fr 145px;
    min-height: 70px;
    padding: 9px 18px;
  }

  .result-header p {
    margin-top: 5px;
  }

  .result-vehicle-badge {
    min-height: 54px;
  }

  .result-vehicle-badge img {
    width: 135px;
    height: 43px;
  }

  .result-screen main {
    padding: 10px 18px 8px;
  }

  .result-screen .result-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }

  .result-screen .result-grid article {
    min-height: 84px;
    padding: 10px;
  }

  .result-screen .result-grid b {
    font-size: 25px;
  }

  .result-grid article > small,
  .result-grid article > i {
    display: none;
  }

  .result-summary {
    margin-top: 7px;
    padding: 7px 10px;
  }

  .result-actions {
    padding: 8px 18px max(9px, env(safe-area-inset-bottom));
  }

  .result-actions .result-primary,
  .result-actions .btn {
    min-height: 40px;
  }

  .settings-content {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px 16px;
  }

  .setting-row {
    min-height: 55px;
  }

  .settings-danger-row {
    padding: 10px;
  }

  .settings-group > header {
    padding: 8px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .premium-menu,
  .result-screen .result-grid article,
  .reset-confirm {
    animation: none;
  }
}

/* Landscape-first premium Home composition */
.orientation-guard {
  display: none;
}

#overlay:has(.home-command) {
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

.screen.home-screen.home-command {
  --home-logo: clamp(27px, 2.45vw, 47px);
  --home-rampage: clamp(20px, 1.86vw, 35px);
  --home-button: clamp(16px, 1.22vw, 22px);
  --home-body: clamp(12px, 0.94vw, 16px);
  --home-small: clamp(8px, 0.62vw, 11px);
  width: min(1560px, calc(100vw - 32px));
  height: min(860px, calc(100dvh - 32px));
  min-height: min(620px, calc(100dvh - 32px));
  grid-template-rows: clamp(62px, 9dvh, 86px) minmax(0, 1fr);
  border-color: rgba(235, 174, 78, 0.25);
  border-radius: clamp(12px, 1vw, 18px);
  background: #090c0d;
}

.home-topbar {
  min-height: 0;
  padding:
    clamp(8px, 1.1dvh, 13px)
    clamp(13px, 1.6vw, 25px);
  gap: clamp(10px, 2vw, 24px);
  background: linear-gradient(180deg, rgba(5, 8, 9, 0.92), rgba(7, 10, 10, 0.54));
}

.home-brand h1 {
  gap: clamp(5px, 0.55vw, 10px);
}

.home-brand h1 span {
  font-size: var(--home-logo);
}

.home-brand h1 strong {
  font-size: var(--home-rampage);
}

.home-account {
  gap: clamp(6px, 0.7vw, 10px);
}

.home-currency,
.home-settings {
  min-height: clamp(40px, 5.4dvh, 52px);
}

.home-currency {
  min-width: clamp(96px, 8.4vw, 132px);
  padding-inline: clamp(8px, 0.9vw, 14px);
}

.home-currency > i {
  width: clamp(23px, 2vw, 30px);
  height: clamp(23px, 2vw, 30px);
}

.home-currency b {
  font-size: clamp(16px, 1.35vw, 21px);
}

.home-settings {
  min-width: clamp(44px, 6.4vw, 96px);
}

.home-layout {
  grid-template-columns: minmax(0, 3fr) minmax(232px, 1fr);
  gap: clamp(12px, 1.5vw, 24px);
  padding: clamp(12px, 1.45vw, 24px);
  overflow: hidden;
}

.home-hero {
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.home-copy-kicker {
  font-size: var(--home-small);
}

.home-copy p {
  font-size: var(--home-body);
}

.home-vehicle-stage {
  min-height: 0;
  overflow: hidden;
  contain: layout paint;
}

.home-vehicle-stage img {
  width: min(980px, 52vw, 94%);
  max-height: min(41dvh, 430px);
}

.home-vehicle-floor {
  left: 12%;
  right: 8%;
  bottom: 12%;
  height: clamp(18px, 3dvh, 34px);
}

.home-ride-tag {
  left: 2%;
  bottom: 9%;
  padding: clamp(5px, 0.7vw, 9px) clamp(8px, 0.9vw, 13px);
}

.home-ride-tag b {
  font-size: clamp(16px, 1.55vw, 24px);
}

.home-menu {
  grid-template-columns: minmax(230px, 1.05fr) minmax(270px, 1fr);
  gap: clamp(8px, 0.8vw, 12px);
}

.home-play {
  min-height: clamp(68px, 9.5dvh, 94px);
  border-radius: 11px;
}

.home-play::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 -35%;
  width: 28%;
  pointer-events: none;
  transform: skewX(-18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 244, 207, 0.13), transparent);
  animation: homePlayShine 5.5s ease-in-out infinite;
}

.home-play b {
  font-size: clamp(34px, 3.35vw, 56px);
}

.home-secondary-actions {
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(233, 217, 171, 0.2);
  border-radius: 10px;
  background: rgba(238, 178, 89, 0.12);
}

.home-secondary-actions button {
  min-height: clamp(68px, 9.5dvh, 94px);
  border: 0;
  border-radius: 0;
  background: linear-gradient(180deg, rgba(41, 46, 44, 0.88), rgba(13, 16, 16, 0.95));
}

.home-secondary-actions button + button {
  border-left: 1px solid rgba(233, 217, 171, 0.14);
}

.home-secondary-actions b {
  font-size: var(--home-button);
}

.home-progress {
  align-self: end;
  width: 100%;
  padding: clamp(12px, 1.15vw, 18px);
  border-color: rgba(232, 206, 144, 0.13);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(16, 20, 20, 0.8), rgba(7, 9, 9, 0.88));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035), 0 18px 44px rgba(0, 0, 0, 0.3);
}

.home-progress-heading {
  margin-bottom: clamp(9px, 1.2dvh, 15px);
}

.home-loadout {
  padding-bottom: clamp(8px, 1.2dvh, 13px);
}

.home-loadout strong {
  font-size: clamp(22px, 2vw, 30px);
}

.home-road-status {
  display: grid;
  gap: 3px;
  padding: clamp(8px, 1.1dvh, 12px) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.065);
  font-family: Arial, sans-serif;
}

.home-road-status small {
  color: #858b82;
  font-size: var(--home-small);
  font-weight: 900;
  letter-spacing: 0.12em;
}

.home-road-status strong {
  overflow: hidden;
  color: #d9ceb6;
  font-size: clamp(12px, 1vw, 15px);
  text-transform: uppercase;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.home-level-progress {
  padding: clamp(9px, 1.3dvh, 14px) 0;
}

.home-progress-grid > div {
  padding: clamp(7px, 0.75vw, 10px);
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0;
  background: transparent;
}

.home-loadout-link {
  margin-top: clamp(7px, 1dvh, 11px);
}

@keyframes homePlayShine {
  0%, 70%, 100% { transform: translateX(0) skewX(-18deg); opacity: 0; }
  78% { opacity: 1; }
  94% { transform: translateX(520%) skewX(-18deg); opacity: 0; }
}

@media (max-width: 1100px) and (min-height: 501px) {
  .screen.home-screen.home-command {
    grid-template-rows: clamp(60px, 9dvh, 72px) minmax(0, 1fr);
  }

  .home-layout {
    grid-template-columns: minmax(0, 1fr) clamp(220px, 25vw, 260px);
  }

  .home-vehicle-stage img {
    width: min(52vw, 94%);
    max-height: 35dvh;
    transform: translate(var(--vehicle-x), var(--vehicle-y)) scale(calc(var(--vehicle-scale) * 0.94));
  }

  .home-secondary-actions small {
    display: none;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  #overlay:has(.home-command) {
    padding:
      max(5px, env(safe-area-inset-top))
      max(7px, env(safe-area-inset-right))
      max(5px, env(safe-area-inset-bottom))
      max(7px, env(safe-area-inset-left));
  }

  .screen.home-screen.home-command {
    --home-logo: clamp(20px, 3.35vw, 28px);
    --home-rampage: clamp(15px, 2.45vw, 21px);
    --home-button: clamp(13px, 1.9vw, 17px);
    --home-body: clamp(10px, 1.35vw, 12px);
    --home-small: clamp(8px, 1.1vw, 9px);
    width: 100%;
    height: calc(100dvh - 10px);
    min-height: 0;
    max-height: calc(100dvh - 10px);
    grid-template-rows: clamp(46px, 13dvh, 54px) minmax(0, 1fr);
    border-radius: 9px;
  }

  .home-topbar {
    padding:
      max(5px, env(safe-area-inset-top))
      max(9px, env(safe-area-inset-right))
      5px
      max(11px, env(safe-area-inset-left));
  }

  .home-brand-kicker,
  .home-settings b,
  .home-currency small {
    display: none;
  }

  .home-currency,
  .home-settings {
    min-height: 34px;
  }

  .home-currency {
    min-width: clamp(72px, 12vw, 92px);
    padding: 3px 7px;
    gap: 6px;
  }

  .home-currency > i {
    width: 20px;
    height: 20px;
  }

  .home-currency b {
    font-size: clamp(14px, 2.2vw, 17px);
  }

  .home-settings {
    min-width: 36px;
    padding: 0;
  }

  .home-settings span {
    font-size: 18px;
  }

  .home-layout {
    grid-template-columns: minmax(0, 1fr) clamp(156px, 24vw, 210px);
    gap: clamp(7px, 1.2vw, 12px);
    padding: clamp(6px, 1.2dvh, 9px) clamp(7px, 1.25vw, 12px);
    overflow: hidden;
  }

  .home-hero {
    grid-template-rows: clamp(20px, 6dvh, 27px) minmax(0, 1fr) 52px;
  }

  .home-copy {
    padding-left: 1px;
  }

  .home-copy p {
    margin-top: 1px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .home-vehicle-stage {
    min-height: 0;
  }

  .home-vehicle-stage img {
    width: min(44vw, 94%);
    max-height: min(38dvh, 148px);
    transform: translate(var(--vehicle-x), var(--vehicle-y)) scale(calc(var(--vehicle-scale) * 0.9));
  }

  .home-vehicle-floor {
    left: 8%;
    right: 6%;
    bottom: 10%;
    height: 18px;
  }

  .home-vehicle-glow {
    width: 66%;
    height: 58%;
  }

  .home-dust {
    bottom: 10%;
    opacity: 0.22;
  }

  .home-ride-tag {
    left: 1%;
    bottom: 5%;
    padding: 3px 6px;
  }

  .home-ride-tag small {
    display: none;
  }

  .home-ride-tag b {
    font-size: clamp(12px, 1.9vw, 16px);
  }

  .home-menu {
    grid-template-columns: minmax(150px, 0.9fr) minmax(190px, 1.1fr);
    gap: 6px;
  }

  .home-play,
  .home-secondary-actions button {
    min-height: 52px;
    height: 52px;
  }

  .home-play {
    padding: 5px 9px 5px 12px;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.25), 0 3px 0 #45140f, 0 9px 18px rgba(0, 0, 0, 0.38);
  }

  .home-play b {
    font-size: clamp(22px, 3.2vw, 28px);
  }

  .home-play small {
    font-size: 8px;
  }

  .home-play > i {
    width: 29px;
    height: 29px;
    font-size: 16px;
  }

  .home-secondary-actions {
    gap: 1px;
  }

  .home-secondary-actions button {
    justify-content: center;
    padding: 4px;
    gap: 4px;
  }

  .home-secondary-actions i {
    flex-basis: 19px;
    font-size: 18px;
  }

  .home-secondary-actions small {
    display: none;
  }

  .home-progress {
    align-self: stretch;
    display: grid;
    align-content: start;
    padding: clamp(7px, 1.5dvh, 10px);
    overflow: hidden;
    backdrop-filter: blur(8px);
  }

  .home-progress-heading {
    margin-bottom: 5px;
  }

  .home-progress-heading i {
    width: 27px;
    height: 21px;
    font-size: 10px;
  }

  .home-loadout {
    padding-bottom: 5px;
  }

  .home-loadout strong {
    margin-top: 2px;
    font-size: clamp(17px, 2.8vw, 22px);
  }

  .home-loadout span {
    display: none;
  }

  .home-road-status {
    gap: 1px;
    padding: 5px 0;
  }

  .home-road-status strong {
    font-size: clamp(9px, 1.45vw, 11px);
  }

  .home-level-progress {
    padding: 5px 0;
  }

  .home-level-progress b {
    font-size: 16px;
  }

  .home-level-progress > i {
    height: 3px;
    margin-top: 4px;
  }

  .home-progress-grid {
    gap: 2px;
  }

  .home-progress-grid > div {
    padding: 4px;
  }

  .home-progress-grid b {
    margin-top: 1px;
    font-size: 16px;
  }

  .home-loadout-link {
    min-height: 25px;
    margin-top: 5px;
    padding-inline: 6px;
    font-size: 8px;
  }

  .home-ruins-front {
    bottom: 21%;
  }

  .home-road {
    bottom: -14%;
  }

  .hud-top {
    top: max(5px, env(safe-area-inset-top));
    left: max(7px, env(safe-area-inset-left));
    right: max(7px, env(safe-area-inset-right));
    grid-template-columns: minmax(60px, 92px) minmax(150px, 42vw) 34px;
    gap: 6px;
  }

  .progress-wrap {
    height: 11px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .touch-controls {
    /* Phone landscape: keep the 44px tap floor but give the road back its screen. */
    --pad-height: clamp(44px, 12.5dvh, 50px);
    --pad-width: clamp(60px, 9vw, 74px);
    --pad-icon: clamp(15px, 2vw, 18px);
    --pad-label: clamp(7px, 1vw, 8px);
    --pad-gap: clamp(5px, 0.9vw, 8px);
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    bottom: max(7px, env(safe-area-inset-bottom));
    gap: 10px;
  }

  .touch-btn {
    border-radius: 10px;
    opacity: 0.92;
  }

  .gauge-cluster,
  .hud .gauge-cluster {
    top: max(48px, calc(env(safe-area-inset-top) + 45px));
    bottom: auto;
    gap: 2px;
    padding: 3px 5px;
  }

  .gauge {
    width: 48px;
    height: 43px;
  }

  .speed-gauge {
    width: 58px;
    height: 49px;
  }

  .gauge canvas {
    width: 48px;
    height: 48px;
  }

  .speed-gauge canvas {
    width: 58px;
    height: 58px;
  }

  .gauge span {
    font-size: 7px;
  }

  .gauge b {
    font-size: 12px;
  }
}

@media (max-height: 399px) and (orientation: landscape) {
  .home-copy p,
  .home-progress-heading span {
    display: none;
  }

  .home-hero {
    grid-template-rows: 14px minmax(0, 1fr) 52px;
  }

  .home-vehicle-stage img {
    width: min(42vw, 92%);
    max-height: 34dvh;
  }

  .home-play,
  .home-secondary-actions button {
    min-height: 46px;
    height: 46px;
  }

  .home-progress {
    padding: 6px 8px;
  }

  .home-progress-heading {
    min-height: 21px;
    margin-bottom: 2px;
    justify-content: flex-end;
  }

  .home-loadout {
    padding-bottom: 3px;
  }

  .home-road-status,
  .home-level-progress {
    padding: 3px 0;
  }

  .home-progress-grid > div {
    padding-block: 2px;
  }

  .home-loadout-link {
    min-height: 23px;
    margin-top: 3px;
  }
}

@media (max-width: 760px) and (orientation: portrait) {
  .orientation-guard {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    grid-template-rows: auto auto auto auto;
    place-content: center;
    justify-items: center;
    gap: clamp(9px, 2.2dvh, 17px);
    padding:
      max(24px, env(safe-area-inset-top))
      max(22px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(22px, env(safe-area-inset-left));
    text-align: center;
    background:
      linear-gradient(180deg, rgba(4, 7, 9, 0.25), rgba(5, 6, 6, 0.9)),
      radial-gradient(ellipse at 50% 57%, rgba(224, 99, 39, 0.38), transparent 37%),
      linear-gradient(145deg, #071017, #29150f 72%, #070909);
  }

  .orientation-guard::before {
    content: "";
    position: absolute;
    inset: 58% -10% -12%;
    border-top: 2px solid rgba(218, 139, 66, 0.24);
    transform: rotate(-4deg);
    background: linear-gradient(180deg, #171512, #070808);
  }

  .orientation-guard > * {
    position: relative;
  }

  .orientation-brand {
    display: grid;
    line-height: 0.86;
    text-transform: uppercase;
    filter: drop-shadow(0 6px 12px #000);
  }

  .orientation-brand span {
    color: #f1e7ca;
    font-size: clamp(28px, 8vw, 44px);
  }

  .orientation-brand strong {
    color: #e56831;
    font-size: clamp(22px, 6.2vw, 34px);
    text-shadow: 0 2px #6c2118;
  }

  .orientation-phone {
    width: 54px;
    height: 88px;
    margin: clamp(9px, 2dvh, 17px) 0;
    border: 3px solid #e6d6ae;
    border-radius: 9px;
    transform: rotate(90deg);
    animation: orientationTurn 2.4s ease-in-out infinite;
    box-shadow: 0 0 28px rgba(229, 104, 49, 0.2);
  }

  .orientation-phone i {
    position: absolute;
    left: 50%;
    bottom: 5px;
    width: 13px;
    height: 3px;
    border-radius: 3px;
    background: #e56831;
    transform: translateX(-50%);
  }

  .orientation-guard h2 {
    margin: 0;
    color: #f1e7ca;
    font-size: clamp(25px, 7vw, 36px);
    text-transform: uppercase;
  }

  .orientation-guard p {
    margin: 0;
    color: #bdb39d;
    font: 700 clamp(13px, 3.7vw, 17px)/1.4 Arial, sans-serif;
  }
}

@keyframes orientationTurn {
  0%, 18% { transform: rotate(0deg); }
  46%, 100% { transform: rotate(90deg); }
}

@media (prefers-reduced-motion: reduce) {
  .home-play::after,
  .orientation-phone {
    animation: none;
  }
}

/* Mission intro and countdown popups only */
#overlay:has(.mission-intro-popup),
#overlay:has(.stage-reveal-popup) {
  background: radial-gradient(circle at 50% 50%, rgba(225, 119, 44, 0.07), rgba(2, 4, 5, 0.38) 52%, rgba(2, 4, 5, 0.6));
}

.mission-intro-popup,
.stage-reveal-popup {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid rgba(238, 180, 82, 0.34);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px) 0 0 / 54px 54px,
    radial-gradient(circle at 86% 8%, rgba(231, 125, 48, 0.16), transparent 36%),
    linear-gradient(145deg, rgba(26, 31, 31, 0.98), rgba(7, 10, 11, 0.99) 66%);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.055),
    inset 0 0 54px rgba(0, 0, 0, 0.28),
    0 28px 78px rgba(0, 0, 0, 0.72),
    0 0 28px rgba(218, 117, 42, 0.07);
  animation: missionPopupIn 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.mission-intro-popup::before,
.stage-reveal-popup::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  left: 9%;
  width: 42%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #e89940, #f0c46d, transparent);
  box-shadow: 0 0 15px rgba(231, 139, 57, 0.4);
}

.mission-intro-popup::after,
.stage-reveal-popup::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -12%;
  bottom: -38%;
  width: 54%;
  height: 72%;
  border: 1px solid rgba(232, 147, 61, 0.09);
  transform: rotate(-12deg);
  background: repeating-linear-gradient(90deg, transparent 0 24px, rgba(255, 255, 255, 0.018) 24px 25px);
}

.mission-intro-popup {
  width: min(780px, calc(100vw - 32px));
  padding: 0;
  border-radius: 14px;
}

.mission-intro-header {
  display: grid;
  gap: 10px;
  padding: clamp(24px, 4vw, 38px) clamp(24px, 5vw, 46px) 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
  background: linear-gradient(180deg, rgba(19, 24, 24, 0.78), rgba(9, 12, 13, 0.38));
}

.mission-eyebrow {
  color: #e99a43;
  font: 900 10px/1 var(--font-ui, Arial, sans-serif);
  letter-spacing: 2px;
}

.mission-intro-header h2 {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: clamp(13px, 2vw, 22px);
  margin: 0;
  text-transform: uppercase;
}

.mission-intro-header h2 > span {
  color: #e98a39;
  font: 900 clamp(46px, 8vw, 74px)/0.82 var(--font-display, Impact, sans-serif);
  text-shadow: 0 3px 0 #68271a, 0 0 18px rgba(229, 112, 43, 0.16);
}

.mission-intro-header h2 > strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #f4edda;
  font: 900 clamp(33px, 5.4vw, 56px)/0.92 var(--font-display, Impact, sans-serif);
  letter-spacing: 0;
}

.mission-objective {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  padding: 20px clamp(24px, 5vw, 46px);
  background: rgba(5, 8, 9, 0.42);
}

.mission-objective > span {
  padding-top: 2px;
  color: #f0b25c;
  font: 900 9px/1 var(--font-ui, Arial, sans-serif);
  letter-spacing: 1.5px;
}

.mission-objective p {
  margin: 0;
  color: #aeb5b5;
  font: 600 13px/1.48 var(--font-ui, Arial, sans-serif);
}

.mission-objective em {
  /* Last column whether the briefing is two-column or stacked on short phones. */
  grid-column: -2 / -1;
  margin-top: 9px;
  padding: 6px 10px;
  border-left: 2px solid rgba(240, 178, 92, 0.6);
  border-radius: 0 5px 5px 0;
  display: block;
  color: #e7c68d;
  background: rgba(240, 178, 92, 0.09);
  font: 700 11px/1.4 var(--font-ui, Arial, sans-serif);
  font-style: normal;
}

.mission-actions {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) minmax(120px, 0.72fr) minmax(120px, 0.72fr);
  gap: 10px;
  padding: 17px clamp(24px, 5vw, 46px) max(21px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(6, 9, 10, 0.84);
}

.mission-actions button {
  position: relative;
  min-width: 0;
  min-height: 52px;
  padding: 0 17px;
  border: 1px solid rgba(240, 193, 104, 0.24);
  border-radius: 9px;
  cursor: pointer;
  color: #d9dddd;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 44%),
    linear-gradient(180deg, #252c2c, #101415);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.055), 0 7px 18px rgba(0, 0, 0, 0.3);
  font: 900 12px/1 var(--font-ui, Arial, sans-serif);
  letter-spacing: 0.7px;
  transition: transform 150ms ease, filter 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.mission-actions .mission-start {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-color: rgba(255, 222, 154, 0.6);
  color: #fff6e0;
  background:
    linear-gradient(115deg, rgba(255, 225, 158, 0.16), transparent 38%),
    linear-gradient(180deg, #e78235, #a53e22 72%, #7b281b);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.23), 0 5px 0 #4d1c14, 0 13px 28px rgba(0, 0, 0, 0.36);
  font-size: 14px;
}

.mission-start i {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(69, 23, 15, 0.28);
  font: normal 18px/1 Arial, sans-serif;
  transition: transform 150ms ease;
}

.mission-actions button:hover,
.mission-actions button:focus-visible {
  border-color: rgba(255, 205, 116, 0.72);
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.12), 0 10px 23px rgba(0, 0, 0, 0.36), 0 0 16px rgba(225, 126, 49, 0.1);
  outline: none;
}

.mission-actions .mission-start:hover,
.mission-actions .mission-start:focus-visible {
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.26), 0 7px 0 #4d1c14, 0 17px 31px rgba(0, 0, 0, 0.4), 0 0 19px rgba(225, 126, 49, 0.14);
}

.mission-start:hover i,
.mission-start:focus-visible i {
  transform: translateX(2px);
}

.mission-actions button:active {
  transform: translateY(1px) scale(0.98);
}

.stage-reveal-popup {
  width: min(430px, calc(100vw - 32px));
  min-height: 390px;
  padding: 31px 32px 29px;
  border-radius: 14px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  justify-items: center;
  align-items: center;
  text-align: center;
}

.stage-reveal-kicker,
.stage-reveal-road,
.stage-reveal-status {
  font-family: var(--font-ui, Arial, sans-serif);
  font-weight: 900;
  letter-spacing: 2px;
}

.stage-reveal-kicker {
  color: #798182;
  font-size: 9px;
}

.stage-reveal-road {
  margin-top: 9px;
  padding: 6px 10px;
  border: 1px solid rgba(232, 154, 67, 0.3);
  border-radius: 4px;
  color: #e8a557;
  background: rgba(154, 69, 27, 0.1);
  font-size: 10px;
}

.stage-reveal-popup h1 {
  align-self: stretch;
  display: grid;
  place-items: center;
  min-width: 0;
  margin: 6px 0 2px;
  color: #f5edda;
  font: 900 clamp(112px, 25vw, 176px)/0.82 var(--font-display, Impact, sans-serif);
  letter-spacing: 0;
  text-shadow: 0 5px 0 #6f281a, 0 0 25px rgba(229, 111, 42, 0.19);
  animation: stageNumberIn 380ms 70ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.stage-reveal-popup > strong {
  max-width: 100%;
  overflow: hidden;
  color: #e9deca;
  font: 900 clamp(22px, 5vw, 30px)/1 var(--font-display, Impact, sans-serif);
  letter-spacing: 0;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.stage-reveal-status {
  position: relative;
  width: 100%;
  margin-top: 17px;
  padding-top: 14px;
  color: #747c7d;
  font-size: 8px;
}

.stage-reveal-status::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  width: 76%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(235, 167, 78, 0.48), transparent);
}

@keyframes missionPopupIn {
  from { opacity: 0; transform: translateY(10px) scale(0.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes stageNumberIn {
  from { opacity: 0; transform: translateY(7px) scale(0.965); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-height: 500px) and (orientation: landscape) {
  .mission-intro-popup {
    width: min(720px, calc(100vw - 24px));
    max-height: calc(100dvh - 18px);
    border-radius: 10px;
  }

  .mission-intro-header {
    gap: 5px;
    padding: 15px 24px 11px;
  }

  .mission-eyebrow { font-size: 8px; }
  .mission-intro-header h2 > span { font-size: clamp(38px, 7vw, 55px); }
  .mission-intro-header h2 > strong { font-size: clamp(29px, 5vw, 43px); }

  .mission-objective {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 11px;
    padding: 12px 24px;
  }

  .mission-objective p { font-size: 11px; }

  .mission-actions {
    grid-template-columns: minmax(190px, 1.3fr) minmax(105px, 0.7fr) minmax(105px, 0.7fr);
    gap: 8px;
    padding: 11px 24px 15px;
  }

  .mission-actions button { min-height: 44px; }

  .stage-reveal-popup {
    width: min(400px, calc(100vw - 24px));
    min-height: 0;
    max-height: calc(100dvh - 18px);
    padding: 17px 28px 16px;
    grid-template-rows: auto auto minmax(100px, 1fr) auto auto;
    border-radius: 10px;
  }

  .stage-reveal-road { margin-top: 5px; padding-block: 4px; }
  .stage-reveal-popup h1 { margin: 1px 0; font-size: clamp(94px, 26dvh, 128px); }
  .stage-reveal-popup > strong { font-size: clamp(20px, 4vw, 27px); }
  .stage-reveal-status { margin-top: 9px; padding-top: 9px; }
}

@media (max-width: 560px) {
  .mission-intro-header h2 {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .mission-objective {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .mission-actions {
    grid-template-columns: 1fr 1fr;
  }

  .mission-actions .mission-start {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mission-intro-popup,
  .stage-reveal-popup,
  .stage-reveal-popup h1 {
    animation: none;
  }
}

/* Dedicated short-height phone Home layout */
@media (max-width: 980px) and (max-height: 500px) and (orientation: landscape) {
  #overlay:has(.home-command) {
    padding:
      max(4px, env(safe-area-inset-top))
      max(6px, env(safe-area-inset-right))
      max(4px, env(safe-area-inset-bottom))
      max(6px, env(safe-area-inset-left));
  }

  .screen.home-screen.home-command {
    --home-logo: clamp(18px, 2.9vw, 24px);
    --home-rampage: clamp(13px, 2.15vw, 18px);
    --home-button: clamp(10px, 1.5vw, 13px);
    --home-body: clamp(9px, 1.2vw, 11px);
    --home-small: clamp(7px, 0.95vw, 8px);
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    grid-template-rows: clamp(40px, 12dvh, 48px) minmax(0, 1fr);
    border-radius: clamp(7px, 1.3dvh, 9px);
  }

  .home-topbar {
    padding:
      max(3px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      3px
      max(10px, env(safe-area-inset-left));
    gap: 8px;
  }

  .home-brand h1 {
    gap: clamp(3px, 0.55vw, 5px);
  }

  .home-currency,
  .home-settings {
    min-height: clamp(31px, 9.5dvh, 35px);
  }

  .home-currency {
    min-width: clamp(68px, 11vw, 88px);
    padding: 3px 7px;
    gap: 5px;
  }

  .home-currency > i {
    width: clamp(18px, 5.5dvh, 21px);
    height: clamp(18px, 5.5dvh, 21px);
  }

  .home-currency b {
    font-size: clamp(13px, 2vw, 16px);
  }

  .home-settings {
    min-width: clamp(32px, 9.5dvh, 36px);
  }

  .home-settings span {
    font-size: clamp(15px, 4.8dvh, 18px);
  }

  .home-layout {
    grid-template-columns: minmax(0, 1fr) clamp(176px, 24vw, 216px);
    gap: clamp(6px, 1vw, 10px);
    padding:
      clamp(5px, 1.4dvh, 7px)
      max(clamp(7px, 1.1vw, 10px), env(safe-area-inset-right))
      clamp(5px, 1.4dvh, 7px)
      max(clamp(7px, 1.1vw, 10px), env(safe-area-inset-left));
  }

  .home-hero {
    grid-template-rows: clamp(17px, 5.8dvh, 25px) minmax(0, 1fr) clamp(44px, 12.2dvh, 50px);
  }

  .home-copy-kicker {
    font-size: var(--home-small);
  }

  .home-copy p {
    margin-top: 1px;
    font-size: var(--home-body);
    line-height: 1.12;
  }

  .home-vehicle-stage img {
    width: min(42vw, 92%);
    max-height: min(34dvh, 146px);
    transform: translate(var(--vehicle-x), var(--vehicle-y)) scale(calc(var(--vehicle-scale) * 0.88));
  }

  .home-vehicle-floor {
    height: clamp(14px, 4.6dvh, 18px);
  }

  .home-ride-tag {
    padding: 2px 5px;
  }

  .home-ride-tag b {
    font-size: clamp(11px, 1.65vw, 14px);
  }

  .home-menu {
    grid-template-columns: minmax(142px, 0.92fr) minmax(184px, 1.08fr);
    gap: clamp(4px, 0.75vw, 6px);
  }

  /* Play and the secondary pair share one height so the row reads as a single system. */
  .home-play,
  .home-secondary-actions button {
    min-height: clamp(44px, 12.2dvh, 50px);
    height: clamp(44px, 12.2dvh, 50px);
  }

  .home-play {
    padding: 4px 8px 4px 11px;
    border-radius: 8px;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.24), 0 3px 0 #45140f, 0 8px 16px rgba(0, 0, 0, 0.36);
  }

  .home-play b {
    font-size: clamp(19px, 2.9vw, 24px);
  }

  .home-play small {
    font-size: clamp(6px, 0.95vw, 8px);
  }

  .home-play > i {
    width: clamp(24px, 7dvh, 28px);
    height: clamp(24px, 7dvh, 28px);
    font-size: clamp(13px, 4dvh, 15px);
  }

  .home-secondary-actions {
    border-radius: 8px;
  }

  .home-secondary-actions button {
    justify-content: center;
    padding: 3px 5px;
    gap: 5px;
  }

  .home-secondary-actions i {
    flex-basis: clamp(14px, 4.2dvh, 17px);
    font-size: clamp(13px, 4.2dvh, 16px);
  }

  .home-secondary-actions b {
    font-size: var(--home-button);
  }

  .home-progress {
    align-self: center;
    display: grid;
    align-content: start;
    max-height: 100%;
    padding: clamp(5px, 1.5dvh, 7px) 8px;
    overflow: hidden;
    border-radius: 8px;
    backdrop-filter: blur(7px);
  }

  .home-progress-heading {
    min-height: clamp(18px, 5.8dvh, 22px);
    margin-bottom: 2px;
  }

  .home-progress-heading span {
    display: block;
    font-size: var(--home-small);
  }

  .home-progress-heading i {
    width: clamp(24px, 7.2dvh, 28px);
    height: clamp(19px, 5.8dvh, 22px);
    font-size: 9px;
  }

  .home-loadout {
    padding-bottom: clamp(3px, 1dvh, 5px);
  }

  .home-loadout small,
  .home-level-progress span,
  .home-progress-grid small,
  .home-road-status small {
    font-size: var(--home-small);
  }

  .home-loadout strong {
    margin-top: 1px;
    font-size: clamp(15px, 2.45vw, 19px);
  }

  .home-road-status {
    gap: 1px;
    padding: clamp(3px, 1dvh, 5px) 0;
  }

  .home-road-status strong {
    font-size: clamp(8px, 1.25vw, 10px);
  }

  .home-level-progress {
    padding: clamp(3px, 1dvh, 5px) 0;
  }

  .home-level-progress b {
    font-size: clamp(13px, 2vw, 16px);
  }

  .home-level-progress > i {
    height: 3px;
    margin-top: 3px;
  }

  .home-progress-grid {
    gap: 2px;
  }

  .home-progress-grid > div {
    padding: clamp(2px, 0.8dvh, 4px);
  }

  .home-progress-grid b {
    margin-top: 1px;
    font-size: clamp(13px, 2vw, 16px);
  }

  .home-loadout-link {
    min-height: clamp(26px, 7.4dvh, 30px);
    margin-top: clamp(4px, 1.2dvh, 7px);
    padding-inline: 8px;
    border-radius: 7px;
    font-size: clamp(7px, 1vw, 8px);
  }
}

/* ===================================================================
   Home entrance, ambience and the first-time guide.
   Motion here is CSS only and lives entirely inside .home-command, so
   replacing the overlay markup on the way into a run ends all of it.
   =================================================================== */

/* --- staggered entrance ------------------------------------------- */
/* `backwards` rather than `both`: the element is hidden through its delay but
   reverts to its normal styles afterwards, so hover transforms still work. */
.home-enter .home-atmosphere { animation: homeFadeIn 0.52s ease-out backwards; }
.home-enter .home-brand { animation: homeRiseIn 0.34s 0.09s cubic-bezier(0.22, 0.7, 0.25, 1) backwards; }
.home-enter .home-account { animation: homeRiseIn 0.32s 0.15s cubic-bezier(0.22, 0.7, 0.25, 1) backwards; }
.home-enter .home-copy { animation: homeSlideIn 0.3s 0.21s cubic-bezier(0.22, 0.7, 0.25, 1) backwards; }
.home-enter .home-vehicle-stage img { animation: homeVehicleArrival 0.52s 0.3s cubic-bezier(0.2, 0.85, 0.25, 1) backwards; }
.home-enter .home-progress { animation: homeSlideIn 0.32s 0.47s cubic-bezier(0.22, 0.7, 0.25, 1) backwards; }
.home-enter .home-play { animation: homeRiseIn 0.3s 0.56s cubic-bezier(0.22, 0.7, 0.25, 1) backwards; }
.home-enter .home-secondary-actions { animation: homeRiseIn 0.3s 0.66s cubic-bezier(0.22, 0.7, 0.25, 1) backwards; }

/* The orange accent wipes across the logo just after it lands. */
.home-enter .home-brand h1 strong { animation: homeAccentReveal 0.46s 0.26s ease-out backwards; }

/* Returning to Home from another screen skips the cinematic and just appears. */
.home-enter-instant .home-vehicle-stage img { animation: none; }

@keyframes homeFadeIn {
  from { opacity: 0; }
}

@keyframes homeRiseIn {
  from { opacity: 0; transform: translateY(11px); }
}

@keyframes homeSlideIn {
  from { opacity: 0; transform: translateY(-10px); }
}

@keyframes homeAccentReveal {
  from { color: var(--ui-cream); text-shadow: none; }
}

/* --- idle life ----------------------------------------------------- */
/* The body carries a 1.5px breath and the contact shadow answers it, which
   reads as suspension rather than the vehicle floating. */
.home-idle .home-vehicle-stage { animation: homeVehicleIdle 7s 0.2s ease-in-out infinite; }
.home-idle .home-vehicle-floor { animation: homeSuspensionIdle 7s 0.2s ease-in-out infinite; }

@keyframes homeVehicleIdle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  42% { transform: translateY(-1.5px) rotate(0.13deg); }
}

@keyframes homeSuspensionIdle {
  0%, 100% { transform: scaleX(1); opacity: 1; }
  42% { transform: scaleX(0.985); opacity: 0.86; }
}

/* An occasional highlight sweep across the bodywork. */
.home-idle .home-vehicle-stage::after {
  content: "";
  position: absolute;
  z-index: 4;
  inset: 12% 4%;
  pointer-events: none;
  background: linear-gradient(104deg, transparent 42%, rgba(255, 228, 178, 0.13) 50%, transparent 58%);
  mix-blend-mode: screen;
  animation: homeHighlightSweep 11s 2.4s linear infinite;
}

@keyframes homeHighlightSweep {
  0%, 82% { opacity: 0; transform: translateX(-40%); }
  86% { opacity: 1; }
  100% { opacity: 0; transform: translateX(40%); }
}

/* --- ambient background -------------------------------------------- */
.home-haze {
  left: -12%;
  right: -12%;
  bottom: 12%;
  height: 44%;
  opacity: 0.14;
  filter: blur(26px);
  background: radial-gradient(ellipse at 30% 60%, rgba(196, 158, 118, 0.7), transparent 58%);
}

.home-haze.haze-b {
  bottom: 26%;
  height: 34%;
  opacity: 0.09;
  background: radial-gradient(ellipse at 72% 40%, rgba(150, 168, 178, 0.6), transparent 60%);
}

/* Dust as a single tiled layer: the look of many motes at the cost of one node. */
.home-motes {
  inset: 0;
  opacity: 0.3;
  background-image:
    radial-gradient(circle, rgba(255, 226, 178, 0.5) 0.6px, transparent 1.4px),
    radial-gradient(circle, rgba(255, 214, 158, 0.34) 0.5px, transparent 1.2px);
  background-size: 180px 150px, 260px 210px;
  background-position: 0 0, 60px 40px;
}

.home-command .home-horizon { animation: homeHorizonPulse 9s ease-in-out infinite; }
.home-command .home-ruins-back { animation: homeParallaxBack 64s ease-in-out infinite; }
.home-command .home-ruins-front { animation: homeParallaxFront 48s ease-in-out infinite; }
.home-command .home-haze { animation: homeHazeDrift 46s linear infinite; }
.home-command .home-haze.haze-b { animation: homeHazeDrift 67s linear infinite reverse; }
.home-command .home-motes { animation: homeMoteDrift 38s linear infinite; }

@keyframes homeHorizonPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.68; }
}

@keyframes homeParallaxBack {
  0%, 100% { transform: translate(-6px, -44px) scale(1.08); }
  50% { transform: translate(6px, -44px) scale(1.08); }
}

@keyframes homeParallaxFront {
  0%, 100% { transform: translateX(3px); }
  50% { transform: translateX(-3px); }
}

@keyframes homeHazeDrift {
  from { transform: translateX(-4%); }
  to { transform: translateX(4%); }
}

@keyframes homeMoteDrift {
  from { background-position: 0 0, 60px 40px; }
  to { background-position: -180px -150px, -200px -170px; }
}

/* --- first-time guide ----------------------------------------------- */
.home-guide {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.home-guide-scrim,
.home-guide-spot {
  position: absolute;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.home-guide-scrim {
  inset: 0;
  background: rgba(4, 6, 7, 0.5);
}

/* The spotlight is its own scrim: an oversized shadow darkens everything
   except the control being taught, which is what makes it read as a cut-out. */
.home-guide-spot {
  left: var(--spot-x, 0);
  top: var(--spot-y, 0);
  width: var(--spot-w, 0);
  height: var(--spot-h, 0);
  border: 1px solid rgba(241, 198, 107, 0.5);
  border-radius: 12px;
  box-shadow: 0 0 0 100vmax rgba(4, 6, 7, 0.5), 0 0 24px rgba(233, 154, 67, 0.32);
  transition: opacity 0.22s ease, left 0.24s ease, top 0.24s ease, width 0.24s ease, height 0.24s ease;
}

.home-guide.is-placing .home-guide-panel,
.home-guide.is-placing .home-guide-spot { transition: none; }

.home-guide.is-open .home-guide-scrim,
.home-guide.is-open.has-spot .home-guide-spot { opacity: 1; }
.home-guide.has-spot .home-guide-scrim { opacity: 0; }

.home-guide-panel {
  position: absolute;
  left: 50%;
  top: clamp(54px, 13dvh, 108px);
  width: min(470px, calc(100% - 40px));
  padding: clamp(13px, 2.2dvh, 20px) clamp(15px, 2vw, 24px);
  pointer-events: auto;
  opacity: 0;
  transform: translate(-50%, 11px);
  border: 1px solid rgba(236, 180, 86, 0.34);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(20, 23, 24, 0.97), rgba(9, 11, 12, 0.98));
  box-shadow: 0 26px 64px rgba(0, 0, 0, 0.62), inset 0 1px rgba(255, 236, 196, 0.08);
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.22, 0.7, 0.25, 1);
}

.home-guide.is-open .home-guide-panel { opacity: 1; transform: translate(-50%, 0); }

/* On the controls step there is no button to ring, so the panel itself becomes
   the lit object. */
.home-guide:not(.has-spot) .home-guide-panel {
  border-color: rgba(241, 198, 107, 0.5);
  box-shadow: 0 26px 64px rgba(0, 0, 0, 0.62), 0 0 30px rgba(233, 154, 67, 0.26), inset 0 1px rgba(255, 236, 196, 0.08);
}

.home-guide-body { transition: opacity 0.16s ease, transform 0.16s ease; }
.home-guide.is-swapping .home-guide-body { opacity: 0; transform: translateY(-6px); }

.home-guide-step {
  display: block;
  color: var(--ui-amber);
  font-family: Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(8px, 0.62vw, 10px);
  letter-spacing: 0.22em;
}

.home-guide-panel h2 {
  margin: clamp(4px, 0.9dvh, 8px) 0 0;
  color: var(--ui-cream);
  font-size: clamp(17px, 1.5vw, 25px);
  letter-spacing: 0.03em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.6);
}

.home-guide-panel p {
  margin: clamp(3px, 0.7dvh, 7px) 0 0;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: clamp(10px, 0.78vw, 13px);
  line-height: 1.45;
}

.home-guide-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(3px, 0.7dvh, 6px);
  margin: clamp(7px, 1.3dvh, 12px) 0 0;
  padding: 0;
  list-style: none;
}

.home-guide-controls li {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: clamp(3px, 0.7dvh, 6px) 8px;
  border: 1px solid rgba(236, 180, 86, 0.16);
  border-radius: 7px;
  background: rgba(255, 236, 196, 0.04);
}

.home-guide-controls i {
  flex: none;
  min-width: 46px;
  color: var(--ui-gold);
  font-family: Arial, sans-serif;
  font-style: normal;
  font-weight: 900;
  font-size: clamp(9px, 0.7vw, 12px);
  text-align: center;
}

/* Key caps need a fixed column so the labels align; pad icons do not. */
.home-guide-controls.is-touch i { min-width: 0; }

.home-guide-controls .touch-icon {
  width: 18px;
  height: 18px;
}

.home-guide-controls span {
  overflow: hidden;
  color: var(--ui-cream);
  font-family: Arial, sans-serif;
  font-size: clamp(9px, 0.66vw, 11px);
  letter-spacing: 0.05em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-guide-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: clamp(9px, 1.6dvh, 15px);
}

.home-guide-actions button {
  min-height: clamp(30px, 6.4dvh, 40px);
  padding-inline: clamp(12px, 1.4vw, 22px);
  border-radius: 8px;
  font-family: Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(9px, 0.74vw, 12px);
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.home-guide-next {
  flex: 1;
  border: 1px solid rgba(255, 214, 148, 0.5);
  background: linear-gradient(180deg, #e9873c, #b8541f);
  color: #1b0f06;
  box-shadow: 0 8px 22px rgba(198, 92, 32, 0.32);
}

.home-guide-next:hover { background: linear-gradient(180deg, #f2954a, #c75d24); }

.home-guide-skip {
  border: 1px solid rgba(255, 240, 190, 0.18);
  background: rgba(255, 240, 190, 0.05);
  color: var(--ui-muted);
}

.home-guide-skip:hover { border-color: rgba(255, 240, 190, 0.32); color: var(--ui-cream); }

/* Short landscape phones: compact panel, controls in one row, no scrolling. */
@media (max-height: 500px) and (orientation: landscape) {
  .home-guide-panel {
    top: clamp(44px, 14dvh, 62px);
    width: min(400px, calc(100% - 28px));
    padding: 9px 12px;
    border-radius: 10px;
  }

  .home-guide-panel h2 { margin-top: 2px; font-size: clamp(13px, 2.6vw, 17px); }
  .home-guide-panel p { margin-top: 3px; font-size: clamp(8px, 1.5vw, 10px); line-height: 1.35; }

  .home-guide-controls {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3px;
    margin-top: 6px;
  }

  .home-guide-controls li {
    flex-direction: column;
    gap: 1px;
    padding: 3px 2px;
    text-align: center;
  }

  .home-guide-controls i { min-width: 0; font-size: clamp(8px, 1.5vw, 10px); }
  .home-guide-controls span { font-size: clamp(6px, 1.1vw, 8px); letter-spacing: 0.02em; }

  .home-guide-actions { gap: 6px; margin-top: 7px; }
  .home-guide-actions button { min-height: 28px; padding-inline: 10px; font-size: clamp(8px, 1.4vw, 10px); }
}

@media (max-height: 399px) and (orientation: landscape) {
  .home-guide-panel { top: 40px; padding: 7px 10px; }
  .home-guide-panel p { margin-top: 2px; }
  .home-guide-actions { margin-top: 5px; }
  .home-guide-actions button { min-height: 25px; }
}

/* --- accessibility -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .home-enter .home-atmosphere,
  .home-enter .home-brand,
  .home-enter .home-account,
  .home-enter .home-copy,
  .home-enter .home-brand h1 strong,
  .home-enter .home-vehicle-stage img,
  .home-enter .home-progress,
  .home-enter .home-play,
  .home-enter .home-secondary-actions,
  .home-idle .home-vehicle-stage,
  .home-idle .home-vehicle-floor,
  .home-idle .home-vehicle-stage::after,
  .home-command .home-horizon,
  .home-command .home-ruins-back,
  .home-command .home-ruins-front,
  .home-command .home-haze,
  .home-command .home-haze.haze-b,
  .home-command .home-motes {
    animation: none;
  }

  /* The guide still opens and closes, just without the travel. */
  .home-guide-panel,
  .home-guide-spot,
  .home-guide-body {
    transition-duration: 0.01ms;
  }

  .home-guide-panel,
  .home-guide.is-open .home-guide-panel { transform: translate(-50%, 0); }
}
