* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #050510;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #e0f0ff;
  touch-action: none;
  user-select: none;
}

#game-container {
  position: fixed;
  inset: 0;
}

#game-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 1.25rem 1.5rem;
  pointer-events: none;
  z-index: 10;
}

#hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  width: 100%;
}

#hud-meta {
  text-align: right;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.9;
}

#personal-best {
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
  margin-bottom: 0.25rem;
  transition: transform 0.2s ease, color 0.2s ease;
}

#personal-best.pb-flash {
  transform: scale(1.12);
  color: #ffff44;
  text-shadow: 0 0 16px #ffd700;
}

#crash-ticker {
  color: #ff6666;
  text-shadow: 0 0 8px rgba(255, 80, 80, 0.5);
}

#credits-display {
  color: #cc88ff;
  text-shadow: 0 0 10px rgba(170, 102, 255, 0.55);
  margin-bottom: 0.25rem;
  font-weight: 800;
}

#biome-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  font-size: clamp(1.25rem, 4vw, 2rem);
  font-weight: 900;
  letter-spacing: 0.18em;
  color: #ff4400;
  text-shadow: 0 0 24px #ff2200, 0 0 48px #ff6600;
  pointer-events: none;
  opacity: 0;
  z-index: 12;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

#biome-banner.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

#biome-banner.fade-out {
  opacity: 0;
  transform: translate(-50%, -60%) scale(1.05);
}

#score {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-shadow: 0 0 20px #00ffff, 0 0 40px #ff00ff;
  color: #fff;
}

#shield-indicator {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #ffd700;
  text-shadow: 0 0 12px #ffd700;
  animation: pulse 1s ease-in-out infinite;
}

#vehicle-hud {
  margin-top: 0.65rem;
  max-width: 220px;
}

#vehicle-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: #44ffff;
  text-shadow: 0 0 8px rgba(68, 255, 255, 0.5);
  margin-bottom: 0.35rem;
}

.bar-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  opacity: 0.75;
  margin-bottom: 0.2rem;
}

.hud-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.hud-bar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.12s linear;
  border-radius: 3px;
}

.hud-bar-fill.weapon {
  background: linear-gradient(90deg, #44ff88, #44ffff);
  box-shadow: 0 0 10px rgba(68, 255, 136, 0.6);
}

.hud-bar-fill.weapon.overheated {
  background: linear-gradient(90deg, #ff4400, #ff8800);
  box-shadow: 0 0 10px rgba(255, 68, 0, 0.6);
}

.hud-bar-fill.hull {
  background: linear-gradient(90deg, #4488ff, #8866ff);
  box-shadow: 0 0 10px rgba(68, 136, 255, 0.5);
}

.hud-bar.boss-bar {
  height: 12px;
  border-color: rgba(255, 68, 0, 0.45);
  box-shadow: 0 0 14px rgba(255, 34, 0, 0.35);
}

.hud-bar-fill.boss {
  background: linear-gradient(90deg, #ff2200, #ff8800);
  box-shadow: 0 0 12px rgba(255, 68, 0, 0.75);
}

#boss-hud {
  position: absolute;
  left: 50%;
  top: 5.5rem;
  transform: translateX(-50%);
  width: min(420px, 72vw);
  text-align: center;
  pointer-events: none;
}

#boss-hud .bar-label {
  color: #ff6644;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-shadow: 0 0 10px rgba(255, 68, 0, 0.55);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

#multiplier {
  margin-top: 0.35rem;
  font-size: 1rem;
  font-weight: 700;
  color: #44ffff;
  text-shadow: 0 0 12px #44ffff;
}

#level-block {
  margin-top: 0.5rem;
  max-width: 140px;
}

#level-display {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: #ffaa44;
  text-shadow: 0 0 8px rgba(255, 170, 68, 0.5);
}

.hud-bar.xp-bar {
  margin-top: 0.25rem;
  margin-bottom: 0;
  height: 6px;
}

.hud-bar-fill.xp {
  background: linear-gradient(90deg, #ff8800, #ffdd00);
  box-shadow: 0 0 8px rgba(255, 170, 0, 0.5);
}

#collect-popup {
  position: fixed;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%) scale(0.6);
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  pointer-events: none;
  opacity: 0;
  z-index: 15;
}

#collect-popup.pop {
  animation: collect-pop 0.65s ease-out forwards;
}

@keyframes collect-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  30% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -90%) scale(1); }
}

#charge-bar {
  display: none;
}

#overlay,
#game-over {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 20, 0.85);
  backdrop-filter: blur(8px);
  z-index: 20;
  text-align: center;
  padding: 2rem;
}

#overlay h1,
#game-over h2 {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  background: linear-gradient(135deg, #00ffff, #ff00ff, #ffff00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
}

.hint-red {
  color: #ff3333;
  text-shadow: 0 0 10px #ff0000;
  font-weight: 700;
}

.hint-key {
  color: #44ffff;
  font-weight: 700;
}

