* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0e0e1a;
  color: #e0e0e0;
  font-family: 'Segoe UI', Arial, sans-serif;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

#join-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0e0e1a;
  z-index: 10;
  overflow-y: auto;
  padding: 20px 0;
}

.title-barrage {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  perspective: 600px;
}

.barrage-letter {
  font-size: 64px;
  font-weight: 900;
  color: #00e5ff;
  letter-spacing: 4px;
  text-shadow:
    0 0 10px #00e5ff,
    0 0 30px #00e5ff88,
    0 0 60px #00e5ff44;
  display: inline-block;
  animation:
    barrage-drop 0.5s calc(var(--i) * 0.07s) both,
    barrage-glow 2.5s calc(var(--i) * 0.3s) ease-in-out infinite;
}

@keyframes barrage-drop {
  0% {
    opacity: 0;
    transform: translateY(-60px) rotateX(40deg) scale(0.5);
    filter: blur(6px);
  }
  70% {
    opacity: 1;
    transform: translateY(6px) rotateX(-5deg) scale(1.05);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotateX(0deg) scale(1);
    filter: blur(0);
  }
}

@keyframes barrage-glow {
  0%, 100% {
    text-shadow:
      0 0 10px #00e5ff,
      0 0 30px #00e5ff88,
      0 0 60px #00e5ff44;
    color: #00e5ff;
  }
  50% {
    text-shadow:
      0 0 15px #00ffcc,
      0 0 40px #00ffcc88,
      0 0 80px #00ffcc44;
    color: #00ffcc;
  }
}

#join-screen .subtitle {
  font-size: 14px;
  color: #666;
  margin-bottom: 40px;
}

.join-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: #1a1a2e;
  padding: 24px 40px;
  border-radius: 12px;
  border: 1px solid #2a2a4a;
}

.join-form label {
  font-size: 14px;
  color: #aaa;
  align-self: flex-start;
}

.join-form input[type="text"] {
  width: 240px;
  padding: 10px 14px;
  font-size: 16px;
  border: 1px solid #3a3a5a;
  border-radius: 6px;
  background: #12122a;
  color: #e0e0e0;
  outline: none;
}

.join-form input[type="text"]:focus {
  border-color: #00e5ff;
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 260px;
  justify-content: center;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.selected {
  border-color: #ffffff;
  box-shadow: 0 0 12px currentColor;
}

#play-btn {
  width: 240px;
  padding: 12px;
  font-size: 18px;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  background: #00e5ff;
  color: #0e0e1a;
  cursor: pointer;
  margin-top: 8px;
  letter-spacing: 1px;
  transition: background 0.2s;
}

#play-btn:hover {
  background: #00b8d4;
}

#game-canvas {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  touch-action: none;
}

#death-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 20;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#death-overlay h2 {
  font-size: 56px;
  color: #ff1744;
  margin-bottom: 16px;
}

#death-overlay p {
  font-size: 18px;
  color: #ccc;
  margin-bottom: 24px;
}

#death-overlay .death-stats {
  font-size: 16px;
  color: #aaa;
  margin-bottom: 24px;
}

#death-catchphrase {
  font-size: 20px;
  font-style: italic;
  color: #ffcc80;
  margin-bottom: 24px;
  text-shadow: 0 0 10px rgba(255, 204, 128, 0.4);
}

#death-overlay button {
  padding: 12px 32px;
  font-size: 18px;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  background: #00e5ff;
  color: #0e0e1a;
  cursor: pointer;
  letter-spacing: 1px;
}

/* Decal picker */
.decal-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 260px;
  justify-content: center;
}

.decal-option {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid #3a3a5a;
  background: #12122a;
  color: #aaa;
  transition: border-color 0.15s, transform 0.15s, color 0.15s;
}

.decal-option:hover {
  transform: scale(1.1);
  color: #fff;
}

.decal-option.selected {
  border-color: #00e5ff;
  color: #00e5ff;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
}

/* Bullet shape picker */
.bullet-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 260px;
  justify-content: center;
}

.bullet-option {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid #3a3a5a;
  background: #12122a;
  transition: border-color 0.15s, transform 0.15s;
}

.bullet-option:hover {
  transform: scale(1.1);
}

.bullet-option.selected {
  border-color: #00e5ff;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
}

.bullet-option canvas {
  display: block;
}

/* Randomize button */
#randomize-btn {
  width: 240px;
  padding: 10px;
  font-size: 15px;
  font-weight: bold;
  border: 2px solid #00e5ff;
  border-radius: 6px;
  background: transparent;
  color: #00e5ff;
  cursor: pointer;
  letter-spacing: 1px;
  transition: background 0.2s, color 0.2s;
  margin-top: 4px;
}

#randomize-btn:hover {
  background: #00e5ff;
  color: #0e0e1a;
}

/* Tank preview canvas */
#tank-preview {
  width: 280px;
  height: 160px;
  border-radius: 8px;
  border: 1px solid #2a2a4a;
  background: #0a0a18;
}

/* Customize toggle */
#customize-toggle {
  width: 240px;
  padding: 8px 0;
  font-size: 14px;
  font-weight: bold;
  color: #888;
  cursor: pointer;
  text-align: left;
  transition: color 0.15s;
  user-select: none;
}

#customize-toggle:hover {
  color: #00e5ff;
}

/* Collapsible customize section */
#customize-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 260px;
  max-height: 600px;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.25s ease;
  opacity: 1;
}

#customize-section.collapsed {
  max-height: 0;
  opacity: 0;
}

/* Decal option canvas */
.decal-option canvas {
  display: block;
}

/* Mobile-specific body styles */
body.mobile {
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body.mobile .color-swatch,
body.mobile .decal-option,
body.mobile .bullet-option,
body.mobile button {
  touch-action: manipulation;
}

/* Responsive: phones */
@media (max-width: 600px) {
  .barrage-letter {
    font-size: 40px;
    letter-spacing: 2px;
  }

  #join-screen .subtitle {
    font-size: 12px;
    margin-bottom: 20px;
  }

  .join-form {
    padding: 16px 20px;
    width: calc(100% - 32px);
    max-width: 320px;
  }

  .join-form input[type="text"] {
    width: 100%;
  }

  .color-swatches,
  .decal-options,
  .bullet-options {
    width: 100%;
    max-width: 260px;
  }

  .color-swatch {
    width: 28px;
    height: 28px;
  }

  .decal-option {
    width: 36px;
    height: 36px;
  }

  .bullet-option {
    width: 38px;
    height: 38px;
  }

  #play-btn,
  #randomize-btn,
  #customize-toggle {
    width: 100%;
  }

  #tank-preview {
    width: 100%;
    max-width: 280px;
    height: auto;
    aspect-ratio: 280 / 160;
  }

  #customize-section {
    width: 100%;
    max-width: 260px;
  }

  #death-overlay h2 {
    font-size: 36px;
  }

  #death-overlay p {
    font-size: 15px;
    padding: 0 20px;
  }

  #death-overlay .death-stats {
    font-size: 14px;
  }

  #death-catchphrase {
    font-size: 16px;
    padding: 0 20px;
  }

  #death-overlay button {
    padding: 14px 40px;
    font-size: 16px;
  }
}
