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

body {
  overflow: hidden;
  background: #0a0a2e;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #fff;
  cursor: default;
}

#gameCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  background: rgba(0, 0, 0, 0.7);
}

.menu-container, .death-container {
  text-align: center;
  padding: 40px;
  border-radius: 16px;
  background: rgba(10, 10, 46, 0.95);
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 60px rgba(76, 175, 80, 0.3);
  max-width: 500px;
  width: 90%;
}

.game-title {
  font-size: 58px;
  font-weight: 900;
  letter-spacing: 4px;
  background: linear-gradient(135deg, #4CAF50, #8BC34A, #CDDC39);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 30px;
  text-shadow: none;
}

.title-dot {
  font-size: 36px;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #8BC34A, #CDDC39, #FFC107);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#nameInput {
  width: 100%;
  padding: 14px 20px;
  font-size: 18px;
  border: 2px solid rgba(76, 175, 80, 0.5);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  outline: none;
  margin-bottom: 20px;
  transition: border-color 0.3s;
}

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

#nameInput::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.skin-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.skin-option {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.2s, border-color 0.2s;
}

.skin-option:hover {
  transform: scale(1.15);
}

.skin-option.selected {
  border-color: #fff;
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
}

.play-btn {
  width: 100%;
  padding: 16px;
  font-size: 22px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: #fff;
  cursor: pointer;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: transform 0.2s, box-shadow 0.2s;
}

.play-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.play-btn:active {
  transform: translateY(0);
}

.player-count {
  margin-top: 16px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
}

.language-selector {
  margin-top: 20px;
}

.language-selector select {
  padding: 8px 16px;
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  outline: none;
}

.language-selector select option {
  background: #1a1a4e;
  color: #fff;
}

/* Death screen */
.death-container h2 {
  font-size: 36px;
  color: #F44336;
  margin-bottom: 16px;
}

.death-container p {
  font-size: 16px;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.7);
}

.final-score, .final-length {
  font-size: 20px !important;
  color: #fff !important;
}

.death-container .play-btn {
  margin-top: 20px;
}

/* HUD */
#hud {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 50;
}

.hud-item {
  font-size: 16px;
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 6px;
  margin-bottom: 6px;
  backdrop-filter: blur(4px);
}

/* Leaderboard */
#leaderboardPanel {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 220px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 10px;
  padding: 14px;
  z-index: 50;
  backdrop-filter: blur(4px);
}

#leaderboardPanel h3 {
  font-size: 16px;
  margin-bottom: 10px;
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 2px;
}

#leaderboardList {
  list-style: none;
  padding: 0;
}

#leaderboardList li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#leaderboardList li .lb-rank {
  width: 22px;
  color: rgba(255, 255, 255, 0.4);
}

#leaderboardList li .lb-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0 8px;
}

#leaderboardList li .lb-score {
  color: #8BC34A;
  font-weight: 600;
}

#leaderboardList li.self {
  color: #FFD700;
}

#leaderboardList li.self .lb-score {
  color: #FFD700;
}

/* Minimap */
#minimapCanvas {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.4);
  z-index: 50;
}

/* Connection status */
#connectionStatus {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 20px 40px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 10px;
  font-size: 18px;
  z-index: 200;
}

/* Mobile boost button */
#boostButton {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  padding: 20px 60px;
  background: rgba(244, 67, 54, 0.6);
  border-radius: 30px;
  font-size: 18px;
  font-weight: 700;
  z-index: 50;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* Mode selector */
.mode-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.mode-selector .mode-btn {
  flex: 1;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s;
}

.mode-selector .mode-btn:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.mode-selector .mode-btn.selected {
  border-color: #4CAF50;
  background: rgba(76, 175, 80, 0.2);
  color: #fff;
  box-shadow: 0 0 12px rgba(76, 175, 80, 0.3);
}

/* BR HUD */
#brHud {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  text-align: center;
}

.br-timer {
  font-size: 32px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 80, 20, 0.5);
  background: rgba(0, 0, 0, 0.6);
  padding: 6px 24px;
  border-radius: 10px;
  border: 2px solid rgba(255, 80, 20, 0.4);
  backdrop-filter: blur(4px);
}

.br-alive {
  margin-top: 6px;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 16px;
  border-radius: 6px;
}

/* Winner overlay */
.winner-container {
  text-align: center;
  padding: 50px;
  border-radius: 16px;
  background: rgba(10, 10, 46, 0.95);
  border: 2px solid rgba(255, 215, 0, 0.5);
  box-shadow: 0 0 80px rgba(255, 215, 0, 0.3);
  max-width: 500px;
  width: 90%;
}

.winner-title {
  font-size: 48px;
  font-weight: 900;
  background: linear-gradient(135deg, #FFD700, #FFA500, #FF6347);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
  animation: winnerPulse 1.5s ease-in-out infinite;
}

@keyframes winnerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.winner-name {
  font-size: 28px;
  color: #FFD700;
  margin-bottom: 30px;
  font-weight: 700;
}

/* Secondary button */
.btn-secondary {
  background: linear-gradient(135deg, #607D8B, #546E7A) !important;
  margin-top: 10px !important;
}

.btn-secondary:hover {
  box-shadow: 0 6px 20px rgba(96, 125, 139, 0.4) !important;
}

/* Responsive */
@media (max-width: 600px) {
  .game-title {
    font-size: 40px;
    letter-spacing: 4px;
  }

  .menu-container, .death-container {
    padding: 24px;
  }

  #leaderboardPanel {
    width: 160px;
    padding: 10px;
    top: 10px;
    right: 10px;
  }

  #minimapCanvas {
    width: 120px;
    height: 120px;
  }
}