#overlay p,
#game-over p {
  font-size: 1rem;
  opacity: 0.75;
  max-width: 420px;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.upgrade-panel {
  width: min(420px, 92vw);
  margin-bottom: 1rem;
  text-align: left;
  pointer-events: auto;
}

.vehicle-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
  pointer-events: auto;
}

button.vehicle-btn {
  font-size: 0.72rem;
  padding: 0.5rem 0.85rem;
  letter-spacing: 0.1em;
  border-color: #8866ff;
  color: #ccaaFF;
}

button.vehicle-btn.selected {
  border-color: #44ffff;
  color: #44ffff;
  background: rgba(68, 255, 255, 0.12);
  box-shadow: 0 0 20px rgba(68, 255, 255, 0.35);
}

button.vehicle-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.upgrade-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(0, 255, 255, 0.15);
}

.upgrade-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.85rem;
}

.upgrade-info strong {
  letter-spacing: 0.06em;
  color: #e0f0ff;
}

.upgrade-info span {
  opacity: 0.65;
  font-size: 0.75rem;
}

button.upgrade-btn {
  font-size: 0.72rem;
  padding: 0.45rem 0.85rem;
  letter-spacing: 0.08em;
  min-width: 6.5rem;
}

button.upgrade-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button {
  pointer-events: auto;
  cursor: pointer;
  border: 2px solid #00ffff;
  background: transparent;
  color: #00ffff;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  padding: 1rem 2.5rem;
  border-radius: 4px;
  text-shadow: 0 0 10px #00ffff;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.3), inset 0 0 20px rgba(0, 255, 255, 0.05);
  transition: all 0.2s ease;
}

button:hover {
  background: rgba(0, 255, 255, 0.15);
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
}

.hidden {
  display: none !important;
}

#death-snapshot-wrap {
  margin-bottom: 1.25rem;
  max-width: min(320px, 85vw);
}

.snapshot-label {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #ff6666;
  margin-bottom: 0.5rem;
}

#death-snapshot,
#share-snapshot {
  width: 100%;
  border: 2px solid #ff00ff;
  border-radius: 6px;
  box-shadow: 0 0 24px rgba(255, 0, 255, 0.35);
  display: block;
}

.game-over-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

#share-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 20, 0.92);
  backdrop-filter: blur(10px);
  padding: 1.5rem;
}

.share-modal-panel {
  background: rgba(15, 10, 35, 0.95);
  border: 2px solid #00ffff;
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 0 40px rgba(0, 255, 255, 0.25);
}

.share-modal-panel h3 {
  font-size: 1.25rem;
  letter-spacing: 0.15em;
  margin-bottom: 1rem;
  color: #00ffff;
}

#share-message {
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 1rem 0;
  opacity: 0.9;
}

#copy-feedback {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #44ff88;
}

button.btn-secondary {
  margin-top: 0.75rem;
  border-color: #8866ff;
  color: #8866ff;
  font-size: 0.9rem;
  padding: 0.65rem 1.5rem;
}

/* —— Hangar hub —— */
#hangar-root {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
}

#hangar-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 1.25rem 1rem 2rem;
  background: linear-gradient(
    180deg,
    rgba(6, 6, 18, 0.15) 0%,
    rgba(6, 6, 18, 0.55) 45%,
    rgba(4, 4, 14, 0.92) 100%
  );
  pointer-events: none;
}

.hangar-header {
  width: min(1100px, 96vw);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
  pointer-events: auto;
}

.hangar-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  opacity: 0.65;
  margin-bottom: 0.25rem;
}

.hangar-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 900;
  letter-spacing: 0.14em;
  background: linear-gradient(135deg, #00ffff, #ff00ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hangar-credits-wrap {
  text-align: right;
  padding: 0.65rem 1rem;
  border: 2px solid rgba(170, 102, 255, 0.55);
  border-radius: 6px;
  box-shadow: 0 0 18px rgba(170, 102, 255, 0.25), inset 0 0 16px rgba(170, 102, 255, 0.06);
  background: rgba(10, 8, 24, 0.75);
}

.hangar-credits-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  opacity: 0.7;
  margin-bottom: 0.2rem;
}

.hangar-credits {
  font-size: 1.35rem;
  font-weight: 800;
  color: #cc88ff;
  text-shadow: 0 0 12px rgba(170, 102, 255, 0.6);
}

.hangar-subtitle {
  width: min(1100px, 96vw);
  font-size: 0.82rem;
  opacity: 0.72;
  margin-bottom: 1rem;
  pointer-events: none;
}

.hangar-vehicles {
  width: min(1100px, 96vw);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  pointer-events: auto;
}

@media (max-width: 900px) {
  .hangar-vehicles {
    grid-template-columns: 1fr;
    max-height: 42vh;
    overflow-y: auto;
    padding-right: 0.25rem;
  }
}

