* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

:root {
  --neon-viewport-width: 100vw;
  --neon-viewport-height: 100dvh;
  --neon-render-resolution: 1;
}

@font-face {
  font-family: 'Vapor';
  src: local('Courier New'), monospace; /* Fallback to standard monospace */
}

body, html {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: #000; /* Letterbox background */
  font-family: 'Vapor', 'Courier New', monospace;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  overscroll-behavior: none;
  touch-action: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 100svh;
  /* Fullscreen nativo sem bordas ou letterbox obrigatorio em mobile portrait */
  background: #0a001a;
  overflow: hidden;
  container-type: inline-size;
  box-shadow: 0 0 50px rgba(0, 255, 255, 0.15); /* Soft neon border */
}

#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
  touch-action: none;
  image-rendering: auto;
}

#ui-layer {
  position: absolute;
  top: 0; left: 0; right: 0; margin: 0 auto;
  width: 100%; height: 100%;
  max-width: 100vw;
  z-index: 10;
  pointer-events: none; /* Let touches pass through unhandled areas */
  container-type: inline-size;
  contain: layout size;
}

.screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  background: rgba(10, 0, 26, 0.90); /* Darker to compensate for no-blur */
  pointer-events: auto;
  transition: opacity 0.3s;
  overflow-y: auto;
  overflow-x: hidden;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  padding: max(env(safe-area-inset-top), 14px) 0 max(env(safe-area-inset-bottom), 14px) 0;
}

/* Smart vertical centering that allows safe top scrolling without clipping */
.screen:not(#hud) > :first-child {
  margin-top: auto;
}
.screen:not(#hud) > :last-child {
  margin-bottom: auto;
}

.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

#hud {
  background: transparent;
  justify-content: flex-start;
  pointer-events: none;
  padding: 15px;
}

.hud-top {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: flex-start;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  font-size: 1.2rem;
  font-weight: bold;
  text-shadow: 2px 2px 0 #000, 0 0 10px #0ff;
}

.hud-center-stack {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0 clamp(4px, 1cqw, 10px);
}

.hud-widget {
  min-width: clamp(124px, 18cqw, 160px);
  padding: clamp(8px, 1.2cqw, 10px) clamp(10px, 1.6cqw, 15px);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.hud-widget.glass {
  background: rgba(10, 0, 26, 0.7);
  backdrop-filter: blur(5px);
  border-left: 4px solid #0ff;
  border-bottom: 2px solid rgba(0,255,255,0.2);
  clip-path: polygon(0 0, 100% 0, 90% 100%, 0% 100%);
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.hud-widget .label {
  font-size: clamp(0.56rem, 1.2cqw, 0.7rem);
  color: #f0f;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: 2px;
  margin-bottom: 2px;
}

#score-value, #coins, #time-value {
  font-size: clamp(1.1rem, 2.8cqw, 1.8rem);
  color: #fff;
  text-shadow: 0 0 10px rgba(255,255,255,0.5);
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1;
}

.hud-timer {
  background: rgba(10, 0, 26, 0.7);
  backdrop-filter: blur(5px);
  padding: clamp(6px, 1.2cqw, 8px) clamp(12px, 2cqw, 20px);
  border: 2px solid #0ff;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.4), inset 0 0 10px rgba(0, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 10px;
}

#time-value {
  color: #0ff;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
}

#coins { color: #ff0; }

.flow-widget {
  --flow-accent: #78dfff;
  --flow-glow: rgba(120, 223, 255, 0.24);
  width: min(100%, clamp(160px, 28cqw, 260px));
  min-width: 0;
  padding: clamp(5px, 0.8cqw, 7px) clamp(8px, 1.1cqw, 11px) clamp(5px, 0.8cqw, 7px);
  gap: 2px;
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(10, 8, 30, 0.92), rgba(9, 15, 40, 0.92)),
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.03) 0px,
      rgba(255, 255, 255, 0.03) 1px,
      rgba(0, 0, 0, 0) 1px,
      rgba(0, 0, 0, 0) 4px
    );
  border: 1px solid rgba(82, 208, 255, 0.3);
  border-left: 4px solid var(--flow-accent);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.025);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.flow-widget .flow-header {
  display: flex;
  width: 100%;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.flow-widget .label {
  color: var(--flow-accent);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.55);
}

.flow-multiplier {
  font-size: clamp(0.74rem, 1.6cqw, 0.88rem);
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--flow-accent);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.65), 0 0 8px var(--flow-glow);
}

.flow-feedback {
  order: 2;
  font-size: clamp(0.46rem, 0.82cqw, 0.56rem);
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--flow-accent);
  text-align: center;
  line-height: 1;
  min-height: 1em;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.55), 0 0 8px var(--flow-glow);
  margin-top: 0;
}

.flow-bar {
  display: flex;
  width: 100%;
  align-items: stretch;
  position: relative;
  height: 8px;
  margin-top: 0;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(70, 208, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.22)),
    linear-gradient(90deg, rgba(8, 16, 55, 0.95), rgba(12, 33, 88, 0.96));
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.55);
}

.flow-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0px,
    rgba(255, 255, 255, 0.05) 1px,
    rgba(0, 0, 0, 0) 1px,
    rgba(0, 0, 0, 0) 26px
  );
  opacity: 0.35;
  pointer-events: none;
}

.flow-bar-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06), var(--flow-accent)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 55%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  transition: width 0.12s linear, opacity 0.12s linear;
  opacity: 0.96;
}

.hud-bottom {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  margin-top: auto;
  padding-bottom: env(safe-area-inset-bottom, 20px);
  padding-left: 10px;
  transition: transform 0.3s ease;
}

.mobile-controls {
  position: absolute;
  inset-inline: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(12px, 2vw, 24px));
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  gap: clamp(12px, 2vw, 20px);
  padding-inline: clamp(10px, 3vw, 28px);
  z-index: 220;
  pointer-events: none;
}

.mobile-controls-left,
.mobile-controls-right {
  display: flex;
  pointer-events: none;
}

.mobile-controls-left {
  align-items: center;
  gap: clamp(12px, 1.8vw, 18px);
}

.mobile-controls-right {
  flex-direction: row;
  align-items: flex-end;
  justify-content: flex-end;
  gap: clamp(12px, 1.6vw, 18px);
}

.mobile-control {
  --mobile-control-bg: rgba(20, 22, 28, 0.28);
  --mobile-control-border: rgba(255, 255, 255, 0.08);
  --mobile-control-highlight: rgba(255, 255, 255, 0.09);
  --mobile-control-shadow: rgba(0, 0, 0, 0.22);
  pointer-events: auto;
  width: clamp(78px, 16vw, 110px);
  height: clamp(78px, 16vw, 110px);
  padding: 0;
  border: 1px solid var(--mobile-control-border);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.06), transparent 44%),
    linear-gradient(180deg, rgba(28, 30, 38, 0.28), rgba(14, 16, 22, 0.34)),
    var(--mobile-control-bg);
  color: rgba(255, 255, 255, 0.42);
  font-family: 'Vapor', 'Courier New', monospace;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  font-weight: 900;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(10px) saturate(0.8);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 -18px 28px rgba(0, 0, 0, 0.14),
    0 10px 24px var(--mobile-control-shadow);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease, background 120ms ease, opacity 120ms ease, color 120ms ease;
  overflow: hidden;
}

.mobile-control:hover {
  transform: translateY(-1px);
}

.mobile-control:active,
.mobile-control.is-active {
  transform: translateY(1px) scale(0.985);
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -18px 28px rgba(0, 0, 0, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.26);
}

.mobile-control-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mobile-control-icon {
  display: block;
  line-height: 1;
  font-size: 1.18em;
  transform: translateY(-1px);
  opacity: 0.72;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}

