html,
body {
  overflow: hidden;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: #05010f;
  font-family: "Segoe UI", Tahoma, sans-serif;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#renderCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  display: block;
  z-index: 0;
  /* No hub o menu precisa receber o clique; na corrida reativamos */
  pointer-events: none;
}

#renderCanvas.racing {
  pointer-events: auto;
}

#hud {
  display: none;
  position: fixed;
  left: 16px;
  top: 16px;
  color: #b8f3ff;
  text-shadow: 0 0 8px #00e5ff;
  pointer-events: none;
  user-select: none;
  z-index: 2;
}

#hud.show {
  display: block;
}

/* Hub estilo Brawl Stars / Stumble Guys: carro no centro */
#mainMenu {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: radial-gradient(
    ellipse 55% 50% at 50% 55%,
    transparent 0%,
    rgba(5, 1, 20, 0.15) 55%,
    rgba(5, 1, 20, 0.55) 100%
  );
}

#mainMenu.show {
  display: block;
}

#mainMenu .hit {
  pointer-events: auto;
}

.menu-brand {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

.menu-brand h1 {
  margin: 0;
  font-family: "Orbitron", "Segoe UI", Tahoma, sans-serif;
  font-weight: 800;
  font-size: clamp(28px, 6vw, 48px);
  letter-spacing: 6px;
  color: #ff4fd8;
  text-shadow: 0 0 18px #ff4fd8, 0 0 36px #00e5ff;
}

.logo-glitch {
  position: relative;
  display: inline-block;
  isolation: isolate;
}

.logo-glitch::before,
.logo-glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  font: inherit;
  letter-spacing: inherit;
  white-space: nowrap;
  text-shadow: none;
}

/* Ghosts só nos picos — ciclo longo: burst A (esq/dir) depois burst B invertido */
.logo-glitch::before {
  color: #00e5ff;
  opacity: 0;
  transform: translate(0, 0);
  z-index: -1;
  animation: logo-glitch-cyan 5.6s steps(2, end) infinite;
}

.logo-glitch::after {
  color: #ff4fd8;
  opacity: 0;
  transform: translate(0, 0);
  z-index: -2;
  animation: logo-glitch-magenta 5.6s steps(2, end) infinite;
  animation-delay: 0.12s;
}

@keyframes logo-glitch-cyan {
  0%,
  43%,
  50%,
  93%,
  100% {
    opacity: 0;
    transform: translate(0, 0);
    clip-path: inset(0 0 0 0);
  }

  /* Burst A — inicia para a esquerda */
  43.5% {
    opacity: 0.55;
    transform: translate(-6px, 2px);
    clip-path: inset(12% 0 55% 0);
  }
  44.5% {
    opacity: 0.25;
    transform: translate(4px, -2px);
    clip-path: inset(40% 0 20% 0);
  }
  45.5% {
    opacity: 0.45;
    transform: translate(-5px, 0);
    clip-path: inset(0 0 0 0);
  }
  46.5% {
    opacity: 0.6;
    transform: translate(-7px, 1px);
  }
  47%,
  48% {
    opacity: 0;
    transform: translate(0, 0);
  }

  /* Burst B — direções invertidas (inicia para a direita) */
  93.5% {
    opacity: 0.55;
    transform: translate(6px, 2px);
    clip-path: inset(12% 0 55% 0);
  }
  94.5% {
    opacity: 0.25;
    transform: translate(-4px, -2px);
    clip-path: inset(40% 0 20% 0);
  }
  95.5% {
    opacity: 0.45;
    transform: translate(5px, 0);
    clip-path: inset(0 0 0 0);
  }
  96.5% {
    opacity: 0.6;
    transform: translate(7px, 1px);
  }
  97%,
  98% {
    opacity: 0;
    transform: translate(0, 0);
  }
}