.hangar-card {
  padding: 0.85rem 0.95rem;
  border: 2px solid rgba(0, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(8, 10, 28, 0.82);
  box-shadow: 0 0 16px rgba(0, 255, 255, 0.08), inset 0 0 20px rgba(0, 255, 255, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hangar-card.selected {
  border-color: #44ffff;
  box-shadow: 0 0 24px rgba(68, 255, 255, 0.35), inset 0 0 24px rgba(68, 255, 255, 0.06);
}

.hangar-card.locked {
  opacity: 0.88;
  border-color: rgba(136, 102, 255, 0.35);
}

.hangar-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.hangar-card-header h3 {
  font-size: 0.95rem;
  letter-spacing: 0.12em;
}

.hangar-card-tag {
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  opacity: 0.65;
}

.hangar-stats {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.hangar-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.hangar-stat-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.78rem;
}

.hangar-stat-info strong {
  letter-spacing: 0.06em;
  color: #d8ecff;
}

.hangar-stat-info span {
  opacity: 0.62;
  font-size: 0.68rem;
}

button.hangar-btn {
  font-size: 0.68rem;
  padding: 0.45rem 0.75rem;
  letter-spacing: 0.1em;
  border-radius: 4px;
  min-width: auto;
  width: 100%;
}

button.hangar-btn-upgrade {
  width: auto;
  min-width: 7.5rem;
  border-color: #8866ff;
  color: #ccaaFF;
  box-shadow: 0 0 14px rgba(136, 102, 255, 0.25), inset 0 0 12px rgba(136, 102, 255, 0.05);
}

button.hangar-btn-select {
  border-color: #44ffff;
  color: #44ffff;
}

button.hangar-btn-select.active {
  background: rgba(68, 255, 255, 0.14);
  box-shadow: 0 0 22px rgba(68, 255, 255, 0.4);
}

button.hangar-btn-start {
  font-size: 1rem;
  padding: 0.95rem 2.8rem;
  pointer-events: auto;
  border-color: #00ffff;
  color: #00ffff;
}

button.hangar-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

#hangar-btn {
  border-color: #8866ff;
  color: #ccaaFF;
}

#leaderboard-btn {
  border-color: #44ffff;
  color: #44ffff;
  box-shadow: 0 0 22px rgba(68, 255, 255, 0.35);
}

/* —— Global leaderboard modal —— */
#leaderboard-modal {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 4, 16, 0.72);
  backdrop-filter: blur(12px);
  padding: 1.25rem;
  pointer-events: auto;
}

.leaderboard-panel {
  width: min(440px, 94vw);
  max-height: min(80vh, 620px);
  overflow: auto;
  padding: 1.35rem 1.25rem 1.5rem;
  border: 2px solid rgba(0, 255, 255, 0.45);
  border-radius: 10px;
  background: rgba(8, 10, 28, 0.78);
  box-shadow:
    0 0 40px rgba(0, 255, 255, 0.22),
    inset 0 0 30px rgba(0, 255, 255, 0.04);
  transform: translateY(24px);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.leaderboard-panel.open {
  transform: translateY(0);
  opacity: 1;
}

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.leaderboard-header h3,
#leaderboard-alias h3 {
  font-size: 1.05rem;
  letter-spacing: 0.16em;
  color: #44ffff;
  text-shadow: 0 0 12px rgba(68, 255, 255, 0.45);
}

button.leaderboard-close {
  margin-top: 0;
  padding: 0.45rem 0.85rem;
  font-size: 0.72rem;
}

.leaderboard-status {
  font-size: 0.82rem;
  opacity: 0.85;
  margin-bottom: 0.75rem;
}

.leaderboard-status.error {
  color: #ff6644;
}

.leaderboard-status.success {
  color: #44ff88;
}

.leaderboard-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
}

.leaderboard-row.you {
  border-color: rgba(255, 215, 0, 0.55);
  background: rgba(255, 215, 0, 0.08);
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.18);
}

.lb-rank {
  font-size: 0.78rem;
  font-weight: 800;
  color: #aa88ff;
}

.lb-name {
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-score {
  font-size: 0.95rem;
  font-weight: 800;
  color: #44ffff;
  text-shadow: 0 0 8px rgba(68, 255, 255, 0.45);
}

.leaderboard-empty {
  text-align: center;
  opacity: 0.7;
  padding: 1rem 0.5rem;
  font-size: 0.88rem;
}

.leaderboard-alias-copy {
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0.75rem 0 1rem;
  opacity: 0.88;
}

.leaderboard-alias-copy strong {
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.45);
}

#leaderboard-alias-input {
  width: 100%;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.65rem;
  border: 2px solid rgba(68, 255, 255, 0.45);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  color: #e8f8ff;
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  outline: none;
  box-shadow: inset 0 0 16px rgba(68, 255, 255, 0.08);
}

#leaderboard-alias-input:focus {
  border-color: #44ffff;
  box-shadow: 0 0 18px rgba(68, 255, 255, 0.25);
}

.leaderboard-alias-error {
  color: #ff6644;
  font-size: 0.78rem;
  margin-bottom: 0.65rem;
}

.leaderboard-alias-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
}

.leaderboard-alias-actions button {
  font-size: 0.82rem;
  padding: 0.65rem 1.25rem;
}