.mobile-control-steer {
  --mobile-control-bg: rgba(22, 24, 30, 0.24);
  --mobile-control-shadow: rgba(0, 0, 0, 0.18);
  width: clamp(84px, 18vw, 118px);
  height: clamp(84px, 18vw, 118px);
}

.mobile-control-steer:active,
.mobile-control-steer.is-active {
  color: rgba(255, 255, 255, 0.82);
}

.mobile-control-steer:first-child .mobile-control-icon {
  transform: translateY(-1px) translateX(-2px);
}

.mobile-control-steer:last-child .mobile-control-icon {
  transform: translateY(-1px) translateX(2px);
}

.mobile-controls-right .mobile-control {
  width: clamp(76px, 14vw, 94px);
  border-radius: 18px;
}

.mobile-control-brake,
.mobile-control-gas {
  --mobile-control-bg: rgba(18, 20, 26, 0.32);
  --mobile-control-shadow: rgba(0, 0, 0, 0.24);
  justify-content: flex-start;
}

.mobile-control-brake {
  height: clamp(88px, 16vw, 116px);
}

.mobile-control-gas {
  height: clamp(118px, 24vw, 170px);
}

.mobile-control-brake::before,
.mobile-control-gas::before {
  content: '';
  position: absolute;
  inset: clamp(10px, 1.6vw, 12px);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    linear-gradient(180deg, rgba(10, 11, 14, 0.62), rgba(25, 27, 33, 0.42));
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    inset 0 -10px 18px rgba(0, 0, 0, 0.14);
}

.mobile-control-brake::after,
.mobile-control-gas::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 56%;
  border-radius: 12px;
  transform: translateX(-50%);
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.16) 0 5px,
      rgba(255, 255, 255, 0.02) 5px 16px
    ),
    linear-gradient(180deg, rgba(60, 65, 74, 0.42), rgba(22, 24, 30, 0.14));
  opacity: 0.42;
}

.mobile-control-brake::after {
  top: 24%;
  height: 42%;
}

.mobile-control-gas::after {
  top: 16%;
  height: 68%;
}

.mobile-control-brake.is-active::after,
.mobile-control-gas.is-active::after {
  opacity: 0.62;
}

@media (pointer: coarse), (hover: none) {
  .mobile-controls {
    display: flex;
    opacity: 0.78;
  }

  .hud-bottom {
    position: absolute;
    left: calc(clamp(10px, 3vw, 28px) + clamp(84px, 18vw, 118px) + clamp(6px, 0.9vw, 9px));
    bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(12px, 2vw, 24px) + clamp(84px, 18vw, 118px) + clamp(6px, 1.4vw, 12px));
    transform: translateX(-50%);
    width: max-content;
    margin-top: 0;
    padding-left: 0;
    justify-content: center;
  }

  .speedometer-widget {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    transform: scale(0.6);
    transform-origin: center bottom;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    border: none;
    box-shadow: none;
  }

  .speedometer-gauge {
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: flex-start;
    gap: 0;
  }

  .speedometer-gauge::before,
  .speedometer-gauge::after,
  .gauge-ring,
  .gauge-ring-inner,
  .gauge-tick,
  .gauge-label,
  .gauge-needle,
  .gauge-center {
    display: none !important;
  }

  .gauge-digital {
    position: static;
    transform: none;
    left: auto;
    bottom: auto;
    width: auto;
    text-align: left;
    font-size: clamp(0.9rem, 3.8vw, 1.25rem);
    font-weight: 900;
    letter-spacing: 0.02em;
    color: #d8ffff;
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.8), 0 0 18px rgba(0, 229, 255, 0.35);
  }

  .speedometer-widget .unit {
    display: none !important;
    margin-top: 0;
    color: rgba(215, 255, 255, 0.8);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    text-shadow: 0 0 6px rgba(0, 229, 255, 0.45);
  }

  #hud.turbo-active .speedometer-gauge,
  #hud.shield-active .speedometer-gauge,
  #hud.slow-active .speedometer-gauge {
    filter: none;
    --speedometer-powerup-ring: transparent;
    --speedometer-powerup-ring-glow: transparent;
  }

  #hud.turbo-active .gauge-digital,
  #hud.shield-active .gauge-digital,
  #hud.slow-active .gauge-digital {
    transition: color 120ms ease;
  }

  #hud.turbo-active .gauge-digital {
    color: #ff355e;
  }

  #hud.shield-active .gauge-digital {
    color: #00e5ff;
  }

  #hud.slow-active .gauge-digital {
    color: #7c5cff;
  }
}

@media (max-width: 480px) {
  .mobile-controls {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
    gap: 6px;
    padding-inline: 8px;
    opacity: 0.7;
  }

  .mobile-controls-left {
    gap: 6px;
  }

  .mobile-controls-right {
    gap: 5px;
  }

  .hud-bottom {
    left: calc(8px + 58px + 3px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px + 58px + 8px);
    transform: translateX(-50%);
    width: max-content;
    justify-content: center;
  }

  .mobile-control {
    --mobile-control-bg: rgba(16, 18, 24, 0.14);
    --mobile-control-border: rgba(255, 255, 255, 0.055);
    --mobile-control-highlight: rgba(255, 255, 255, 0.045);
    --mobile-control-shadow: rgba(0, 0, 0, 0.12);
    width: 52px;
    height: 52px;
    color: rgba(255, 255, 255, 0.34);
    backdrop-filter: blur(7px) saturate(0.7);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.03),
      inset 0 -12px 18px rgba(0, 0, 0, 0.08),
      0 6px 14px var(--mobile-control-shadow);
  }

  .mobile-control-steer {
    --mobile-control-bg: rgba(18, 20, 26, 0.12);
    --mobile-control-shadow: rgba(0, 0, 0, 0.1);
    width: 58px;
    height: 58px;
  }

  .mobile-control-steer .mobile-control-icon {
    font-size: 1.42em;
  }

  .mobile-controls-right .mobile-control {
    width: 50px;
    border-radius: 13px;
  }

  .mobile-control-brake,
  .mobile-control-gas {
    --mobile-control-bg: rgba(16, 18, 24, 0.16);
    --mobile-control-shadow: rgba(0, 0, 0, 0.12);
  }

  .mobile-control-brake {
    height: 64px;
  }

  .mobile-control-gas {
    height: 88px;
  }

  .mobile-control-brake::before,
  .mobile-control-gas::before {
    inset: 7px;
    border-radius: 10px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.005)),
      linear-gradient(180deg, rgba(10, 11, 14, 0.36), rgba(25, 27, 33, 0.22));
    border-color: rgba(255, 255, 255, 0.025);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.02),
      inset 0 -8px 12px rgba(0, 0, 0, 0.08);
  }

  .mobile-control-brake::after,
  .mobile-control-gas::after {
    opacity: 0.28;
  }

  .mobile-control:active,
  .mobile-control.is-active {
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.68);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.04),
      inset 0 -12px 18px rgba(0, 0, 0, 0.12),
      0 5px 12px rgba(0, 0, 0, 0.16);
  }
}

/* Active Power-Up HUD States */
#hud.turbo-active .glass,
#hud.shield-active .glass,
#hud.slow-active .glass {
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

#hud.turbo-active .glass {
  border-color: #ff355e;
  box-shadow: 0 0 24px rgba(255, 53, 94, 0.45), inset 0 0 14px rgba(255, 183, 3, 0.14);
  animation: hud-shake 0.14s infinite;
}

#hud.shield-active .glass {
  border-color: #00e5ff;
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.34), inset 0 0 12px rgba(102, 255, 242, 0.16);
}

#hud.slow-active .glass {
  border-color: #7c5cff;
  box-shadow: 0 0 24px rgba(124, 92, 255, 0.34), inset 0 0 12px rgba(168, 85, 247, 0.16);
}

