* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  overflow: hidden;
  background: #111;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  cursor: crosshair;
}

#gameCanvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 100;
  animation: fadeIn 0.3s ease;
}

.overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.overlay-content {
  text-align: center;
  color: #fff;
}

.game-title {
  font-size: 72px;
  font-weight: 900;
  letter-spacing: 12px;
  color: #4f4;
  text-shadow: 0 0 30px rgba(68, 255, 68, 0.5), 0 0 60px rgba(68, 255, 68, 0.3);
  margin-bottom: 8px;
}

.subtitle {
  font-size: 18px;
  color: #888;
  margin-bottom: 40px;
  letter-spacing: 4px;
}

#nameInput {
  display: block;
  width: 280px;
  margin: 0 auto 20px;
  padding: 14px 20px;
  font-size: 18px;
  border: 2px solid #333;
  border-radius: 8px;
  background: #1a1a1a;
  color: #fff;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

#nameInput:focus {
  border-color: #4f4;
}

#nameInput::placeholder {
  color: #555;
}

.color-picker {
  margin: 0 auto 20px;
  width: 280px;
}

.color-label {
  font-size: 13px;
  color: #777;
  margin-bottom: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.color-options {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
}

.color-swatch:hover {
  transform: scale(1.2);
}

.color-swatch.selected {
  border-color: #fff;
  transform: scale(1.2);
}

.btn-play {
  display: block;
  width: 280px;
  margin: 0 auto;
  padding: 16px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #111;
  background: #4f4;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-play:hover {
  transform: scale(1.03);
  box-shadow: 0 0 20px rgba(68, 255, 68, 0.4);
}

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

.controls-info {
  margin-top: 30px;
  color: #666;
  font-size: 14px;
}

/* Death screen */
.death-title {
  font-size: 48px;
  color: #f44;
  text-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
  margin-bottom: 16px;
}

.death-score, .death-length {
  font-size: 20px;
  color: #ccc;
  margin-bottom: 8px;
}

.death-length {
  margin-bottom: 30px;
}

/* HUD */
#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 50;
  color: #fff;
  font-size: 14px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

#hud.hidden {
  display: none;
}

.hud-item {
  margin-bottom: 4px;
}

/* Leaderboard */
#leaderboard {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 50;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 8px;
  padding: 12px 16px;
  color: #fff;
  min-width: 180px;
  backdrop-filter: blur(4px);
}

#leaderboard.hidden {
  display: none;
}

#leaderboard h3 {
  font-size: 14px;
  color: #4f4;
  margin-bottom: 8px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

#leaderboardList {
  list-style: none;
  padding: 0;
  font-size: 13px;
}

#leaderboardList li {
  padding: 3px 0;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

#leaderboardList li .lb-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#leaderboardList li .lb-score {
  color: #4f4;
  margin-left: 12px;
}

#leaderboardList li.self {
  color: #4f4;
  font-weight: 700;
}

/* Minimap */
#minimap {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 50;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  background: rgba(0,0,0,0.5);
}

#minimap.hidden {
  display: none;
}
