/* styles.css — Mobile-First Hill-Climb-Inspired Arcade Hub & Full-Screen Flight UI */
:root {
  --ink: #1E2430;
  --bg-dark: #111622;
  --panel: #1D2535;
  --panel-inner: #131A27;
  --cream: #F5EFE0;
  --orange: #F97316;
  --cyan: #38BDF8;
  --gold: #FACC15;
  --green: #22C55E;
  --slate: #94A3B8;
  --text: #F8FAFC;
  --safe-top: 0px;
  --safe-right: 0px;
  --safe-bottom: 0px;
  --safe-left: 0px;
  --edge-x-left: max(28px, env(safe-area-inset-left), var(--safe-left));
  --edge-x-right: max(28px, env(safe-area-inset-right), var(--safe-right));
  --edge-y-top: max(10px, env(safe-area-inset-top), var(--safe-top));
  --edge-y-bot: max(8px, env(safe-area-inset-bottom), var(--safe-bottom));
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  touch-action: none;
}

button {
  font-family: inherit;
}

#game-canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

#portrait-rotate-overlay {
  display: none;
}

@media (max-width: 620px) and (orientation: portrait) {
  #portrait-rotate-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: #080C14;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 28px;
    text-align: center;
  }
  .rotate-title {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 0.08em;
    color: #F8FAFC;
  }
  .rotate-sub {
    font-size: 14px;
    font-weight: 700;
    color: #94A3B8;
    max-width: 260px;
  }
}

/* =========================================================================
   0. SPRUNGER STUDIOS BOOT SPLASH SCREEN (CONCEPT 3: CLEAN INDIE MARK)
   ========================================================================= */
#splash-screen {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #080C14;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.34s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity;
}

#splash-screen.splash-out {
  opacity: 0;
  pointer-events: none;
}

.splash-halo {
  position: absolute;
  width: min(380px, 78vw);
  height: min(380px, 78vw);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.16) 0%, rgba(56, 189, 248, 0.04) 48%, rgba(8, 12, 20, 0) 72%);
  transform: translateY(-10px) scale(0.88);
  opacity: 0;
  pointer-events: none;
  animation: splashEmblemIn 0.44s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.splash-lockup {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transform: translateY(-4px);
}

.splash-emblem-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.88);
  opacity: 0;
  animation: splashEmblemIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.splash-emblem {
  display: block;
  width: 72px;
  height: 80px;
  filter: drop-shadow(0 8px 20px rgba(2, 6, 23, 0.65));
}

.splash-wordmark {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 6px 18px;
  opacity: 0;
  transform: translateY(5px);
  animation: splashWordmarkIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) 0.17s forwards;
}

.splash-wordmark::after {
  content: '';
  position: absolute;
  inset: -8px 0;
  width: 64px;
  background: radial-gradient(ellipse at 50% 50%, rgba(248, 250, 252, 0.16) 0%, rgba(56, 189, 248, 0.06) 45%, rgba(8, 12, 20, 0) 72%);
  transform: translateX(-90px);
  opacity: 0;
  pointer-events: none;
  animation: splashSheen 0.78s cubic-bezier(0.25, 0.8, 0.25, 1) 0.44s forwards;
}

.splash-brand {
  font-size: 26px;
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0.34em;
  padding-left: 0.34em;
  color: #F8FAFC;
  text-align: center;
  white-space: nowrap;
}

.splash-sub {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.52em;
  padding-left: 0.52em;
  color: #94A3B8;
  text-align: center;
  white-space: nowrap;
}

@keyframes splashEmblemIn {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes splashWordmarkIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes splashSheen {
  0% {
    opacity: 0;
    transform: translateX(-90px);
  }
  25% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(260px);
  }
}

@media (max-height: 430px) {
  .splash-lockup {
    gap: 11px;
  }
  .splash-emblem {
    width: 64px;
    height: 72px;
  }
  .splash-brand {
    font-size: 24px;
  }
  .splash-sub {
    font-size: 12px;
  }
}

/* Crisp Style A Vector Coin Dot */
.coin-dot {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #FEF9C3 0%, #FACC15 55%, #D97706 100%);
  border: 2px solid var(--ink);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  vertical-align: -2px;
  flex-shrink: 0;
}
.coin-dot.sm {
  width: 13px;
  height: 13px;
  border-width: 1.8px;
}

/* =========================================================================
   1. FULL-SCREEN LEFT / RIGHT SPLIT TOUCH CONTROLS
   ========================================================================= */
#controls-layer {
  position: fixed;
  inset: 0;
  display: flex;
  z-index: 12;
}

.touch-zone {
  flex: 1;
  height: 100%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow 0.06s ease;
}
.touch-zone.left.bot-press {
  box-shadow: inset 0 -5px 0 rgba(251, 146, 60, 0.72), inset 18px 0 28px rgba(251, 146, 60, 0.14);
}
.touch-zone.right.bot-press {
  box-shadow: inset 0 -5px 0 rgba(56, 189, 248, 0.72), inset -18px 0 28px rgba(56, 189, 248, 0.14);
}

#touch-hint {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
  padding-bottom: max(22px, env(safe-area-inset-bottom));
  transition: opacity 0.35s ease;
}

#touch-hint.faded {
  opacity: 0;
}

.hint-half {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1.2px;
  color: #FFFFFF;
  text-shadow: 0 2px 0 var(--ink), 0 4px 12px rgba(0, 0, 0, 0.55);
  opacity: 0.88;
}

.hint-half.left { color: #FFEDD5; }
.hint-half.right { color: #E0F2FE; }

.hint-arrow {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hint-divider {
  position: fixed;
  top: 22%;
  bottom: 10%;
  left: 50%;
  border-left: 2px dashed rgba(255, 255, 255, 0.22);
}

/* Full-Half Left/Right Transparent Tutorial Overlays (Stage 1 Onboarding) */
#tutorial-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  pointer-events: none;
  z-index: 6;
}

.tut-zone {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.26s ease;
  padding: 24px 18px;
}

.tut-zone.active {
  opacity: 1;
}

.tut-zone.right {
  background: linear-gradient(270deg, rgba(34, 197, 94, 0.28) 0%, rgba(16, 185, 129, 0.14) 72%, rgba(16, 185, 129, 0.03) 100%);
  border-left: 2.5px dashed rgba(74, 222, 128, 0.62);
}

.tut-zone.left {
  background: linear-gradient(90deg, rgba(250, 204, 21, 0.30) 0%, rgba(245, 158, 11, 0.15) 72%, rgba(245, 158, 11, 0.03) 100%);
  border-right: 2.5px dashed rgba(250, 204, 21, 0.68);
}

.tut-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  transform: translateY(14px);
}

.tut-ring {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 12, 20, 0.52);
  border: 2.5px solid currentColor;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  animation: tutPulse 1.15s ease-in-out infinite;
}

.tut-zone.right .tut-ring,
.tut-zone.right .tut-title {
  color: #86EFAC;
}

.tut-zone.left .tut-ring,
.tut-zone.left .tut-title {
  color: #FDE047;
}

.tut-ring svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tut-title {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 0 var(--ink), 0 4px 14px rgba(0, 0, 0, 0.65);
}

.tut-sub {
  font-size: 13px;
  font-weight: 800;
  color: #F8FAFC;
  background: rgba(8, 12, 20, 0.62);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 99px;
  padding: 4px 12px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.65);
}

@keyframes tutPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* =========================================================================
   2. MINIMAL IN-FLIGHT HUD (Uniform Pill Height + Corner-Safe Margins)
   ========================================================================= */
#hud-layer {
  position: fixed;
  top: var(--edge-y-top);
  left: var(--edge-x-left);
  right: var(--edge-x-right);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  pointer-events: none;
  z-index: 20;
}

.hud-side {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-side.right {
  justify-self: end;
}

.hud-icon-btn {
  pointer-events: auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(24, 33, 50, 0.92);
  color: #F8FAFC;
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 rgba(10, 14, 23, 0.85);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.hud-icon-btn:active { transform: translateY(2px); }

.fuel-pill {
  height: 42px;
  background: rgba(24, 33, 50, 0.92);
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 rgba(10, 14, 23, 0.85);
  border-radius: 12px;
  padding: 0 11px 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.fuel-bolt-svg {
  width: 16px;
  height: 16px;
  color: #4ADE80;
  flex-shrink: 0;
}

.fuel-track {
  width: 126px;
  height: 13px;
  background: #0B1120;
  border-radius: 7px;
  border: 2px solid var(--ink);
  overflow: hidden;
  flex-shrink: 0;
}

#hud-fuel-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #16A34A, #4ADE80);
  transform-origin: left center;
  will-change: transform;
}

#hud-fuel-bar.low {
  animation: pulseLow 0.4s infinite alternate;
}

@keyframes pulseLow {
  from { opacity: 0.62; }
  to { opacity: 1; }
}

.shield-pips {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding-left: 7px;
  margin-left: 2px;
  border-left: 2px solid rgba(148, 163, 184, 0.24);
}

.shield-pip-svg {
  width: 17px;
  height: 18px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 0 rgba(10, 14, 23, 0.85));
}

.shield-inf-tag {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.4px;
  color: #FDE047;
}