@keyframes logo-glitch-magenta {
  0%,
  43%,
  50%,
  93%,
  100% {
    opacity: 0;
    transform: translate(0, 0);
    clip-path: inset(0 0 0 0);
  }

  /* Burst A — inicia para a direita */
  44% {
    opacity: 0.5;
    transform: translate(6px, -2px);
    clip-path: inset(50% 0 10% 0);
  }
  45% {
    opacity: 0.22;
    transform: translate(-3px, 2px);
    clip-path: inset(8% 0 48% 0);
  }
  46% {
    opacity: 0.4;
    transform: translate(5px, 0);
    clip-path: inset(0 0 0 0);
  }
  47% {
    opacity: 0.55;
    transform: translate(7px, -1px);
  }
  47.5%,
  48.5% {
    opacity: 0;
    transform: translate(0, 0);
  }

  /* Burst B — invertido (inicia para a esquerda) */
  94% {
    opacity: 0.5;
    transform: translate(-6px, -2px);
    clip-path: inset(50% 0 10% 0);
  }
  95% {
    opacity: 0.22;
    transform: translate(3px, 2px);
    clip-path: inset(8% 0 48% 0);
  }
  96% {
    opacity: 0.4;
    transform: translate(-5px, 0);
    clip-path: inset(0 0 0 0);
  }
  97% {
    opacity: 0.55;
    transform: translate(-7px, -1px);
  }
  97.5%,
  98.5% {
    opacity: 0;
    transform: translate(0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .logo-glitch::before,
  .logo-glitch::after {
    animation: none;
    opacity: 0;
  }
}

.menu-brand p {
  margin: 4px 0 0;
  font-family: "Orbitron", "Segoe UI", Tahoma, sans-serif;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 4px;
  color: #b8f3ff;
  text-shadow: 0 0 8px #00e5ff;
  opacity: 0.5;
}

.menu-rail {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 86px;
}

.menu-account {
  appearance: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border: 2px solid #ffd24a;
  border-radius: 14px;
  background: rgba(10, 4, 30, 0.82);
  box-shadow: 0 0 14px rgba(255, 210, 74, 0.25);
  color: #ffe79a;
  cursor: pointer;
  font: inherit;
  text-align: center;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.menu-account:hover,
.menu-account:focus-visible,
#mainMenu.account-open #btnAccount {
  background: rgba(255, 210, 74, 0.16);
  box-shadow: 0 0 18px rgba(255, 210, 74, 0.4);
  outline: none;
}

.menu-money-value,
.menu-ficha-value {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
}

.menu-money-value {
  color: #fff8d6;
  text-shadow: 0 0 8px rgba(255, 210, 74, 0.45);
}

.menu-ficha-value {
  color: #ffc7c4;
  text-shadow: 0 0 8px rgba(229, 57, 53, 0.45);
}

.menu-money-value #moneyLabel,
.menu-ficha-value #fichaLabel {
  font: inherit;
  color: inherit;
  text-shadow: inherit;
}

.coin-icon,
.ficha-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.coin-icon {
  filter: drop-shadow(0 0 4px rgba(255, 210, 74, 0.55));
}

.ficha-icon {
  filter: drop-shadow(0 0 4px rgba(229, 57, 53, 0.55));
}

.menu-account-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  color: #b8f3ff;
}

.menu-account-row small {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.8px;
  opacity: 0.8;
}

.menu-account-row strong {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.45);
}

.boost-badge {
  margin-top: 2px;
  font-size: 9px !important;
  letter-spacing: 0.5px !important;
  opacity: 1 !important;
}

.boost-badge.mult {
  color: #39ff9f;
  text-shadow: 0 0 8px rgba(57, 255, 159, 0.55);
}

.boost-badge.tire {
  color: #7ec8ff;
  text-shadow: 0 0 8px rgba(126, 200, 255, 0.55);
}

.boost-badge.ticket {
  color: #ffb347;
  text-shadow: 0 0 8px rgba(255, 179, 71, 0.55);
}

.play-btn.needs-ticket {
  border-color: #ffb347;
  background: linear-gradient(
    180deg,
    rgba(255, 179, 71, 0.28),
    rgba(120, 70, 20, 0.5)
  );
  color: #ffe7c2;
  text-shadow: 0 0 10px rgba(255, 179, 71, 0.65);
  box-shadow: 0 0 20px rgba(255, 179, 71, 0.25);
  opacity: 0.85;
  font-size: clamp(14px, 2.8vw, 18px);
  letter-spacing: 1px;
  padding: 14px 12px;
  font-weight: 700;
}

.track-switch-btn.track-locked strong {
  color: #ffb347;
}

.rail-btn {
  appearance: none;
  width: 100%;
  min-height: 72px;
  padding: 8px 6px;
  border: 2px solid #00e5ff;
  border-radius: 14px;
  background: rgba(10, 4, 30, 0.82);
  color: #b8f3ff;
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-shadow: 0 0 8px #00e5ff;
  transition: background 0.15s ease, box-shadow 0.15s ease,
    transform 0.15s ease;
}

.rail-btn .icon {
  font-size: 22px;
  line-height: 1;
}

.rail-btn.race {
  border-color: #39ff9f;
  color: #c8ffe0;
  text-shadow: 0 0 8px rgba(57, 255, 159, 0.55);
}

.rail-btn.race:hover:not(:disabled),
.rail-btn.race:focus-visible:not(:disabled) {
  background: rgba(57, 255, 159, 0.16);
  box-shadow: 0 0 16px rgba(57, 255, 159, 0.3);
  outline: none;
}

.rail-btn:hover:not(:disabled),
.rail-btn:focus-visible:not(:disabled),
#mainMenu.garage-open #btnGarage,
#mainMenu.shop-open #btnShop,
#mainMenu.missions-open #btnMissions {
  background: rgba(0, 229, 255, 0.18);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.3);
  outline: none;
}

.rail-btn:disabled {
  opacity: 0.4;
  cursor: default;
  border-color: #556;
  color: #99a;
  text-shadow: none;
}

.menu-play-wrap {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: min(200px, 42vw);
}

#btnMultiplayer {
  min-height: 44px;
  padding: 8px;
  border: 1px solid #00e5ff;
  border-radius: 12px;
  background: rgba(8, 2, 24, 0.85);
  color: #b8f3ff;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

#mpDialog {
  box-sizing: border-box;
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: 20px;
  border: 2px solid #00e5ff;
  border-radius: 16px;
  background: #100820;
  color: #e8faff;
  touch-action: pan-y;
}