#hud.turbo-active .speedometer-widget.glass,
#hud.shield-active .speedometer-widget.glass,
#hud.slow-active .speedometer-widget.glass {
  animation: none;
  border-color: transparent;
  box-shadow: none;
}

#hud.turbo-active .speedometer-gauge {
  --speedometer-powerup-ring: #ff355e;
  --speedometer-powerup-ring-glow: rgba(255, 53, 94, 0.58);
}

#hud.turbo-active .gauge-needle {
  background: linear-gradient(180deg, #ffffff 0%, #ffd166 40%, #ff355e 100%);
  box-shadow: 0 0 14px rgba(255, 183, 3, 0.9);
}

#hud.shield-active .speedometer-gauge {
  --speedometer-powerup-ring: #00e5ff;
  --speedometer-powerup-ring-glow: rgba(0, 229, 255, 0.52);
}

#hud.shield-active .gauge-needle {
  background: linear-gradient(180deg, #e7ffff 0%, #84ffff 35%, #00b8d4 100%);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.55);
}

#hud.slow-active .speedometer-gauge {
  --speedometer-powerup-ring: #7c5cff;
  --speedometer-powerup-ring-glow: rgba(124, 92, 255, 0.5);
}

#hud.slow-active .gauge-needle {
  background: linear-gradient(180deg, #eef1ff 0%, #b9b4ff 35%, #7c5cff 100%);
  box-shadow: 0 0 12px rgba(124, 92, 255, 0.55);
}

@keyframes hud-shake {
  0% { transform: translate(1px, 0); }
  50% { transform: translate(-1px, 1px); }
  100% { transform: translate(0, 0); }
}

@media (pointer: coarse), (hover: none) {
  #hud.turbo-active .glass,
  #hud.shield-active .glass,
  #hud.slow-active .glass {
    animation: none;
  }

  #hud.turbo-active .hud-widget.glass,
  #hud.shield-active .hud-widget.glass,
  #hud.slow-active .hud-widget.glass {
    border-color: rgba(0, 255, 255, 0.12);
    border-left-color: #0ff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
  }

  #hud.turbo-active .speedometer-widget,
  #hud.shield-active .speedometer-widget,
  #hud.slow-active .speedometer-widget {
    border: none;
    box-shadow: none;
    background: transparent;
    backdrop-filter: none;
  }

  #hud.turbo-active .speedometer-gauge,
  #hud.shield-active .speedometer-gauge,
  #hud.slow-active .speedometer-gauge {
    filter: none;
  }

  .speedometer-widget {
    align-items: center;
    gap: 0;
    transform: scale(0.6);
    transform-origin: center bottom;
  }

  .speedometer-widget .unit {
    display: none !important;
  }

  .gauge-digital {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.18em;
    padding: 1px 5px 2px;
    min-width: 4.2em;
    border: 1px solid rgba(0, 229, 255, 0.22);
    border-radius: 6px;
    background: rgba(3, 13, 22, 0.2);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.28);
    line-height: 1;
  }

  #hud.turbo-active .gauge-digital {
    border-color: #ff355e;
    color: #ff355e;
  }

  #hud.shield-active .gauge-digital {
    border-color: #00e5ff;
    color: #00e5ff;
  }

  #hud.slow-active .gauge-digital {
    border-color: #7c5cff;
    color: #7c5cff;
  }

  .gauge-digital::after {
    content: 'km/h';
    font-size: 0.34rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    opacity: 0.9;
    line-height: 1;
    transform: translateY(0.08em);
  }

  #hud.turbo-active .speedometer-widget .unit {
    color: rgba(255, 53, 94, 0.82);
  }

  #hud.shield-active .speedometer-widget .unit {
    color: rgba(0, 229, 255, 0.82);
  }

  #hud.slow-active .speedometer-widget .unit {
    color: rgba(124, 92, 255, 0.82);
  }
}

.speedometer-widget {
  min-width: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: transparent;
  backdrop-filter: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.speedometer-gauge {
  --speedometer-powerup-ring: transparent;
  --speedometer-powerup-ring-glow: transparent;
  width: clamp(130px, 18cqw, 160px);
  height: clamp(130px, 18cqw, 160px);
  position: relative;
}

.speedometer-gauge::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('img/velocimetro.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.25;
  z-index: 0;
}

.speedometer-gauge::after {
  content: '';
  position: absolute;
  inset: 22px;
  z-index: 1;
  border-radius: 50%;
  border: 2px solid var(--speedometer-powerup-ring);
  background: transparent;
  box-shadow:
    0 0 10px var(--speedometer-powerup-ring-glow),
    0 0 20px color-mix(in srgb, var(--speedometer-powerup-ring) 36%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

#hud.turbo-active .speedometer-gauge::after,
#hud.shield-active .speedometer-gauge::after,
#hud.slow-active .speedometer-gauge::after {
  opacity: 1;
}

.gauge-needle,
.gauge-center,
.gauge-digital {
  position: absolute;
  z-index: 2;
}

/* Substituídos pela imagem */
.gauge-ring,
.gauge-ring-inner,
.gauge-tick,
.gauge-tick-0, .gauge-tick-1, .gauge-tick-2,
.gauge-tick-3, .gauge-tick-4, .gauge-tick-5,
.gauge-label,
.gauge-label-0, .gauge-label-200, .gauge-label-400 {
  display: none;
}

.gauge-needle {
  --needle-angle: -130deg;
  position: absolute;
  left: 50%;
  bottom: calc(50% - 1.3%);
  width: 3.2%;
  height: 33%;
  border-radius: 3px;
  background: linear-gradient(180deg, #ffffff 0%, #ff4e00 50%, #ff1500 100%);
  clip-path: polygon(50% 0, 90% 38%, 70% 100%, 30% 100%, 10% 38%);
  transform: translateX(-50%) rotate(var(--needle-angle));
  transform-origin: 50% calc(100% - 1.3%);
  transition: transform 70ms linear, box-shadow 140ms ease, background 140ms ease;
  box-shadow: 0 0 8px rgba(255, 80, 0, 0.9);
  opacity: 0.55;
  z-index: 2;
}

.gauge-center {
  position: absolute;
  left: calc(50% - 4.4%);
  bottom: calc(50% - 4.4%);
  width: 8.8%;
  height: 8.8%;
  border-radius: 50%;
  border: 2px solid rgba(255, 200, 100, 0.9);
  background: radial-gradient(circle at 35% 35%, #ffffff, #ffb347 45%, #1a0800 100%);
  box-shadow: 0 0 8px rgba(255, 140, 0, 0.8);
  z-index: 3;
}

.speedometer-widget .unit {
  display: none;
}

.gauge-digital {
  position: absolute;
  bottom: 30%;
  left: 50%;
  transform: translateX(-50%);
  width: 30%;
  text-align: center;
  font-family: 'Vapor', 'Courier New', monospace;
  font-size: clamp(9px, 1.4cqw, 13px);
  font-weight: bold;
  letter-spacing: 0.05em;
  color: #00e5ff;
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.9), 0 0 12px rgba(0, 180, 255, 0.5);
  z-index: 4;
  pointer-events: none;
  line-height: 1;
}

@media (pointer: coarse), (hover: none) {
  .speedometer-widget {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    transform: scale(0.6);
    transform-origin: center bottom;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    border: none;
    box-shadow: none;
  }

  .speedometer-gauge {
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: flex-start;
    gap: 0;
  }

  .speedometer-gauge::before,
  .speedometer-gauge::after,
  .gauge-ring,
  .gauge-ring-inner,
  .gauge-tick,
  .gauge-label,
  .gauge-needle,
  .gauge-center {
    display: none !important;
  }

  .gauge-digital {
    position: static;
    transform: none;
    left: auto;
    bottom: auto;
    width: auto;
    padding: 1px 4px 2px;
    border: 1px solid rgba(0, 229, 255, 0.22);
    border-radius: 6px;
    background: rgba(3, 13, 22, 0.2);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.28);
    text-align: left;
    font-size: clamp(0.9rem, 3.8vw, 1.25rem);
    font-weight: 900;
    letter-spacing: 0.02em;
    color: #d8ffff;
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.8), 0 0 18px rgba(0, 229, 255, 0.35);
    line-height: 1;
  }

  .speedometer-widget .unit {
    display: none !important;
    margin-top: 0;
    color: rgba(215, 255, 255, 0.8);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1;
    text-transform: lowercase;
    text-shadow: 0 0 6px rgba(0, 229, 255, 0.45);
  }

  #hud.turbo-active .speedometer-gauge,
  #hud.shield-active .speedometer-gauge,
  #hud.slow-active .speedometer-gauge {
    filter: none;
    --speedometer-powerup-ring: transparent;
    --speedometer-powerup-ring-glow: transparent;
  }

  #hud.turbo-active .gauge-digital {
    border-color: #ff355e;
    color: #ff355e;
  }

  #hud.shield-active .gauge-digital {
    border-color: #00e5ff;
    color: #00e5ff;
  }

  #hud.slow-active .gauge-digital {
    border-color: #7c5cff;
    color: #7c5cff;
  }

  #hud.turbo-active .speedometer-widget .unit {
    color: rgba(255, 53, 94, 0.82);
  }

  #hud.shield-active .speedometer-widget .unit {
    color: rgba(0, 229, 255, 0.82);
  }

  #hud.slow-active .speedometer-widget .unit {
    color: rgba(124, 92, 255, 0.82);
  }
}