.hud-center {
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.dist-pill {
  height: 42px;
  background: rgba(24, 33, 50, 0.92);
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 rgba(10, 14, 23, 0.85);
  border-radius: 12px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 0.4px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #FFFFFF;
}

.dist-pill.beating {
  color: var(--gold);
}

.timer-pill {
  height: 42px;
  background: rgba(24, 33, 50, 0.92);
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 rgba(10, 14, 23, 0.85);
  border-radius: 12px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17.5px;
  font-weight: 900;
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #BAE6FD;
}

.timer-pill.on-pace {
  color: #4ADE80;
}

.timer-pill.invalidated {
  color: #94A3B8;
  text-decoration: line-through;
  opacity: 0.78;
}

.coin-pill {
  height: 42px;
  background: rgba(24, 33, 50, 0.92);
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 rgba(10, 14, 23, 0.85);
  border-radius: 12px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--gold);
  font-size: 19px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.bot-pill-btn {
  pointer-events: auto;
  height: 42px;
  background: linear-gradient(180deg, #0284C7 0%, #0369A1 100%);
  color: #F0F9FF;
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 rgba(10, 14, 23, 0.85);
  border-radius: 12px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.dev-pill-btn {
  pointer-events: auto;
  height: 42px;
  background: #7C3AED;
  color: #FFFFFF;
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 rgba(10, 14, 23, 0.85);
  border-radius: 12px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

/* =========================================================================
   3. HILL-CLIMB-STYLE GARAGE HUB (TOP BAR + FULL-WIDTH STAGE/SHIP/TUNE + DOCK)
   ========================================================================= */
#hub-screen {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 8%, rgba(56, 189, 248, 0.16) 0%, rgba(17, 22, 34, 0) 62%),
    repeating-linear-gradient(-22deg, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 34px),
    linear-gradient(180deg, #1A2438 0%, #0E1420 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 25;
  padding: var(--edge-y-top) var(--edge-x-right) var(--edge-y-bot) var(--edge-x-left);
  gap: 10px;
}

/* Top Utility Bar */
.hub-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.hub-top-left,
.hub-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bank-pill {
  height: 42px;
  background: #1B2538;
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 #0A0E17;
  border-radius: 12px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--gold);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.4px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.mastery-pill-btn {
  height: 42px;
  background: #1B2538;
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 #0A0E17;
  border-radius: 12px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #FEF08A;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.4px;
  cursor: pointer;
}
.mastery-pill-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #0A0E17;
}
.trophy-mini-svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}

.store-pill-btn {
  height: 42px;
  background: linear-gradient(180deg, #1E293B 0%, #141C2C 100%);
  border: 2.5px solid #FACC15;
  box-shadow: 0 3px 0 #0A0E17;
  border-radius: 12px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #FEF08A;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.4px;
  cursor: pointer;
}
.store-pill-btn.vip-owned {
  background: linear-gradient(180deg, #422006 0%, #271506 100%);
  border-color: #FACC15;
  color: #FDE047;
}
.store-pill-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #0A0E17;
}
.store-crown-svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.loadout-pill {
  background: rgba(20, 29, 45, 0.85);
  border: 2px solid #2D3B55;
  border-radius: 10px;
  padding: 6px 12px;
  color: #CBD5E1;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.square-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #233047;
  color: #F8FAFC;
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 #0A0E17;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.square-btn.sm {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}
.square-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #0A0E17; }

.dev-toggle-btn {
  height: 42px;
  padding: 0 13px;
  border-radius: 12px;
  background: #1A2336;
  color: #94A3B8;
  border: 2px solid #334155;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.5px;
  cursor: pointer;
}
.dev-toggle-btn.dev-on {
  background: #7C3AED;
  border-color: #DDD6FE;
  color: #FFFFFF;
}

/* Center Active View Container */
.hub-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
}

/* =========================================================================
   3A. SHIP & STAGE 3-CARD PEEKING CAROUSEL
   ========================================================================= */
.selector-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
  flex-shrink: 0;
}

.selector-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.selector-title {
  margin: 0;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: #FFFFFF;
  text-shadow: 0 3px 0 #0A0E17;
  line-height: 1.05;
}

.selector-sub {
  font-size: 14px;
  font-weight: 700;
  color: #CBD5E1;
  line-height: 1.2;
}

.carousel-dots {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.c-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  padding: 0;
  border: none;
  background: #475569;
  cursor: pointer;
  transition: 0.14s;
}
.c-dot.locked {
  background: #1E293B;
  border: 1.5px solid #475569;
}
.c-dot.active {
  width: 24px;
  border-radius: 99px;
  background: var(--cyan);
}

.coverflow-row {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(140px, 0.56fr) minmax(300px, 1.18fr) minmax(140px, 0.56fr);
  align-items: center;
  gap: 14px;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

/* Subtle Open-Hangar Radial Spotlight Pool Behind Center Ship */
.coverflow-row.ship-open-hangar::before {
  content: "";
  position: absolute;
  inset: -6% 14% 2% 14%;
  background: radial-gradient(ellipse 52% 62% at 50% 48%, rgba(56, 189, 248, 0.14) 0%, rgba(30, 41, 59, 0.06) 52%, transparent 78%);
  pointer-events: none;
  z-index: 0;
}

.ship-lv-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 7px;
  background: rgba(20, 29, 45, 0.90);
  border: 1.8px solid #334155;
  color: #CBD5E1;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.ship-lv-pill.maxed {
  background: #15803D;
  border-color: #4ADE80;
  color: #F0FDF4;
}

/* Continuous 6-Card Coverflow Track (100% GPU-Composited, Zero Layout Reflow!) */
.coverflow-track {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  contain: layout style;
}

.track-card {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  contain: layout style;
  will-change: opacity;
}

.track-card-box {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 15px;
  border: 3px solid #0B0F18;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.58), inset 0 0 0 1.5px rgba(255, 255, 255, 0.14);
  overflow: hidden;
  background: #0F172A;
  transform-origin: center center;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Frameless Open-Hangar Ship Cards (zero rectangular box or border!) */
.track-card.frameless-ship .track-card-box {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}
.track-card.frameless-ship .track-dim {
  display: none;
}
.track-card.frameless-ship.is-locked canvas {
  filter: saturate(0.18) brightness(0.38) contrast(1.06);
}

/* Obscured Locked Stage Cards (Hero + Peeks) */
.track-card.stage-card.is-locked canvas {
  filter: saturate(0.32) brightness(0.46);
}

.track-card-box canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.track-dim {
  position: absolute;
  inset: 0;
  background: #080C15;
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}

.track-peek-label {
  position: absolute;
  left: 50%;
  top: 50%;
  margin-left: -100px;
  width: 200px;
  margin-top: -9px;
  text-align: center;
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #E2E8F0;
  text-shadow: 0 2px 0 #0A0E17;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  will-change: transform, opacity;
}

.track-peek-lock {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(11, 16, 28, 0.94);
  border: 1.8px solid #475569;
  border-radius: 9px;
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 900;
  color: #F8FAFC;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.65);
  will-change: transform, opacity;
}

.track-peek-lock .lock-mini {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Transparent Left / Right Neighbor Click Hit Zones (preserves layout metrics & click targets) */
.peek-slot {
  position: relative;
  z-index: 24;
  opacity: 0;
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-width: 0;
}
.peek-slot.empty {
  visibility: hidden;
  pointer-events: none;
}

.peek-label {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #E2E8F0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.peek-card {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9.4;
  max-height: 185px;
  border-radius: 12px;
  overflow: hidden;
}

.peek-card canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.peek-dim,
.peek-lock-badge {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.peek-cost {
  font-size: 13px;
  font-weight: 900;
}

/* Center Hero HUD Frame (sits directly over the 1.0x center track-card) */
.hero-card {
  position: relative;
  z-index: 26;
  width: 100%;
  height: 100%;
  max-height: 330px;
  border-radius: 16px;
  overflow: hidden;
  background: transparent;
}
.hero-card.frameless-hero {
  border-radius: 0;
  overflow: visible;
}

.hero-card > canvas {
  display: none;
}

.hero-top-bar {
  position: absolute;
  top: 9px;
  left: 10px;
  right: 10px;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 9px;
  border: 2px solid var(--ink);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.50);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.4px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.hero-chip.right-pin { margin-left: auto; }
.hero-chip.cyan { background: rgba(12, 18, 30, 0.88); color: var(--cyan); }
.hero-chip.new-tag { background: rgba(12, 18, 30, 0.88); color: #4ADE80; }
.hero-chip.gold { background: rgba(12, 18, 30, 0.88); color: var(--gold); }
.hero-chip.green { background: #15803D; color: #F0FDF4; }
.hero-chip.locked { background: rgba(15, 23, 42, 0.92); color: #FCA5A5; }
.hero-chip.slate { background: rgba(15, 23, 42, 0.88); color: #E2E8F0; }
.hero-chip.medal { background: rgba(12, 18, 30, 0.90); color: #F8FAFC; }
.hero-chip.medal.plat { border-color: rgba(56, 189, 248, 0.55); color: #E0F2FE; }
.chip-star-svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Sleek Single-Line Stage Progress Dock (Only shown while < 2,000m!) */
.stage-prog-dock {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 9px;
  height: 28px;
  background: rgba(11, 16, 28, 0.88);
  border: 2px solid #0B0F18;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
  border-radius: 9px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 11px;
  z-index: 3;
  pointer-events: none;
}

.stage-prog-track {
  position: relative;
  flex: 1;
  height: 7px;
  background: #1E293B;
  border-radius: 99px;
  overflow: visible;
}

.stage-prog-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0EA5E9, #38BDF8);
  border-radius: 99px;
}

.stage-prog-pips {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ms-pip {
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  margin-top: -4px;
  border-radius: 50%;
  background: #475569;
  border: 1.5px solid #0B0F18;
}
.ms-pip.claimed {
  background: #4ADE80;
}
.ms-pip.next {
  width: 10px;
  height: 10px;
  margin-left: -5px;
  margin-top: -5px;
  background: #FACC15;
}

.stage-next-bonus {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.stage-next-dist {
  color: #CBD5E1;
}
.stage-next-val {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--gold);
}

/* Locked Stage & Ship Overlays */
.hero-locked-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px;
  z-index: 3;
}
.hero-locked-overlay.stage-locked {
  justify-content: center;
  background: radial-gradient(ellipse at 50% 50%, rgba(8, 12, 22, 0.28) 0%, rgba(8, 12, 22, 0.56) 100%);
}
.hero-locked-overlay.ship-locked {
  justify-content: flex-end;
  padding-bottom: 4px;
  background: none;
  pointer-events: none;
}
.hero-locked-overlay.ship-locked .unlock-big-btn {
  pointer-events: auto;
}

.locked-hint {
  font-size: 12.5px;
  font-weight: 800;
  color: #E2E8F0;
  background: rgba(11, 16, 28, 0.90);
  border: 1.5px solid #334155;
  border-radius: 8px;
  padding: 3px 10px;
  text-align: center;
}

.lock-svg.inline {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}

.unlock-big-btn {
  min-width: 205px;
  height: 46px;
  padding: 0 20px;
  font-size: 16.5px;
  font-weight: 900;
  letter-spacing: 0.4px;
  border-radius: 13px;
  border: 3px solid var(--ink);
  box-shadow: 0 4px 0 #0B0F18;
  background: linear-gradient(180deg, #FDE047 0%, #EA580C 100%);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
}
.unlock-big-btn .btn-cost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.unlock-big-btn:disabled {
  background: rgba(24, 34, 52, 0.96);
  border-color: #334155;
  color: #CBD5E1;
  cursor: not-allowed;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.55);
}
.unlock-big-btn:disabled .coin-dot {
  opacity: 0.85;
}

/* =========================================================================
   3B. TUNE VIEW (4 SIDE-BY-SIDE TACTILE PART CARDS + VERTICAL METERS)
   ========================================================================= */
.tune-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.tune-title-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Crisp 'i' Vehicle Specs Pill Button */
.info-pill-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #0B0F18;
  box-shadow: 0 2px 0 #090D15;
  background: linear-gradient(180deg, #38BDF8 0%, #0284C7 100%);
  color: #082F49;
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.info-pill-btn.sm {
  width: 24px;
  height: 24px;
  font-size: 14px;
}
.info-pill-btn:hover {
  filter: brightness(1.1);
}
.info-pill-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #090D15;
}

/* Vehicle Specs ('i') Modal Card */
.specs-card {
  background: var(--panel);
  border: 3.5px solid #0B0F18;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.75);
  border-radius: 18px;
  width: 96%;
  max-width: 470px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.specs-card.compare-mode {
  max-width: 812px;
  padding: 13px 16px;
  gap: 8px;
}

.specs-single-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.specs-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.specs-title-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
}

.specs-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compare-open-btn,
.compare-back-btn {
  height: 32px;
  padding: 0 11px;
  border-radius: 9px;
  border: 2px solid #0B0F18;
  background: linear-gradient(180deg, #0284C7 0%, #0369A1 100%);
  box-shadow: 0 2px 0 #090D15;
  color: #F8FAFC;
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: 0.4px;
  cursor: pointer;
  white-space: nowrap;
}

.compare-back-btn {
  background: linear-gradient(180deg, #334155 0%, #1E293B 100%);
  color: #E2E8F0;
}

.compare-open-btn:active,
.compare-back-btn:active {
  transform: translateY(1px);
}

.compare-mode-toggle {
  display: inline-flex;
  background: #0F172A;
  border: 2px solid #0B0F18;
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}

.cmp-mode-btn {
  height: 26px;
  padding: 0 9px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #94A3B8;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.3px;
  cursor: pointer;
}

.cmp-mode-btn.active {
  background: linear-gradient(180deg, #0EA5E9 0%, #0284C7 100%);
  color: #FFFFFF;
}

.compare-matrix {
  display: grid;
  grid-template-columns: 108px repeat(6, minmax(0, 1fr));
  gap: 4px;
  align-items: stretch;
}

.cmp-corner {
  display: flex;
  align-items: center;
  padding-left: 4px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.4px;
  color: #64748B;
}

.cmp-col-head {
  background: #141C2C;
  border: 2px solid #29354D;
  border-radius: 9px;
  padding: 4px 4px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  cursor: pointer;
}

.cmp-col-head.focused {
  background: #1E293B;
  border-color: #FACC15;
  box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.35);
}

.cmp-col-head.locked canvas {
  opacity: 0.58;
}

.cmp-col-head canvas {
  width: 36px;
  height: 25px;
  flex-shrink: 0;
}

.cmp-col-name {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.2px;
  color: #E2E8F0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.cmp-col-head.focused .cmp-col-name {
  color: #FEF08A;
}

.cmp-row-label {
  background: #141C2C;
  border: 1.5px solid #29354D;
  border-radius: 8px;
  padding: 0 7px;
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.3px;
  color: #CBD5E1;
  white-space: nowrap;
}

.cmp-cell {
  height: 33px;
  background: #151F32;
  border: 1.5px solid #29354D;
  border-radius: 8px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  color: #E2E8F0;
  white-space: nowrap;
  min-width: 0;
}

.cmp-cell.focused {
  background: #1C2B45;
  border-color: rgba(250, 204, 21, 0.55);
}

.cmp-cell.best {
  color: #4ADE80;
  border-color: rgba(74, 222, 128, 0.48);
}

.cmp-cell.perk {
  font-size: 12px;
  font-weight: 800;
  color: #BAE6FD;
  letter-spacing: -0.1px;
}

.specs-title {
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 0.7px;
  color: #FFFFFF;
  text-shadow: 0 2px 0 #0B0F18;
}

.specs-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  font-weight: 800;
  color: #94A3B8;
  letter-spacing: 0.4px;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: -1px;
}
.legend-dot.cur { background: #38BDF8; }
.legend-dot.max { background: rgba(148, 163, 184, 0.42); border: 1px solid #64748B; }

.specs-bars {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.spec-row {
  display: grid;
  grid-template-columns: 102px 1fr 118px;
  align-items: center;
  gap: 9px;
}

.spec-label {
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: 0.4px;
  color: #CBD5E1;
}

.spec-bar-track {
  position: relative;
  height: 12px;
  background: #0F172A;
  border: 2px solid #0B0F18;
  border-radius: 99px;
  overflow: hidden;
}

.spec-bar-max {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(148, 163, 184, 0.34);
  border-right: 2px solid rgba(226, 232, 240, 0.65);
}

.spec-bar-cur {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #0EA5E9 0%, #38BDF8 100%);
  border-radius: 99px;
}

.spec-val {
  font-size: 12.5px;
  font-weight: 900;
  color: #F8FAFC;
  text-align: right;
  white-space: nowrap;
}
.spec-val .spec-max-sub {
  color: #94A3B8;
  font-weight: 800;
}

.specs-perks {
  background: var(--panel-inner);
  border: 2px solid #334155;
  border-radius: 12px;
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.spec-perk-line {
  font-size: 12.5px;
  font-weight: 800;
  color: #BAE6FD;
  line-height: 1.28;
}

.tune-ship-name {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: #FFFFFF;
  text-shadow: 0 3px 0 #0A0E17;
}

.tune-ship-sub {
  font-size: 14px;
  font-weight: 700;
  color: #94A3B8;
}

.tune-grid {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 900px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: stretch;
}

.upg-tile {
  background: linear-gradient(180deg, #334155 0%, #1E293B 100%);
  color: var(--text);
  border: 3px solid #0B0F18;
  box-shadow: 0 6px 0 #090D15, 0 10px 20px rgba(0, 0, 0, 0.45);
  border-radius: 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.07s, filter 0.1s, border-color 0.1s;
}

.upg-tile.affordable {
  border-color: #0B0F18;
  box-shadow: 0 6px 0 #090D15, inset 0 0 0 2px rgba(250, 204, 21, 0.55);
}
.upg-tile.affordable:hover {
  filter: brightness(1.07);
}
.upg-tile.affordable:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #090D15;
}

.upg-tile.unaffordable {
  cursor: default;
  opacity: 0.88;
}

.upg-tile.maxed {
  cursor: default;
  box-shadow: 0 6px 0 #090D15, inset 0 0 0 2px rgba(74, 222, 128, 0.55);
}

/* Top Coin-Cost Cap (Hill Climb Style) */
.upg-cost-cap {
  background: linear-gradient(180deg, #52638A 0%, #3A496B 100%);
  border-bottom: 2.5px solid #0B0F18;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.4px;
  color: #FFFFFF;
  text-shadow: 0 2px 0 #0B0F18;
  flex-shrink: 0;
}
.upg-tile.affordable .upg-cost-cap {
  background: linear-gradient(180deg, #5B6E99 0%, #3E4F73 100%);
  color: #FEF08A;
}
.upg-tile.unaffordable .upg-cost-cap {
  background: linear-gradient(180deg, #334155 0%, #243042 100%);
  color: #94A3B8;
}
.upg-tile.unaffordable .coin-dot {
  opacity: 0.5;
}
.upg-tile.maxed .upg-cost-cap {
  background: linear-gradient(180deg, #16A34A 0%, #15803D 100%);
  color: #F0FDF4;
}

/* Center Art Well + Left Segmented Vertical Meter */
.upg-art-well {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  padding: 8px 10px 6px 9px;
  gap: 6px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, transparent 55%),
    #3F4B5B;
}

.upg-vmeter {
  width: 11px;
  background: #141B26;
  border: 1.8px solid #0B0F18;
  border-radius: 5px;
  padding: 2px;
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  flex-shrink: 0;
}

.v-seg {
  flex: 1;
  border-radius: 1.5px;
  background: #263244;
}
.v-seg.on {
  background: #38BDF8;
  box-shadow: 0 0 4px rgba(56, 189, 248, 0.5);
}
.v-seg.owned {
  background: rgba(250, 204, 21, 0.35);
  box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.72);
}
.upg-tile.maxed:not(.tuned-down) .v-seg.on {
  background: #4ADE80;
}
.upg-tile.maxed.tuned-down .upg-cost-cap {
  background: linear-gradient(180deg, #B45309 0%, #92400E 100%);
  color: #FEF08A;
}

.upg-canvas-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upg-part-canvas {
  width: 100%;
  height: 100%;
  max-height: 160px;
  display: block;
}

.upg-lvl {
  position: absolute;
  right: 2px;
  bottom: 0;
  font-size: 16px;
  font-weight: 900;
  color: #FFFFFF;
  text-shadow: 0 2px 0 #0B0F18, 0 0 6px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.3px;
}
.upg-lvl.tuned {
  color: #FACC15;
}

/* Right-Edge Up / Down Level Stepper Controls */
.upg-stepper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  z-index: 2;
}

.upg-step-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  border: 2px solid #0B0F18;
  background: linear-gradient(180deg, #334155 0%, #1E293B 100%);
  color: #F8FAFC;
  box-shadow: 0 3px 0 #0B0F18;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.06s, filter 0.1s, opacity 0.1s;
}
.upg-step-btn:not(:disabled):hover {
  filter: brightness(1.14);
  border-color: #38BDF8;
}
.upg-step-btn.up:not(:disabled) {
  background: linear-gradient(180deg, #0284C7 0%, #0369A1 100%);
  color: #F0F9FF;
}
.upg-step-btn.down:not(:disabled) {
  background: linear-gradient(180deg, #475569 0%, #334155 100%);
  color: #F8FAFC;
}
.upg-step-btn:not(:disabled):active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #0B0F18;
}
.upg-step-btn:disabled {
  opacity: 0.32;
  cursor: default;
  box-shadow: none;
}

/* Bottom Name & Perk Strip */
.upg-foot {
  background: #1B2434;
  border-top: 2px solid #0B0F18;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  flex-shrink: 0;
}

.upg-name {
  font-size: 13.5px;
  font-weight: 900;
  color: #E2E8F0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upg-tag {
  font-size: 12px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(56, 189, 248, 0.20);
  color: #7DD3FC;
  white-space: nowrap;
  flex-shrink: 0;
}

/* =========================================================================
   3C. PERSISTENT BOTTOM THUMB DOCK (STAGE | SHIP | TUNE | START)
   ========================================================================= */
.hub-dock {
  display: grid;
  grid-template-columns: repeat(4, minmax(112px, 158px));
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
}

.dock-btn {
  position: relative;
  height: 58px;
  border-radius: 12px;
  border: 3px solid #0B0F18;
  box-shadow: 0 4px 0 #090D15, inset 0 2px 0 rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, #566376 0%, #394454 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.7px;
  text-shadow: 0 2px 0 #0B0F18;
  cursor: pointer;
  transition: transform 0.07s, filter 0.1s;
}

.dock-btn:hover {
  filter: brightness(1.07);
}
.dock-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #090D15;
}

.dock-btn.active {
  background: linear-gradient(180deg, #3B6B94 0%, #244869 100%);
  box-shadow: 0 4px 0 #090D15, inset 0 0 0 2px #7DD3FC;
  transform: translateY(-2px);
}

.dock-btn.start {
  background: linear-gradient(180deg, #65A30D 0%, #4D7C0F 48%, #3F6212 100%);
  background-image: linear-gradient(180deg, #84CC16 0%, #4D7C0F 100%);
  box-shadow: 0 4px 0 #1A2E05, inset 0 2px 0 rgba(255, 255, 255, 0.28);
}

.dock-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.45));
}

.dock-canvas {
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.5));
}
.dock-canvas.stage {
  width: 28px;
  height: 28px;
}
.dock-canvas.ship {
  width: 34px;
  height: 26px;
}

/* =========================================================================
   4. CLEAN POST-RUN CRASH SUMMARY, PAUSE & DEV DRAWER
   ========================================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 13, 22, 0.82);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 35;
  padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.results-card {
  background: var(--panel);
  border: 3.5px solid #0B0F18;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.72);
  border-radius: 20px;
  width: 100%;
  max-width: 460px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}

.res-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.res-badge {
  background: var(--gold);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  padding: 4px 12px;
  border-radius: 99px;
  margin-bottom: 3px;
}
.res-badge.platinum {
  background: #38BDF8;
  color: #0B0F18;
}

.res-reason {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.6px;
  color: #FDBA74;
}

#res-dist {
  font-size: 52px;
  font-weight: 900;
  line-height: 1.02;
  color: var(--cyan);
  text-shadow: 0 3px 0 #0B0F18;
}

#res-best {
  font-size: 15px;
  font-weight: 800;
  color: var(--slate);
}

.res-payout-box {
  background: var(--panel-inner);
  border: 2px solid #334155;
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.res-payout-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.res-payout-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ad-play-svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.ad-play-svg.lg {
  width: 19px;
  height: 19px;
}

.res-double-btn {
  height: 34px;
  padding: 0 11px;
  border-radius: 10px;
  border: 2.5px solid #0B0F18;
  box-shadow: 0 3px 0 #78350F;
  background: linear-gradient(180deg, #FDE047 0%, #F59E0B 100%);
  color: #1E2430;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: 0.3px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.res-double-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #78350F;
}
.res-double-btn.claimed,
.res-double-btn:disabled {
  background: rgba(21, 128, 61, 0.30);
  border-color: #4ADE80;
  color: #86EFAC;
  box-shadow: none;
  cursor: default;
}

.vip-payout-chip {
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: linear-gradient(180deg, #422006 0%, #271506 100%);
  border: 2px solid #FACC15;
  color: #FEF08A;
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: 0.4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

/* Opt-In 1x Shield Revive Pre-Results Modal */
.revive-card {
  background: var(--panel);
  border: 3.5px solid #0284C7;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.78), inset 0 0 0 1.5px rgba(56, 189, 248, 0.32);
  border-radius: 20px;
  width: 100%;
  max-width: 428px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  text-align: center;
}

.revive-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.revive-badge {
  background: rgba(14, 165, 233, 0.22);
  border: 1.5px solid #38BDF8;
  color: #BAE6FD;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.6px;
  padding: 3px 11px;
  border-radius: 99px;
}

.revive-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #FFFFFF;
  text-shadow: 0 2px 0 #0B0F18;
  line-height: 1.1;
}

.revive-sub {
  font-size: 13.5px;
  font-weight: 800;
  color: #CBD5E1;
}

.revive-watch-btn {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border-radius: 14px;
  border: 3px solid #0B0F18;
  box-shadow: 0 4px 0 #0C4A6E;
  background: linear-gradient(180deg, #38BDF8 0%, #0284C7 100%);
  color: #082F49;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.4px;
  cursor: pointer;
}
.revive-watch-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #0C4A6E;
}

.revive-timer-note {
  font-size: 12px;
  font-weight: 800;
  color: #94A3B8;
  margin-top: -4px;
}

.res-payout-label {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.6px;
  color: #CBD5E1;
}

.res-payout-val {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 24px;
  font-weight: 900;
  color: var(--gold);
}

.res-milestone-note {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 2px 6px;
  font-size: 12.5px;
  font-weight: 800;
  color: #4ADE80;
  text-align: right;
}
.res-milestone-note.hidden {
  display: none !important;
}
.res-bonus-chip {
  white-space: nowrap;
}
.res-bonus-sep {
  color: #64748B;
  font-weight: 900;
}

.results-card.victory {
  border-color: #CA8A04;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.75), inset 0 0 0 2px rgba(250, 204, 21, 0.42);
}

.results-card.victory .res-reason {
  color: #4ADE80;
  font-size: 19px;
}

.results-card.victory #res-dist {
  color: var(--gold);
}

.res-actions {
  display: grid;
  grid-template-columns: 0.92fr 1.28fr;
  gap: 10px;
}

.res-actions.has-next {
  grid-template-columns: 0.82fr 1.05fr 1.15fr;
}

.next-stage-btn {
  width: 100%;
  height: 52px;
  border-radius: 14px;
  border: 3px solid #0B0F18;
  box-shadow: 0 4px 0 #854D0E;
  background: linear-gradient(180deg, #FDE047 0%, #EAB308 100%);
  color: #1E2430;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.5px;
  cursor: pointer;
}
.next-stage-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #854D0E; }

.play-btn {
  width: 100%;
  height: 52px;
  border-radius: 14px;
  border: 3px solid #0B0F18;
  box-shadow: 0 4px 0 #14532D;
  background: linear-gradient(180deg, #4ADE80 0%, #16A34A 100%);
  color: #052E16;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.6px;
  cursor: pointer;
}
.play-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #14532D; }

.secondary-btn {
  width: 100%;
  height: 52px;
  border-radius: 14px;
  border: 3px solid #0B0F18;
  box-shadow: 0 4px 0 #0B0F18;
  background: linear-gradient(180deg, #475569 0%, #334155 100%);
  color: #F8FAFC;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.6px;
  cursor: pointer;
}
.secondary-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #0B0F18; }

.ghost-btn {
  height: 42px;
  border-radius: 11px;
  border: 2px solid #334155;
  background: transparent;
  color: #94A3B8;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

/* Pause Card */
.compact-card {
  background: var(--panel);
  border: 3px solid #0B0F18;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
  border-radius: 20px;
  width: 92%;
  max-width: 350px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}

.compact-card h3 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: var(--cream);
}

/* Unified Settings Modal */
.modal-backdrop.settings-layer {
  z-index: 46;
}

.settings-card {
  background: var(--panel);
  border: 3px solid #0B0F18;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.72), inset 0 0 0 1.5px rgba(255, 255, 255, 0.10);
  border-radius: 18px;
  width: 92%;
  max-width: 444px;
  padding: 13px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.settings-pane {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.setting-row {
  height: 43px;
  background: #141C2C;
  border: 2px solid #2D3B55;
  border-radius: 12px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #F8FAFC;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.4px;
  cursor: pointer;
}
.setting-row:active {
  transform: translateY(1px);
}

.setting-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #E2E8F0;
}

.setting-pill {
  min-width: 56px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: 0.5px;
}
.setting-pill.on {
  background: #16A34A;
  color: #F0FDF4;
}
.setting-pill.off {
  background: #1E293B;
  border-color: #475569;
  color: #94A3B8;
}

.setting-studio-card {
  width: 100%;
  background: #0F1624;
  border: 2px solid #26344B;
  border-radius: 12px;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  text-align: left;
}
.setting-studio-card:active {
  transform: translateY(1px);
}

.studio-card-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.studio-mini-mark {
  flex-shrink: 0;
  display: block;
}

.studio-card-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.studio-card-brand {
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #F8FAFC;
  line-height: 1.1;
}

.studio-card-byline {
  font-size: 12px;
  font-weight: 700;
  color: #94A3B8;
  line-height: 1.15;
}

.studio-credits-chip {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #7DD3FC;
  background: rgba(56, 189, 248, 0.12);
  border: 1.5px solid rgba(56, 189, 248, 0.36);
  border-radius: 7px;
  padding: 4px 8px;
}

.setting-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px;
  flex-wrap: wrap;
}

.setting-meta-left,
.setting-meta-right {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.setting-backup-note {
  font-size: 12px;
  font-weight: 700;
  color: #94A3B8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.setting-backup-note.cloud-active {
  color: #4ADE80;
}

.pgs-signin-btn {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #F0FDF4;
  background: #15803D;
  border: 1.5px solid #4ADE80;
  border-radius: 7px;
  padding: 2px 8px;
  cursor: pointer;
  flex-shrink: 0;
}
.pgs-signin-btn:active {
  transform: translateY(1px);
}

.reset-open-btn {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #FCA5A5;
  background: rgba(127, 29, 29, 0.34);
  border: 1.5px solid rgba(248, 113, 113, 0.48);
  border-radius: 7px;
  padding: 3px 8px;
  cursor: pointer;
  flex-shrink: 0;
}
.reset-open-btn:hover {
  background: rgba(153, 27, 27, 0.48);
  color: #FEE2E2;
}
.reset-open-btn:active {
  transform: translateY(1px);
}

/* Reset Progress Confirmation Pane */
.reset-warn-box {
  background: rgba(69, 10, 10, 0.42);
  border: 2px solid rgba(239, 68, 68, 0.55);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.reset-warn-title {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #FCA5A5;
}

.reset-warn-copy {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.42;
  color: #E2E8F0;
}

.reset-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 9px;
}

.reset-danger-btn {
  height: 38px;
  border-radius: 11px;
  border: 2px solid #0B0F18;
  box-shadow: 0 3px 0 #0B0F18;
  background: linear-gradient(180deg, #DC2626 0%, #991B1B 100%);
  color: #FEF2F2;
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: 0.05em;
  cursor: pointer;
}
.reset-danger-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 0 #0B0F18;
}

.setting-ver-note {
  font-size: 12px;
  font-weight: 800;
  color: #64748B;
  font-variant-numeric: tabular-nums;
}

/* Credits Pane inside Settings Modal */
.credits-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: #0C121E;
  border: 2px solid #26344B;
  border-radius: 12px;
}

.credits-hero-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.credits-hero-brand {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.16em;
  color: #F8FAFC;
}

.credits-hero-sub {
  font-size: 12px;
  font-weight: 800;
  color: #38BDF8;
}

.credits-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.credit-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #141C2C;
  border: 1.5px solid #29364E;
  border-radius: 10px;
  padding: 7px 11px;
}

.credit-role {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: #94A3B8;
}

.credit-name {
  font-size: 13px;
  font-weight: 900;
  color: #F8FAFC;
  text-align: right;
}

.credits-oss-note {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #94A3B8;
}

.credits-back-btn {
  height: 38px;
  border-radius: 11px;
  border: 2px solid #0B0F18;
  box-shadow: 0 3px 0 #0B0F18;
  background: linear-gradient(180deg, #334155 0%, #1E293B 100%);
  color: #F8FAFC;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.credits-back-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 0 #0B0F18;
}

/* 6x6 Fleet Mastery Medal Grid Modal */
.mastery-card {
  background: var(--panel);
  border: 3px solid #0B0F18;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.72), inset 0 0 0 1.5px rgba(255, 255, 255, 0.10);
  border-radius: 18px;
  width: 96%;
  max-width: 836px;
  padding: 13px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.mastery-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.mastery-title-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.mastery-title {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.6px;
  color: #FFFFFF;
}

.mastery-sub {
  font-size: 12.5px;
  font-weight: 700;
  color: #94A3B8;
}

.mastery-matrix {
  display: grid;
  grid-template-columns: 122px repeat(6, minmax(0, 1fr)) 86px;
  gap: 5px;
  align-items: stretch;
}

.m-corner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 4px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #64748B;
}

.m-col-head {
  background: #141C2C;
  border: 1.5px solid #29354D;
  border-radius: 9px;
  padding: 4px 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
}

.m-col-head canvas {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.m-col-label {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.3px;
  color: #CBD5E1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-row-head {
  background: #141C2C;
  border: 1.5px solid #29354D;
  border-radius: 9px;
  padding: 3px 7px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.m-row-head canvas {
  width: 28px;
  height: 21px;
  flex-shrink: 0;
}

.m-row-label {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.3px;
  color: #F8FAFC;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-cell {
  position: relative;
  height: 42px;
  border-radius: 9px;
  border: 2px solid #2D3B55;
  background: #151F32;
  color: #E2E8F0;
  padding: 2px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 900;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.1s;
}
.m-cell:not(.locked):active {
  transform: scale(0.96);
}

.m-cell.earned {
  background: linear-gradient(180deg, #854D0E 0%, #63380A 100%);
  border-color: #FACC15;
  color: #FEF08A;
  font-variant-numeric: tabular-nums;
}

.m-cell.earned.tier-bronze {
  background: linear-gradient(180deg, #7C2D12 0%, #581F0C 100%);
  border-color: #FB923C;
  color: #FFEDD5;
}

.m-cell.earned.tier-silver {
  background: linear-gradient(180deg, #475569 0%, #2B3648 100%);
  border-color: #E2E8F0;
  color: #F8FAFC;
}

.m-cell.earned.tier-gold {
  background: linear-gradient(180deg, #854D0E 0%, #63380A 100%);
  border-color: #FACC15;
  color: #FEF08A;
}

.m-cell.earned.tier-dev {
  background: linear-gradient(180deg, #0369A1 0%, #0C4A6E 100%);
  border-color: #38BDF8;
  color: #E0F2FE;
  box-shadow: inset 0 0 0 1px rgba(186, 230, 253, 0.35);
}

.m-time-val {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.m-col-head.tour-head {
  background: #101A2B;
  border-color: #334155;
}
.m-col-head.tour-head .m-col-label {
  color: #7DD3FC;
}

.m-tour-cell {
  height: 42px;
  border-radius: 9px;
  border: 2px solid #243248;
  background: #101827;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #64748B;
  white-space: nowrap;
}

.m-tour-cell.complete {
  background: linear-gradient(180deg, #0F3A56 0%, #0B273B 100%);
  border-color: #38BDF8;
  color: #FDE047;
}

.m-cell.progress {
  background: #1B2840;
  border-color: #38BDF8;
  color: #E0F2FE;
}

.m-cell.ready {
  background: #151E30;
  border-color: #334155;
  color: #FDE047;
}

.m-cell.locked {
  background: #0E1422;
  border-color: #1E293B;
  color: #64748B;
  opacity: 0.60;
  cursor: default;
}

.m-cell.active-pair {
  box-shadow: 0 0 0 2px var(--cyan);
}

.m-star-svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.m-lock-svg {
  width: 14px;
  height: 14px;
  opacity: 0.75;
}

.m-prog-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3.5px;
  background: rgba(15, 23, 42, 0.75);
}

.m-prog-fill {
  height: 100%;
  background: #38BDF8;
}

.mastery-card.grandmaster {
  border-color: #CA8A04;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.75), inset 0 0 0 2px rgba(250, 204, 21, 0.42);
}

.mastery-pill-btn.grandmaster {
  border-color: #FACC15;
  background: linear-gradient(180deg, #422006 0%, #271506 100%);
  color: #FEF08A;
}

.dev-subhead {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #A78BFA;
  margin-top: 2px;
}

.dev-ad-meta {
  font-size: 12px;
  font-weight: 800;
  color: #BAE6FD;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid #334155;
  border-radius: 8px;
  padding: 5px 9px;
  font-variant-numeric: tabular-nums;
}

/* =========================================================================
   4B. DEV MODE PLACEHOLDER ADS (HCR 320x50 BANNER & FULLSCREEN INTERSTITIAL/REWARDED)
   ========================================================================= */
.ad-banner-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(50px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: transparent;
  border-top: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 38;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

body.has-preview-banner #hub-screen {
  padding-bottom: calc(max(10px, var(--edge-y-bot)) + 50px);
}

.ad-banner-slot {
  position: relative;
  width: 320px;
  height: 50px;
  background: linear-gradient(90deg, #0F172A 0%, #1E293B 55%, #0F172A 100%);
  border: 1.5px solid #29364E;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  padding: 0 8px;
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
}

.ad-banner-tag {
  position: absolute;
  left: 0;
  top: 0;
  background: #FACC15;
  color: #0F172A;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  padding: 1.5px 4px;
  border-bottom-right-radius: 4px;
  z-index: 2;
}

.ad-banner-tiles {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding-left: 16px;
}

.ad-b-tile {
  width: 38px;
  height: 36px;
  border-radius: 6px;
  border: 1.5px solid #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ad-b-tile.t1 { background: linear-gradient(180deg, #38BDF8 0%, #0284C7 100%); }
.ad-b-tile.t2 { background: linear-gradient(180deg, #FDE047 0%, #EA580C 100%); }
.ad-b-tile svg { width: 32px; height: 28px; display: block; }

.ad-b-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ad-b-headline {
  font-size: 12px;
  font-weight: 900;
  color: #F8FAFC;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ad-b-meta {
  font-size: 12px;
  font-weight: 800;
  color: #94A3B8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ad-b-cta {
  height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  background: #16A34A;
  color: #F0FDF4;
  font-size: 12px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 4px;
}

.ad-choices-badge {
  position: absolute;
  top: 0;
  right: 0;
  line-height: 0;
  z-index: 2;
}

/* Fullscreen Dummy Interstitial & Rewarded Video Simulator */
.ad-sim-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 45%, #172033 0%, #070A12 100%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  user-select: none;
  -webkit-user-select: none;
}

.ad-sim-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.ad-sim-top-left,
.ad-sim-top-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ad-sim-format-pill {
  height: 32px;
  padding: 0 11px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.92);
  border: 1.5px solid #475569;
  color: #E2E8F0;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
}

.ad-sim-timer-pill {
  height: 32px;
  padding: 0 10px;
  border-radius: 99px;
  background: rgba(250, 204, 21, 0.16);
  border: 1.5px solid rgba(250, 204, 21, 0.55);
  color: #FEF08A;
  font-size: 12.5px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
}

.ad-sim-noads-btn {
  height: 32px;
  padding: 0 11px;
  border-radius: 99px;
  border: 1.5px solid #38BDF8;
  background: rgba(14, 165, 233, 0.18);
  color: #E0F2FE;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.4px;
  cursor: pointer;
}

/* =========================================================================
   4C. PURIST-FRIENDLY 2-CARD IAP STORE & SIMULATED PLAY BILLING SHEET
   ========================================================================= */
.store-card {
  position: relative;
  background: var(--panel);
  border: 3px solid #0B0F18;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.78), inset 0 0 0 1.5px rgba(255, 255, 255, 0.10);
  border-radius: 18px;
  width: 95%;
  max-width: 632px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  overflow: hidden;
}

.store-card .specs-title-wrap {
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.store-sub-note {
  font-size: 12px;
  font-weight: 700;
  color: #94A3B8;
  white-space: nowrap;
}

.store-grid {
  display: grid;
  grid-template-columns: 1fr 1.08fr;
  gap: 12px;
  align-items: stretch;
}

.store-tier-card {
  background: #141C2C;
  border: 2.5px solid #2D3B55;
  border-radius: 15px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}
.store-tier-card.vip {
  background: linear-gradient(180deg, #1E2436 0%, #171D2D 100%);
  border-color: #CA8A04;
  box-shadow: inset 0 0 0 1.5px rgba(250, 204, 21, 0.28);
}

.store-tier-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
}

.store-tier-badge {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 2px 9px;
  border-radius: 99px;
}
.store-tier-badge.slate {
  background: rgba(56, 189, 248, 0.16);
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  color: #BAE6FD;
}
.store-tier-badge.gold {
  background: #FACC15;
  color: #0B0F18;
}

.store-tier-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0B0F18;
}
.store-tier-icon.cyan {
  background: linear-gradient(180deg, #0EA5E9 0%, #0369A1 100%);
}
.store-tier-icon.gold {
  background: linear-gradient(180deg, #422006 0%, #271506 100%);
  border-color: #CA8A04;
}

.store-tier-title {
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #FFFFFF;
}

.store-perks {
  margin: 0;
  padding: 0 0 0 17px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: #E2E8F0;
  line-height: 1.3;
  text-align: left;
}
.store-tier-card.noads .store-perks strong {
  color: #7DD3FC;
}
.store-perks strong {
  color: #FDE047;
  font-weight: 900;
}

.store-buy-btn {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 2.5px solid #0B0F18;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.4px;
  cursor: pointer;
}
.store-buy-btn.noads {
  background: linear-gradient(180deg, #38BDF8 0%, #0284C7 100%);
  color: #082F49;
  box-shadow: 0 4px 0 #0C4A6E;
}
.store-buy-btn.vip {
  background: linear-gradient(180deg, #FDE047 0%, #EAB308 100%);
  color: #1E2430;
  box-shadow: 0 4px 0 #854D0E;
}
.store-buy-btn:active:not(:disabled) {
  transform: translateY(2px);
}
.store-buy-btn:disabled {
  background: rgba(21, 128, 61, 0.30);
  border-color: #4ADE80;
  color: #86EFAC;
  box-shadow: none;
  cursor: default;
}

.store-status-note {
  text-align: center;
  font-size: 12.5px;
  font-weight: 800;
  color: #4ADE80;
}

.setting-row.vip-row {
  border-color: #CA8A04;
  background: linear-gradient(90deg, #1E1B12 0%, #141C2C 100%);
}
.setting-row.store-row {
  border-color: #38BDF8;
}

/* Simulated Google Play Billing Bottom Sheet */
.store-gp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 9, 15, 0.84);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  z-index: 6;
}

.store-gp-card {
  width: 100%;
  max-width: 470px;
  background: #1E293B;
  border: 2.5px solid #475569;
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.75);
}

.store-gp-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 900;
  color: #CBD5E1;
}

.store-gp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #0F172A;
  border: 1.5px solid #334155;
  border-radius: 12px;
  padding: 10px 12px;
}

.store-gp-name {
  font-size: 15px;
  font-weight: 900;
  color: #FFFFFF;
}

.store-gp-desc {
  font-size: 12px;
  font-weight: 700;
  color: #94A3B8;
}

.store-gp-price {
  font-size: 20px;
  font-weight: 900;
  color: #4ADE80;
  white-space: nowrap;
}

.store-gp-actions {
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 10px;
}

.ad-sim-dev-ff {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1.5px solid #A78BFA;
  background: rgba(124, 58, 237, 0.28);
  color: #EDE9FE;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.3px;
  cursor: pointer;
}
.ad-sim-dev-ff:hover {
  background: rgba(124, 58, 237, 0.45);
}

.ad-sim-action-btn {
  height: 42px;
  padding: 0 18px;
  border-radius: 99px;
  border: 2.5px solid #F8FAFC;
  background: #F8FAFC;
  color: #0F172A;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.4px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.ad-sim-action-btn.reward-ready {
  background: linear-gradient(180deg, #4ADE80 0%, #16A34A 100%);
  border-color: #BBF7D0;
  color: #052E16;
}
.ad-sim-action-btn:disabled {
  background: rgba(15, 23, 42, 0.88);
  border-color: #475569;
  color: #CBD5E1;
  cursor: default;
}

.ad-sim-abort-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid #475569;
  background: rgba(15, 23, 42, 0.85);
  color: #CBD5E1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ad-sim-stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 0.95fr 1.15fr;
  align-items: center;
  gap: 20px;
  padding: 10px 18px;
}

.ad-sim-art {
  width: 100%;
  max-height: 210px;
  aspect-ratio: 16 / 10;
  border-radius: 16px;
  border: 3px solid #0B0F18;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
  background: linear-gradient(180deg, #0EA5E9 0%, #0369A1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ad-sim-art svg {
  width: 100%;
  height: 100%;
  display: block;
}

.ad-sim-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
}

.ad-sim-sponsor {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #94A3B8;
}

.ad-sim-headline {
  font-size: 24px;
  font-weight: 900;
  color: #FFFFFF;
  line-height: 1.12;
}

.ad-sim-sub {
  font-size: 14px;
  font-weight: 700;
  color: #CBD5E1;
  line-height: 1.3;
}

.ad-sim-mock-cta {
  height: 44px;
  padding: 0 22px;
  border-radius: 12px;
  border: 2.5px solid #0B0F18;
  box-shadow: 0 4px 0 #14532D;
  background: linear-gradient(180deg, #4ADE80 0%, #16A34A 100%);
  color: #052E16;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.5px;
  cursor: pointer;
}

.ad-sim-toast {
  font-size: 12px;
  font-weight: 800;
  color: #FDE047;
}

.ad-sim-forfeit {
  position: absolute;
  inset: 0;
  background: rgba(7, 10, 18, 0.86);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 4;
}

.ad-forfeit-card {
  background: var(--panel);
  border: 3px solid #0B0F18;
  border-radius: 18px;
  max-width: 380px;
  width: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}

.ad-forfeit-title {
  font-size: 19px;
  font-weight: 900;
  color: #FCA5A5;
}

.ad-forfeit-sub {
  font-size: 13px;
  font-weight: 700;
  color: #E2E8F0;
  line-height: 1.35;
}

.ad-forfeit-actions {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 9px;
}

.ad-sim-prog-track {
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: rgba(51, 65, 85, 0.65);
  overflow: hidden;
  flex-shrink: 0;
}

.ad-sim-prog-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38BDF8 0%, #4ADE80 100%);
  transition: width 0.1s linear;
}
#dev-drawer {
  position: fixed;
  top: 56px;
  right: 14px;
  width: 300px;
  max-height: calc(100vh - 68px);
  max-height: calc(100dvh - 68px);
  overflow-y: auto;
  background: rgba(17, 24, 39, 0.98);
  border: 3px solid #7C3AED;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
  border-radius: 16px;
  padding: 14px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.dev-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 900;
  font-size: 15px;
  color: #DDD6FE;
}

.dev-check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 700;
  color: #E2E8F0;
  cursor: pointer;
}

.dev-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.dev-mini-btn {
  background: #283347;
  color: #F8FAFC;
  border: 2px solid #475569;
  border-radius: 9px;
  padding: 9px 8px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.dev-mini-btn.accent {
  background: linear-gradient(180deg, #0369A1 0%, #075985 100%);
  border-color: #38BDF8;
  color: #E0F2FE;
}
.dev-mini-btn.danger {
  border-color: #EF4444;
  color: #FCA5A5;
}

/* =========================================================================
   5. MOBILE LANDSCAPE TUNING (Phone Heights 340px - 500px, e.g. 844x390)
   ========================================================================= */
@media (max-height: 500px) {
  #hub-screen {
    padding: max(8px, env(safe-area-inset-top), var(--safe-top)) var(--edge-x-right) max(6px, env(safe-area-inset-bottom), var(--safe-bottom)) var(--edge-x-left);
    gap: 6px;
  }

  .bank-pill { height: 36px; padding: 0 12px; font-size: 16.5px; border-radius: 10px; gap: 7px; }
  .mastery-pill-btn { height: 36px; padding: 0 11px; font-size: 14.5px; border-radius: 10px; gap: 6px; }
  .store-pill-btn { height: 36px; padding: 0 10px; font-size: 12.5px; border-radius: 10px; gap: 5px; }
  .store-crown-svg { width: 15px; height: 15px; }
  .trophy-mini-svg { width: 17px; height: 17px; }
  .loadout-pill { padding: 4px 10px; font-size: 12.5px; }
  .square-btn, .dev-toggle-btn { height: 36px; border-radius: 10px; }
  .square-btn { width: 36px; }

  .hub-view { gap: 6px; }

  /* Ship & Stage 3-Card Carousel on 844x390 */
  .selector-head { gap: 2px; }
  .selector-title { font-size: 21px; }
  .selector-sub { font-size: 13px; }
  .coverflow-row {
    grid-template-columns: minmax(120px, 0.50fr) minmax(280px, 1.24fr) minmax(120px, 0.50fr);
    gap: 10px;
  }
  .peek-slot { gap: 4px; }
  .peek-label { font-size: 12.5px; }
  .peek-card { max-height: 142px; border-radius: 10px; }
  .peek-cost { font-size: 12px; padding: 2px 7px; }
  .peek-lock-badge .lock-svg { width: 23px; height: 23px; }

  .track-card-box { border-radius: 14px; }
  .track-peek-label { font-size: 12.5px; }
  .track-peek-lock { font-size: 12px; padding: 2px 7px; }
  .hero-card { border-radius: 14px; }
  .specs-card { padding: 11px 15px; gap: 7px; max-width: 455px; border-radius: 15px; }
  .specs-card.compare-mode { padding: 8px 11px; gap: 5px; max-width: 814px; border-radius: 14px; }
  .specs-single-pane { gap: 7px; }
  .specs-title { font-size: 18px; }
  .compare-open-btn, .compare-back-btn { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 8px; }
  .cmp-mode-btn { height: 24px; padding: 0 8px; font-size: 12px; }
  .compare-matrix { grid-template-columns: 104px repeat(6, minmax(0, 1fr)); gap: 3px; }
  .cmp-col-head { padding: 2px 3px; border-radius: 7px; gap: 1px; }
  .cmp-col-head canvas { width: 29px; height: 20px; }
  .cmp-row-label { border-radius: 7px; padding: 0 6px; font-size: 12px; }
  .cmp-cell { height: 27px; border-radius: 7px; font-size: 12px; padding: 0 3px; }
  .cmp-cell.perk { font-size: 12px; }
  .specs-bars { gap: 5px; }
  .spec-row { grid-template-columns: 96px 1fr 112px; gap: 7px; }
  .spec-bar-track { height: 10px; }
  .specs-perks { padding: 7px 10px; gap: 3px; }
  .hero-top-bar { top: 7px; left: 8px; right: 8px; }
  .hero-chip { padding: 3px 8px; font-size: 12px; border-radius: 7px; }
  .chip-star-svg { width: 13.5px; height: 13.5px; }
  .ship-lv-pill { height: 22px; padding: 0 7px; font-size: 11.5px; border-radius: 6px; }
  .stage-prog-dock { left: 8px; right: 8px; bottom: 7px; height: 25px; padding: 0 9px; gap: 9px; border-radius: 8px; }
  .stage-prog-track { height: 6px; }
  .stage-next-bonus { font-size: 11.5px; }

  .hero-locked-overlay { padding: 10px; gap: 6px; }
  .hero-locked-overlay.ship-locked { padding-bottom: 2px; }
  .locked-hint { font-size: 12px; padding: 3px 9px; }
  .unlock-big-btn { height: 40px; font-size: 15px; padding: 0 18px; min-width: 185px; }

  /* Tune 4-Part Grid on 844x390 */
  .tune-ship-name { font-size: 19px; }
  .tune-ship-sub { font-size: 13px; }
  .tune-grid { gap: 10px; }
  .upg-tile { border-radius: 12px; box-shadow: 0 4px 0 #090D15; }
  .upg-cost-cap { padding: 5px 8px; font-size: 16px; }
  .upg-art-well { padding: 6px 6px 4px 7px; gap: 4px; }
  .upg-vmeter { width: 9px; gap: 1.5px; }
  .upg-lvl { font-size: 14px; }
  .upg-stepper { gap: 4px; }
  .upg-step-btn { width: 26px; height: 26px; border-radius: 7px; }
  .upg-step-btn svg { width: 14px; height: 14px; }
  .upg-foot { padding: 4px 7px; }
  .upg-name { font-size: 12.5px; }
  .upg-tag { font-size: 12px; padding: 1px 5px; }

  /* Persistent Bottom Dock on 844x390 */
  .hub-dock {
    grid-template-columns: repeat(4, minmax(105px, 146px));
    gap: 7px;
  }
  .dock-btn { height: 46px; font-size: 16px; border-radius: 10px; gap: 7px; }
  .dock-icon { width: 22px; height: 22px; }
  .dock-canvas.stage { width: 24px; height: 24px; }
  .dock-canvas.ship { width: 30px; height: 23px; }

  /* HUD & Modals on Phone Landscape (Exact 36px uniform pill height + symmetric corner clearance!) */
  #hud-layer {
    top: max(8px, env(safe-area-inset-top), var(--safe-top));
    left: var(--edge-x-left);
    right: var(--edge-x-right);
  }
  .hud-side { gap: 7px; }
  .hud-icon-btn { width: 36px; height: 36px; border-radius: 10px; }
  .fuel-pill { height: 36px; border-radius: 10px; padding: 0 10px 0 8px; gap: 6px; }
  .fuel-bolt-svg { width: 14px; height: 14px; }
  .fuel-track { width: 104px; height: 11px; }
  .shield-pips { padding-left: 6px; gap: 2.5px; }
  .shield-pip-svg { width: 15px; height: 16px; }
  .dist-pill { height: 36px; border-radius: 10px; padding: 0 13px; font-size: 18px; }
  .timer-pill { height: 36px; border-radius: 10px; padding: 0 11px; font-size: 15px; }
  .coin-pill { height: 36px; border-radius: 10px; padding: 0 12px; font-size: 16.5px; gap: 7px; }
  .bot-pill-btn, .dev-pill-btn { height: 36px; border-radius: 10px; padding: 0 10px; font-size: 12px; }

  .results-card { padding: 14px 18px; gap: 10px; border-radius: 16px; max-width: 452px; }
  .res-reason { font-size: 15px; }
  #res-dist { font-size: 40px; }
  #res-best { font-size: 13.5px; }
  .res-payout-box { padding: 9px 14px; }
  .res-payout-val { font-size: 20px; }
  .res-double-btn { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
  .revive-card { padding: 13px 17px; gap: 8px; border-radius: 16px; max-width: 410px; }
  .revive-title { font-size: 21px; }
  .revive-sub { font-size: 12.5px; }
  .revive-watch-btn { height: 42px; font-size: 14.5px; border-radius: 11px; }
  .ad-sim-stage { gap: 14px; padding: 4px 10px; }
  .ad-sim-art { max-height: 168px; border-radius: 13px; }
  .ad-sim-headline { font-size: 19px; }
  .ad-sim-sub { font-size: 13px; }
  .ad-sim-mock-cta { height: 38px; padding: 0 18px; font-size: 13.5px; border-radius: 10px; }
  body.has-preview-banner #hub-screen {
    padding-bottom: calc(max(9px, env(safe-area-inset-bottom), var(--safe-bottom)) + 50px);
    gap: 4px;
  }
  body.has-preview-banner .hub-view { gap: 4px; }
  body.has-preview-banner .selector-title { font-size: 19px; }
  body.has-preview-banner .selector-sub { font-size: 12px; }
  body.has-preview-banner .tune-ship-name { font-size: 17.5px; }
  body.has-preview-banner .tune-ship-sub { font-size: 12px; }
  body.has-preview-banner .upg-cost-cap { padding: 4px 8px; font-size: 15px; }
  body.has-preview-banner .upg-art-well { padding: 4px 6px 3px 7px; }
  body.has-preview-banner .upg-foot { padding: 3px 7px; }
  .play-btn, .secondary-btn, .next-stage-btn { height: 39px; font-size: 14.5px; border-radius: 11px; }
  .ghost-btn { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
  .compact-card { padding: 11px 15px; gap: 6px; }
  .compact-card h3 { font-size: 18px; margin: 0; }
  .settings-card { padding: 8px 14px; gap: 5px; max-width: 442px; border-radius: 15px; }
  .settings-pane { gap: 5px; }
  .settings-list { gap: 4px; }
  .setting-row { height: 33px; font-size: 12.5px; border-radius: 9px; }

  .store-card { padding: 10px 14px; gap: 8px; max-width: 620px; border-radius: 15px; }
  .store-grid { gap: 10px; }
  .store-tier-card { padding: 9px 12px; gap: 7px; border-radius: 12px; }
  .store-tier-icon { width: 34px; height: 34px; border-radius: 9px; }
  .store-tier-icon svg { width: 24px; height: 24px; }
  .store-tier-title { font-size: 16.5px; }
  .store-perks { gap: 3px; font-size: 12px; }
  .store-buy-btn { height: 37px; font-size: 15px; border-radius: 10px; }
  .store-gp-card { padding: 11px 14px; gap: 8px; }

  .mastery-card { padding: 8px 10px; gap: 5px; max-width: 824px; border-radius: 14px; }
  .mastery-title { font-size: 16.5px; }
  .mastery-sub { font-size: 12px; }
  .mastery-matrix { grid-template-columns: 116px repeat(6, minmax(0, 1fr)) 72px; gap: 3px; }
  .m-col-head { padding: 2px 3px; gap: 3px; border-radius: 7px; }
  .m-col-head canvas { width: 15px; height: 15px; }
  .m-col-label, .m-row-label { font-size: 11.5px; letter-spacing: 0; }
  .m-row-head { padding: 1.5px 5px; gap: 4px; border-radius: 7px; }
  .m-row-head canvas { width: 21px; height: 16px; }
  .m-cell { height: 29px; border-radius: 7px; font-size: 11.5px; gap: 3px; }
  .m-star-svg { width: 13px; height: 13px; }
  .m-tour-cell { height: 29px; border-radius: 7px; font-size: 11.5px; padding: 2px 2px; }
}

/* =========================================================================
   5B. MOBILE WEB BROWSER LANDSCAPE (Short 260px - 345px Viewport w/ URL Bar)
   ========================================================================= */
@media (max-height: 345px) {
  #hub-screen {
    padding: max(5px, env(safe-area-inset-top), var(--safe-top)) var(--edge-x-right) max(5px, env(safe-area-inset-bottom), var(--safe-bottom)) var(--edge-x-left);
    gap: 4px;
  }
  .bank-pill { height: 32px; padding: 0 10px; font-size: 15px; }
  .mastery-pill-btn { height: 32px; padding: 0 9px; font-size: 13.5px; }
  .store-pill-btn { height: 32px; padding: 0 9px; font-size: 12px; }
  .square-btn, .dev-toggle-btn { height: 32px; }
  .square-btn { width: 32px; }
  .selector-title { font-size: 18px; }
  .selector-sub { font-size: 12px; }
  .hub-view { gap: 4px; }
  .peek-card { max-height: 116px; }
  .hub-dock { gap: 6px; }
  .dock-btn { height: 38px; font-size: 14.5px; border-radius: 9px; }
  #hud-layer { top: max(6px, env(safe-area-inset-top), var(--safe-top)); }
  .hud-icon-btn { width: 32px; height: 32px; border-radius: 9px; }
  .fuel-pill, .dist-pill, .timer-pill, .coin-pill, .bot-pill-btn, .dev-pill-btn { height: 32px; border-radius: 9px; }
  .dist-pill { font-size: 16px; padding: 0 11px; }
  .timer-pill { font-size: 13.5px; padding: 0 9px; }
  .coin-pill { font-size: 15px; padding: 0 10px; }
  .results-card { padding: 10px 16px; gap: 6px; }
  #res-dist { font-size: 32px; }
  .res-double-btn { height: 27px; padding: 0 8px; font-size: 12px; }
  .revive-card { padding: 9px 14px; gap: 6px; }
  .revive-title { font-size: 18px; }
  .revive-watch-btn { height: 36px; font-size: 13.5px; }
  body.has-preview-banner #hub-screen {
    padding-bottom: calc(max(6px, env(safe-area-inset-bottom), var(--safe-bottom)) + 50px);
    gap: 2px;
  }
  body.has-preview-banner .hub-view { gap: 2px; }
  body.has-preview-banner .upg-cost-cap { padding: 2px 6px; font-size: 13px; }
  body.has-preview-banner .upg-art-well { padding: 2px 4px; }
  body.has-preview-banner .upg-foot { padding: 2px 5px; }
  .play-btn, .secondary-btn, .next-stage-btn { height: 35px; font-size: 13.5px; }
  .settings-card { padding: 7px 12px; gap: 4px; }
  .settings-pane { gap: 4px; }
  .settings-list { gap: 3.5px; }
  .setting-row { height: 31px; font-size: 12px; }
  .setting-pill { height: 23px; min-width: 48px; font-size: 11.5px; }
  .setting-studio-card { padding: 5px 9px; }
}

@media (max-width: 660px) {
  .loadout-pill { display: none; }
  .tune-grid { grid-template-columns: repeat(2, 1fr); }
  .coverflow-row { grid-template-columns: 1fr; }
  .peek-slot { display: none; }
  .ad-sim-stage { grid-template-columns: 1fr; gap: 10px; text-align: center; }
  .ad-sim-info { align-items: center; text-align: center; }
}