#mpDialog::backdrop { background: rgba(0, 0, 0, 0.8); }
#mpDialog h2 { margin: 0; font-size: 20px; }
#mpDialog p, #mpDialog li { font-size: 13px; line-height: 1.5; }
#mpDialog label { display: grid; gap: 5px; font-size: 13px; }
#mpDialog input, #mpDialog select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #567;
  border-radius: 8px;
  padding: 8px;
  background: #080418;
  color: white;
  font: inherit;
  font-size: 16px;
}
#mpDialog button, #mpLeaveRace {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #00e5ff;
  border-radius: 8px;
  background: #152035;
  color: #e8faff;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
#mpDialog button:disabled { opacity: 0.45; cursor: default; }
.mp-header, .mp-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mp-join { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; margin-top: 16px; }
#mpRoomCode { letter-spacing: 2px; overflow-wrap: anywhere; }
#mpPlayers { padding-left: 20px; overflow-wrap: anywhere; }
.mp-public-rooms { margin-block: 16px; border-block: 1px solid #345; padding-block: 12px; }
#mpRoomsTitle { margin: 0; font-size: 16px; }
#mpRooms { list-style: none; padding: 0; }
#mpRooms li { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-block: 8px; }
#mpRooms li span { min-width: 0; overflow-wrap: anywhere; }
#mpRooms li button { flex-shrink: 0; }
#mpCreate { margin-top: 10px; }
#mpStatus { color: #9fe9ff; margin-bottom: 0; }
#mpLeaveRace { position: fixed; right: max(12px, env(safe-area-inset-right)); top: 75px; z-index: 50; }
.mp-racing #rankingPanel {
  box-sizing: border-box;
  width: min(440px, calc(100vw - 24px));
  min-width: 0;
  max-height: calc(100dvh - 100px);
  overflow-y: auto;
  pointer-events: auto;
  touch-action: pan-y;
}
.mp-racing .ranking-row > span { overflow-wrap: anywhere; }
.mp-finished #rankingPanel.centered {
  top: 12px;
  right: 50%;
  transform: translateX(50%);
  min-width: 0;
  max-height: calc(100dvh - 80px);
  transition: none;
}
.mp-finished #mpLeaveRace { top: auto; bottom: max(12px, env(safe-area-inset-bottom)); }
html:has(#mpDialog[open]), body:has(#mpDialog[open]) { touch-action: pan-y; }
@media (orientation: landscape) and (max-height: 500px) {
  #mpDialog { padding: 12px; }
  #mpDialog p { margin-block: 8px; }
}

.play-btn {
  appearance: none;
  border: 3px solid #39ff9f;
  border-radius: 16px;
  background: linear-gradient(
    180deg,
    rgba(57, 255, 159, 0.35),
    rgba(20, 120, 80, 0.55)
  );
  color: #eafff4;
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 800;
  letter-spacing: 3px;
  padding: 22px 18px;
  cursor: pointer;
  text-shadow: 0 0 12px rgba(57, 255, 159, 0.8);
  box-shadow: 0 0 28px rgba(57, 255, 159, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.play-btn:hover,
.play-btn:focus-visible {
  transform: scale(1.04);
  box-shadow: 0 0 36px rgba(57, 255, 159, 0.5);
  outline: none;
}

.play-btn:active {
  transform: scale(0.98);
}

.menu-hint {
  text-align: center;
  font-size: 12px;
  color: #b8f3ff;
  opacity: 0.9;
  pointer-events: none;
  margin: 0;
  letter-spacing: 1px;
  text-shadow: 0 0 8px currentColor;
}

.track-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  position: relative;
  z-index: 2;
}

.track-switch-btn {
  appearance: none;
  width: 100%;
  border: 2px solid #ff4fd8;
  border-radius: 14px;
  background: rgba(255, 79, 216, 0.18);
  color: #ffe3f8;
  cursor: pointer;
  padding: 12px 10px;
  text-align: center;
  box-shadow: 0 0 16px rgba(255, 79, 216, 0.25);
}

.track-switch-btn:hover,
.track-switch-btn:focus-visible {
  background: rgba(255, 79, 216, 0.32);
  outline: none;
}

.track-switch-btn:active {
  transform: scale(0.98);
}

.track-switch-btn small {
  display: block;
  font-size: 10px;
  letter-spacing: 1px;
  opacity: 0.85;
  margin-bottom: 4px;
}

.track-switch-btn strong {
  display: block;
  font-size: 14px;
  letter-spacing: 1px;
}

#garagePanel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

#garagePanel.show {
  display: block;
}

#mainMenu.garage-open .menu-play-wrap,
#mainMenu.garage-open .menu-brand p,
#mainMenu.shop-open .menu-play-wrap,
#mainMenu.shop-open .menu-brand p,
#mainMenu.missions-open .menu-play-wrap,
#mainMenu.missions-open .menu-brand p,
#mainMenu.account-open .menu-play-wrap,
#mainMenu.account-open .menu-brand p {
  opacity: 0;
  pointer-events: none;
}