.logo {
  width: min(90cqw, 560px);
  height: auto;
  display: block;
  margin: 6px auto 22px;
  filter: drop-shadow(0 0 12px rgba(0, 255, 255, 0.35)) drop-shadow(0 0 24px rgba(255, 0, 255, 0.22));
  user-select: none;
  pointer-events: none;
}

.beta-tag {
  color: #f0f;
  font-size: clamp(0.9rem, 1.8cqw, 1.25rem);
  font-weight: 900;
  letter-spacing: clamp(4px, 1cqw, 8px);
  text-shadow: 0 0 14px rgba(255, 0, 255, 0.9), 0 0 28px rgba(255, 0, 255, 0.45);
  margin-top: -35px;
  margin-bottom: 24px;
  opacity: 0.95;
  font-family: inherit;
}

h2 {
  color: #f0f;
  text-shadow: 0 0 10px #f0f;
  font-size: clamp(1.3rem, 2.9cqw, 2rem);
  margin-bottom: 20px;
  letter-spacing: 2px;
}

.btn {
  background: rgba(0, 255, 255, 0.05);
  backdrop-filter: blur(4px);
  border: 2px solid #0ff;
  color: #0ff;
  font-family: inherit;
  font-size: clamp(1rem, 2.4cqw, 1.5rem);
  padding: clamp(11px, 1.8cqw, 15px) clamp(8px, 1.2cqw, 10px);
  margin: 10px;
  width: min(70cqw, 250px);
  border-radius: 4px;
  box-shadow: 0 0 15px rgba(0,255,255,0.3), inset 0 0 10px rgba(0,255,255,0.2);
  text-shadow: 0 0 8px #0ff;
  cursor: pointer;
  text-transform: uppercase;
  font-weight: bold;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn:hover {
  background: rgba(0, 255, 255, 0.2);
  box-shadow: 0 0 25px rgba(0,255,255,0.6), inset 0 0 15px rgba(0,255,255,0.4);
  transform: scale(1.05);
}

.btn:active {
  background: #00ffff;
  color: #0a001a;
  text-shadow: none;
  transform: scale(0.95);
}

/* -- SHOP -- */
#shop-menu {
  justify-content: flex-start;
  padding-top: 50px;
  overflow-y: auto;
  pointer-events: auto;
}

.coins-display {
  font-size: clamp(1.1rem, 2.6cqw, 1.5rem);
  color: #ff0;
  text-shadow: 0 0 10px #ff0;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.btn-free-coins {
  display: block;
  margin: 0 auto 12px;
  padding: 5px 14px;
  font-size: 0.7rem;
  font-family: inherit;
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: 4px;
  color: #00111a;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.55);
  animation: pulse-gold 1.8s infinite ease-in-out;
  text-transform: uppercase;
  letter-spacing: 1px;
}

@keyframes pulse-gold {
  0% { transform: scale(1); box-shadow: 0 0 8px rgba(255, 215, 0, 0.4); }
  50% { transform: scale(1.06); box-shadow: 0 0 18px rgba(255, 215, 0, 0.9); }
  100% { transform: scale(1); box-shadow: 0 0 8px rgba(255, 215, 0, 0.4); }
}

.btn-free-coins:disabled,
.btn-free-coins.fc-cooldown {
  background: linear-gradient(135deg, #444, #222);
  color: rgba(255,255,255,0.45);
  box-shadow: none;
  animation: none;
  cursor: not-allowed;
}

.top-score-display {
  font-size: clamp(0.82rem, 1.8cqw, 1.05rem);
  color: #9efbff;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.55);
  margin-bottom: 10px;
  letter-spacing: 0.8px;
}

.shop-section {
  width: 90%;
  max-width: 400px;
  margin-bottom: 20px;
  text-align: center;
}

.shop-section h3 {
  color: #0ff;
  border-bottom: 1px solid #0ff;
  margin-bottom: 10px;
  padding-bottom: 5px;
}

.shop-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shop-section.shop-section-cars {
  width: min(90%, 400px);
  max-width: 400px;
}

#cars-grid.shop-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: row;
  gap: 8px;
  width: 100%;
}

.shop-car-nav {
  width: clamp(52px, 7cqw, 64px);
  height: clamp(52px, 7cqw, 64px);
  border: 2px solid #0ff;
  border-radius: 6px;
  background: rgba(0, 255, 255, 0.12);
  color: #00e5ff;
  font-size: clamp(2rem, 4.2cqw, 3rem);
  line-height: 1;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(0, 255, 255, 0.55), inset 0 0 14px rgba(0, 255, 255, 0.18);
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.9);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shop-car-nav:hover:not(:disabled) {
  transform: scale(1.04);
  background: rgba(0, 255, 255, 0.28);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.72), inset 0 0 16px rgba(0, 255, 255, 0.24);
}

.shop-car-nav:disabled {
  opacity: 0.28;
  cursor: default;
  pointer-events: none;
}

.shop-car-focus {
  width: min(50cqw, 252px);
  max-width: 252px;
  min-width: 0;
  padding: 10px 10px 12px;
  border-radius: 22px;
  border: 2px solid rgba(123, 255, 242, 0.72);
  background:
    radial-gradient(circle at 50% 12%, rgba(183, 255, 248, 0.16), transparent 56%),
    linear-gradient(160deg, rgba(12, 34, 60, 0.94), rgba(7, 13, 34, 0.92));
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.42),
    0 0 24px rgba(0, 229, 255, 0.25),
    inset 0 0 18px rgba(127, 246, 255, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.shop-car-focus-preview {
  width: min(45cqw, 224px);
  max-width: 224px;
  aspect-ratio: 1.34 / 1;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 255, 255, 0.15), transparent 60%),
    linear-gradient(180deg, rgba(10, 20, 38, 0.88), rgba(5, 6, 18, 0.94));
  box-shadow: inset 0 0 20px rgba(0, 255, 255, 0.12), 0 8px 20px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.shop-car-focus-preview canvas {
  width: 100%;
  height: 100%;
}

