:root {
  --navy: #071428;
  --gold: #ffcc33;
  --cream: #fff6e8;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --r: 16px;
  --font: "Trebuchet MS", "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #0a1c38;
  color: var(--cream);
  font-family: var(--font);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
}
img { -webkit-user-drag: none; user-select: none; pointer-events: none; }

#app { position: fixed; inset: 0; overflow: hidden; }
.screen {
  position: absolute; inset: 0;
  display: flex; align-items: stretch; justify-content: center;
}
.screen.hidden, .popup.hidden, .hidden { display: none !important; }

.logo-sign {
  display: flex; flex-direction: column; align-items: center; line-height: .86;
  font-weight: 900; letter-spacing: .08em;
  padding: 10px 22px 12px;
  background: linear-gradient(#2a1a0c, #1a1008);
  border: 4px solid #e2b34a;
  border-radius: 6px;
  box-shadow: 0 8px 0 #7a4e10, 0 14px 22px rgba(0,0,0,.35);
  transform: rotate(-1.4deg);
}
.logo-sign span { display: block; }
.logo-sign .c1 { color: #ffd24d; }
.logo-sign .c2 { color: #ff8a1a; }
.logo-sign .c3 { color: #ff4d4d; }
.logo-hero { font-size: clamp(28px, 7.4vh, 54px); margin: 2px 0 4px; }
.load-inner .logo-sign { font-size: clamp(26px, 7vw, 44px); transform: none; }

.coin-glyph {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff4b0, #ffcc33 42%, #d49a00);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.2), 0 2px 0 rgba(0,0,0,.2);
  display: inline-block; flex-shrink: 0;
}
.coin-glyph.lg { width: 36px; height: 36px; }

#screen-loading { background: #6eb8ea; }
.load-sky {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(7,20,40,.08), rgba(7,20,40,.42)),
    url("../assets/backgrounds/bg-city.webp") center / cover no-repeat;
}
.load-inner {
  position: relative; z-index: 1;
  margin: auto; width: min(520px, 90vw); text-align: center;
  padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b));
  --p: 0;
}
.load-track {
  position: relative; margin: 28px 8px 10px; height: 54px;
}
.load-track .progress-track {
  position: absolute; left: 0; right: 0; top: 28px;
  height: 14px; border-radius: 4px;
  background: #2c3038;
  box-shadow: 0 6px 0 #1b1e24, inset 0 2px 0 rgba(255,255,255,.12);
  overflow: visible;
}
.progress-fill {
  height: 100%; width: 4%;
  background: repeating-linear-gradient(90deg, #f2c94c 0 10px, #2c3038 10px 18px);
  border-radius: 4px; transition: width .18s;
}
.load-car {
  position: absolute; top: 0; left: calc(var(--p) * 86%);
  font-size: 28px; transition: left .18s linear;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,.25));
}
.load-flag {
  position: absolute; right: -6px; top: -2px; font-size: 22px;
}
#load-text { margin-top: 14px; letter-spacing: .14em; font-weight: 800; text-shadow: 0 2px 0 rgba(0,0,0,.35); }