#accountPanel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background: transparent;
}

#accountPanel.show {
  display: block;
}

.account-sheet {
  pointer-events: auto;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: calc(14px + 86px + 8px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) 16px;
}

.account-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.account-header-text h2 {
  margin: 0;
  font-family: "Orbitron", "Segoe UI", Tahoma, sans-serif;
  font-size: clamp(24px, 5vw, 34px);
  letter-spacing: 2px;
  color: #ffd24a;
  text-shadow: 0 0 12px rgba(255, 210, 74, 0.45);
}

.account-header-text p {
  margin: 8px 0 0;
  font-size: 14px;
  letter-spacing: 1px;
  color: #b8f3ff;
  opacity: 0.8;
}

.account-card {
  width: min(420px, 100%);
  margin: auto 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 2px solid rgba(255, 210, 74, 0.55);
  border-radius: 18px;
  background: rgba(14, 6, 40, 0.92);
  padding: 18px 20px;
  box-shadow: 0 0 18px rgba(255, 210, 74, 0.18);
}

.account-detail {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: #b8f3ff;
  font-size: 15px;
  letter-spacing: 1px;
}

.account-detail strong {
  color: #fff8d6;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 8px rgba(255, 210, 74, 0.35);
}

#missionsPanel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background: transparent;
}

#missionsPanel.show {
  display: block;
}

.missions-sheet {
  pointer-events: auto;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  /* Deixa a barra lateral clicável, como Loja/Garagem */
  left: calc(14px + 86px + 8px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) 16px;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.missions-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.missions-header-text h2 {
  margin: 0;
  font-family: "Orbitron", "Segoe UI", Tahoma, sans-serif;
  font-size: clamp(24px, 5vw, 34px);
  letter-spacing: 2px;
  color: #ffb347;
  text-shadow: 0 0 12px rgba(255, 179, 71, 0.45);
}

.missions-header-text p {
  margin: 8px 0 0;
  font-size: 14px;
  letter-spacing: 1px;
  color: #b8f3ff;
  opacity: 0.8;
}

.missions-carousel {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.missions-viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.missions-track {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 100%;
  transform: translate3d(0, 0, 0);
  transition: transform 0.28s ease;
  will-change: transform;
}

.missions-track.dragging {
  transition: none;
}

.missions-slide {
  flex: 0 0 100%;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 4px;
  box-sizing: border-box;
}

.mission-card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  border: 2px solid rgba(0, 229, 255, 0.45);
  border-radius: 18px;
  background: rgba(14, 6, 40, 0.98);
  padding: 16px 18px 14px;
  min-height: 0;
  height: fit-content;
}

.missions-nav {
  appearance: none;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 2px solid #00e5ff;
  border-radius: 14px;
  background: rgba(0, 229, 255, 0.1);
  color: #b8f3ff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  touch-action: manipulation;
}

.missions-nav:hover:not(:disabled) {
  background: rgba(0, 229, 255, 0.22);
}

.missions-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.missions-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-bottom: 4px;
}

.missions-dot {
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 4px;
  border: 1px solid rgba(0, 229, 255, 0.55);
  background: rgba(0, 229, 255, 0.12);
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.missions-dot.active {
  background: #00e5ff;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.55);
}

@media (max-width: 640px) {
  .account-sheet,
  .missions-sheet {
    left: calc(8px + 70px + 8px);
  }

  .missions-nav {
    width: 38px;
    height: 38px;
    font-size: 24px;
    border-radius: 12px;
  }
}

.mission-card.ready {
  border-color: rgba(57, 255, 159, 0.65);
  box-shadow: 0 0 18px rgba(57, 255, 159, 0.22);
}

.mission-card.claimed {
  opacity: 0.72;
  border-color: rgba(255, 179, 71, 0.4);
}

.mission-card.ticket-reward {
  border-color: rgba(255, 179, 71, 0.7);
}

.mission-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mission-card-head strong {
  color: #fff;
  font-size: clamp(20px, 3.4vw, 26px);
  letter-spacing: 1px;
  line-height: 1.2;
}

.mission-reward {
  color: #ffd24a;
  font-size: clamp(15px, 2.4vw, 18px);
  font-weight: 800;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.mission-reward.ticket {
  color: #ffb347;
}

.mission-desc {
  margin: 10px 0 12px;
  font-size: clamp(17px, 2.8vw, 22px);
  line-height: 1.35;
  color: #e7fbff;
  opacity: 0.95;
  flex: 0 0 auto;
}

.mission-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 0;
}

.mission-progress {
  font-size: clamp(15px, 2.4vw, 18px);
  color: #7ec8ff;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  font-weight: 700;
}

.mission-claim {
  appearance: none;
  border: 2px solid #39ff9f;
  border-radius: 12px;
  background: rgba(57, 255, 159, 0.14);
  color: #39ff9f;
  font-size: clamp(14px, 2.2vw, 16px);
  letter-spacing: 1px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
}

.mission-claim:hover:not(:disabled) {
  background: rgba(57, 255, 159, 0.26);
}

.mission-claim:disabled {
  border-color: rgba(184, 243, 255, 0.25);
  color: rgba(184, 243, 255, 0.55);
  background: transparent;
  cursor: default;
}

#shopPanel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

#shopPanel.show {
  display: block;
}