.shop-car-focus-name {
  width: 100%;
  text-align: center;
  color: #fff;
  font-size: clamp(0.82rem, 1.95cqw, 1.12rem);
  letter-spacing: 0.8px;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.28);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-car-focus .shop-item-btn {
  width: clamp(132px, 22cqw, 176px);
  height: 44px;
  padding: 0 12px;
  font-size: clamp(0.9rem, 1.8cqw, 1.15rem);
  border: 2px solid rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  line-height: 1;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.shop-car-focus.owned .shop-item-btn {
  background: #0ff;
  color: #00111a;
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.48), inset 0 0 10px rgba(255, 255, 255, 0.16);
}

.shop-car-focus.locked .shop-item-btn {
  background: rgba(40, 46, 60, 0.95);
  color: #ffefc8;
  border-color: rgba(255, 200, 117, 0.55);
}

.shop-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(255,255,255,0.15);
  padding: 10px;
  background: linear-gradient(135deg, rgba(15, 6, 34, 0.92), rgba(4, 8, 22, 0.72));
  border-radius: 10px;
  box-shadow: inset 0 0 14px rgba(255,255,255,0.04), 0 10px 18px rgba(0,0,0,0.25);
  gap: 10px;
}
.shop-item.owned { border-color: rgba(0, 229, 255, 0.55); }
.shop-item.equipped {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.22), rgba(8, 20, 44, 0.82));
  border-color: #66fff2;
  box-shadow: inset 0 0 16px rgba(102,255,242,0.14), 0 12px 24px rgba(0,0,0,0.28);
}



.shop-item-name { font-size: clamp(0.72rem, 1.6cqw, 0.9rem); flex: 1; text-align: left; font-weight: bold; color: #fff; }
.shop-item-btn { 
  background: #333; color: white; border: none; padding: 6px 8px; font-family: inherit; font-size: clamp(0.66rem, 1.4cqw, 0.8rem); font-weight: bold; cursor:pointer;
  min-width: clamp(72px, 11cqw, 80px);
}
.shop-item.owned .shop-item-btn { background: #0ff; color: #000; }

.btn.btn-reset-save {
  border-color: #ff4d6d;
  color: #ffd3dc;
  background: rgba(255, 77, 109, 0.12);
  box-shadow: 0 0 14px rgba(255,77,109,0.28), inset 0 0 10px rgba(255,77,109,0.18);
  font-size: 1rem;
  width: min(320px, 90%);
  margin-top: 6px;
  margin-bottom: 2px;
}

.btn.btn-reset-save:hover {
  background: rgba(255, 77, 109, 0.24);
  box-shadow: 0 0 22px rgba(255,77,109,0.42), inset 0 0 12px rgba(255,77,109,0.26);
}

.btn.btn-reset-save:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.shop-reset-modal {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 14, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 25;
}

.shop-reset-card {
  width: min(92%, 460px);
  padding: 20px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 120, 145, 0.55);
  background: linear-gradient(160deg, rgba(22, 6, 28, 0.96), rgba(8, 10, 24, 0.94));
  box-shadow: 0 16px 30px rgba(0,0,0,0.42), inset 0 0 18px rgba(255, 120, 145, 0.12);
  text-align: center;
}

.shop-reset-card h3 {
  color: #ffd3dc;
  margin-bottom: 10px;
  letter-spacing: 1px;
}

.shop-reset-card p {
  margin: 6px 0;
  color: #f7f5ff;
  font-size: 0.95rem;
}

.shop-reset-warn {
  color: #ffbfcd !important;
  font-size: 0.82rem !important;
  margin-top: 10px !important;
  letter-spacing: 0.5px;
}

.shop-reset-question {
  margin-top: 12px !important;
  color: #9efbff !important;
  font-size: 0.86rem !important;
  letter-spacing: 0.5px;
}

.shop-reset-option {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #f7f5ff;
  font-size: 0.84rem;
  cursor: pointer;
  user-select: none;
}

.shop-reset-option input {
  accent-color: #00e5ff;
  width: 16px;
  height: 16px;
}

.shop-reset-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
  flex-wrap: wrap;
}

.shop-reset-actions .btn {
  width: 170px;
  font-size: 1rem;
  margin: 0;
  padding: 10px 8px;
}

/* -- HUD -- */
#hud {
  background: none;
  pointer-events: none;
  justify-content: space-between;
  padding: env(safe-area-inset-top, 20px) 20px env(safe-area-inset-bottom, 20px) 20px;
}

#coins { color: #ff0; text-shadow: 2px 2px 0 #000, 0 0 10px #ff0; }

#powerup-status {
  --powerup-primary: #ff355e;
  --powerup-secondary: #ffb703;
  --powerup-accent: #fff3b0;
  position: absolute;
  top: 146px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  min-width: 188px;
  padding: 10px 16px 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.18), transparent 45%),
    linear-gradient(135deg, rgba(8, 14, 30, 0.96), rgba(20, 8, 38, 0.88));
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.35),
    inset 0 0 22px rgba(255, 255, 255, 0.08);
  font-weight: bold;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(255,255,255,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: pulse 0.8s ease-in-out infinite;
}

#powerup-status::before {
  content: attr(data-powerup);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--powerup-accent);
  text-transform: uppercase;
  opacity: 0.95;
}

#powerup-status #powerup-text {
  font-size: 0.88rem;
  color: #fff;
}

#powerup-status.turbo {
  border-color: rgba(255, 183, 3, 0.35);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35), 0 0 20px rgba(255, 53, 94, 0.25), inset 0 0 22px rgba(255, 183, 3, 0.08);
}

#powerup-status.shield {
  border-color: rgba(102, 255, 242, 0.35);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35), 0 0 20px rgba(0, 229, 255, 0.22), inset 0 0 22px rgba(102, 255, 242, 0.08);
}

#powerup-status.slow {
  border-color: rgba(168, 85, 247, 0.35);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35), 0 0 20px rgba(88, 123, 255, 0.22), inset 0 0 22px rgba(168, 85, 247, 0.08);
}

#powerup-status.turbo #powerup-text,
#powerup-status.turbo::before {
  text-shadow: 0 0 10px rgba(255, 183, 3, 0.45);
}

#powerup-status.shield #powerup-text,
#powerup-status.shield::before {
  text-shadow: 0 0 10px rgba(102, 255, 242, 0.4);
}

#powerup-status.slow #powerup-text,
#powerup-status.slow::before {
  text-shadow: 0 0 10px rgba(168, 85, 247, 0.45);
}

#powerup-bar-wrap {
  width: 156px;
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.18);
  overflow: hidden;
  box-shadow: inset 0 0 12px rgba(255,255,255,0.08);
}

#powerup-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--powerup-primary), var(--powerup-secondary));
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.45);
  transition: width 0.12s linear;
}

@keyframes pulse {
  0% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.035); }
  100% { transform: translateX(-50%) scale(1); }
}

#game-over {
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 54, 124, 0.14), transparent 38%),
    linear-gradient(180deg, rgba(8, 5, 22, 0.85), rgba(8, 5, 22, 0.96));
}

#game-over h2 {
  color: #ff5aa5;
  text-shadow: 0 0 12px rgba(255, 90, 165, 0.95), 0 0 26px rgba(255, 90, 165, 0.35);
  letter-spacing: 4px;
  margin-bottom: 16px;
}

#final-score {
  width: min(92cqw, 520px);
  margin-bottom: 28px;
  padding: 14px 16px;
  border: 1px solid rgba(0, 255, 255, 0.28);
  border-radius: 10px;
  background:
    linear-gradient(160deg, rgba(4, 10, 26, 0.88), rgba(8, 4, 22, 0.84));
  box-shadow: inset 0 0 18px rgba(0, 255, 255, 0.08), 0 10px 22px rgba(0, 0, 0, 0.35);
}