@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes phone-tilt { 0%,100% { transform: rotate(-18deg); } 50% { transform: rotate(72deg); } }
@keyframes floaty { from { transform: translateX(0); } to { transform: translateX(-30%); } }
@keyframes pop-in { from { transform: scale(.88) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes star-pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

#screen-home { overflow: hidden; }
.home-bg {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(7,20,40,.1), rgba(7,20,40,.48)),
    url("../assets/backgrounds/bg-city.webp") center / cover no-repeat;
}
.home-clouds {
  position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(circle at 18% 16%, rgba(255,255,255,.32), transparent 26%),
    radial-gradient(circle at 72% 10%, rgba(255,255,255,.22), transparent 22%);
  animation: floaty 22s linear infinite;
}
.home-safe {
  position: relative; z-index: 1; width: min(560px, 100%); margin: auto;
  padding: calc(8px + var(--safe-t)) calc(16px + var(--safe-r)) calc(10px + var(--safe-b)) calc(16px + var(--safe-l));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.top-bar { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.home-car-stage {
  position: relative;
  height: min(22vh, 132px);
  width: min(300px, 72vw);
  display: flex; align-items: flex-end; justify-content: center;
}
#home-car {
  height: 92%; max-width: 100%; object-fit: contain; object-position: center bottom;
  animation: bob 2.4s ease-in-out infinite; z-index: 1;
}
.home-pad {
  position: absolute; left: 6%; right: 6%; bottom: 0; height: 16px;
  background: linear-gradient(#4d5360, #2d323c);
  border-radius: 6px 6px 3px 3px;
  box-shadow: 0 8px 0 rgba(0,0,0,.2);
}
.home-pad::after {
  content: ""; position: absolute; left: 10%; right: 10%; top: 5px; height: 3px;
  background: repeating-linear-gradient(90deg, #f2c94c 0 12px, transparent 12px 22px);
}
.home-actions { width: min(360px, 94%); display: flex; flex-direction: column; gap: 10px; }
.home-row { display: flex; gap: 10px; }
.home-row .btn { flex: 1; }

.coin-chip, .icon-btn, .hud-btn, .btn, .world-tab, .lvl-card, .garage-card {
  border: none; cursor: pointer; font-family: inherit; font-weight: 800;
}
.coin-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(#2b4d86, #1a335f); color: var(--gold);
  padding: 7px 12px; border-radius: 999px;
  box-shadow: 0 4px 0 #0a1a36; font-size: clamp(15px, 2.8vw, 20px);
}
.coin-chip.mini { padding: 5px 10px; font-size: 14px; }
.icon-btn, .hud-btn {
  width: 42px; height: 42px; border-radius: 14px;
  background: linear-gradient(#ffd24d, #f5a400); color: #5a3200; font-size: 20px;
  box-shadow: 0 4px 0 #c47a00;
}
.hud-btn { width: 38px; height: 38px; border-radius: 12px; }

.btn {
  border-radius: 14px;
  padding: 11px 16px;
  font-size: clamp(14px, 2.2vw, 18px);
  letter-spacing: .06em; color: #fff;
  box-shadow: 0 5px 0 rgba(0,0,0,.28);
  transition: transform .08s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: scale(.96); }
.btn-ico { font-size: .95em; }
.btn-play {
  background: linear-gradient(#49d36a, #1ea84a);
  box-shadow: 0 7px 0 #0f7a32;
  font-size: clamp(20px, 3.4vw, 28px);
  padding: 13px 18px;
  border-radius: 18px;
}
.btn-secondary {
  background: linear-gradient(#3aa4ff, #1c6fe0);
  box-shadow: 0 5px 0 #0e4ca8;
}
.btn-sign {
  background: linear-gradient(#3a7bd5, #1f4f9a);
  box-shadow: 0 5px 0 #12366e;
  border: 2px solid rgba(255,255,255,.18);
}
.btn-ghost {
  background: transparent; box-shadow: none; color: rgba(255,255,255,.88);
  padding: 8px 10px; font-size: 15px;
}
.btn-back {
  width: 42px; padding: 8px 0;
  background: linear-gradient(#3aa4ff, #1c6fe0);
}

.panel-page {
  width: 100%; height: 100%;
  padding: calc(8px + var(--safe-t)) calc(14px + var(--safe-r)) calc(10px + var(--safe-b)) calc(14px + var(--safe-l));
  background: linear-gradient(180deg, rgba(7,20,40,.4), rgba(7,20,40,.72)),
    url("../assets/backgrounds/bg-city.webp") center / cover no-repeat;
  display: flex; flex-direction: column; gap: 8px; overflow: hidden;
}
.panel-page.desert { background-image: linear-gradient(180deg, rgba(70,30,10,.35), rgba(40,18,8,.7)), url("../assets/backgrounds/bg-desert.webp"); background-size: cover; background-position: center; }
.panel-page.snow { background-image: linear-gradient(180deg, rgba(20,40,70,.28), rgba(10,24,48,.7)), url("../assets/backgrounds/bg-snow.webp"); background-size: cover; background-position: center; }
.panel-page.jungle { background-image: linear-gradient(180deg, rgba(10,40,16,.3), rgba(8,24,12,.72)), url("../assets/backgrounds/bg-jungle.webp"); background-size: cover; background-position: center; }
.panel-page.factory { background-image: linear-gradient(180deg, rgba(20,28,40,.35), rgba(8,12,20,.75)), url("../assets/backgrounds/bg-factory.webp"); background-size: cover; background-position: center; }

.page-head { display: flex; align-items: center; gap: 10px; }
.page-head h1 {
  flex: 1; text-align: center;
  font-size: clamp(18px, 3vw, 26px);
  letter-spacing: .16em;
  text-shadow: 0 3px 0 rgba(0,0,0,.35);
  background: linear-gradient(#2a1a0c, #1a1008);
  border: 3px solid #e2b34a;
  border-radius: 6px;
  padding: 6px 14px;
  box-shadow: 0 4px 0 #7a4e10;
}

.world-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.world-tab {
  flex: 0 0 auto; border-radius: 999px; padding: 7px 12px; color: #fff;
  background: rgba(255,255,255,.16); font-size: 13px;
}
.world-tab.on { background: linear-gradient(#ffd24d, #f5a400); color: #5a3200; }
.world-tab.locked { opacity: .55; }
.world-lock-msg {
  text-align: center; font-weight: 800; padding: 18px 12px;
  background: rgba(8,16,32,.45); border-radius: 16px;
}

.level-grid {
  flex: 1; overflow: auto;
  display: grid;
  grid-template-columns: repeat(3, clamp(104px, 18vmin, 168px));
  grid-auto-rows: clamp(104px, 18vmin, 168px);
  gap: 12px;
  justify-content: center;
  align-content: center;
}
.lvl-card {
  width: 100%; height: 100%; padding: 0;
  border-radius: 16px; color: #fff;
  position: relative; overflow: hidden;
  background: #243044;
  box-shadow: 0 5px 0 #121820;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 0;
}
.lvl-art {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, #7ecbff 0 42%, #68b56a 42% 58%, #4d5360 58% 70%, #c4893c 70%);
}
.lvl-art::before {
  content: ""; position: absolute; left: 10px; right: 28px; top: 18px; height: 28px;
  background: linear-gradient(90deg, #8aa4c8 0 18px, #d7b48a 18px 36px, #6b7fa0 36px 52px);
  clip-path: polygon(0 100%, 8% 40%, 22% 70%, 40% 20%, 58% 55%, 78% 15%, 100% 80%, 100% 100%);
  opacity: .9;
}
.lvl-art::after {
  content: ""; position: absolute; left: 8px; right: 8px; top: 62%; height: 3px;
  background: repeating-linear-gradient(90deg, #f2c94c 0 8px, transparent 8px 16px);
}
.lvl-card.world-desert .lvl-art { background: linear-gradient(180deg, #f2d08a 0 46%, #e2b36a 46% 68%, #c4893c 68%); }
.lvl-card.world-snow .lvl-art { background: linear-gradient(180deg, #cfe8ff 0 48%, #eef7ff 48% 66%, #9ec4e6 66%); }
.lvl-card.world-jungle .lvl-art { background: linear-gradient(180deg, #7ecbff 0 36%, #3e9a36 36% 58%, #7a4b2a 58%); }
.lvl-card.world-factory .lvl-art { background: linear-gradient(180deg, #6a7384 0 40%, #4d5563 40% 62%, #2c313a 62%); }
.lvl-num {
  position: relative; z-index: 1;
  font-size: 28px; text-shadow: 0 3px 0 rgba(0,0,0,.45);
  margin-bottom: 2px;
}
.lvl-card .stars {
  position: relative; z-index: 1;
  font-size: 12px; color: #ffe08a; letter-spacing: 1px; margin-bottom: 8px;
}
.lvl-card.locked { filter: saturate(.35) brightness(.62); }
.lvl-card.locked .lvl-num { font-size: 22px; }
.lvl-card.current {
  outline: 3px solid #ffd24d;
  transform: scale(1.06);
  z-index: 2;
}
.lvl-card.done .stars { color: #ffd24d; }

.garage-grid {
  flex: 1; overflow-x: auto; overflow-y: hidden;
  display: flex; gap: 10px;
  align-items: center;
  justify-content: flex-start;
  padding-bottom: 6px;
}
.garage-card {
  flex: 0 0 auto;
  width: min(220px, 52vw);
  height: min(260px, 72vh);
  padding: 10px 10px 12px;
  border-radius: 16px; color: #fff;
  background: linear-gradient(#2b4d86, #1a335f);
  box-shadow: 0 5px 0 #0a1a36;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-align: center;
}
.garage-card img {
  flex: 1; width: 100%; min-height: 96px; max-height: 130px;
  object-fit: contain; object-position: center bottom;
}
.garage-card .name { font-size: 14px; letter-spacing: .04em; }
.garage-card .stats { width: 100%; font-size: 10px; opacity: .9; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.garage-card .price {
  margin-top: auto; font-size: 12px; color: var(--gold);
  background: rgba(0,0,0,.22); width: 100%; border-radius: 10px; padding: 5px 6px;
}
.garage-card.selected { box-shadow: 0 0 0 3px #ffd24d, 0 5px 0 #0a1a36; }
.garage-card.locked { filter: saturate(.7); }

#screen-play { background: #6eb8ea; touch-action: none; }
#game-stage { position: relative; width: 100%; height: 100%; margin: 0; }
#game-canvas { display: block; width: 100%; height: 100%; touch-action: none; }

#hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: calc(6px + var(--safe-t)) calc(8px + var(--safe-r)) 0 calc(8px + var(--safe-l));
  pointer-events: none; z-index: 3;
}
#hud > button { pointer-events: auto; }
.hud-pill {
  background: rgba(10, 22, 44, .55);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px; padding: 6px 12px 7px; min-width: min(220px, 46vw);
  text-align: center; text-shadow: 0 2px 0 rgba(0,0,0,.35);
}
#hud-level { font-weight: 900; font-size: clamp(13px, 2.1vw, 16px); letter-spacing: .12em; }
.ink-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 11px; color: #ffe08a; font-weight: 800; }
.ink-track { flex: 1; height: 10px; border-radius: 8px; background: rgba(0,0,0,.35); overflow: hidden; }
#ink-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #7ad0ff, #3aa4ff); }

#hint-banner, #intro-banner {
  position: absolute; left: 50%; top: 16%; transform: translateX(-50%);
  background: rgba(10, 24, 48, .72); padding: 8px 16px; border-radius: 14px;
  font-weight: 900; letter-spacing: .12em; pointer-events: none; z-index: 4; font-size: 14px;
}
#intro-banner { top: 40%; font-size: clamp(20px, 4vw, 32px); }

.popup {
  position: absolute; inset: 0; background: rgba(4, 10, 22, .52);
  display: flex; align-items: center; justify-content: center; z-index: 20;
  padding: calc(8px + var(--safe-t)) calc(10px + var(--safe-r)) calc(8px + var(--safe-b)) calc(10px + var(--safe-l));
}
.popup-card {
  width: min(360px, 100%);
  max-height: min(82dvh, 520px);
  overflow-y: auto;
  background: linear-gradient(180deg, #245392, #12325f);
  border: 2px solid rgba(255,255,255,.16);
  border-radius: 22px; padding: 14px 14px 12px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 16px 36px rgba(0,0,0,.45);
  animation: pop-in .22s ease;
}
.popup-card h2 { text-align: center; font-size: clamp(20px, 3.6vw, 26px); text-shadow: 0 3px 0 rgba(0,0,0,.3); }
.popup-card.win { background: linear-gradient(180deg, #2f9a5c, #145c36); text-align: center; }
.popup-card.fail { background: linear-gradient(180deg, #b44545, #7a2228); }
.win-kicker { letter-spacing: .14em; font-weight: 900; font-size: 13px; }
.win-stars { font-size: 28px; color: #ffe066; animation: star-pop .35s ease; }
.reward { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 30px; color: var(--gold); font-weight: 900; }
.reward-label { font-size: 12px; letter-spacing: .2em; opacity: .85; }
.win-row { display: flex; justify-content: center; gap: 8px; }
.toggle {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(0,0,0,.2); padding: 10px 12px; border-radius: 12px; font-weight: 800;
}

#orientation-overlay {
  position: absolute; inset: 0; z-index: 80;
  background: radial-gradient(ellipse at center, #1a4d8c, #071428);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
#orientation-overlay.hidden { display: none !important; }
.orient-card { text-align: center; max-width: 360px; }
.phone-icon { font-size: 64px; animation: phone-tilt 1.6s ease-in-out infinite; }
.orient-card h2 { margin: 12px 0 8px; font-size: 26px; }

@media (max-height: 420px) {
  .home-car-stage { height: 72px; }
  .logo-hero { font-size: 22px; padding: 6px 12px; }
  .btn-play { font-size: 16px; padding: 8px; }
  .garage-card { height: min(168px, 70vh); width: min(170px, 46vw); }
  .lvl-card, .level-grid { width: 92px; }
  .level-grid { grid-template-columns: repeat(3, 92px); grid-template-rows: repeat(2, 92px); }
  .popup-card { padding: 10px; gap: 6px; }
}

/* Premium visual system */
:root {
  --ink-950: #081426;
  --ink-900: #0c1d35;
  --ink-800: #16345a;
  --ink-700: #24558d;
  --sky-300: #75d6ff;
  --sky-500: #269ee8;
  --sun-300: #ffe58a;
  --sun-500: #ffc42e;
  --sun-700: #d98500;
  --grass-400: #5de36f;
  --grass-600: #20a94d;
  --line: rgba(255,255,255,.2);
  --panel: linear-gradient(160deg, rgba(31,74,123,.96), rgba(12,36,69,.97));
  --panel-shadow: 0 14px 30px rgba(3,13,31,.36), inset 0 1px 0 rgba(255,255,255,.18);
  --soft-shadow: 0 8px 18px rgba(6,20,42,.28);
  --ease-pop: cubic-bezier(.2,.8,.2,1);
}

button { -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 3px solid #fff2a6; outline-offset: 3px; }
.screen:not(.hidden) { animation: screen-in .34s var(--ease-pop); }
@keyframes screen-in {
  from { opacity: 0; transform: scale(1.012); }
  to { opacity: 1; transform: none; }
}
@keyframes ambient-rise {
  0% { transform: translate3d(0, 20px, 0) scale(.7); opacity: 0; }
  20% { opacity: .7; }
  100% { transform: translate3d(18px, -100px, 0) scale(1.2); opacity: 0; }
}
@keyframes car-idle {
  0%,100% { transform: translateY(0) rotate(-.35deg); }
  42% { transform: translateY(-4px) rotate(.35deg); }
  58% { transform: translateY(-3px) rotate(.1deg); }
}
@keyframes logo-float {
  0%,100% { transform: rotate(-1.2deg) translateY(0); }
  50% { transform: rotate(-.5deg) translateY(-3px); }
}
@keyframes road-glint {
  from { transform: translateX(-120%); }
  to { transform: translateX(420%); }
}
@keyframes selected-pulse {
  0%,100% { box-shadow: 0 0 0 3px #ffd85a, 0 9px 0 #a86400, 0 16px 30px rgba(7,20,40,.38); }
  50% { box-shadow: 0 0 0 4px #fff1a0, 0 9px 0 #a86400, 0 18px 36px rgba(255,198,40,.22); }
}

.ambient { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.ambient i {
  position: absolute; bottom: 5%; width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,242,174,.88);
  box-shadow: 0 0 10px rgba(255,224,112,.8);
  animation: ambient-rise 5.4s linear infinite;
}
.ambient i:nth-child(1) { left: 18%; animation-delay: -.4s; }
.ambient i:nth-child(2) { left: 31%; animation-delay: -2.2s; transform: scale(.7); }
.ambient i:nth-child(3) { left: 48%; animation-delay: -4s; }
.ambient i:nth-child(4) { left: 66%; animation-delay: -1.3s; transform: scale(.55); }
.ambient i:nth-child(5) { left: 79%; animation-delay: -3.2s; }
.ambient i:nth-child(6) { left: 90%; animation-delay: -4.7s; transform: scale(.7); }

.logo-sign {
  position: relative;
  padding: 11px 28px 14px;
  border: 2px solid #ffd85b;
  border-radius: 15px 15px 19px 19px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.1), transparent 25%),
    linear-gradient(155deg, #243f67 0%, #102442 58%, #09182e 100%);
  box-shadow: 0 6px 0 #071326, 0 11px 0 #d98500, 0 20px 34px rgba(4,13,29,.42), inset 0 0 0 2px rgba(255,255,255,.08);
  text-shadow: 0 3px 0 rgba(0,0,0,.35), 0 0 18px rgba(255,187,47,.16);
}
.logo-sign::before,
.logo-sign::after {
  content: ""; position: absolute; top: 14px; bottom: 14px; width: 5px; border-radius: 5px;
  background: linear-gradient(#ffe887,#e69b00);
  box-shadow: 0 1px 0 rgba(255,255,255,.45);
}
.logo-sign::before { left: 9px; }
.logo-sign::after { right: 9px; }
.logo-sign .c1 { color: #fff5c4; }
.logo-sign .c2 { color: #ffc536; }
.logo-sign .c3 { color: #ff625c; }
.logo-hero { animation: logo-float 4.8s ease-in-out infinite; }
.hero-kicker,
.load-tagline {
  color: rgba(255,255,255,.88); font-size: 10px; font-weight: 900;
  letter-spacing: .22em; text-shadow: 0 2px 4px rgba(0,0,0,.4);
}

.btn, .icon-btn, .hud-btn, .world-tab, .lvl-card, .garage-card {
  transition: transform .14s var(--ease-pop), filter .14s ease, box-shadow .14s ease;
}
.btn {
  min-height: 42px;
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: 0 6px 0 rgba(6,24,48,.7), 0 11px 19px rgba(5,18,40,.24), inset 0 2px 0 rgba(255,255,255,.2);
  text-shadow: 0 2px 0 rgba(0,0,0,.24);
}
.btn::after {
  content: ""; position: absolute; inset: 2px 8px auto; height: 32%;
  border-radius: inherit; background: linear-gradient(rgba(255,255,255,.14), transparent);
  pointer-events: none;
}
.btn { position: relative; overflow: hidden; }
.btn:hover { filter: brightness(1.08) saturate(1.08); transform: translateY(-2px); }
.btn:active { transform: translateY(3px) scale(.985); box-shadow: 0 2px 0 rgba(6,24,48,.75); }
.btn:disabled {
  cursor: not-allowed; opacity: .58; filter: grayscale(.28);
  transform: none; box-shadow: 0 3px 0 rgba(6,24,48,.58);
}
.btn-play {
  background: linear-gradient(180deg, #69ed7b, #28be58 58%, #15933f);
  border-color: rgba(255,255,255,.42);
  box-shadow: 0 7px 0 #0b7732, 0 13px 25px rgba(6,52,24,.34), inset 0 2px 0 rgba(255,255,255,.32);
}
.btn-sign, .btn-secondary {
  background: linear-gradient(180deg, #57b7ff, #247dd1 60%, #16549e);
  box-shadow: 0 6px 0 #123e77, 0 11px 20px rgba(6,30,66,.3), inset 0 2px 0 rgba(255,255,255,.24);
}
.btn-back {
  width: 44px; min-width: 44px; height: 44px; border-radius: 50%; padding: 0;
  background: linear-gradient(#5ac0ff,#2179d2); box-shadow: 0 5px 0 #123e77, var(--soft-shadow);
  font-size: 32px; line-height: 1;
}
.btn-back span { transform: translateY(-2px); }
.icon-btn, .hud-btn {
  border: 1px solid rgba(255,255,255,.45);
  background: linear-gradient(#ffe66a,#ffc026 56%,#ee9310);
  box-shadow: 0 5px 0 #b96500, var(--soft-shadow), inset 0 2px 0 rgba(255,255,255,.45);
}
.icon-btn:hover, .hud-btn:hover { transform: translateY(-2px) rotate(3deg); filter: brightness(1.05); }
.icon-btn:active, .hud-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #b96500; }

.coin-chip {
  border: 1px solid rgba(255,255,255,.25);
  background: linear-gradient(180deg, rgba(35,78,129,.97), rgba(13,40,77,.98));
  box-shadow: 0 5px 0 rgba(6,21,43,.8), var(--soft-shadow), inset 0 1px 0 rgba(255,255,255,.18);
}
.coin-glyph {
  position: relative; border: 2px solid #ffe986;
  box-shadow: inset 0 -3px 0 #d48700, 0 2px 0 rgba(0,0,0,.22), 0 0 8px rgba(255,203,45,.24);
}
.coin-glyph::after {
  content: ""; position: absolute; width: 28%; height: 55%; left: 24%; top: 13%;
  border-radius: 50%; background: rgba(255,255,255,.55); transform: rotate(35deg);
}
.coin-glyph.tiny { width: 16px; height: 16px; border-width: 1px; }

.home-safe { width: min(620px, 100%); gap: 7px; }
.top-bar {
  position: absolute; top: calc(10px + var(--safe-t)); left: 50%;
  width: 100vw; transform: translateX(-50%);
  padding: 0 calc(14px + var(--safe-r)) 0 calc(14px + var(--safe-l));
}
.home-car-stage { height: min(24vh, 155px); width: min(350px, 76vw); isolation: isolate; }
.home-spotlight {
  position: absolute; width: 135%; height: 145%; bottom: -8%; z-index: -1;
  background: radial-gradient(ellipse at 50% 70%, rgba(255,234,132,.28), transparent 65%);
}
#home-car {
  height: 96%; filter: drop-shadow(0 12px 10px rgba(5,15,28,.28));
  animation: car-idle 2.8s var(--ease-pop) infinite;
}
.home-pad {
  left: 2%; right: 2%; height: 19px; border-radius: 8px 8px 14px 14px;
  background: linear-gradient(180deg,#656c7a,#303641 65%,#202630);
  border-top: 2px solid rgba(255,255,255,.25);
  box-shadow: 0 9px 0 #51351f, 0 15px 20px rgba(5,17,34,.28);
}
.home-pad::before {
  content: ""; position: absolute; inset: 2px; overflow: hidden;
  background: linear-gradient(90deg,transparent,rgba(255,255,255,.16),transparent);
  animation: road-glint 3.4s ease-in-out infinite;
}
.home-actions { width: min(380px, 94%); gap: 11px; }
.home-actions .btn-play { min-height: 55px; font-size: clamp(20px,3.3vw,27px); }
.home-row .btn { min-height: 46px; opacity: .96; }

#screen-loading { isolation: isolate; }
.load-sky {
  filter: saturate(1.08);
  transform: scale(1.02);
}
.load-sky::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 44%, rgba(90,203,255,.15), transparent 48%), linear-gradient(transparent 58%, rgba(8,25,48,.38));
}
.load-inner { width: min(580px, 90vw); }
.load-inner .logo-sign { display: inline-flex; font-size: clamp(30px,7vw,50px); }
.load-tagline { margin-top: 20px; }
.load-track { height: 76px; margin: 27px 8px 2px; }
.load-track .progress-track {
  top: 35px; height: 18px; border-radius: 8px;
  border: 2px solid rgba(255,255,255,.16);
  background: linear-gradient(#3c4553,#252c36);
  box-shadow: 0 8px 0 #51351f, 0 14px 20px rgba(4,15,31,.34), inset 0 2px 4px rgba(0,0,0,.4);
  overflow: hidden;
}
.load-track .progress-track::after {
  content: ""; position: absolute; inset: 5px 0 auto; height: 3px;
  background: repeating-linear-gradient(90deg,#ffe06c 0 14px,transparent 14px 26px);
}
.progress-fill {
  background: linear-gradient(90deg,rgba(41,177,255,.45),rgba(105,237,123,.56));
  box-shadow: inset 0 0 10px rgba(255,255,255,.28);
}
.load-car {
  top: -8px; left: calc(var(--p) * 83%); width: 82px; height: 54px; object-fit: contain;
  object-position: center; filter: drop-shadow(0 7px 4px rgba(3,13,28,.32));
  opacity: 0; transform: translateY(4px); transition: left .18s linear, opacity .22s ease, transform .22s ease;
}
.load-car.ready { opacity: 1; transform: none; }
.load-flag {
  top: -9px; right: 0; width: 34px; height: 48px;
  border-left: 4px solid #f5f7fb;
  filter: drop-shadow(0 4px 3px rgba(0,0,0,.2));
}
.load-flag span {
  position: absolute; left: 0; top: 1px; width: 29px; height: 22px;
  background: conic-gradient(#111 25%,#fff 0 50%,#111 0 75%,#fff 0) 0 0/14px 14px;
  clip-path: polygon(0 0,100% 8%,86% 100%,0 90%);
}
#load-text {
  display: inline-block; padding: 7px 16px; border-radius: 999px;
  background: rgba(8,27,54,.68); border: 1px solid rgba(255,255,255,.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}

.panel-page {
  gap: 11px;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(80,192,255,.08), transparent 50%),
    linear-gradient(180deg, rgba(8,28,55,.22), rgba(7,20,40,.65)),
    url("../assets/backgrounds/bg-city.webp") center/cover no-repeat;
}
.page-head {
  max-width: 980px; width: 100%; margin: 0 auto;
  display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px;
}
.page-title { justify-self: center; text-align: center; line-height: 1; }
.page-title small { display: block; font-size: 9px; letter-spacing: .24em; color: #c5e8ff; margin-bottom: 4px; }
.page-head h1 {
  padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none;
  font-size: clamp(22px,4vw,34px); letter-spacing: .16em;
  color: #fff; text-shadow: 0 3px 0 #123962, 0 6px 14px rgba(0,0,0,.28);
}
.world-tabs {
  max-width: 820px; width: 100%; margin: 0 auto; justify-content: center;
  gap: 7px; padding: 3px 5px 7px; scrollbar-width: none;
}
.world-tabs::-webkit-scrollbar, .garage-grid::-webkit-scrollbar { display: none; }
.world-tab {
  position: relative; min-height: 35px; padding: 7px 13px;
  border: 1px solid rgba(255,255,255,.2);
  background: linear-gradient(180deg,rgba(52,104,160,.92),rgba(22,59,103,.95));
  box-shadow: 0 4px 0 rgba(7,27,53,.78), inset 0 1px 0 rgba(255,255,255,.16);
  text-shadow: 0 2px 0 rgba(0,0,0,.3);
}
.world-tab:hover:not(.locked) { transform: translateY(-2px); filter: brightness(1.1); }
.world-tab.on {
  color: #5b3500; border-color: #fff1a7;
  background: linear-gradient(#ffe779,#ffc42e);
  box-shadow: 0 4px 0 #bd7000, 0 8px 16px rgba(255,184,24,.18), inset 0 1px 0 #fff8cb;
  text-shadow: 0 1px 0 rgba(255,255,255,.45);
}
.world-tab.locked { opacity: .48; filter: grayscale(.35); }

.level-grid { gap: clamp(10px,1.5vw,16px); padding: 9px 14px 18px; }
.lvl-card {
  border: 2px solid rgba(255,255,255,.2);
  border-radius: 20px;
  box-shadow: 0 8px 0 #10223a, 0 14px 24px rgba(5,18,40,.3), inset 0 1px 0 rgba(255,255,255,.2);
}
.lvl-card:hover:not(.locked) { transform: translateY(-4px) scale(1.025); filter: saturate(1.08) brightness(1.04); }
.lvl-card:active:not(.locked) { transform: translateY(3px) scale(.99); box-shadow: 0 3px 0 #10223a; }
.lvl-art { inset: 0; filter: saturate(1.08); }
.lvl-art::before { height: 34%; top: 15%; opacity: .95; filter: drop-shadow(0 3px 2px rgba(0,0,0,.2)); }
.lvl-art::after { top: 61%; height: 5px; border-radius: 3px; }
.lvl-road {
  position: absolute; left: -10%; right: -10%; top: 53%; height: 22%;
  background: linear-gradient(#636b78,#353b46);
  border-top: 3px solid rgba(255,255,255,.25);
  box-shadow: 0 5px 0 rgba(55,32,17,.28);
  transform: rotate(-3deg);
}
.lvl-road::after {
  content: ""; position: absolute; left: 5%; right: 5%; top: 44%; height: 3px;
  background: repeating-linear-gradient(90deg,#ffe06c 0 11px,transparent 11px 20px);
}
.lvl-num {
  width: 48px; height: 48px; margin-bottom: 26px;
  display: grid; place-items: center; border-radius: 50%;
  background: linear-gradient(180deg,rgba(34,77,126,.96),rgba(12,37,72,.98));
  border: 2px solid rgba(255,255,255,.34);
  box-shadow: 0 4px 0 rgba(5,23,47,.7), 0 7px 14px rgba(0,0,0,.25), inset 0 2px 0 rgba(255,255,255,.18);
  font-size: 25px;
}
.lvl-card .stars {
  position: absolute; left: 0; right: 0; bottom: 7px; margin: 0;
  display: flex; justify-content: center; gap: 3px; font-size: 17px;
  color: rgba(255,255,255,.32); text-shadow: 0 2px 0 rgba(0,0,0,.35);
}
.lvl-card .stars .earned { color: #ffdc43; filter: drop-shadow(0 1px 2px #b86b00); }
.current-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  padding: 3px 7px; border-radius: 999px; color: #603800;
  background: linear-gradient(#fff197,#ffc934); border: 1px solid #fff5b9;
  font-size: 8px; font-weight: 900; letter-spacing: .12em; box-shadow: 0 2px 0 #ad6200;
}
.lvl-card.current {
  outline: 0; transform: scale(1.035); border-color: #fff1a0;
  animation: selected-pulse 2.4s ease-in-out infinite;
}
.lvl-card.locked {
  opacity: .72; filter: saturate(.35) brightness(.62);
  border-color: rgba(255,255,255,.1);
}
.lvl-card.locked .lvl-num { margin-bottom: 28px; }
.lvl-card .lock-mark {
  color: #dce7f5; font-size: 9px; letter-spacing: .14em;
  background: rgba(7,20,40,.72); width: max-content; left: 50%; right: auto;
  transform: translateX(-50%); padding: 4px 8px; border-radius: 999px;
}

.garage-hint {
  text-align: center; color: rgba(224,244,255,.75);
  font-size: 10px; font-weight: 800; letter-spacing: .14em;
}
.garage-grid {
  gap: 16px; max-width: 100%; padding: 8px max(18px,calc((100vw - 1140px)/2)) 22px;
  scroll-snap-type: x mandatory; align-items: center;
}
.garage-card {
  position: relative; overflow: hidden; isolation: isolate;
  width: clamp(190px,22vw,238px); height: clamp(236px,66vh,310px);
  padding: 11px 12px 13px; gap: 7px; scroll-snap-align: center;
  border: 2px solid rgba(255,255,255,.2); border-radius: 22px;
  background:
    radial-gradient(circle at 50% 25%,rgba(103,204,255,.2),transparent 38%),
    var(--panel);
  box-shadow: 0 9px 0 #091b33, 0 17px 30px rgba(4,15,32,.36), inset 0 2px 0 rgba(255,255,255,.16);
}
.garage-card:hover:not(.locked) { transform: translateY(-5px); filter: brightness(1.05); }
.garage-card:active { transform: translateY(3px); }
.card-shine {
  position: absolute; width: 50%; height: 180%; left: -70%; top: -40%; z-index: -1;
  background: linear-gradient(90deg,transparent,rgba(255,255,255,.1),transparent);
  transform: rotate(22deg); transition: left .6s ease;
}
.garage-card:hover .card-shine { left: 130%; }
.vehicle-badge {
  position: absolute; top: 10px; left: 10px; z-index: 3;
  padding: 4px 8px; border-radius: 999px;
  background: rgba(7,23,46,.76); border: 1px solid rgba(255,255,255,.2);
  color: #d7edff; font-size: 8px; letter-spacing: .12em;
}
.garage-card.selected .vehicle-badge {
  color: #4a2c00; background: linear-gradient(#fff3a1,#ffca34); border-color: #fff5bc;
}
.vehicle-preview {
  position: relative; width: 100%; min-height: 110px; flex: 1;
  display: flex; align-items: flex-end; justify-content: center; padding: 7px 5px 13px;
}
.vehicle-preview::before {
  content: ""; position: absolute; width: 92%; height: 76%; bottom: 2px; border-radius: 50%;
  background: radial-gradient(ellipse,rgba(89,191,255,.2),transparent 68%);
}
.vehicle-preview img {
  position: relative; z-index: 2; flex: none; width: 100%; height: 100%; min-height: 0; max-height: 138px;
  object-fit: contain; object-position: center bottom;
  filter: drop-shadow(0 9px 7px rgba(3,12,25,.34));
  transition: transform .28s var(--ease-pop);
}
.garage-card:hover .vehicle-preview img { transform: translateY(-3px) scale(1.025); }
.vehicle-platform {
  position: absolute; z-index: 1; left: 8%; right: 8%; bottom: 5px; height: 12px; border-radius: 50%;
  background: rgba(3,12,24,.45); filter: blur(2px);
}
.garage-card .name {
  font-size: clamp(16px,2vw,20px); font-weight: 900; letter-spacing: .08em;
  text-transform: uppercase; text-shadow: 0 2px 0 rgba(0,0,0,.35);
}
.garage-card .stats {
  display: flex; flex-direction: column; gap: 6px; width: 100%; opacity: 1;
  padding: 8px 9px; border-radius: 12px; background: rgba(4,18,37,.36);
  border: 1px solid rgba(255,255,255,.1);
}
.stat-row { display: grid; grid-template-columns: 42px 1fr; gap: 7px; align-items: center; }
.stat-row span { color: #cfe8ff; font-size: 8px; letter-spacing: .1em; text-align: left; }
.stat-row i {
  display: block; height: 7px; border-radius: 8px; background: rgba(2,12,27,.58);
  overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.35);
}
.stat-row b {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg,#45b8ff,#77e981);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45),0 0 6px rgba(66,187,255,.25);
}
.garage-card .price {
  min-height: 35px; display: flex; align-items: center; justify-content: center; gap: 7px;
  color: #fff; font-size: 11px; letter-spacing: .1em;
  border: 1px solid rgba(255,255,255,.24); border-radius: 12px; padding: 7px;
  background: linear-gradient(#42adff,#216cc0); box-shadow: 0 4px 0 #123e77, inset 0 1px 0 rgba(255,255,255,.22);
}
.garage-card.selected {
  border-color: #ffe777;
  background: radial-gradient(circle at 50% 24%,rgba(255,220,89,.23),transparent 38%),var(--panel);
  box-shadow: 0 0 0 2px #ffc52f,0 9px 0 #9a5a00,0 18px 34px rgba(255,190,40,.18),inset 0 2px 0 rgba(255,255,255,.2);
}
.garage-card.selected .price {
  color: #4d2e00; background: linear-gradient(#fff29b,#ffca35); box-shadow: 0 4px 0 #a55f00;
}
.garage-card.locked { filter: saturate(.65); }
.garage-card.locked .vehicle-preview img { filter: saturate(.55) brightness(.82) drop-shadow(0 9px 7px rgba(3,12,25,.34)); }
.garage-card.unaffordable {
  cursor: not-allowed; opacity: .66; filter: saturate(.45) brightness(.82);
}
.garage-card.unaffordable .price {
  color: #d7e1ed; background: linear-gradient(#64758a,#3c4c61); box-shadow: 0 4px 0 #253448;
}

.hud-pill {
  min-width: min(250px,48vw); padding: 7px 14px 9px; border-radius: 17px;
  background: linear-gradient(180deg,rgba(30,71,118,.94),rgba(9,31,61,.94));
  border: 1px solid rgba(255,255,255,.3);
  box-shadow: 0 6px 0 rgba(5,20,42,.68),0 11px 22px rgba(4,15,32,.25),inset 0 1px 0 rgba(255,255,255,.17);
}
#hud-level { color: #fff; font-size: clamp(13px,2.1vw,17px); }
.ink-row { color: #ffe98e; gap: 8px; }
.ink-track {
  height: 11px; padding: 2px; border: 1px solid rgba(255,255,255,.13);
  background: rgba(2,13,29,.58); box-shadow: inset 0 2px 3px rgba(0,0,0,.3);
}
#ink-fill {
  border-radius: inherit; background: linear-gradient(90deg,#43b6ff,#72eaff);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5),0 0 8px rgba(70,190,255,.28);
  transition: width .12s linear;
}
#hint-banner, #intro-banner {
  border: 1px solid rgba(255,255,255,.22);
  background: linear-gradient(180deg,rgba(35,79,128,.92),rgba(10,35,69,.92));
  box-shadow: 0 5px 0 rgba(5,21,44,.65),var(--soft-shadow),inset 0 1px 0 rgba(255,255,255,.16);
}
.popup-card {
  border: 2px solid rgba(255,255,255,.24); border-radius: 25px;
  background: var(--panel); box-shadow: 0 10px 0 #081b33,0 24px 54px rgba(2,9,22,.5),inset 0 2px 0 rgba(255,255,255,.16);
}
.popup-card.win { background: linear-gradient(160deg,#3bbb70,#176142); }
.popup-card.fail { background: linear-gradient(160deg,#d45454,#7f2833); }
.toggle {
  min-height: 48px; border: 1px solid rgba(255,255,255,.12);
  background: rgba(3,17,35,.28); box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.toggle input {
  appearance: none; -webkit-appearance: none; position: relative;
  width: 48px; height: 27px; border: 0; border-radius: 999px;
  background: #44536a; box-shadow: inset 0 2px 4px rgba(0,0,0,.32);
  cursor: pointer; transition: background .18s ease;
}
.toggle input::after {
  content: ""; position: absolute; width: 21px; height: 21px; left: 3px; top: 3px;
  border-radius: 50%; background: linear-gradient(#fff,#d9e5f1);
  box-shadow: 0 2px 4px rgba(0,0,0,.32); transition: transform .18s var(--ease-pop);
}
.toggle input:checked { background: linear-gradient(90deg,#29b957,#66df75); }
.toggle input:checked::after { transform: translateX(21px); }
.toggle input:focus-visible { outline: 3px solid #fff2a6; outline-offset: 2px; }

@media (max-height: 440px) {
  .home-safe { gap: 4px; }
  .logo-hero { font-size: clamp(20px,7.5vh,30px); padding: 7px 18px 9px; }
  .hero-kicker { display: none; }
  .home-car-stage { height: 78px; }
  .home-actions { width: min(340px,91%); gap: 7px; }
  .home-actions .btn-play { min-height: 43px; font-size: 17px; padding: 8px; }
  .home-row .btn { min-height: 36px; padding: 7px 10px; font-size: 12px; }
  .garage-hint { display: none; }
  .garage-grid { padding-top: 1px; padding-bottom: 10px; gap: 12px; }
  .garage-card { width: 172px; height: calc(100vh - 75px); min-height: 230px; padding: 7px 8px 9px; gap: 4px; }
  .vehicle-preview { min-height: 86px; padding-bottom: 8px; }
  .vehicle-preview img { max-height: 105px; }
  .garage-card .stats { padding: 5px 7px; gap: 4px; }
  .garage-card .price { min-height: 29px; padding: 5px; }
  .page-head { grid-template-columns: 43px 1fr auto; }
  .page-title small { display: none; }
  .page-head h1 { font-size: 21px; }
  .btn-back { width: 38px; min-width: 38px; height: 38px; }
  .world-tabs { padding-bottom: 3px; }
  .world-tab { min-height: 30px; padding: 5px 10px; font-size: 11px; }
  .level-grid { width: 100%; grid-template-columns: repeat(3, min(25vw,106px)); grid-auto-rows: min(25vw,106px); gap: 9px; padding: 2px 8px 10px; }
  .lvl-card { width: 100%; }
  .lvl-num { width: 39px; height: 39px; font-size: 21px; margin-bottom: 22px; }
  .lvl-card .stars { font-size: 14px; bottom: 5px; }
  .load-inner .logo-sign { font-size: 25px; padding: 7px 20px 10px; }
  .load-tagline { margin-top: 16px; }
  .load-track { margin-top: 10px; }
}

@media (min-height: 700px) and (min-width: 1100px) {
  .home-safe { transform: scale(1.1); }
  .garage-card { height: min(330px,60vh); }
}

/* Home, showroom, and modal polish */
:root {
  --premium-panel: linear-gradient(155deg, rgba(34,78,126,.98), rgba(10,31,61,.985) 64%, rgba(7,21,43,.99));
  --premium-edge: rgba(203,235,255,.28);
  --premium-gold: #ffd34e;
  --premium-green: #55df75;
  --premium-red: #ff7474;
}

@keyframes hero-stage-in {
  from { opacity: 0; transform: translateY(16px) scale(.94); }
  to { opacity: 1; transform: none; }
}
@keyframes modal-backdrop-in {
  from { opacity: 0; backdrop-filter: blur(0); }
  to { opacity: 1; backdrop-filter: blur(7px); }
}
@keyframes modal-panel-in {
  0% { opacity: 0; transform: translateY(18px) scale(.9) rotateX(5deg); }
  70% { transform: translateY(-2px) scale(1.012); }
  100% { opacity: 1; transform: none; }
}
@keyframes emblem-pop {
  0% { opacity: 0; transform: translateY(-16px) scale(.45) rotate(-10deg); }
  72% { transform: translateY(2px) scale(1.08) rotate(2deg); }
  100% { opacity: 1; transform: none; }
}
@keyframes active-card-glow {
  0%,100% { box-shadow: 0 0 0 2px #ffc52f, 0 11px 0 #925400, 0 22px 42px rgba(255,190,40,.2), inset 0 2px 0 rgba(255,255,255,.22); }
  50% { box-shadow: 0 0 0 3px #fff0a1, 0 11px 0 #925400, 0 25px 48px rgba(255,205,65,.3), inset 0 2px 0 rgba(255,255,255,.28); }
}

#screen-home::after {
  content: ""; position: absolute; inset: auto 0 0; height: 35%;
  background: linear-gradient(transparent, rgba(5,19,38,.2));
  pointer-events: none;
}
.home-safe {
  min-height: 100%;
  justify-content: center;
  padding-top: calc(12px + var(--safe-t));
  padding-bottom: calc(13px + var(--safe-b));
}
.home-brand {
  position: relative; display: flex; justify-content: center; align-items: center;
  margin-top: 2px; animation: hero-stage-in .48s var(--ease-pop) both;
}
.home-brand::after {
  content: ""; position: absolute; left: 13%; right: 13%; bottom: -10px; height: 12px;
  border-radius: 0 0 16px 16px;
  background: linear-gradient(180deg,#ffca31,#d67e00);
  box-shadow: 0 4px 0 #754100, inset 0 1px 0 #fff0a1;
  z-index: -1;
}
.brand-rivet {
  position: absolute; top: 48%; width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%,#fff7bf,#ffc72f 50%,#af6200);
  border: 1px solid #fff1a1; box-shadow: 0 2px 0 #744000; z-index: 3;
}
.brand-rivet.left { left: 7px; }
.brand-rivet.right { right: 7px; }
.brand-tag {
  position: absolute; left: 50%; bottom: -18px; transform: translateX(-50%);
  padding: 4px 13px; border-radius: 999px; white-space: nowrap;
  color: #fff3b4; background: #0b203e; border: 1px solid rgba(255,226,111,.58);
  box-shadow: 0 3px 0 #06152b; font-size: 7px; font-weight: 900; letter-spacing: .2em;
}
.hero-kicker { margin-top: 16px; }
.home-car-stage {
  margin-top: 0;
  animation: hero-stage-in .55s .08s var(--ease-pop) both;
}
.home-vehicle-label {
  position: absolute; top: 1px; left: 50%; z-index: 3; transform: translateX(-50%);
  display: flex; align-items: center; gap: 7px; padding: 4px 9px;
  border: 1px solid rgba(255,255,255,.22); border-radius: 999px;
  background: rgba(8,29,56,.78); box-shadow: 0 3px 8px rgba(3,13,28,.22);
  white-space: nowrap; pointer-events: none;
}
.home-vehicle-label span { color: #9edbff; font-size: 6px; font-weight: 900; letter-spacing: .16em; }
.home-vehicle-label b { color: #fff2a1; font-size: 8px; letter-spacing: .1em; }
#home-car { transform-origin: 50% 82%; }
.home-pad {
  height: 22px;
  border: 1px solid rgba(255,255,255,.22);
  border-bottom-color: rgba(0,0,0,.42);
  transform: perspective(90px) rotateX(5deg);
}
.home-pad::after {
  top: 7px; height: 3px;
  box-shadow: 0 1px 0 rgba(0,0,0,.2);
}
.home-pad .pad-bolt {
  position: absolute; z-index: 3; bottom: -8px; width: 11px; height: 11px; border-radius: 3px;
  background: linear-gradient(#424b58,#202630); border: 1px solid rgba(255,255,255,.14);
}
.home-pad .pad-bolt.left { left: 16%; }
.home-pad .pad-bolt.right { right: 16%; }
.home-actions { animation: hero-stage-in .48s .16s var(--ease-pop) both; }
.home-actions .btn-play {
  letter-spacing: .11em;
  box-shadow: 0 8px 0 #0b7732, 0 16px 30px rgba(6,52,24,.38), inset 0 2px 0 rgba(255,255,255,.38);
}
.btn-ico {
  display: inline-grid; place-items: center; min-width: 25px; height: 25px; padding: 0 3px;
  border-radius: 9px; background: rgba(255,255,255,.15);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16);
  font-size: .75em; line-height: 1;
}
.home-row .btn-ico { min-width: 22px; height: 22px; border-radius: 7px; }

#garage-page {
  background:
    radial-gradient(ellipse at 50% 80%, rgba(38,125,197,.24), transparent 48%),
    linear-gradient(180deg, rgba(6,24,47,.35), rgba(5,18,37,.8)),
    url("../assets/backgrounds/bg-city.webp") center/cover no-repeat;
}
#garage-page::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 24%;
  background: linear-gradient(transparent, rgba(4,15,31,.42));
  pointer-events: none;
}
.garage-subhead {
  max-width: 980px; width: calc(100% - 28px); margin: 0 auto;
  display: flex; justify-content: center; align-items: center; gap: 12px;
}
.garage-hint { margin: 0; }
.collection-count {
  padding: 4px 9px; border-radius: 999px;
  color: #ffe89a; background: rgba(9,31,60,.72); border: 1px solid rgba(255,221,93,.26);
  font-size: 8px; font-weight: 900; letter-spacing: .12em;
}
.garage-grid {
  z-index: 1; gap: clamp(15px,2vw,24px);
  padding-top: 10px; padding-bottom: 28px;
  scroll-padding-inline: 10vw; scroll-snap-stop: always;
  scrollbar-color: rgba(255,211,78,.65) rgba(7,24,47,.35);
}
.garage-card {
  width: clamp(210px,23vw,258px); height: clamp(250px,68vh,326px);
  padding: 13px 14px 15px; border-radius: 26px;
  border-color: rgba(208,236,255,.24);
  background:
    linear-gradient(135deg,rgba(255,255,255,.1),transparent 24%),
    radial-gradient(circle at 50% 26%,rgba(97,199,255,.22),transparent 40%),
    var(--premium-panel);
  box-shadow: 0 11px 0 #07182d, 0 21px 38px rgba(3,13,29,.4), inset 0 2px 0 rgba(255,255,255,.18);
}
.garage-card::before {
  content: ""; position: absolute; inset: 7px; border-radius: 19px;
  border: 1px solid rgba(255,255,255,.07); pointer-events: none;
}
.garage-card:hover:not(:disabled) { transform: translateY(-7px) scale(1.018); }
.garage-card:active:not(:disabled) { transform: translateY(3px) scale(.992); }
.vehicle-number {
  position: absolute; right: 13px; top: 11px;
  color: rgba(212,238,255,.38); font-size: 16px; font-weight: 900; font-style: italic; letter-spacing: .04em;
}
.vehicle-badge {
  top: 12px; left: 12px; padding: 5px 9px;
  box-shadow: 0 3px 0 rgba(3,14,30,.45); font-weight: 900;
}
.garage-card:not(.locked):not(.selected) .vehicle-badge {
  color: #bfffd1; border-color: rgba(113,233,145,.35); background: rgba(19,91,52,.72);
}
.vehicle-preview {
  min-height: 120px; margin: 5px -3px 0;
  border-radius: 19px;
  background:
    radial-gradient(ellipse at 50% 72%,rgba(83,193,255,.2),transparent 54%),
    linear-gradient(180deg,rgba(108,200,255,.07),transparent);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.vehicle-preview::after {
  content: ""; position: absolute; left: 13%; right: 13%; bottom: 3px; height: 13px;
  border-radius: 50%; background: rgba(2,10,21,.5); filter: blur(3px);
}
.vehicle-preview img { max-height: 150px; z-index: 3; }
.vehicle-platform { bottom: 8px; height: 8px; filter: none; background: linear-gradient(90deg,transparent,rgba(127,211,255,.35),transparent); }
.garage-card .name { margin-top: 1px; font-size: clamp(17px,2vw,21px); }
.vehicle-series {
  margin-top: -5px; color: #94caeb; font-size: 7px; font-weight: 900; letter-spacing: .17em;
}
.garage-card .stats { border-radius: 14px; padding: 9px 10px; }
.stat-row { grid-template-columns: 46px 1fr; }
.stat-row i { height: 8px; border: 1px solid rgba(255,255,255,.07); }
.stat-grip b { background: linear-gradient(90deg,#ffc94b,#68e57d); }
.garage-card .price {
  border-radius: 14px; font-weight: 900; min-height: 38px;
  transition: filter .15s ease, transform .15s var(--ease-pop);
}
.garage-card:not(.selected):not(.locked):hover .price { filter: brightness(1.12); }
.garage-card.selected {
  transform: translateY(-4px);
  animation: active-card-glow 2.8s ease-in-out infinite;
}
.garage-card.selected .vehicle-preview {
  background:
    radial-gradient(ellipse at 50% 72%,rgba(255,216,74,.24),transparent 55%),
    linear-gradient(180deg,rgba(255,229,126,.08),transparent);
}
.garage-card.selected .vehicle-series { color: #ffe67d; }

.popup {
  background:
    radial-gradient(circle at 50% 45%,rgba(63,135,207,.14),transparent 48%),
    rgba(3,10,23,.66);
  backdrop-filter: blur(7px) saturate(.85);
  animation: modal-backdrop-in .2s ease both;
}
.popup-card {
  position: relative; isolation: isolate;
  width: min(350px,100%); padding: 27px 18px 16px; gap: 9px;
  overflow: visible;
  border: 2px solid var(--premium-edge); border-radius: 28px;
  background: var(--premium-panel);
  box-shadow: 0 11px 0 #06172d, 0 30px 70px rgba(1,7,18,.62), inset 0 2px 0 rgba(255,255,255,.2);
  animation: modal-panel-in .3s var(--ease-pop) both;
}
.popup-card::before {
  content: ""; position: absolute; inset: 7px; z-index: -1; border-radius: 20px;
  border: 1px solid rgba(255,255,255,.07); pointer-events: none;
}
.popup-card::after {
  content: ""; position: absolute; left: 16%; right: 16%; bottom: -14px; height: 16px; z-index: -2;
  border-radius: 0 0 20px 20px; background: #07182e; opacity: .72;
}
.popup-emblem {
  position: absolute; left: 50%; top: -29px; transform: translateX(-50%);
  width: 58px; height: 58px; display: grid; place-items: center;
  border-radius: 20px; color: #fff; font-size: 25px; font-weight: 900;
  background: linear-gradient(155deg,#55b9ff,#1d69b9);
  border: 2px solid rgba(255,255,255,.65);
  box-shadow: 0 6px 0 #0d417b, 0 12px 24px rgba(3,16,35,.38), inset 0 2px 0 rgba(255,255,255,.3);
  animation: emblem-pop .42s .06s var(--ease-pop) both;
}
.popup-kicker, .win-kicker {
  margin: 2px 0 -4px; text-align: center;
  color: #9edbff; font-size: 8px; font-weight: 900; letter-spacing: .24em;
}
.popup-card h2 {
  margin: 0; color: #fff; font-size: clamp(23px,3.8vw,29px); letter-spacing: .02em;
  text-shadow: 0 3px 0 rgba(3,18,38,.55);
}
.popup-subtitle, .popup-card.fail #fail-reason {
  margin: -3px 0 4px; text-align: center; color: #cbe8fa; font-size: 12px; line-height: 1.35;
}
.popup-card .btn { width: 100%; }
.popup-card .btn-play { min-height: 50px; font-size: 18px; letter-spacing: .1em; }
.popup-action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.popup-action-grid .btn, .win-row .btn { min-height: 41px; padding: 8px 10px; font-size: 11px; }
.popup-card .btn-ghost {
  min-height: 28px; color: #b8d4e8; letter-spacing: .1em; opacity: .86;
}
.settings-emblem { background: linear-gradient(155deg,#ffd963,#ef9f16); color: #5a3300; box-shadow: 0 6px 0 #a65b00,0 12px 24px rgba(3,16,35,.38),inset 0 2px 0 rgba(255,255,255,.42); }
.settings-list { display: flex; flex-direction: column; gap: 8px; }
.toggle {
  min-height: 58px; padding: 9px 12px 9px 14px; border-radius: 16px;
  background: linear-gradient(135deg,rgba(255,255,255,.08),rgba(2,15,32,.28));
}
.toggle > span { display: flex; flex-direction: column; gap: 2px; }
.toggle b { color: #fff; font-size: 13px; }
.toggle small { color: #9ec9e6; font-size: 8px; font-weight: 600; letter-spacing: .03em; }
.popup-card.win, .popup-card.fail { background: var(--premium-panel); text-align: center; }
.popup-card.win { border-color: rgba(104,240,145,.48); }
.popup-card.fail { border-color: rgba(255,123,123,.44); }
.win-emblem {
  color: #073b20; background: linear-gradient(155deg,#80f39a,#35bd62);
  box-shadow: 0 6px 0 #13813b,0 12px 24px rgba(3,16,35,.38),inset 0 2px 0 rgba(255,255,255,.42);
}
.fail-emblem {
  background: linear-gradient(155deg,#ff8e8e,#d94d58);
  box-shadow: 0 6px 0 #8f2632,0 12px 24px rgba(3,16,35,.38),inset 0 2px 0 rgba(255,255,255,.35);
}
.win-kicker { color: #a8f7bd; }
.win-stars {
  margin: -1px 0 1px; font-size: 33px; letter-spacing: 4px;
  filter: drop-shadow(0 3px 0 #a96800) drop-shadow(0 7px 8px rgba(0,0,0,.24));
}
.reward-panel {
  padding: 8px 12px; border-radius: 17px;
  background: linear-gradient(135deg,rgba(255,230,107,.13),rgba(2,16,34,.25));
  border: 1px solid rgba(255,225,101,.24);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09);
}
.reward-panel .reward { line-height: 1; margin: 3px 0; }
.reward-label { display: block; color: #bcd9ea; font-size: 7px; letter-spacing: .22em; }
.win-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.popup-card.fail #fail-reason {
  padding: 9px 11px; border-radius: 14px;
  background: rgba(93,23,35,.22); border: 1px solid rgba(255,135,135,.14);
}

@media (max-height: 440px) {
  .home-brand { margin-top: 0; }
  .brand-tag { bottom: -14px; padding: 3px 10px; }
  .hero-kicker { margin-top: 12px; }
  .home-vehicle-label { top: -2px; }
  .home-pad { height: 17px; }
  .garage-subhead { display: none; }
  .garage-grid { padding-top: 12px; padding-bottom: 12px; }
  .garage-card { height: calc(100vh - 88px); min-height: 0; width: 185px; }
  .vehicle-preview { min-height: 88px; }
  .vehicle-preview img { max-height: 108px; }
  .vehicle-series { display: none; }
  .popup-card { width: min(540px,96%); padding: 19px 13px 10px; gap: 5px; border-radius: 22px; }
  .popup-emblem { width: 42px; height: 42px; top: -21px; border-radius: 14px; font-size: 18px; }
  .popup-kicker, .win-kicker { font-size: 7px; }
  .popup-card h2 { font-size: 19px; }
  .popup-subtitle { display: none; }
  .popup-card .btn-play { min-height: 39px; font-size: 14px; padding: 7px 12px; }
  .popup-action-grid .btn, .win-row .btn { min-height: 33px; padding: 6px 8px; }
  .settings-list { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
  .toggle { min-height: 45px; padding: 6px 9px; }
  .toggle small { display: none; }
  .win-stars { font-size: 25px; }
  .reward-panel { padding: 5px 10px; }
  .reward-panel .reward { font-size: 23px; }
  .popup-card.fail #fail-reason { padding: 6px 9px; margin-bottom: 1px; }
}

@media (prefers-reduced-motion: reduce) {
  .home-clouds, .ambient i, #home-car, .logo-hero, .home-pad::before,
  .garage-card.selected, .popup, .popup-card, .popup-emblem { animation: none !important; }
  .btn, .garage-card { transition-duration: .01ms !important; }
}

@media (min-height: 700px) and (min-width: 1100px) {
  .home-safe { transform: none; }
  .garage-card { width: clamp(230px,15vw,290px); height: min(400px,62vh); }
  .vehicle-preview { min-height: 145px; }
  .vehicle-preview img { max-height: 178px; }
  .popup-card { width: min(390px,100%); padding-inline: 20px; }
}

/* Shared premium game-state popup system */
.ui-symbols {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}
.game-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.popup {
  background:
    radial-gradient(circle at 50% 43%,rgba(62,132,202,.17),transparent 47%),
    linear-gradient(rgba(3,10,23,.64),rgba(2,8,20,.76));
  backdrop-filter: blur(4px) saturate(.82);
  animation: premium-overlay-in .2s ease-out both;
}
.popup.closing {
  pointer-events: none;
  animation: premium-overlay-out .15s ease-in both;
}
.popup-card.popup-shell {
  --popup-accent: #69c8ff;
  --popup-accent-soft: rgba(105,200,255,.22);
  width: min(380px,100%);
  max-height: calc(100dvh - var(--safe-t) - var(--safe-b) - 24px);
  padding: 29px 20px 17px;
  gap: 9px;
  border: 1px solid rgba(190,224,247,.32);
  border-radius: 27px;
  overflow: visible;
  background:
    radial-gradient(circle at 50% -8%,var(--popup-accent-soft),transparent 40%),
    linear-gradient(165deg,#16375d 0%,#0b2444 48%,#071a33 100%);
  box-shadow:
    0 7px 0 #05152a,
    0 25px 65px rgba(0,5,16,.6),
    inset 0 1px 0 rgba(255,255,255,.22),
    inset 0 -1px 0 rgba(0,0,0,.3);
  animation: premium-panel-in .24s cubic-bezier(.2,.8,.25,1.08) both;
}
.popup.closing .popup-card {
  animation: premium-panel-out .15s ease-in both;
}
.popup-card.popup-shell::before {
  inset: 6px;
  border: 1px solid rgba(255,255,255,.065);
  border-radius: 21px;
  box-shadow: inset 0 15px 28px rgba(255,255,255,.025);
}
.popup-card.popup-shell::after {
  left: 22%;
  right: 22%;
  bottom: -9px;
  height: 10px;
  border-radius: 0 0 16px 16px;
  background: #041225;
  opacity: .8;
}
.popup-card.popup-shell.win {
  --popup-accent: #72e78f;
  --popup-accent-soft: rgba(73,216,116,.24);
  border-color: rgba(145,244,172,.4);
}
.popup-card.popup-shell.fail {
  --popup-accent: #ff876e;
  --popup-accent-soft: rgba(255,103,79,.2);
  border-color: rgba(255,151,128,.34);
  animation-name: fail-panel-in;
}
.popup-card.popup-shell.settings-card {
  --popup-accent: #ffd164;
  --popup-accent-soft: rgba(255,195,68,.18);
}
.popup-emblem {
  top: -25px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.68);
  color: #effaff;
  background: linear-gradient(145deg,#58b8ee,#20649f);
  box-shadow:
    0 4px 0 #0b3d70,
    0 9px 24px rgba(0,7,20,.4),
    0 0 20px rgba(81,185,246,.18),
    inset 0 2px 0 rgba(255,255,255,.38);
  animation: premium-medal-in .34s .04s cubic-bezier(.2,.8,.2,1.2) both;
}
.popup-emblem .game-icon { width: 24px; height: 24px; stroke-width: 2.4; }
.win-emblem {
  color: #07391e;
  background: linear-gradient(145deg,#9af5ac,#39c56b);
  box-shadow: 0 4px 0 #147f3d,0 9px 24px rgba(0,7,20,.4),0 0 22px rgba(74,226,114,.26),inset 0 2px 0 rgba(255,255,255,.5);
}
.fail-emblem {
  color: #5c1717;
  background: linear-gradient(145deg,#ffb06f,#f15a53);
  box-shadow: 0 4px 0 #9d302d,0 9px 24px rgba(0,7,20,.4),0 0 18px rgba(255,105,76,.2),inset 0 2px 0 rgba(255,255,255,.42);
}
.settings-emblem {
  color: #613600;
  background: linear-gradient(145deg,#ffe58c,#f5ab2d);
  box-shadow: 0 4px 0 #a9660c,0 9px 24px rgba(0,7,20,.4),0 0 18px rgba(255,192,60,.19),inset 0 2px 0 rgba(255,255,255,.48);
}
.popup-kicker,.win-kicker {
  margin: 1px 0 -3px;
  color: var(--popup-accent);
  font-size: 8px;
  letter-spacing: .24em;
  opacity: .88;
}
.popup-card.popup-shell h2 {
  margin: 0;
  font-size: clamp(24px,3.8vw,30px);
  line-height: 1.03;
  letter-spacing: .045em;
  text-shadow: 0 3px 0 rgba(1,10,25,.46);
}
.popup-subtitle,.popup-card.fail #fail-reason {
  color: #b8d3e6;
  font-size: 11px;
}
.popup-card.popup-shell .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.popup-card.popup-shell .popup-primary {
  min-height: 53px;
  border-color: rgba(255,255,255,.42);
  border-radius: 16px;
  color: #07351d;
  font-size: 17px;
  background: linear-gradient(180deg,#72ec91 0%,#38c766 58%,#22aa51 100%);
  box-shadow: 0 5px 0 #11753a,0 10px 21px rgba(3,14,31,.3),inset 0 2px 0 rgba(255,255,255,.48);
}
.popup-card.popup-shell .popup-primary::after {
  left: 12px;
  right: 12px;
  top: 3px;
  height: 35%;
  border-radius: 12px;
  background: linear-gradient(180deg,rgba(255,255,255,.28),transparent);
}
.popup-card.popup-shell .popup-primary:hover { filter: brightness(1.08) saturate(1.04); }
.popup-card.popup-shell .popup-primary:active {
  transform: translateY(4px) scale(.985);
  box-shadow: 0 1px 0 #11753a,0 4px 10px rgba(3,14,31,.28),inset 0 1px 0 rgba(255,255,255,.35);
}
.popup-card.popup-shell.fail .fail-primary {
  color: #46170e;
  background: linear-gradient(180deg,#ffb06d,#f06b4f 62%,#d94d42);
  box-shadow: 0 5px 0 #92342f,0 10px 21px rgba(3,14,31,.3),inset 0 2px 0 rgba(255,255,255,.4);
}
.popup-card.popup-shell .popup-secondary,.popup-card.popup-shell .btn-secondary {
  min-height: 40px;
  color: #d8edf9;
  border: 1px solid rgba(177,215,240,.18);
  background: linear-gradient(180deg,rgba(46,91,135,.82),rgba(20,56,91,.9));
  box-shadow: 0 3px 0 #071b35,inset 0 1px 0 rgba(255,255,255,.12);
}
.popup-card.popup-shell .popup-tertiary {
  min-height: 29px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: #9fbed3;
}
.popup-card.popup-shell .popup-tertiary .game-icon { width: 16px; height: 16px; }
.next-action { justify-content: space-between !important; padding-inline: 22px !important; }
.next-action .game-icon { width: 23px; height: 23px; }
.win-row,.popup-action-grid { gap: 9px; }
.win-stars {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  margin: -1px 0 0;
  color: #ffd64f;
  font-size: 32px;
  letter-spacing: 0;
  filter: drop-shadow(0 3px 0 #9b5b06) drop-shadow(0 5px 7px rgba(0,0,0,.24));
}
.win-stars span {
  position: relative;
  display: inline-block;
  overflow: hidden;
  margin: 0 3px;
  opacity: .18;
  color: #587087;
}
.win-stars span.earned {
  color: #ffd64f;
  opacity: 0;
  animation: premium-star-in .32s cubic-bezier(.2,.8,.2,1.35) forwards;
}
.win-stars span.earned:nth-child(1) { animation-delay: .16s; }
.win-stars span.earned:nth-child(2) { animation-delay: .28s; }
.win-stars span.earned:nth-child(3) { animation-delay: .4s; }
.win-stars span.earned::after {
  content: "";
  position: absolute;
  inset: 20% -15%;
  background: linear-gradient(105deg,transparent 35%,rgba(255,255,255,.85) 50%,transparent 65%);
  transform: translateX(-150%);
  animation: premium-star-shine .42s .55s ease-out forwards;
  clip-path: polygon(50% 0,61% 36%,100% 38%,69% 60%,80% 100%,50% 75%,20% 100%,31% 60%,0 38%,39% 36%);
}
.reward-panel {
  position: relative;
  min-height: 67px;
  padding: 8px 16px 7px;
  border: 1px solid rgba(255,218,91,.25);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 45%,rgba(255,218,78,.16),transparent 58%),
    linear-gradient(150deg,rgba(255,232,128,.1),rgba(3,17,36,.3));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09),0 7px 20px rgba(1,9,22,.16);
}
.reward-panel .reward {
  margin: 3px 0 2px;
  color: #ffe36e;
  font-size: 31px;
  text-shadow: 0 3px 0 #86520d,0 0 14px rgba(255,204,65,.25);
}
.reward-panel .coin-glyph.lg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 0 8px rgba(255,203,55,.35));
}
.reward-label { color: #aac6da; font-size: 7px; }
.emblem-spark {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ffe574;
  box-shadow: 0 0 7px #ffdd51;
  animation: emblem-spark 1.1s .35s ease-out both;
}
.emblem-spark.s1 { left: -9px; top: 8px; }
.emblem-spark.s2 { right: -10px; top: 18px; animation-delay: .44s; }
.emblem-spark.s3 { right: 1px; top: -8px; animation-delay: .53s; }
.popup-celebration {
  position: absolute;
  inset: -35px -24px;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}
.popup-confetti,.coin-flight {
  position: absolute;
  pointer-events: none;
}
.popup-confetti {
  top: 12%;
  width: 5px;
  height: 10px;
  border-radius: 3px;
  background: var(--confetti,#ffd75b);
  animation: popup-confetti-fall .75s ease-out forwards;
}
.coin-flight {
  left: 50%;
  top: 56%;
  width: 11px;
  height: 11px;
  border: 2px solid #ffe67b;
  border-radius: 50%;
  background: #f7b820;
  box-shadow: 0 0 8px rgba(255,209,68,.5);
  animation: popup-coin-flight .72s var(--delay,0s) cubic-bezier(.2,.7,.25,1) forwards;
}
.popup-crack {
  position: absolute;
  right: 19px;
  top: 18px;
  width: 35px;
  height: 32px;
  opacity: .15;
  background:
    linear-gradient(125deg,transparent 45%,#ffb293 47% 51%,transparent 53%) 0 0/18px 20px,
    linear-gradient(55deg,transparent 46%,#ffb293 48% 52%,transparent 54%) 14px 12px/20px 20px;
}
.settings-list { gap: 8px; }
.settings-list .toggle {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  min-height: 56px;
  padding: 8px 11px;
  border: 1px solid rgba(169,211,238,.13);
  background: linear-gradient(135deg,rgba(255,255,255,.065),rgba(2,15,32,.27));
}
.setting-icon { color: #f7c75a; width: 22px; height: 22px; }
.settings-list .toggle input {
  box-shadow: inset 0 2px 5px rgba(0,0,0,.34),0 1px 0 rgba(255,255,255,.1);
}
.settings-list .toggle input:checked {
  background: linear-gradient(90deg,#25ad57,#69df7d);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.18),0 0 10px rgba(63,211,102,.17);
}

/* Shared variants for compact confirmations, unlocks, purchases and notices. */
.popup-card.confirm,.popup-card.purchase,.popup-card.unlock,.popup-card.reward-card,
.popup-card.info,.popup-card.warning,.popup-card.error {
  width: min(360px,100%);
}
.popup-card.unlock,.popup-card.reward-card { --popup-accent: #ffd65d; --popup-accent-soft: rgba(255,205,67,.2); }
.popup-card.warning,.popup-card.error { --popup-accent: #ff8d72; --popup-accent-soft: rgba(255,104,77,.18); }
.popup-card.confirm { --popup-accent: #79cfff; --popup-accent-soft: rgba(84,180,240,.16); }

@keyframes premium-overlay-in {
  from { opacity: 0; backdrop-filter: blur(0) saturate(1); }
  to { opacity: 1; }
}
@keyframes premium-overlay-out { to { opacity: 0; } }
@keyframes premium-panel-in {
  from { opacity: 0; transform: translateY(13px) scale(.94); }
  to { opacity: 1; transform: none; }
}
@keyframes premium-panel-out { to { opacity: 0; transform: translateY(5px) scale(.97); } }
@keyframes premium-medal-in {
  from { opacity: 0; transform: translateX(-50%) scale(.62) rotate(-8deg); }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}
@keyframes premium-star-in {
  0% { opacity: 0; transform: scale(.25) rotate(-15deg); }
  68% { opacity: 1; transform: scale(1.18) rotate(4deg); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes premium-star-shine { to { transform: translateX(150%); } }
@keyframes emblem-spark {
  from { opacity: 0; transform: scale(.2); }
  45% { opacity: 1; }
  to { opacity: 0; transform: translateY(-12px) scale(1.2); }
}
@keyframes popup-confetti-fall {
  from { opacity: 0; transform: translateY(-16px) rotate(0); }
  20% { opacity: 1; }
  to { opacity: 0; transform: translate(var(--drift,0),100px) rotate(210deg); }
}
@keyframes popup-coin-flight {
  0% { opacity: 0; transform: translate(-50%,0) scale(.5); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--coin-x,120px)),-145px) scale(.28); }
}
@keyframes fail-panel-in {
  0% { opacity: 0; transform: translateY(12px) scale(.95); }
  45% { transform: translateX(-3px) scale(1); }
  65% { transform: translateX(2px); }
  100% { opacity: 1; transform: none; }
}

@media (max-height: 440px) {
  .popup { padding-top: calc(5px + var(--safe-t)); padding-bottom: calc(5px + var(--safe-b)); }
  .popup-card.popup-shell {
    width: min(430px,95%);
    padding: 18px 13px 9px;
    gap: 4px;
    border-radius: 20px;
  }
  .popup-card.popup-shell::before { inset: 4px; border-radius: 16px; }
  .popup-emblem { width: 38px; height: 38px; top: -19px; }
  .popup-emblem .game-icon { width: 19px; height: 19px; }
  .popup-card.popup-shell h2 { font-size: 19px; }
  .popup-kicker,.win-kicker { font-size: 6.5px; }
  .popup-subtitle { display: none; }
  .popup-card.popup-shell .popup-primary { min-height: 37px; font-size: 13px; border-radius: 12px; }
  .popup-card.popup-shell .popup-secondary,.popup-card.popup-shell .btn-secondary { min-height: 31px; padding: 5px 8px; font-size: 10px; }
  .popup-card.popup-shell .game-icon { width: 16px; height: 16px; }
  .win-stars { min-height: 27px; font-size: 24px; }
  .reward-panel { min-height: 45px; padding: 4px 9px; border-radius: 13px; }
  .reward-panel .reward { margin: 1px 0; font-size: 22px; }
  .reward-panel .coin-glyph.lg { width: 21px; height: 21px; }
  .settings-list { grid-template-columns: 1fr 1fr; gap: 6px; }
  .settings-list .toggle { grid-template-columns: 20px 1fr auto; min-height: 41px; padding: 5px 7px; gap: 6px; }
  .settings-list .toggle small { display: none; }
  .setting-icon { width: 17px !important; height: 17px !important; }
  .toggle input { width: 42px; height: 24px; }
  .toggle input::after { width: 18px; height: 18px; }
  .toggle input:checked::after { transform: translateX(18px); }
  .popup-card.fail #fail-reason { padding: 5px 8px; margin: -1px 0 1px; }
}

@media (prefers-reduced-motion: reduce) {
  .popup-confetti,.coin-flight,.win-stars span.earned,.win-stars span.earned::after,
  .emblem-spark,.popup.closing .popup-card { animation: none !important; }
  .win-stars span.earned { opacity: 1; }
}

/* Premium garage carousel */
.garage-carousel {
  --garage-card-w: clamp(210px,23vw,258px);
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  width: min(100%,1040px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0,1fr);
  align-items: center;
  gap: 0;
}
.garage-grid {
  min-width: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 10px calc((100% - var(--garage-card-w))/2) 22px;
  display: flex;
  align-items: center;
  gap: clamp(14px,2vw,24px);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-behavior: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: calc((100% - var(--garage-card-w))/2);
  scrollbar-width: none !important;
  scrollbar-color: transparent transparent !important;
  touch-action: pan-x;
  cursor: grab;
  user-select: none;
  -webkit-overflow-scrolling: touch;
}
.garage-grid::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}
.garage-grid.grabbing {
  cursor: grabbing;
  scroll-behavior: auto;
  scroll-snap-type: none;
}
.garage-grid.settling { scroll-snap-type: none; }
.garage-arrow {
  position: relative;
  z-index: 4;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(186,224,246,.25);
  border-radius: 50%;
  color: #d7efff;
  background:
    radial-gradient(circle at 42% 30%,rgba(255,255,255,.17),transparent 38%),
    linear-gradient(155deg,rgba(42,99,151,.92),rgba(11,43,78,.96));
  box-shadow: 0 4px 0 #06172d,0 9px 22px rgba(2,10,24,.3),inset 0 1px 0 rgba(255,255,255,.17);
  cursor: pointer;
  transition: transform .16s var(--ease-pop),filter .16s ease,opacity .16s ease;
}
.garage-arrow.prev .game-icon { transform: rotate(180deg); }
.garage-arrow:hover:not(:disabled) { transform: translateY(-2px) scale(1.04); filter: brightness(1.12); }
.garage-arrow:active:not(:disabled) { transform: translateY(3px) scale(.96); box-shadow: 0 1px 0 #06172d; }
.garage-arrow:disabled { opacity: .22; cursor: default; filter: saturate(.5); }
.garage-card {
  flex: 0 0 var(--garage-card-w);
  width: var(--garage-card-w);
  scroll-snap-align: center;
  scroll-snap-stop: always;
  opacity: .8;
  transform: scale(.94);
  transform-origin: center;
  transition:
    transform .24s cubic-bezier(.2,.75,.2,1),
    opacity .2s ease,
    filter .2s ease,
    box-shadow .24s ease,
    border-color .2s ease;
}
.garage-card:hover:not(.selected) { transform: translateY(-3px) scale(.965); opacity: .92; }
.garage-card.selected {
  z-index: 3;
  opacity: 1;
  transform: translateY(-4px) scale(1.035);
  border-color: #ffe98a;
  box-shadow:
    0 0 0 2px #ffc934,
    0 11px 0 #8d5100,
    0 23px 44px rgba(255,190,40,.24),
    inset 0 2px 0 rgba(255,255,255,.25);
}
.garage-card.selected .vehicle-badge {
  color: #4d2d00;
  background: linear-gradient(180deg,#fff4ad,#ffca37);
  border-color: #fff3ad;
  box-shadow: 0 3px 0 #a66000,0 7px 13px rgba(48,27,0,.2);
}
.garage-card:not(.locked):not(.selected) .vehicle-badge {
  color: #caffd6;
  background: rgba(20,84,51,.76);
  border-color: rgba(126,231,153,.3);
}
.garage-card.locked {
  opacity: .72;
  filter: saturate(.66) brightness(.82);
  border-color: rgba(175,201,221,.16);
  background:
    radial-gradient(circle at 50% 24%,rgba(116,146,172,.1),transparent 40%),
    linear-gradient(165deg,rgba(20,43,68,.96),rgba(8,24,43,.98));
}
.garage-card.locked .vehicle-badge {
  color: #d5e1eb;
  background: rgba(12,27,45,.9);
  border-color: rgba(190,211,226,.2);
}
.garage-card.locked .vehicle-preview img {
  opacity: .82;
  filter: saturate(.55) brightness(.82) drop-shadow(0 9px 7px rgba(3,12,25,.34));
}
.garage-card.unaffordable {
  cursor: pointer;
  opacity: .68;
  filter: saturate(.62) brightness(.8);
}
.garage-card.unaffordable .price {
  color: #ffe49a;
  background: linear-gradient(180deg,#4f6175,#2b3c52);
  border-color: rgba(255,218,111,.18);
  box-shadow: 0 4px 0 #18283b,inset 0 1px 0 rgba(255,255,255,.12);
}

@media (max-height: 440px) {
  .garage-carousel {
    --garage-card-w: 185px;
    width: 100%;
    grid-template-columns: minmax(0,1fr);
    gap: 0;
  }
  .garage-arrow { width: 34px; height: 34px; }
  .garage-arrow .game-icon { width: 17px; height: 17px; }
  .garage-grid {
    padding-top: 9px;
    padding-bottom: 10px;
    gap: 13px;
  }
  .garage-card {
    width: var(--garage-card-w);
    height: calc(100vh - 88px);
    min-height: 0;
  }
}

@media (min-height: 700px) and (min-width: 1100px) {
  .garage-carousel { --garage-card-w: clamp(240px,20vw,300px); }
  .garage-card { width: var(--garage-card-w); height: min(400px,62vh); }
}

@media (prefers-reduced-motion: reduce) {
  .garage-grid { scroll-behavior: auto; }
  .garage-card,.garage-arrow { transition-duration: .01ms !important; }
}

/* Premium paged world map */
.map-progress {
  width: min(620px,calc(100% - 24px));
  margin: -2px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #cfeaff;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .13em;
}
.map-progress span {
  padding: 5px 10px;
  border: 1px solid rgba(180,222,247,.16);
  border-radius: 999px;
  background: rgba(7,29,55,.66);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
#world-stars { color: #ffe480; border-color: rgba(255,218,83,.2); }
.level-map-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: min(760px,100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0,1fr);
  align-items: center;
  gap: 0;
}
.level-map-stage::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 11%;
  right: 11%;
  top: 50%;
  height: 8px;
  border-radius: 8px;
  background:
    repeating-linear-gradient(90deg,#f6d44e 0 15px,transparent 15px 28px) center/100% 2px no-repeat,
    linear-gradient(180deg,#596575,#29323d);
  box-shadow: 0 4px 0 rgba(15,24,34,.36),inset 0 1px 0 rgba(255,255,255,.2);
  opacity: .62;
}
.level-grid {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  display: block;
  overflow: hidden;
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
}
.level-grid.dragging { cursor: grabbing; }
.level-page-track {
  width: 100%;
  height: 100%;
  display: flex;
  will-change: transform;
  transition: transform .3s cubic-bezier(.2,.78,.2,1);
}
.level-page-track.no-transition { transition: none; }
.level-page-panel {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  padding: 8px 10px 13px;
  display: grid;
  grid-template-columns: repeat(3,minmax(94px,148px));
  grid-template-rows: repeat(2,minmax(94px,148px));
  justify-content: center;
  align-content: center;
  gap: clamp(10px,1.5vw,16px);
}
.level-grid.page-enter-right { animation: map-page-right .22s ease-out both; }
.level-grid.page-enter-left { animation: map-page-left .22s ease-out both; }
.map-page-arrow {
  position: relative;
  z-index: 3;
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(188,226,249,.25);
  border-radius: 50%;
  color: #dff5ff;
  background: linear-gradient(155deg,rgba(48,112,171,.94),rgba(14,51,91,.97));
  box-shadow: 0 4px 0 #071a33,0 9px 18px rgba(2,12,26,.28),inset 0 1px 0 rgba(255,255,255,.18);
  cursor: pointer;
  transition: transform .15s var(--ease-pop),filter .15s ease,opacity .15s ease;
}
.map-page-arrow.prev .game-icon { transform: rotate(180deg); }
.map-page-arrow:hover:not(:disabled) { transform: translateY(-2px) scale(1.04); filter: brightness(1.12); }
.map-page-arrow:active:not(:disabled) { transform: translateY(3px) scale(.96); box-shadow: 0 1px 0 #071a33; }
.map-page-arrow:disabled { opacity: .2; cursor: default; }
.level-pagination {
  min-height: 19px;
  margin-top: -5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: rgba(215,239,253,.76);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .17em;
}
.level-page-dots { display: flex; align-items: center; gap: 5px; }
.level-page-dots span {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(184,217,238,.3);
  box-shadow: inset 0 1px 1px rgba(0,0,0,.25);
  transition: width .18s ease,background .18s ease;
}
.level-page-dots span.on {
  width: 19px;
  border-radius: 8px;
  background: linear-gradient(90deg,#ffd84d,#ffb625);
  box-shadow: 0 0 8px rgba(255,197,42,.25);
}
.world-tabs {
  align-items: center;
  gap: 7px;
}
.world-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 14px;
  color: #d8effd;
  opacity: .86;
}
.world-tab-icon {
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(4,20,39,.26);
  font-size: 12px;
}
.world-tab.on {
  opacity: 1;
  transform: translateY(-1px);
}
.world-tab.on .world-tab-icon {
  background: rgba(255,255,255,.28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.32);
}
.world-tab.locked {
  position: relative;
  opacity: .56;
  filter: saturate(.55);
}
.world-tab-lock,.level-lock-icon {
  position: relative;
  display: inline-block;
  width: 9px;
  height: 7px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}
.world-tab-lock::before,.level-lock-icon::before {
  content: "";
  position: absolute;
  left: 1px;
  top: -6px;
  width: 5px;
  height: 6px;
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
}
.lvl-card {
  border-width: 1px;
  border-color: rgba(207,235,253,.25);
  background: #173758;
  box-shadow: 0 7px 0 #0a1b31,0 13px 24px rgba(3,14,31,.3),inset 0 1px 0 rgba(255,255,255,.18);
}
.lvl-card:nth-child(2) { transform: translateY(-3px); }
.lvl-card:nth-child(3) { transform: translateY(2px); }
.lvl-card:nth-child(4) { transform: translateY(3px); }
.lvl-card:nth-child(5) { transform: translateY(-2px); }
.lvl-card.current {
  transform: translateY(-4px) scale(1.055);
  border-color: #fff0a0;
  box-shadow: 0 0 0 2px #ffc72e,0 8px 0 #9d5b00,0 16px 27px rgba(255,188,36,.23),inset 0 1px 0 rgba(255,255,255,.24);
}
.lvl-card.done:not(.current) {
  border-color: rgba(111,226,144,.38);
  box-shadow: 0 7px 0 #0a3b2b,0 13px 23px rgba(3,23,28,.28),inset 0 1px 0 rgba(255,255,255,.17);
}
.lvl-card.done:not(.current)::after {
  content: "✓";
  position: absolute;
  z-index: 4;
  right: 8px;
  top: 8px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #073820;
  background: linear-gradient(#95f0a9,#46cc70);
  box-shadow: 0 2px 0 #187f42;
  font-size: 11px;
  font-weight: 900;
}
.lvl-card.locked {
  opacity: .76;
  filter: saturate(.4) brightness(.62);
  border-color: rgba(190,214,231,.13);
}
.lvl-card.locked .lvl-num {
  color: #dbe9f4;
  border-color: rgba(220,237,247,.2);
}
.lvl-card .lock-mark {
  display: flex;
  align-items: center;
  gap: 5px;
}
.level-lock-icon { color: #dce8f2; }
.lvl-card.world-city .lvl-road { transform: rotate(calc((var(--node-index) - 2.5) * 1deg)); }
.lvl-card.world-city:nth-child(odd) .lvl-art::before { transform: scaleX(-1); }

@keyframes map-page-right {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: none; }
}
@keyframes map-page-left {
  from { opacity: 0; transform: translateX(-24px); }
  to { opacity: 1; transform: none; }
}

@media (max-height: 440px) {
  .map-progress { gap: 6px; }
  .map-progress span { padding: 3px 8px; font-size: 6.5px; }
  .level-map-stage { width: min(680px,100%); grid-template-columns: minmax(0,1fr); gap: 0; }
  .map-page-arrow { width: 31px; height: 31px; }
  .map-page-arrow .game-icon { width: 16px; height: 16px; }
  .level-grid {
    padding: 0;
  }
  .level-page-panel {
    grid-template-columns: repeat(3,min(23vw,98px));
    grid-template-rows: repeat(2,min(23vw,98px));
    gap: 8px;
    padding: 3px 5px 6px;
  }
  .level-pagination { min-height: 14px; margin-top: -6px; font-size: 6px; }
  .level-page-dots span { width: 6px; height: 6px; }
  .level-page-dots span.on { width: 16px; }
  .world-tab { min-height: 28px; padding: 4px 8px; font-size: 9px; border-radius: 11px; }
  .world-tab-icon { min-width: 17px; height: 17px; font-size: 10px; }
  .lvl-num { width: 36px; height: 36px; font-size: 19px; margin-bottom: 20px; }
  .lvl-card .stars { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .level-grid.page-enter-left,.level-grid.page-enter-right { animation: none; }
  .level-page-dots span,.level-page-track { transition-duration: .01ms !important; }
}

/* Collectible garage showroom */
#garage-page::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 5%;
  right: 5%;
  bottom: 2%;
  height: 42%;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 82%,rgba(68,176,238,.24),transparent 48%),
    linear-gradient(90deg,transparent 8%,rgba(137,215,255,.08) 50%,transparent 92%);
  clip-path: polygon(7% 100%,20% 16%,80% 16%,93% 100%);
  opacity: .78;
}
.garage-subhead {
  position: relative;
  z-index: 3;
  justify-content: center;
}
.garage-hint {
  color: rgba(204,235,252,.66);
  font-size: 8px;
  letter-spacing: .16em;
}
.garage-focus-label {
  min-width: 170px;
  padding: 5px 12px;
  border: 1px solid rgba(135,210,250,.23);
  border-radius: 999px;
  color: #dff5ff;
  background: linear-gradient(180deg,rgba(26,71,111,.86),rgba(8,34,64,.9));
  box-shadow: 0 3px 0 rgba(3,17,34,.52),inset 0 1px 0 rgba(255,255,255,.12);
  text-align: center;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .12em;
}
.collection-count {
  padding: 5px 10px;
  box-shadow: 0 3px 0 rgba(3,17,34,.5),inset 0 1px 0 rgba(255,255,255,.09);
}
.garage-carousel { width: min(100%,1120px); }
.garage-grid {
  gap: clamp(18px,2.3vw,30px);
  mask-image: linear-gradient(90deg,transparent 0,#000 7%,#000 93%,transparent 100%);
  -webkit-mask-image: linear-gradient(90deg,transparent 0,#000 7%,#000 93%,transparent 100%);
}
.garage-card {
  opacity: .64;
  transform: scale(.91);
  border-radius: 28px 28px 24px 24px;
  border-color: rgba(195,228,249,.2);
  background:
    linear-gradient(145deg,rgba(255,255,255,.11),transparent 22%),
    radial-gradient(ellipse at 50% 24%,rgba(77,185,245,.22),transparent 43%),
    linear-gradient(165deg,rgba(29,68,109,.98),rgba(8,30,58,.99) 66%,rgba(5,20,40,.99));
  box-shadow:
    0 9px 0 #06172c,
    0 18px 34px rgba(2,11,25,.36),
    inset 0 2px 0 rgba(255,255,255,.15);
}
.garage-card.focused {
  z-index: 4;
  opacity: 1;
  transform: translateY(-4px) scale(1.025);
  filter: saturate(1.04);
  border-color: rgba(173,225,255,.48);
  box-shadow:
    0 0 0 1px rgba(116,204,255,.22),
    0 11px 0 #082744,
    0 24px 46px rgba(1,15,34,.48),
    inset 0 2px 0 rgba(255,255,255,.22);
}
.garage-card.selected:not(.focused) {
  z-index: 2;
  opacity: .82;
  transform: scale(.94);
}
.garage-card.selected.focused {
  transform: translateY(-6px) scale(1.045);
  border-color: #fff0a0;
  background:
    linear-gradient(145deg,rgba(255,255,255,.15),transparent 23%),
    radial-gradient(ellipse at 50% 25%,rgba(255,213,65,.27),transparent 45%),
    linear-gradient(165deg,rgba(42,76,109,.99),rgba(11,35,62,.99) 66%,rgba(7,23,43,.99));
  box-shadow:
    0 0 0 2px #ffc934,
    0 11px 0 #8d5100,
    0 25px 48px rgba(255,186,36,.23),
    inset 0 2px 0 rgba(255,255,255,.27);
}
.garage-card.focused .card-shine {
  animation: showroom-glint 4.6s ease-in-out infinite;
}
.garage-card .vehicle-badge {
  min-width: 50px;
  text-align: center;
  letter-spacing: .13em;
}
.garage-card.selected .vehicle-badge { color: #4b2b00; }
.garage-card.locked .vehicle-badge::before {
  content: "◆";
  margin-right: 4px;
  color: #9cb0c2;
  font-size: 7px;
}
.vehicle-preview {
  overflow: hidden;
  border: 1px solid rgba(186,225,247,.08);
  box-shadow: inset 0 -22px 28px rgba(1,12,27,.18);
}
.vehicle-preview img {
  transform: scale(var(--vehicle-card-scale,1));
  transform-origin: center bottom;
}
.garage-card:hover .vehicle-preview img,
.garage-card.focused .vehicle-preview img {
  transform: translateY(-2px) scale(var(--vehicle-card-scale,1));
}
.garage-card.focused .vehicle-platform {
  background: linear-gradient(90deg,transparent,rgba(105,210,255,.55),transparent);
  box-shadow: 0 0 12px rgba(72,191,255,.2);
}
.garage-card.selected.focused .vehicle-platform {
  background: linear-gradient(90deg,transparent,rgba(255,215,72,.68),transparent);
  box-shadow: 0 0 13px rgba(255,202,44,.25);
}
.garage-card .name {
  color: #f4fbff;
  text-shadow: 0 2px 0 rgba(0,0,0,.38);
}
.vehicle-series {
  min-height: 9px;
  color: #8fc8eb;
}
.garage-card .stats {
  gap: 7px;
  border-color: rgba(171,218,245,.12);
  background: linear-gradient(180deg,rgba(3,20,39,.44),rgba(3,15,30,.3));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.stat-row span { color: #d0e9f8; font-size: 7px; }
.stat-row i {
  height: 7px;
  border-color: rgba(185,224,246,.1);
  background: rgba(1,12,26,.7);
}
.stat-row b {
  background: linear-gradient(90deg,#37aef3,#7edfff);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5),0 0 7px rgba(60,185,250,.2);
}
.stat-grip b { background: linear-gradient(90deg,#ffc84a,#6ee184); }
.garage-card .price {
  position: relative;
  overflow: hidden;
  letter-spacing: .12em;
  background: linear-gradient(180deg,#43b8ff,#216fc1);
  box-shadow: 0 4px 0 #123d70,inset 0 1px 0 rgba(255,255,255,.28);
}
.garage-card .vehicle-action {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: inherit;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: transform .13s var(--ease-pop),filter .13s ease,box-shadow .13s ease;
}
.garage-card .vehicle-action:hover { filter: brightness(1.1); }
.garage-card .vehicle-action:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #123d70,inset 0 1px 0 rgba(255,255,255,.18);
}
.garage-card .vehicle-action:focus-visible {
  outline: 3px solid #fff1a0;
  outline-offset: 2px;
}
.garage-card.purchase-denied .vehicle-action {
  animation: purchase-denied .24s ease-out;
}
.garage-card.selected .price {
  color: #4a2b00;
  background: linear-gradient(180deg,#fff29c,#ffc72e);
  box-shadow: 0 4px 0 #9c5900,inset 0 1px 0 rgba(255,255,255,.5);
}
.garage-card.locked.focused {
  opacity: .92;
  filter: saturate(.78) brightness(.9);
}
.garage-card.locked.focused .price {
  color: #ffe9a7;
  border-color: rgba(255,220,105,.3);
  background: linear-gradient(180deg,#5c7187,#31475e);
}

@keyframes showroom-glint {
  0%,70% { transform: translateX(0) rotate(22deg); opacity: 0; }
  78% { opacity: .8; }
  94%,100% { transform: translateX(500%) rotate(22deg); opacity: 0; }
}
@keyframes purchase-denied {
  0%,100% { transform: translateX(0); }
  30% { transform: translateX(-5px); }
  65% { transform: translateX(5px); }
}

@media (max-height: 440px) {
  .garage-subhead {
    display: flex;
    min-height: 18px;
    gap: 6px;
  }
  .garage-hint { display: none; }
  .garage-focus-label { min-width: 150px; padding: 3px 8px; font-size: 6.5px; }
  .collection-count { padding: 3px 7px; font-size: 6.5px; }
  .garage-card { height: calc(100vh - 108px); }
  .garage-card .stats { gap: 4px; padding: 5px 7px; }
  .vehicle-preview { margin-top: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .garage-card.focused .card-shine { animation: none; }
  .garage-card.purchase-denied .vehicle-action { animation: none; }
}

/* Premium Home and Loading identity */
.game-logo {
  display: block;
  object-fit: contain;
  object-position: center;
  user-select: none;
  pointer-events: none;
}
.home-brand {
  min-height: 0;
  margin: -3px 0 0;
}
.home-brand::after { display: none; }
.home-logo {
  width: clamp(210px,31vw,360px);
  height: auto;
  filter:
    drop-shadow(0 8px 0 rgba(107,57,0,.32))
    drop-shadow(0 18px 20px rgba(3,15,31,.3));
  animation: premium-logo-float 4.8s ease-in-out infinite;
}
.home-brand .brand-tag {
  bottom: -7px;
  padding: 4px 15px;
  color: #fff1a4;
  border-color: rgba(255,221,88,.5);
  background: linear-gradient(180deg,rgba(24,64,105,.96),rgba(6,27,55,.98));
  box-shadow: 0 3px 0 #06152b,0 7px 14px rgba(3,14,29,.22),inset 0 1px 0 rgba(255,255,255,.13);
}
.hero-kicker { margin-top: 8px; }
.home-actions {
  width: min(400px,94%);
  gap: 10px;
}
.home-actions .btn {
  isolation: isolate;
  border-width: 2px;
  overflow: visible;
}
.home-actions .btn::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 4px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 12px;
  pointer-events: none;
}
.home-primary {
  min-height: 59px !important;
  display: grid;
  grid-template-columns: 39px 1fr 24px;
  align-items: center;
  gap: 9px;
  padding: 8px 15px !important;
  color: #432800;
  border-color: #fff1a3 !important;
  background:
    radial-gradient(circle at 25% 0,rgba(255,255,255,.38),transparent 34%),
    linear-gradient(180deg,#fff17a,#ffc52b 57%,#f39b0b) !important;
  box-shadow:
    0 7px 0 #a85e00,
    0 15px 28px rgba(92,49,0,.3),
    inset 0 2px 0 rgba(255,255,255,.55) !important;
  text-shadow: 0 1px 0 rgba(255,255,255,.45) !important;
}
.home-primary:hover {
  filter: brightness(1.06) saturate(1.06);
  transform: translateY(-3px) scale(1.012);
}
.home-primary:active {
  transform: translateY(4px) scale(.985);
  box-shadow: 0 2px 0 #a85e00,0 7px 12px rgba(92,49,0,.22) !important;
}
.home-primary .btn-ico {
  width: 37px;
  height: 37px;
  padding: 0;
  color: #fff8c7;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 12px;
  background: linear-gradient(160deg,#ff824c,#e63d25);
  box-shadow: 0 3px 0 #9d2619,inset 0 1px 0 rgba(255,255,255,.3);
}
.home-primary .btn-ico .game-icon { width: 21px; height: 21px; fill: currentColor; }
.home-btn-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}
.home-btn-copy b { font-size: 1em; letter-spacing: .12em; }
.home-btn-copy small {
  margin-top: 4px;
  font-size: 6px;
  font-weight: 900;
  letter-spacing: .2em;
  opacity: .68;
}
.home-btn-arrow {
  font-size: 29px;
  line-height: 1;
  transform: translateY(-1px);
}
.home-secondary {
  min-height: 48px !important;
  display: grid;
  grid-template-columns: 31px 1fr;
  align-items: center;
  gap: 8px;
  padding: 7px 11px !important;
  background:
    linear-gradient(145deg,rgba(255,255,255,.12),transparent 25%),
    linear-gradient(180deg,#4ab8ff,#2478cb 62%,#174f93) !important;
  border-color: rgba(200,235,255,.45) !important;
  box-shadow: 0 6px 0 #113b70,0 12px 22px rgba(5,27,59,.3),inset 0 2px 0 rgba(255,255,255,.25) !important;
}
.home-secondary .btn-ico {
  min-width: 29px;
  width: 29px;
  height: 29px;
  padding: 0;
  color: #e8f8ff;
  border: 1px solid rgba(255,255,255,.23);
  border-radius: 9px;
  background: rgba(5,38,76,.3);
}
.home-secondary .btn-ico .game-icon { width: 17px; height: 17px; }
.home-secondary .home-btn-copy b { font-size: 12px; color: #fff; }
.home-secondary .home-btn-copy small { color: #c6ebff; opacity: .78; }
#btn-home-settings .game-icon { width: 22px; height: 22px; }

.load-inner {
  position: relative;
  isolation: isolate;
}
.load-inner::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 5%;
  right: 5%;
  top: -4%;
  height: 62%;
  border-radius: 50%;
  background: radial-gradient(ellipse,rgba(255,221,91,.16),rgba(55,164,231,.1) 38%,transparent 70%);
  filter: blur(3px);
}
.loading-logo {
  width: min(430px,64vw);
  height: auto;
  margin: 0 auto;
  filter:
    drop-shadow(0 8px 0 rgba(105,55,0,.28))
    drop-shadow(0 20px 24px rgba(3,14,29,.34));
  animation: premium-logo-arrive .5s var(--ease-pop) both;
}
.load-tagline {
  margin-top: 8px;
  color: #fff4bd;
  text-shadow: 0 2px 0 rgba(5,25,48,.48),0 0 12px rgba(255,210,66,.16);
}
.load-track { margin-top: 18px; }
.load-track .progress-track {
  border-color: rgba(255,224,112,.3);
  background: linear-gradient(180deg,#334456,#1d2835);
  box-shadow: 0 7px 0 #4a321d,0 13px 21px rgba(4,15,31,.34),inset 0 2px 4px rgba(0,0,0,.42);
}
.progress-fill {
  background: linear-gradient(90deg,#ffb928,#ffe66d 52%,#60dcff);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.45),0 0 10px rgba(255,199,47,.22);
}
#load-text {
  color: #e9f8ff;
  border-color: rgba(166,220,250,.2);
  background: linear-gradient(180deg,rgba(21,61,99,.82),rgba(7,31,61,.88));
  box-shadow: 0 3px 0 rgba(4,20,40,.5),inset 0 1px 0 rgba(255,255,255,.1);
}

@keyframes premium-logo-float {
  0%,100% { transform: translateY(0) rotate(-.4deg); }
  50% { transform: translateY(-4px) rotate(.35deg); }
}
@keyframes premium-logo-arrive {
  from { opacity: 0; transform: translateY(10px) scale(.9); }
  70% { transform: translateY(-2px) scale(1.018); }
  to { opacity: 1; transform: none; }
}

@media (max-height: 440px) {
  .home-logo { width: clamp(164px,25vw,205px); }
  .home-brand .brand-tag { bottom: -5px; padding: 3px 10px; font-size: 5.5px; }
  .home-actions { width: min(350px,91%); gap: 7px; }
  .home-primary { min-height: 43px !important; grid-template-columns: 29px 1fr 18px; padding: 5px 10px !important; }
  .home-primary .btn-ico { width: 28px; height: 28px; border-radius: 9px; }
  .home-primary .btn-ico .game-icon { width: 16px; height: 16px; }
  .home-primary .home-btn-copy b { font-size: 16px; }
  .home-secondary { min-height: 36px !important; grid-template-columns: 24px 1fr; padding: 4px 8px !important; }
  .home-secondary .btn-ico { min-width: 23px; width: 23px; height: 23px; border-radius: 7px; }
  .home-secondary .btn-ico .game-icon { width: 14px; height: 14px; }
  .home-secondary .home-btn-copy b { font-size: 10px; }
  .home-btn-copy small { display: none; }
  .loading-logo { width: min(220px,42vw); }
  .load-tagline { margin-top: 3px; font-size: 7px; }
  .load-track { margin-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .home-logo,.loading-logo { animation: none; }
}

/* Phone-safe responsive composition */
html,body,#app {
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: 100%;
  max-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}
body { position: fixed; inset: 0; }
.screen,.popup { max-width: 100%; max-height: 100%; }
button,label,.btn,.world-tab,.lvl-card,.vehicle-action {
  touch-action: manipulation;
}

.garage-carousel {
  grid-template-columns: 44px minmax(0,1fr) 44px;
  gap: clamp(6px,1.2vw,12px);
}
.level-map-stage {
  grid-template-columns: 44px minmax(0,1fr) 44px;
  gap: clamp(6px,1.2vw,12px);
}
.garage-arrow,.map-page-arrow {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  align-self: center;
}
.garage-grid,.level-grid { min-width: 0; }

#orientation-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  padding:
    calc(20px + var(--safe-t))
    calc(20px + var(--safe-r))
    calc(20px + var(--safe-b))
    calc(20px + var(--safe-l));
  overflow: hidden;
}
.orient-card {
  width: min(360px,100%);
  max-height: 100%;
}

@media (orientation: landscape) and (max-height: 480px) {
  :root {
    --phone-inline-l: calc(10px + var(--safe-l));
    --phone-inline-r: calc(10px + var(--safe-r));
    --phone-block-t: calc(6px + var(--safe-t));
    --phone-block-b: calc(7px + var(--safe-b));
    --map-card: min(22vw,98px,calc(50dvh - 72px));
  }

  .screen { overflow: hidden; }
  .panel-page {
    padding: var(--phone-block-t) var(--phone-inline-r) var(--phone-block-b) var(--phone-inline-l);
    gap: clamp(4px,1.4dvh,7px);
  }

  .home-safe {
    width: min(620px,100%);
    min-height: 100%;
    max-height: 100dvh;
    padding: var(--phone-block-t) var(--phone-inline-r) var(--phone-block-b) var(--phone-inline-l);
    gap: 4px;
    justify-content: center;
  }
  .top-bar {
    top: calc(6px + var(--safe-t));
    padding-right: var(--phone-inline-r);
    padding-left: var(--phone-inline-l);
  }
  .icon-btn,#btn-home-settings {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .coin-chip { min-height: 44px; }
  .home-logo { width: clamp(160px,25vw,205px); max-height: 31dvh; }
  .home-brand .brand-tag { bottom: -5px; padding: 3px 10px; font-size: 5.5px; }
  .hero-kicker { display: none; }
  .home-car-stage {
    width: min(300px,68vw);
    height: clamp(68px,21dvh,88px);
    margin-top: 3px;
  }
  .home-actions { width: min(350px,91%); gap: 7px; }
  .home-primary {
    min-height: 48px !important;
    grid-template-columns: 31px 1fr 18px;
    padding: 5px 10px !important;
  }
  .home-primary .btn-ico { width: 30px; height: 30px; }
  .home-primary .home-btn-copy b { font-size: 16px; }
  .home-secondary {
    min-height: 44px !important;
    grid-template-columns: 25px 1fr;
    padding: 4px 8px !important;
  }
  .home-secondary .btn-ico { min-width: 24px; width: 24px; height: 24px; }
  .home-secondary .home-btn-copy b { font-size: 10px; }
  .home-btn-copy small { display: none; }

  .load-inner {
    width: min(520px,calc(100% - var(--safe-l) - var(--safe-r) - 24px));
    max-height: calc(100dvh - var(--safe-t) - var(--safe-b) - 12px);
    padding: var(--phone-block-t) 12px var(--phone-block-b);
  }
  .loading-logo { width: min(220px,42vw); max-height: 38dvh; }
  .load-tagline { margin-top: 3px; font-size: 7px; }
  .load-track { height: 64px; margin: 7px 8px 0; }
  #load-text { margin-top: 5px; padding: 5px 12px; font-size: 11px; }

  .page-head {
    min-height: 44px;
    grid-template-columns: 44px minmax(0,1fr) auto;
    gap: 8px;
  }
  .btn-back {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .page-title { min-width: 0; }
  .page-title small { display: none; }
  .page-head h1 {
    max-width: 100%;
    overflow: hidden;
    font-size: clamp(18px,5dvh,22px);
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .coin-chip.mini { min-height: 40px; padding: 5px 9px; }
  .world-tabs {
    width: 100%;
    min-height: 40px;
    justify-content: flex-start;
    gap: 6px;
    padding: 2px 3px 4px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    overscroll-behavior-x: contain;
  }
  .world-tab {
    min-height: 38px;
    padding: 5px 9px;
    font-size: 10px;
    white-space: nowrap;
  }
  .world-tab-icon { min-width: 18px; height: 18px; }
  .map-progress {
    width: min(620px,100%);
    min-width: 0;
    gap: 5px;
  }
  .map-progress span {
    min-width: 0;
    overflow: hidden;
    padding: 3px 7px;
    font-size: 6.5px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .level-map-stage {
    width: min(760px,100%);
    grid-template-columns: 44px minmax(0,1fr) 44px;
    gap: 6px;
  }
  .level-page-panel {
    grid-template-columns: repeat(3,var(--map-card));
    grid-template-rows: repeat(2,var(--map-card));
    gap: 8px;
    padding: 3px 3px 6px;
  }
  .level-pagination {
    min-height: 16px;
    margin-top: -4px;
    overflow: hidden;
    font-size: 6.5px;
    white-space: nowrap;
  }
  .map-page-arrow {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .lvl-num { width: 36px; height: 36px; margin-bottom: 20px; font-size: 19px; }
  .lvl-card .stars { font-size: 12px; }

  .garage-subhead {
    display: flex;
    min-height: 22px;
    gap: 6px;
    overflow: hidden;
  }
  .garage-hint { display: none; }
  .garage-focus-label {
    min-width: 0;
    max-width: min(250px,56vw);
    overflow: hidden;
    padding: 4px 8px;
    font-size: 7px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .collection-count {
    flex: 0 0 auto;
    padding: 4px 7px;
    font-size: 7px;
    white-space: nowrap;
  }
  .garage-carousel {
    --garage-card-w: clamp(176px,29vw,190px);
    width: 100%;
    grid-template-columns: 44px minmax(0,1fr) 44px;
    gap: 6px;
  }
  .garage-grid {
    height: 100%;
    padding: 5px calc((100% - var(--garage-card-w))/2) 8px;
    gap: 13px;
    mask-image: none;
    -webkit-mask-image: none;
  }
  .garage-arrow {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .garage-card {
    width: var(--garage-card-w);
    height: calc(100dvh - var(--safe-t) - var(--safe-b) - 112px);
    min-height: 0;
    padding: 8px 9px 9px;
    gap: 3px;
  }
  .vehicle-preview {
    flex: 1 1 76px;
    min-height: 0;
    margin: 0 -2px;
    padding: 3px 4px 8px;
  }
  .vehicle-preview img { max-height: 100%; }
  .garage-card .name {
    flex: 0 0 auto;
    max-width: 100%;
    overflow: hidden;
    font-size: 15px;
    line-height: 1.05;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .vehicle-series { display: none; }
  .garage-card .stats {
    flex: 0 0 auto;
    gap: 4px;
    padding: 5px 7px;
  }
  .garage-card .price,.garage-card .vehicle-action {
    min-height: 48px;
    flex: 0 0 48px;
    padding: 5px;
  }

  #hud {
    padding-top: calc(6px + var(--safe-t));
    padding-right: var(--phone-inline-r);
    padding-left: var(--phone-inline-l);
    gap: 8px;
  }
  .hud-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .hud-pill {
    min-width: 0;
    width: min(250px,calc(100% - 120px - var(--safe-l) - var(--safe-r)));
    padding: 6px 10px 7px;
  }
  #hud-level { overflow: hidden; font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
  .ink-row { gap: 6px; font-size: 10px; }
  #hint-banner {
    top: calc(64px + var(--safe-t));
    max-width: calc(100% - var(--safe-l) - var(--safe-r) - 24px);
    overflow: hidden;
    padding: 6px 12px;
    font-size: 11px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .popup {
    padding:
      calc(8px + var(--safe-t))
      calc(10px + var(--safe-r))
      calc(8px + var(--safe-b))
      calc(10px + var(--safe-l));
    overflow: hidden;
  }
  .popup-card.popup-shell {
    width: min(430px,calc(100% - 4px));
    max-height: calc(100dvh - var(--safe-t) - var(--safe-b) - 20px);
    padding: 18px 13px 9px;
    gap: 4px;
    border-radius: 20px;
  }
  .popup-emblem { width: 38px; height: 38px; top: -19px; }
  .popup-emblem .game-icon { width: 19px; height: 19px; }
  .popup-card.popup-shell h2 {
    max-width: 100%;
    overflow: hidden;
    font-size: 19px;
    line-height: 1.05;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .popup-kicker,.win-kicker { font-size: 6.5px; white-space: nowrap; }
  .popup-subtitle { display: none; }
  .popup-card.popup-shell .popup-primary,
  .popup-card.popup-shell .popup-secondary,
  .popup-card.popup-shell .btn-secondary,
  .popup-card.popup-shell .popup-tertiary,
  .popup-action-grid .btn,.win-row .btn {
    min-height: 44px;
    padding: 6px 8px;
  }
  .popup-card.popup-shell .popup-primary { font-size: 13px; border-radius: 12px; }
  .popup-card.popup-shell .popup-secondary,
  .popup-card.popup-shell .btn-secondary { font-size: 10px; }
  .win-stars { min-height: 27px; font-size: 24px; }
  .reward-panel { min-height: 45px; padding: 4px 9px; border-radius: 13px; }
  .reward-panel .reward { margin: 1px 0; font-size: 22px; }
  .reward-panel .coin-glyph.lg { width: 21px; height: 21px; }
  .settings-list { grid-template-columns: 1fr 1fr; gap: 6px; }
  .settings-list .toggle {
    grid-template-columns: 20px minmax(0,1fr) auto;
    min-height: 48px;
    padding: 5px 7px;
    gap: 6px;
  }
  .settings-list .toggle > span { min-width: 0; }
  .settings-list .toggle b {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .settings-list .toggle small { display: none; }
  .popup-card.fail #fail-reason {
    max-width: 100%;
    overflow: hidden;
    padding: 5px 8px;
    margin: -1px 0 1px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}

@media (orientation: landscape) and (max-height: 380px) {
  .home-logo { width: clamp(150px,23vw,184px); max-height: 29dvh; }
  .home-car-stage { height: clamp(62px,19dvh,72px); }
  .home-primary { min-height: 46px !important; }
  .garage-card {
    height: calc(100dvh - var(--safe-t) - var(--safe-b) - 108px);
    padding-top: 7px;
    padding-bottom: 8px;
  }
  .vehicle-preview { flex-basis: 64px; }
  .popup-card.popup-shell { gap: 3px; }
  .popup-card.popup-shell h2 { font-size: 18px; }
  .win-stars { min-height: 23px; font-size: 21px; }
  .reward-panel { min-height: 40px; padding-block: 3px; }
}

@media (orientation: portrait) and (max-width: 600px) {
  #orientation-overlay {
    display: flex;
    z-index: 1000;
  }
  .phone-icon { font-size: clamp(52px,18vw,72px); }
  .orient-card h2 { font-size: clamp(23px,7vw,30px); }
  .orient-card p { font-size: clamp(13px,4vw,17px); line-height: 1.4; }
}

/* Continuous swipe routes: Garage and World Map */
.panel-page { position: relative; }
.garage-carousel {
  grid-template-columns: minmax(0,1fr);
  gap: 0;
}
.garage-grid {
  touch-action: pan-y;
  overscroll-behavior-x: contain;
  scrollbar-width: none !important;
  cursor: grab;
}
.garage-grid::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }
.garage-grid.grabbing { cursor: grabbing; scroll-snap-type: none; }
.garage-grid.settling { scroll-snap-type: none; }
.garage-card .vehicle-action { min-height: 44px; }

.level-map-stage {
  width: min(1180px,100%);
  grid-template-columns: minmax(0,1fr);
  gap: 0;
}
.level-map-stage::before { display: none; }
.level-grid {
  --route-card: clamp(104px,12vmin,132px);
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0;
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 45vw;
  scrollbar-width: none !important;
  touch-action: pan-y;
  cursor: grab;
  -webkit-overflow-scrolling: touch;
}
.level-grid::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }
.level-grid.dragging { cursor: grabbing; scroll-snap-type: none; }
.level-grid.settling { scroll-snap-type: none; }
.level-route-track {
  position: relative;
  width: max-content;
  min-width: 100%;
  height: 100%;
  padding-inline: max(36px,calc(50vw - 66px));
  display: flex;
  align-items: center;
  gap: clamp(14px,2vw,28px);
  isolation: isolate;
}
.level-route-track::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: max(36px,calc(50vw - 20px));
  right: max(36px,calc(50vw - 20px));
  top: 50%;
  height: 12px;
  border: 2px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg,#f7d756 0 15px,transparent 15px 29px) center/100% 3px no-repeat,
    linear-gradient(180deg,#667383,#303945);
  box-shadow: 0 5px 0 rgba(5,18,33,.42),inset 0 2px 0 rgba(255,255,255,.2);
}
.level-route-track .lvl-card {
  --route-y: 0px;
  flex: 0 0 var(--route-card);
  width: var(--route-card);
  height: var(--route-card);
  scroll-snap-align: center;
  scroll-snap-stop: always;
  transform: translateY(var(--route-y)) scale(.96);
  opacity: .88;
  transition: transform .2s var(--ease-pop),opacity .18s ease,filter .18s ease,box-shadow .2s ease;
}
.level-route-track .lvl-card:nth-child(6n + 2) { --route-y: -18px; }
.level-route-track .lvl-card:nth-child(6n + 3) { --route-y: 10px; }
.level-route-track .lvl-card:nth-child(6n + 4) { --route-y: -10px; }
.level-route-track .lvl-card:nth-child(6n + 5) { --route-y: 18px; }
.level-route-track .lvl-card:nth-child(6n + 6) { --route-y: -12px; }
.level-route-track .lvl-card.route-focused {
  opacity: 1;
  transform: translateY(var(--route-y)) scale(1.02);
}
.level-route-track .lvl-card.current {
  opacity: 1;
  transform: translateY(calc(var(--route-y) - 4px)) scale(1.055);
}
.level-route-track .lvl-card.current.route-focused {
  transform: translateY(calc(var(--route-y) - 6px)) scale(1.075);
}
.level-route-track .lvl-card.locked { opacity: .7; }
.level-route-track .lvl-card.lock-feedback { animation: route-lock-shake .28s ease-out; }
.world-lock-msg {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: calc(10px + var(--safe-b));
  width: max-content;
  max-width: calc(100% - var(--safe-l) - var(--safe-r) - 24px);
  transform: translateX(-50%);
  padding: 8px 14px;
  border: 1px solid rgba(255,196,106,.34);
  border-radius: 999px;
  background: rgba(8,24,46,.92);
  box-shadow: 0 5px 16px rgba(1,9,21,.34);
  color: #ffe49a;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
@keyframes route-lock-shake {
  0%,100% { transform: translateY(var(--route-y)) translateX(0) scale(.96); }
  28% { transform: translateY(var(--route-y)) translateX(-6px) scale(.96); }
  62% { transform: translateY(var(--route-y)) translateX(5px) scale(.96); }
}

@media (orientation: landscape) and (max-height: 480px) {
  .garage-card.focused { transform: translateY(-2px) scale(1.015); }
  .garage-card.selected.focused { transform: translateY(-2px) scale(1.02); }
  .level-grid { --route-card: min(25vw,98px,calc(100dvh - 168px)); }
  .level-route-track {
    padding-inline: max(28px,calc(50vw - 50px));
    gap: clamp(12px,2.3vw,20px);
  }
  .level-route-track::before {
    left: max(28px,calc(50vw - 14px));
    right: max(28px,calc(50vw - 14px));
    height: 9px;
  }
  .level-route-track .lvl-card:nth-child(6n + 2) { --route-y: -12px; }
  .level-route-track .lvl-card:nth-child(6n + 3) { --route-y: 7px; }
  .level-route-track .lvl-card:nth-child(6n + 4) { --route-y: -7px; }
  .level-route-track .lvl-card:nth-child(6n + 5) { --route-y: 12px; }
  .level-route-track .lvl-card:nth-child(6n + 6) { --route-y: -8px; }
  .world-lock-msg { bottom: calc(6px + var(--safe-b)); padding: 6px 11px; font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .level-route-track .lvl-card,.level-grid,.garage-grid { scroll-behavior: auto; transition: none; }
}

/* Premium transparent vector icon system */
.game-icon {
  display: block;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  shape-rendering: geometricPrecision;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,.12)) drop-shadow(0 2px 2px rgba(2,12,28,.2));
}
.icon-btn,.hud-btn,.btn-back,.btn-ico,.popup-emblem,.world-tab-icon,.phone-icon {
  display: grid;
  place-items: center;
}
.icon-btn,.hud-btn,.btn-back { padding: 10px; }
.icon-btn .game-icon,.hud-btn .game-icon,.btn-back .game-icon {
  width: 100%;
  height: 100%;
}
.btn-ico,.home-primary .btn-ico,.home-secondary .btn-ico {
  padding: 5px;
}
.btn-ico .game-icon {
  width: 100%;
  height: 100%;
}
.home-btn-arrow {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 3px;
}
.home-btn-arrow .game-icon { width: 100%; height: 100%; }
.world-tab-icon {
  position: relative;
  min-width: 26px;
  width: 26px;
  height: 26px;
  padding: 5px;
  border: 1px solid rgba(207,237,255,.16);
  border-radius: 9px;
  color: #dff5ff;
  background: linear-gradient(155deg,rgba(106,194,242,.18),rgba(4,26,50,.28));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12),0 2px 4px rgba(2,13,29,.18);
}
.world-icon-svg { width: 100%; height: 100%; }
.world-tab.on .world-tab-icon {
  color: #563300;
  border-color: rgba(255,255,255,.38);
  background: linear-gradient(155deg,rgba(255,255,255,.34),rgba(255,180,23,.16));
}
.world-tab-lock,.level-lock-icon {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 0;
  color: currentColor;
  flex: 0 0 14px;
}
.world-tab-lock::before,.level-lock-icon::before { display: none; }
.world-tab-lock { width: 12px; height: 12px; flex-basis: 12px; opacity: .82; }
.level-lock-icon { color: #dce8f2; }
.garage-card.locked .vehicle-badge::before { display: none; }
.phone-icon {
  width: 76px;
  height: 76px;
  margin: 0 auto;
  padding: 15px;
  border: 1px solid rgba(207,237,255,.32);
  border-radius: 24px;
  color: #fff2a3;
  background:
    radial-gradient(circle at 35% 24%,rgba(255,255,255,.2),transparent 34%),
    linear-gradient(155deg,#297fbd,#10355f);
  box-shadow: 0 7px 0 #071d38,0 16px 32px rgba(1,10,24,.32),inset 0 2px 0 rgba(255,255,255,.2);
}
.phone-icon .game-icon { width: 100%; height: 100%; stroke-width: 1.7; }

@media (orientation: landscape) and (max-height: 480px) {
  .icon-btn,.hud-btn,.btn-back { padding: 11px; }
  .world-tab-icon { min-width: 24px; width: 24px; height: 24px; padding: 5px; }
}

@media (orientation: portrait) and (max-width: 600px) {
  .phone-icon {
    width: clamp(68px,20vw,82px);
    height: clamp(68px,20vw,82px);
    padding: clamp(13px,4vw,17px);
  }
}