.shop-offer-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.shop-offer-dot {
  width: 10px;
  height: 10px;
  border: 1px solid rgba(0, 229, 255, 0.55);
  border-radius: 4px;
  background: rgba(0, 229, 255, 0.12);
  cursor: pointer;
  pointer-events: auto;
  padding: 0;
}

.shop-offer-dot.active {
  background: #00e5ff;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.55);
}

.shop-price {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ffd24a;
  text-shadow: 0 0 12px rgba(255, 210, 74, 0.45);
}

.shop-price.cant-afford {
  color: #ff8a8a;
  text-shadow: 0 0 10px rgba(255, 100, 100, 0.35);
}

.shop-buy {
  appearance: none;
  border: 1px solid #ffd24a;
  border-radius: 10px;
  background: rgba(255, 210, 74, 0.12);
  color: #ffe79a;
  font-size: 12px;
  letter-spacing: 1px;
  padding: 6px 14px;
  cursor: pointer;
}

.shop-buy:hover:not(:disabled) {
  background: rgba(255, 210, 74, 0.24);
}

.shop-buy:disabled {
  opacity: 0.35;
  cursor: default;
}

.shop-empty {
  margin: 0;
  font-size: 13px;
  letter-spacing: 1px;
  color: #b8f3ff;
  text-align: center;
  opacity: 0.9;
}

.garage-nav {
  pointer-events: auto;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border: 2px solid #00e5ff;
  border-radius: 14px;
  background: rgba(8, 2, 24, 0.72);
  color: #b8f3ff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.garage-nav:hover {
  background: rgba(0, 229, 255, 0.18);
  color: #fff;
}

/* Fora do menu-rail (left 14px + width 86px) para não sobrepor moedas/stats */
.garage-nav.prev {
  left: calc(14px + 86px + 14px);
}

.garage-nav.next {
  right: max(16px, 4vw);
}