#final-score .go-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin: 3px 0;
  flex-wrap: wrap;
}

#final-score .go-label {
  font-size: clamp(0.92rem, 2cqw, 1.16rem);
  color: #8ef7ff;
  text-shadow: 0 0 8px rgba(142, 247, 255, 0.45);
}

#final-score .go-value {
  font-size: clamp(0.95rem, 2.2cqw, 1.2rem);
  font-weight: 900;
  letter-spacing: 1px;
}

#final-score .go-distance {
  color: #d5fdff;
  text-shadow: 0 0 10px rgba(180, 250, 255, 0.6);
}

#final-score .go-points {
  color: #ffd96a;
  text-shadow: 0 0 10px rgba(255, 217, 106, 0.55);
}

#final-score .go-coins {
  color: #ffbf5f;
  text-shadow: 0 0 10px rgba(255, 191, 95, 0.48);
}

#final-score .go-best {
  color: #ff86cc;
  text-shadow: 0 0 10px rgba(255, 134, 204, 0.55);
}

.gameover-car-select {
  width: 100%;
}

.gameover-car-select-title {
  margin-bottom: 10px;
  color: #8ef7ff;
  font-size: clamp(0.74rem, 1.8cqw, 0.92rem);
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 0 8px rgba(142, 247, 255, 0.35);
}

.gameover-cars-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.gameover-select-panel {
  width: min(92cqw, 520px);
  margin-bottom: 24px;
  padding: 12px 14px 14px;
  border: 1px solid rgba(0, 255, 255, 0.22);
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(4, 10, 26, 0.84), rgba(8, 4, 22, 0.8));
  box-shadow: inset 0 0 16px rgba(0, 255, 255, 0.06), 0 10px 22px rgba(0, 0, 0, 0.28);
}

.gameover-loadout-select {
  width: 100%;
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 255, 255, 0.14);
}

.gameover-loadout-section-title {
  color: #8ef7ff;
  font-size: clamp(0.74rem, 1.8cqw, 0.92rem);
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 0 8px rgba(142, 247, 255, 0.35);
}

.gameover-loadout-section + .gameover-loadout-section {
  margin-top: 18px;
}

.gameover-loadout-section-title {
  margin-bottom: 12px;
  color: rgba(180, 250, 255, 0.9);
  font-size: clamp(0.68rem, 1.6cqw, 0.84rem);
}

.gameover-loadout-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.gameover-loadout-focus {
  flex: 1;
  min-height: 54px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  border: 1px solid rgba(0, 255, 255, 0.28);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(15, 6, 34, 0.92), rgba(4, 8, 22, 0.74));
  box-shadow:
    inset 0 0 14px rgba(255, 255, 255, 0.04),
    0 10px 18px rgba(0, 0, 0, 0.25);
}

.gameover-loadout-name {
  flex: 1;
  min-width: 0;
  text-align: center;
  color: #fff;
  font-size: clamp(0.72rem, 1.6cqw, 0.92rem);
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gameover-loadout-nav {
  flex: 0 0 auto;
}

.gameover-loadout-empty {
  color: rgba(220, 248, 255, 0.82);
  font-size: clamp(0.68rem, 1.6cqw, 0.82rem);
  letter-spacing: 1px;
  text-align: center;
  text-transform: uppercase;
}

.gameover-car-hint {
  color: rgba(220, 248, 255, 0.82);
  font-size: clamp(0.68rem, 1.6cqw, 0.82rem);
  letter-spacing: 1px;
  text-align: center;
  text-transform: uppercase;
}

.gameover-car-nav {
  flex: 0 0 auto;
}

/* -- SETTINGS -- */
.settings-content {
  width: min(92cqw, 380px);
  padding: 30px 20px;
  margin-bottom: 30px;
  border: 1px solid rgba(0, 255, 255, 0.2);
  background: rgba(0, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  border-radius: 8px;
}

.setting-item {
  display: flex;
  flex-direction: column;
  margin-bottom: 25px;
  width: 100%;
}

.setting-item:last-child {
  margin-bottom: 0;
}

.setting-item .label {
  font-size: clamp(0.66rem, 1.4cqw, 0.75rem);
  color: #0ff;
  margin-bottom: 12px;
  text-transform: uppercase;
  font-weight: bold;
  letter-spacing: 1.5px;
  display: flex;
  justify-content: space-between;
}

.setting-item .label::after {
  content: '0% - 100%';
  font-size: 0.6rem;
  opacity: 0.6;
}

.setting-item .btn-settings-toggle {
  width: min(320px, 90%);
  margin-bottom: 8px;
  font-size: clamp(0.82rem, 1.8cqw, 1rem);
  border-color: rgba(0, 255, 255, 0.55);
  background: rgba(0, 255, 255, 0.08);
}

.setting-item .btn-settings-toggle:hover {
  background: rgba(0, 255, 255, 0.16);
}

.setting-item .btn-settings-toggle:disabled {
  opacity: 0.72;
}

.setting-hint {
  width: min(320px, 90%);
  color: rgba(224, 245, 255, 0.78);
  font-size: clamp(0.58rem, 1.2cqw, 0.72rem);
  line-height: 1.25;
  letter-spacing: 0.4px;
  text-align: center;
  margin-top: -2px;
}

.btn.btn-settings-reset {
  width: min(320px, 90%);
  margin-top: -6px;
  margin-bottom: 0;
  font-size: clamp(0.86rem, 2cqw, 1.05rem);
  border-color: #66fff2;
}

@media (max-width: 480px) {
  #hud {
    padding: env(safe-area-inset-top, 8px) 8px env(safe-area-inset-bottom, 8px) 8px;
  }
  .hud-top {
    gap: 6px;
    text-shadow: 1px 1px 0 #000, 0 0 7px rgba(0, 255, 255, 0.7);
  }
  .hud-widget {
    min-width: 78px;
    padding: 5px 7px;
  }
  .hud-widget.glass {
    background: rgba(10, 0, 26, 0.44);
    backdrop-filter: blur(3px);
    border-left-width: 2px;
    border-bottom-color: rgba(0, 255, 255, 0.12);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
  }
  .hud-widget .label {
    font-size: 0.5rem;
    letter-spacing: 1px;
    margin-bottom: 1px;
  }
  #score-value,
  #coins,
  #time-value {
    font-size: clamp(0.92rem, 4.6vw, 1.15rem);
    letter-spacing: 0;
  }
  .hud-timer {
    padding: 5px 8px;
    margin: 0 4px;
    border-width: 1px;
    border-radius: 6px;
    background: rgba(10, 0, 26, 0.46);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.28), inset 0 0 8px rgba(0, 255, 255, 0.13);
  }
  #powerup-status {
    top: 102px;
    min-width: 164px;
  }
  .shop-section {
    width: min(94cqw, 420px);
  }
  .shop-section.shop-section-cars {
    width: min(94cqw, 400px);
  }
  #cars-grid.shop-grid {
    gap: 6px;
  }
  .shop-car-nav {
    width: 50px;
    height: 50px;
    font-size: 1.9rem;
  }
  .shop-car-focus {
    min-width: 0;
    width: min(60cqw, 232px);
    padding: 9px 8px 10px;
    border-radius: 16px;
  }
  .shop-car-focus-preview {
    width: min(50cqw, 204px);
    border-radius: 12px;
  }
  .shop-car-focus-name {
    font-size: clamp(0.76rem, 2.4cqw, 0.94rem);
  }
  .shop-car-focus .shop-item-btn {
    width: 112px;
    height: 38px;
    font-size: 0.82rem;
    padding: 0 10px;
  }
  .hud-center-stack {
    gap: 2px;
    padding: 0 2px;
  }
  .flow-widget {
    width: min(100%, 184px);
    padding: 4px 7px 5px;
    gap: 1px;
    background:
      linear-gradient(180deg, rgba(10, 8, 30, 0.66), rgba(9, 15, 40, 0.64)),
      repeating-linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.025) 0px,
        rgba(255, 255, 255, 0.025) 1px,
        rgba(0, 0, 0, 0) 1px,
        rgba(0, 0, 0, 0) 4px
      );
    border-left-width: 2px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  }
  .flow-bar {
    height: 6px;
  }
  .flow-feedback {
    font-size: 0.42rem;
    letter-spacing: 0.8px;
  }
  .flow-multiplier {
    font-size: 0.68rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flow-widget,
  .flow-widget *,
  .flow-bar-fill {
    animation: none !important;
    transition: none !important;
  }
}

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: transparent;
  height: 24px; /* Container for track */
  padding: 0 4px;
  border: 1px solid rgba(0, 255, 255, 0.5); /* The "rectangular base" */
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.1);
}