.garage-footer {
  pointer-events: auto;
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  width: min(420px, 90vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 2px solid rgba(0, 229, 255, 0.55);
  border-radius: 16px;
  background: rgba(8, 2, 24, 0.78);
  box-shadow: 0 0 22px rgba(0, 229, 255, 0.2);
}

.garage-footer-top {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.garage-car-name {
  margin: 0;
  font-size: 18px;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.55);
}

.garage-car-rarity {
  margin: 0;
  font-size: 12px;
  letter-spacing: 1px;
  font-weight: 700;
}

.garage-car-status {
  margin: 0;
  font-size: 12px;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: #b8f3ff;
}

.garage-car-status.locked {
  color: #ff8a8a;
}

.garage-car-status.equipped {
  color: #39ff9f;
}

.garage-car-index {
  margin: 0;
  font-size: 11px;
  opacity: 0.7;
  color: #b8f3ff;
  letter-spacing: 1px;
}

.garage-actions {
  display: flex;
  gap: 8px;
  width: 100%;
  justify-content: center;
}

.garage-equip {
  appearance: none;
  border: 1px solid #39ff9f;
  border-radius: 10px;
  background: transparent;
  color: #39ff9f;
  font-size: 12px;
  letter-spacing: 1px;
  padding: 6px 14px;
  cursor: pointer;
}

.garage-equip:disabled {
  opacity: 0.35;
  cursor: default;
}

.garage-equip:hover:not(:disabled) {
  background: rgba(57, 255, 159, 0.14);
}

@media (max-width: 640px) {
  .menu-rail {
    width: 70px;
    left: 8px;
  }

  .menu-play-wrap {
    right: 8px;
    width: min(150px, 40vw);
  }

  .play-btn {
    padding: 16px 10px;
    letter-spacing: 2px;
  }

  .garage-nav {
    width: 46px;
    height: 46px;
    font-size: 24px;
  }

  .garage-nav.prev {
    left: calc(8px + 70px + 10px);
  }

  .garage-nav.next {
    right: 8px;
  }
}

/* Celular em paisagem: os títulos dos painéis começam abaixo do logotipo.
   A reserva acompanha o tamanho da marca sem alterar retrato ou desktop. */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 1024px) and (pointer: coarse) {
  #garagePanel,
  #shopPanel {
    --landscape-nav-left: 114px;
    --landscape-nav-right: max(16px, 4vw);
  }

  @media (max-width: 640px) {
    #garagePanel,
    #shopPanel {
      --landscape-nav-left: 88px;
      --landscape-nav-right: 8px;
    }
  }

  /* O painel inferior encolhe dentro do espaço livre entre as duas setas. */
  .garage-footer {
    box-sizing: border-box;
    left: calc(var(--landscape-nav-left) + 44px + 8px);
    right: calc(var(--landscape-nav-right) + 44px + 8px);
    top: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    transform: none;
    width: auto;
    max-width: 420px;
    margin-inline: auto;
    max-height: calc(100dvh - 100px);
    gap: 6px;
    padding: 8px;
    overflow-y: auto;
    touch-action: pan-y;
    overscroll-behavior-y: contain;
  }

  .garage-footer > * {
    flex-shrink: 0;
  }

  #garagePanel .garage-footer,
  #shopPanel .garage-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
  }

  #garagePanel .garage-footer > *,
  #shopPanel .garage-footer > * {
    grid-column: 1;
    min-width: 0;
    text-align: center;
    overflow-wrap: anywhere;
  }

  #garagePanel .garage-footer > .garage-actions,
  #shopPanel .garage-footer > .garage-actions {
    grid-column: 2;
    grid-row: 1 / span 5;
    align-self: center;
    width: auto;
  }

  #garagePanel .garage-footer > .garage-actions {
    grid-row: 1 / span 3;
  }

  .garage-footer-top {
    gap: 6px;
    text-align: center;
  }

  .garage-car-name {
    font-size: 16px;
    line-height: 1.2;
    letter-spacing: 1px;
  }

  .garage-nav {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
  }

  .garage-nav.prev {
    left: var(--landscape-nav-left);
  }

  .garage-nav.next {
    right: var(--landscape-nav-right);
  }

  .garage-equip,
  .shop-buy {
    min-height: 44px;
  }

  .menu-rail {
    gap: 4px;
    max-height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
    overflow-y: auto;
    touch-action: pan-y;
    overscroll-behavior-y: contain;
  }

  .menu-rail > button {
    flex-shrink: 0;
  }

  .rail-btn {
    min-height: 44px;
    flex-direction: row;
    gap: 3px;
    padding: 6px 3px;
    font-size: clamp(10px, 1.4vw, 11px);
    letter-spacing: 0;
  }

  .rail-btn .icon {
    font-size: 14px;
  }

  .menu-account {
    gap: 3px;
    padding: 4px;
  }

  .menu-account-row {
    flex-direction: row;
    justify-content: space-between;
    gap: 3px;
    width: 100%;
  }

  .menu-account-row small {
    letter-spacing: 0;
  }

  .menu-account-row strong {
    font-size: 11px;
  }

  .menu-money-value {
    gap: 3px;
    font-size: 12px;
    letter-spacing: 0;
  }

  .menu-money-value .coin-icon {
    width: 12px;
    height: 12px;
  }

  .menu-account .boost-badge {
    margin-top: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  /* Rolagem de segurança se a área útil for menor que os alvos de toque. */
  html:has(#mainMenu.show),
  body:has(#mainMenu.show) {
    touch-action: pan-y;
  }

  .account-sheet,
  .missions-sheet {
    top: calc(18px + clamp(28px, 6vw, 48px) * 1.3 + 12px);
    padding-top: 0;
    gap: 10px;
    overflow-y: auto;
    touch-action: pan-y;
  }

  .account-header-text h2,
  .missions-header-text h2 {
    font-size: 24px;
    line-height: 1.2;
  }

  .account-header-text p,
  .missions-header-text p {
    margin-top: 4px;
    font-size: 12px;
  }

  .account-card {
    flex-shrink: 0;
    margin: 0;
  }

  .missions-carousel {
    flex: 1 0 auto;
  }

  /* Permite alcançar o conteúdo em telas baixas, somente com painel aberto. */
  html:has(#accountPanel.show, #missionsPanel.show),
  body:has(#accountPanel.show, #missionsPanel.show) {
    touch-action: pan-y;
  }
}

#hud h1 {
  margin: 0 0 6px;
  font-family: "Orbitron", "Segoe UI", Tahoma, sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 2px;
  color: #ff4fd8;
  text-shadow: 0 0 10px #ff4fd8;
}

#hud p {
  margin: 0;
  font-size: 14px;
  opacity: 0.9;
}

.hud-meter {
  width: min(220px, 58vw);
  margin: 8px 0 0;
}

.hud-meter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 13px;
  letter-spacing: 1px;
  opacity: 0.95;
}

.hud-meter-head strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 0 8px #00e5ff;
}

.hud-meter-track {
  height: 10px;
  border: 1px solid rgba(0, 229, 255, 0.35);
  border-radius: 8px;
  background: rgba(5, 1, 20, 0.55);
  overflow: hidden;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.35);
}

.hud-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  transform-origin: left center;
  transition: width 0.08s linear;
  opacity: 0.5;
}

.hud-meter-fill.speed {
  background: linear-gradient(90deg, #00e5ff, #39ff9f 55%, #ffe66d);
  box-shadow: 0 0 10px rgba(57, 255, 159, 0.55);
}

.hud-meter-fill.progress {
  background: linear-gradient(90deg, #ff4fd8, #00e5ff);
  box-shadow: 0 0 10px rgba(255, 79, 216, 0.5);
  transition: none;
}

.hud-meter-fill.flash {
  filter: brightness(1.25);
}

.hud-meter-inline {
  margin-top: 10px;
}

.hud-meter-track.speed-track,
.hud-meter-track.progress-track {
  position: relative;
  height: 14px;
  border-radius: 8px;
}

.hud-meter-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px;
  font-size: 10px;
  letter-spacing: 1px;
  line-height: 1;
  color: #eafcff;
  text-shadow: 0 1px 2px rgba(5, 1, 20, 0.9), 0 0 8px rgba(0, 229, 255, 0.35);
  pointer-events: none;
}

.hud-meter-overlay strong {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

#rankingPanel {
  display: none;
  position: fixed;
  right: 16px;
  top: 16px;
  z-index: 3;
  min-width: 280px;
  padding: 14px 16px 12px;
  border: 2px solid #ff4fd8;
  border-radius: 16px;
  box-shadow: 0 0 24px rgba(255, 79, 216, 0.35);
  background: rgba(10, 4, 30, 0.88);
  color: #fff;
  pointer-events: none;
  user-select: none;
  transform: translate(0, 0);
  opacity: 1;
  transition:
    right 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    top 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    min-width 0.55s ease,
    box-shadow 0.55s ease,
    opacity 0.35s ease;
}

#rankingPanel.show {
  display: block;
}