input[type=range]:focus {
  outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 2px; /* Thinner line */
  cursor: pointer;
  background: rgba(0, 255, 255, 0.3);
}

input[type=range]::-moz-range-track {
  width: 100%;
  height: 2px;
  cursor: pointer;
  background: rgba(0, 255, 255, 0.3);
}

input[type=range]::-webkit-slider-thumb {
  height: 14px;
  width: 6px;
  background: #0ff;
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -6px; /* Center on 2px track */
  box-shadow: 0 0 12px #0ff;
  border-radius: 1px;
}

input[type=range]::-moz-range-thumb {
  height: 14px;
  width: 6px;
  background: #0ff;
  cursor: pointer;
  border: none;
  border-radius: 1px;
  box-shadow: 0 0 12px #0ff;
}

/* ── Top Rank Screen ───────────────────────────────────────── */
#toprank-menu {
  flex-direction: column;
  align-items: center;
  padding: 16px 12px 20px;
  overflow: hidden;
  background: rgba(5, 0, 18, 0.97);
}

.toprank-table-wrap {
  width: min(98cqw, 520px);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(0, 255, 255, 0.25);
  margin-bottom: 16px;
  flex: 1;
}

.toprank-header {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px 12px;
  background: rgba(0, 255, 255, 0.08);
  border-bottom: 1px solid rgba(0, 255, 255, 0.2);
  font-family: 'Vapor', 'Courier New', monospace;
  font-size: clamp(0.65rem, 1.8cqw, 0.78rem);
  letter-spacing: 2px;
  color: rgba(0, 255, 255, 0.7);
  flex-shrink: 0;
}

.toprank-list {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 255, 255, 0.35) transparent;
}

.toprank-list::-webkit-scrollbar { width: 4px; }
.toprank-list::-webkit-scrollbar-track { background: transparent; }
.toprank-list::-webkit-scrollbar-thumb { background: rgba(0, 255, 255, 0.35); border-radius: 2px; }