/* Ainda correndo: ranking discreto no canto */
#rankingPanel.show.racing {
  opacity: 0.25;
}

#rankingPanel.show.spectating {
  opacity: 1;
  box-sizing: border-box;
  min-width: min(300px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  pointer-events: auto;
}

@media (max-width: 640px) {
  #rankingPanel.show.spectating {
    top: 160px;
    max-height: calc(100dvh - 176px);
  }
}

#postRaceControls {
  margin-bottom: 12px;
}

#spectatorLabel {
  margin: 0 0 10px;
  color: #b8f3ff;
  font-size: 14px;
}

#btnFinishRace {
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid #00e5ff;
  border-radius: 10px;
  background: #123346;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#btnFinishRace:hover,
#btnFinishRace:focus-visible {
  background: #1b4b62;
  outline: 2px solid #ff4fd8;
  outline-offset: 2px;
}

.post-race-help,
#rankingEstimateNote {
  margin: 8px 0 0;
  color: #b8f3ff;
  font-size: 12px;
  line-height: 1.4;
}

#rankingPanel.centered {
  top: 50%;
  right: 50%;
  min-width: min(360px, 86vw);
  transform: translate(50%, -50%);
  box-shadow: 0 0 40px rgba(255, 79, 216, 0.45);
  opacity: 1;
}

#rankingPanel h2 {
  margin: 0 0 10px;
  font-size: 18px;
  letter-spacing: 2px;
  color: #ff4fd8;
  text-shadow: 0 0 10px #ff4fd8;
}

.ranking-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) max-content;
  gap: 8px;
  align-items: center;
  padding: 6px 4px;
  font-size: 14px;
  color: #b8f3ff;
  border-top: 1px solid rgba(184, 243, 255, 0.15);
}

.ranking-row.you {
  color: #fff;
  text-shadow: 0 0 8px #00e5ff;
}

.ranking-row.pending {
  opacity: 0.45;
}

.ranking-row .pos {
  font-weight: 700;
  color: #ff4fd8;
}

.ranking-row .time {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#rankingHint {
  display: none;
  margin: 12px 0 0;
  font-size: 13px;
  color: #b8f3ff;
  text-align: center;
  line-height: 1.55;
}

#rankingHint.show {
  display: block;
}

#rankingHint .coin-reward,
#rankingHint .ficha-reward {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  white-space: nowrap;
}

#rankingHint .coin-reward {
  color: #ffe79a;
}

#rankingHint .ficha-reward {
  color: #ffb0ac;
}

#rankingHint .coin-icon--inline,
#rankingHint .ficha-icon--inline {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
}

#coinFlyLayer {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  overflow: hidden;
}

.fly-coin {
  position: fixed;
  width: 28px;
  height: 28px;
  margin: 0;
  will-change: transform, opacity;
}

.fly-coin .coin-icon--fly {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 0 8px rgba(255, 210, 74, 0.75));
}

.menu-account.coin-pulse,
.menu-money-value.coin-pulse {
  animation: coinHudPulse 0.45s ease-out;
}

.menu-account.ficha-pulse,
.menu-ficha-value.ficha-pulse {
  animation: fichaHudPulse 0.45s ease-out;
}

@keyframes coinHudPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 14px rgba(255, 210, 74, 0.25);
  }
  40% {
    transform: scale(1.08);
    box-shadow: 0 0 22px rgba(255, 210, 74, 0.7);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 14px rgba(255, 210, 74, 0.25);
  }
}

@keyframes fichaHudPulse {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 4px rgba(229, 57, 53, 0.35));
  }
  40% {
    transform: scale(1.12);
    filter: drop-shadow(0 0 10px rgba(229, 57, 53, 0.85));
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 4px rgba(229, 57, 53, 0.35));
  }
}

.fly-ficha .ficha-icon--fly {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 0 8px rgba(229, 57, 53, 0.8));
}

#countdownOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 4;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(5, 1, 20, 0.35);
}

#countdownOverlay.show {
  display: flex;
}

#countdownNumber {
  font-size: 120px;
  font-weight: 700;
  letter-spacing: 8px;
  color: #ff4fd8;
  text-shadow: 0 0 28px #ff4fd8, 0 0 60px #00e5ff;
  text-align: center;
}

#debugFps {
  display: none;
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 20;
  padding: 6px 10px;
  border: 1px solid #39ff9f;
  background: rgba(5, 1, 20, 0.85);
  color: #39ff9f;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  pointer-events: none;
  user-select: none;
}

#debugFps.show {
  display: block;
}

#debugPerfBtn,
#debugBotBenchBtn {
  display: none;
  width: 100%;
  appearance: none;
  margin-top: 8px;
  padding: 10px 8px;
  border: 2px solid #39ff9f;
  background: rgba(10, 4, 30, 0.88);
  color: #39ff9f;
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
}

#debugBotBenchBtn {
  border-color: #ffb84f;
  color: #ffb84f;
}

#debugPerfBtn.show,
#debugBotBenchBtn.show {
  display: block;
}

#debugPerfBtn:disabled,
#debugBotBenchBtn:disabled {
  opacity: 0.5;
  cursor: wait;
}

#debugPerfReport {
  display: none;
  position: fixed;
  left: 12px;
  bottom: 48px;
  z-index: 21;
  max-width: min(420px, 92vw);
  max-height: 45vh;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid #39ff9f;
  background: rgba(5, 1, 20, 0.92);
  color: #b8fff0;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  pointer-events: auto;
  user-select: text;
}

#debugPerfReport.show {
  display: block;
}

/* Botão de tela cheia (padrão Rock Hero) */
#fullscreen-toggle {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 15;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: #b8f3ff;
  background: rgba(10, 4, 30, 0.72);
  border: 1px solid rgba(0, 229, 255, 0.4);
  border-radius: 10px;
  opacity: 0.85;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, background 0.15s, box-shadow 0.15s;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.15);
}

#fullscreen-toggle[hidden] {
  display: none;
}

#fullscreen-toggle:hover,
#fullscreen-toggle:focus-visible {
  opacity: 1;
  background: rgba(10, 4, 30, 0.92);
  box-shadow: 0 0 16px rgba(255, 79, 216, 0.35);
}

#fullscreen-toggle:focus-visible {
  outline: 2px solid #ff4fd8;
  outline-offset: 2px;
}

#fullscreen-toggle svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#fullscreen-toggle .icon-exit,
#fullscreen-toggle[aria-pressed="true"] .icon-enter {
  display: none;
}

#fullscreen-toggle[aria-pressed="true"] .icon-exit {
  display: block;
}

/* === Controles mobile (padrão Rock Hero) === */
#mobile-controls {
  display: none;
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 12;
}

#mobile-controls.show {
  display: block;
}

.mobile-btn {
  position: absolute;
  pointer-events: auto;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.12);
  border: 3px solid rgba(0, 229, 255, 0.35);
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s, transform 0.1s, box-shadow 0.1s;
  color: rgba(184, 243, 255, 0.85);
  font-weight: 700;
  font-family: "Segoe UI", Tahoma, sans-serif;
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.15);
}

.mobile-btn:active,
.mobile-btn.active {
  background: rgba(255, 79, 216, 0.28);
  border-color: rgba(255, 79, 216, 0.55);
  transform: scale(0.95);
  box-shadow: 0 0 18px rgba(255, 79, 216, 0.35);
}

.mobile-btn svg {
  width: 50%;
  height: 50%;
  fill: rgba(184, 243, 255, 0.8);
}

#dpad-container {
  position: absolute;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: calc(16px + env(safe-area-inset-left, 0px));
  display: flex;
  height: 80px;
  border-radius: 18px;
  overflow: hidden;
  border: 3px solid rgba(0, 229, 255, 0.35);
  background: rgba(5, 1, 20, 0.35);
}

#btn-left,
#btn-right {
  position: relative;
  width: 67.5px;
  height: 100%;
  border-radius: 0;
  border: none;
  background: rgba(0, 229, 255, 0.12);
  box-shadow: none;
}

#dpad-deadzone {
  width: 15px;
  height: 100%;
  background: rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

#btn-left.active,
#btn-right.active {
  background: rgba(255, 79, 216, 0.28);
  transform: none;
}

#btn-accel {
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  right: calc(16px + env(safe-area-inset-right, 0px));
  width: 90px;
  height: 90px;
  font-size: 28px;
}

#btn-brake {
  bottom: calc(130px + env(safe-area-inset-bottom, 0px));
  right: calc(26px + env(safe-area-inset-right, 0px));
  width: 60px;
  height: 60px;
  font-size: 22px;
  color: rgba(255, 140, 160, 0.85);
  border-color: rgba(255, 100, 130, 0.4);
  background: rgba(255, 80, 120, 0.12);
}

@media (max-width: 480px) {
  #dpad-container {
    height: 60px;
    border-radius: 14px;
  }

  #btn-left,
  #btn-right {
    width: 52px;
  }

  #dpad-deadzone {
    width: 12px;
  }

  #btn-accel {
    width: 70px;
    height: 70px;
    font-size: 22px;
  }

  #btn-brake {
    bottom: calc(108px + env(safe-area-inset-bottom, 0px));
    right: calc(22px + env(safe-area-inset-right, 0px));
    width: 45px;
    height: 45px;
    font-size: 16px;
  }
}