.tr-col-rank  { width: 34px;  min-width: 34px;  text-align: right; padding-right: 8px; flex-shrink: 0; }
.tr-col-name  { flex: 1;      min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-col-score { width: 80px;  min-width: 72px;  text-align: right; flex-shrink: 0; padding-right: 10px; }
.tr-col-dist  { width: 52px;  min-width: 48px;  text-align: right; flex-shrink: 0; }

.tr-row {
  display: flex;
  align-items: center;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-family: 'Vapor', 'Courier New', monospace;
  font-size: clamp(0.68rem, 1.9cqw, 0.82rem);
  letter-spacing: 1px;
  transition: background 0.15s;
}

.tr-row:last-child { border-bottom: none; }
.tr-row:nth-child(odd) { background: rgba(255, 255, 255, 0.015); }

.tr-row-empty {
  padding: 32px 12px;
  text-align: center;
  color: rgba(255, 255, 255, 0.25);
  font-family: 'Vapor', 'Courier New', monospace;
  font-size: 0.8rem;
  letter-spacing: 2px;
}

/* rank number colors */
.tr-r1 { color: #ffd700; text-shadow: 0 0 8px #ffd700; }
.tr-r2 { color: #c0c0c0; text-shadow: 0 0 6px #c0c0c0; }
.tr-r3 { color: #cd7f32; text-shadow: 0 0 6px #cd7f32; }
.tr-rn { color: rgba(255, 255, 255, 0.35); }
.tr-rn-faded { color: rgba(255, 255, 255, 0.20); }

/* Visual separator after position 20 */
.tr-row-separator {
  border-top: 1px dashed rgba(0, 255, 255, 0.2);
  margin: 0;
  font-size: 0;
  height: 0;
}

.tr-name  { color: #dde4ff; }
.tr-score { color: #ffff55; text-shadow: 0 0 5px rgba(255, 255, 0, 0.4); }
.tr-dist  { color: rgba(255, 255, 255, 0.38); font-size: 0.9em; }

/* ── Leaderboard Popup ─────────────────────────────────────── */
.lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  touch-action: auto;      /* override global * { touch-action: none } */
  pointer-events: auto;
  animation: lb-fadein 0.25s ease both;
}

.lb-overlay.hidden {
  display: none;
}

@keyframes lb-fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lb-modal {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: min(94cqw, 420px);
  max-height: 90vh;
  background: rgba(5, 0, 20, 0.97);
  border: 2px solid #0ff;
  border-radius: 10px;
  touch-action: auto;
  box-shadow: 0 0 40px rgba(0, 255, 255, 0.35), 0 0 80px rgba(255, 0, 255, 0.15);
  overflow: hidden;
  animation: lb-slidein 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes lb-slidein {
  from { transform: translateY(32px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.lb-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(0, 255, 255, 0.2);
}

.lb-trophy {
  font-size: 1.5rem;
  user-select: none;
}

.lb-title {
  font-family: 'Vapor', 'Courier New', monospace;
  font-size: clamp(1rem, 3cqw, 1.3rem);
  font-weight: bold;
  letter-spacing: 4px;
  color: #0ff;
  text-shadow: 0 0 12px #0ff;
}

.lb-list-wrap {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 50vh;
  scroll-behavior: smooth;
  padding: 0;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 255, 255, 0.4) transparent;
}

.lb-list-wrap::-webkit-scrollbar { width: 4px; }
.lb-list-wrap::-webkit-scrollbar-track { background: transparent; }
.lb-list-wrap::-webkit-scrollbar-thumb { background: rgba(0, 255, 255, 0.4); border-radius: 2px; }

.lb-list {
  display: flex;
  flex-direction: column;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-family: 'Vapor', 'Courier New', monospace;
  font-size: clamp(0.72rem, 2cqw, 0.88rem);
  letter-spacing: 1px;
  transition: background 0.2s;
}

.lb-row:last-child { border-bottom: none; }

.lb-row.lb-row-new {
  background: rgba(0, 255, 255, 0.07);
  border-top: 1px solid rgba(0, 255, 255, 0.3);
  border-bottom: 1px solid rgba(0, 255, 255, 0.3);
  overflow: hidden;
  animation: lb-row-expand 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes lb-row-expand {
  from { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; }
  to   { max-height: 80px; opacity: 1; padding-top: 9px; padding-bottom: 9px; }
}

.lb-rank {
  min-width: 28px;
  text-align: right;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.75em;
}

.lb-rank-1  { color: #ffd700; text-shadow: 0 0 8px #ffd700; }
.lb-rank-2  { color: #c0c0c0; text-shadow: 0 0 6px #c0c0c0; }
.lb-rank-3  { color: #cd7f32; text-shadow: 0 0 6px #cd7f32; }

.lb-name {
  flex: 1;
  color: #e0e0ff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-row-new .lb-name {
  color: #0ff;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
}

.lb-score {
  color: #ff0;
  text-shadow: 0 0 6px rgba(255, 255, 0, 0.5);
  white-space: nowrap;
}

.lb-dist {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.78em;
  white-space: nowrap;
}

.lb-name-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 18px 14px; /* Aumentado para abaixar a caixa */
  border-top: 1px solid rgba(0, 255, 255, 0.2);
  animation: lb-fadein 0.3s 0.1s ease both;
}

.lb-name-row.hidden { display: none; }

.lb-name-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.lb-name-input {
  flex: 1;
  background: rgba(0, 255, 255, 0.07);
  border: 1.5px solid #0ff;
  border-radius: 4px;
  color: #0ff;
  font-family: 'Vapor', 'Courier New', monospace;
  font-size: clamp(0.9rem, 2.5cqw, 1.05rem);
  letter-spacing: 2px;
  padding: 8px 12px;
  outline: none;
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.2), inset 0 0 8px rgba(0, 255, 255, 0.05);
  user-select: text;
  touch-action: auto;
  caret-color: #0ff;
}

.lb-name-input::placeholder { color: rgba(0, 255, 255, 0.3); }
.lb-name-input:focus { box-shadow: 0 0 20px rgba(0, 255, 255, 0.45), inset 0 0 10px rgba(0, 255, 255, 0.1); }

.lb-name-status {
  font-size: 0.78rem;
  font-weight: bold;
  color: #f44;
  text-align: center;
  padding: 0;
  min-height: 1.2em;
  text-shadow: 0 0 10px rgba(255, 68, 68, 0.7);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.lb-confirm-btn {
  width: auto;
  min-width: 64px;
  padding: 8px 14px;
  margin: 0;
  font-size: clamp(0.8rem, 2cqw, 0.95rem);
  letter-spacing: 2px;
  touch-action: auto;
  pointer-events: auto;
}

.lb-skip-btn {
  align-self: center;
  background: transparent;
  border: none;
  touch-action: auto;
  pointer-events: auto;
  color: rgba(255, 60, 60, 0.85);
  text-shadow: 0 0 8px rgba(255, 0, 0, 0.7);
  font-family: 'Vapor', 'Courier New', monospace;
  font-size: 0.9rem;
  letter-spacing: 2px;
  padding: 12px 28px;
  cursor: pointer;
  text-transform: uppercase;
  transition: color 0.2s, text-shadow 0.2s;
}

.lb-skip-btn:hover { color: rgba(255, 80, 80, 1); text-shadow: 0 0 14px rgba(255, 0, 0, 0.9); }

/* Tablet (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
  #hud {
    padding: 10px 16px;
  }
  .shop-section {
    width: min(85cqw, 500px);
  }
  .shop-car-focus {
    width: min(55cqw, 280px);
  }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
  #hud {
    padding: 16px 32px;
  }
  .shop-section {
    width: min(70cqw, 700px);
  }
  #cars-grid.shop-grid {
    gap: 16px;
  }
  .shop-car-nav {
    width: 64px;
    height: 64px;
    font-size: 2.2rem;
  }
}

/* ── LOADING SCREEN ──────────────────────────────────────────────────────── */
#loading-screen {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  background: radial-gradient(ellipse at 50% 30%, #12003a 0%, #0a001a 55%, #000 100%);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 255, 255, 0.025) 3px,
    rgba(0, 255, 255, 0.025) 4px
  );
  pointer-events: none;
  z-index: 1;
}

#loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-logo-wrap {
  position: relative;
  z-index: 2;
  text-align: center;
}

.loading-title {
  font-family: 'Vapor', 'Courier New', monospace;
  font-size: clamp(2rem, 7cqw, 4rem);
  font-weight: 900;
  letter-spacing: clamp(6px, 2cqw, 16px);
  color: #fff;
  text-shadow:
    0 0 12px rgba(0, 255, 255, 0.9),
    0 0 30px rgba(0, 255, 255, 0.45),
    0 0 60px rgba(0, 200, 255, 0.2);
  line-height: 1.1;
  animation: loading-title-pulse 2.5s ease-in-out infinite;
}

.loading-title span {
  display: block;
  color: #f0f;
  text-shadow:
    0 0 12px rgba(255, 0, 255, 0.9),
    0 0 30px rgba(255, 0, 255, 0.45),
    0 0 60px rgba(200, 0, 255, 0.2);
}

@keyframes loading-title-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}

.loading-subtitle {
  margin-top: 14px;
  font-family: 'Vapor', 'Courier New', monospace;
  font-size: clamp(0.7rem, 1.8cqw, 0.95rem);
  letter-spacing: clamp(4px, 1.5cqw, 10px);
  color: #0ff;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.7);
  animation: loading-blink 1.4s step-end infinite;
}

@keyframes loading-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.loading-bar-wrap {
  position: relative;
  z-index: 2;
  width: min(82cqw, 440px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loading-bar-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 255, 255, 0.1);
  border: 1px solid rgba(0, 255, 255, 0.25);
  overflow: hidden;
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.1);
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f0f 0%, #0ff 50%, #0af 100%);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.7), 0 0 20px rgba(255, 0, 255, 0.4);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-status {
  font-family: 'Vapor', 'Courier New', monospace;
  font-size: clamp(0.6rem, 1.4cqw, 0.75rem);
  color: rgba(0, 255, 255, 0.65);
  letter-spacing: 2px;
  text-align: center;
  min-height: 1.2em;
}

/* -- TUTORIAL OVERLAY -- */
.tutorial-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  pointer-events: auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.tutorial-modal {
  width: min(92%, 480px);
  padding: 24px 20px;
  border-radius: 12px;
  border: 1.5px solid rgba(0, 255, 255, 0.5);
  background: linear-gradient(160deg, rgba(10, 0, 26, 0.95), rgba(5, 0, 15, 0.95));
  box-shadow: 0 16px 30px rgba(0,0,0,0.6), inset 0 0 20px rgba(0, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: center;
}

.tutorial-header h3 {
  color: #f0f;
  text-shadow: 0 0 10px #f0f;
  font-size: 1.6rem;
  letter-spacing: 2px;
}

.tutorial-info {
  color: #0ff;
  font-size: 1rem;
  margin-bottom: 16px;
  text-shadow: 0 0 5px rgba(0,255,255,0.4);
}

.tutorial-legend {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  background: rgba(0, 0, 0, 0.3);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.legend-icon {
  font-size: 1.5rem;
  min-width: 32px;
  text-align: center;
}

.color-coin { color: #ff0; text-shadow: 0 0 8px #ff0; }
.color-turbo { color: #ff355e; text-shadow: 0 0 8px #ff355e; }
.color-shield { color: #00e5ff; text-shadow: 0 0 8px #00e5ff; }
.color-slow { color: #a855f7; text-shadow: 0 0 8px #a855f7; }

.css-barrier {
  display: flex; justify-content: center; align-items: center;
}
.barrier-shape {
  width: 26px;
  height: 16px;
  background: #e63946;
  border-top: 3px solid #888;
  position: relative;
  border-radius: 2px;
  box-shadow: 0 0 8px #e63946;
}
.barrier-shape::after {
  content: "///";
  color: #f1faee;
  font-weight: 900;
  font-size: 10px;
  letter-spacing: 1px;
  position: absolute;
  top: 1px;
  left: 3px;
  opacity: 0.9;
}

.legend-text {
  color: #ccc;
  font-size: 0.85rem;
  line-height: 1.4;
}

.tutorial-mobile-tip {
  margin-top: 16px;
  color: #fff;
  font-weight: bold;
  font-size: 0.9rem;
  background: rgba(255, 0, 255, 0.2);
  padding: 10px;
  border-radius: 4px;
  border: 1px dashed #f0f;
}

.tutorial-ok-btn {
  width: 100%;
  margin: 0;
  padding: 12px;
}
