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

:root {
  --primary-color: #00ffff;
  --secondary-color: #ff00ff;
  --accent-color: #ffff00;
  --bg-color: #0a0a1a;
  --bg-secondary: #141428;
  --text-color: #ffffff;
  --text-muted: #8888aa;
  --success-color: #39ff14;
  --danger-color: #ff3366;
  --panel-bg: rgba(20, 20, 40, 0.85);
  --border-glow: 0 0 10px var(--primary-color);
}

body {
  font-family: 'Rajdhani', sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Screens */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  justify-content: center;
  align-items: center;
}

.screen.active {
  display: flex;
}

/* Menu Screen */
#menu {
  background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3a 50%, #0a0a1a 100%);
  background-size: 400% 400%;
  animation: gradientBg 15s ease infinite;
}

@keyframes gradientBg {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.menu-container {
  text-align: center;
  padding: 40px;
  max-width: 500px;
  width: 90%;
}

.game-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 3rem;
  font-weight: 900;
  margin-bottom: 10px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
  animation: titleGlow 2s ease-in-out infinite alternate;
}

@keyframes titleGlow {
  from { filter: drop-shadow(0 0 10px var(--primary-color)); }
  to { filter: drop-shadow(0 0 30px var(--secondary-color)); }
}

.title-icon {
  display: inline-block;
  animation: bounce 1s ease-in-out infinite;
}

.title-icon:last-child {
  animation-delay: 0.5s;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 30px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.menu-section {
  margin-bottom: 25px;
  text-align: left;
}

.menu-section label {
  display: block;
  font-size: 0.9rem;
  color: var(--primary-color);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

input[type="text"] {
  width: 100%;
  padding: 15px 20px;
  font-size: 1.1rem;
  font-family: 'Rajdhani', sans-serif;
  background: var(--bg-secondary);
  border: 2px solid var(--primary-color);
  border-radius: 10px;
  color: var(--text-color);
  outline: none;
  transition: all 0.3s ease;
}

input[type="text"]:focus {
  box-shadow: var(--border-glow), inset 0 0 20px rgba(0, 255, 255, 0.1);
}

input[type="text"]::placeholder {
  color: var(--text-muted);
}

/* Skin Selector */
.skin-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 10px;
}

.skin-option {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.3s ease;
  position: relative;
}

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

.skin-option.selected {
  border-color: var(--accent-color);
  box-shadow: 0 0 20px currentColor;
}

.skin-option::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  background: currentColor;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 15px currentColor;
}

/* Buttons */
.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 30px;
}

.btn {
  padding: 15px 30px;
  font-size: 1.1rem;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.btn-icon {
  font-size: 1.3rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), #0088aa);
  color: var(--bg-color);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.6);
}

.btn-secondary {
  background: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
  background: rgba(0, 255, 255, 0.1);
  box-shadow: var(--border-glow);
}

.btn-accent {
  background: linear-gradient(135deg, var(--secondary-color), #aa0088);
  color: var(--text-color);
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.4);
}

.btn-accent:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 30px rgba(255, 0, 255, 0.6);
}

.btn-small {
  padding: 5px 10px;
  font-size: 0.9rem;
  background: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-small:hover {
  background: rgba(0, 255, 255, 0.2);
}

/* Join Form */
.join-form {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.join-form input {
  flex: 1;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 5px;
  font-size: 1.3rem;
}

.hidden {
  display: none !important;
}

.menu-footer {
  margin-top: 30px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Game Screen */
#game-screen {
  background: var(--bg-color);
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
}

/* HUD */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hud-panel {
  position: absolute;
  background: var(--panel-bg);
  border: 1px solid rgba(0, 255, 255, 0.3);
  border-radius: 10px;
  padding: 15px;
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.top-left {
  top: 20px;
  left: 20px;
}

.top-center {
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.top-right {
  top: 20px;
  right: 20px;
}

.bottom-left {
  bottom: 20px;
  left: 20px;
}

.bottom-center {
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
}

.bottom-right {
  bottom: 20px;
  right: 20px;
}

/* Room Info */
#room-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

#room-info .label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

#room-info .value {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  color: var(--primary-color);
  letter-spacing: 3px;
}

/* Score Display */
#score-display {
  min-width: 120px;
}

#player-score {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--accent-color);
  text-shadow: 0 0 20px var(--accent-color);
}

#score-display .label {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* Leaderboard */
#leaderboard {
  min-width: 200px;
  max-height: 300px;
}

#leaderboard h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  margin-bottom: 10px;
  color: var(--accent-color);
}

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

#leaderboard-list li {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
}

#leaderboard-list li:last-child {
  border-bottom: none;
}

#leaderboard-list li.you {
  color: var(--primary-color);
  font-weight: 700;
}

#leaderboard-list li.dead {
  color: var(--text-muted);
  opacity: 0.6;
}

.leader-rank {
  color: var(--accent-color);
  font-weight: 700;
  margin-right: 8px;
}

.leader-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-score {
  font-family: 'Orbitron', sans-serif;
  color: var(--success-color);
}

/* Mini Map */
#minimap-container {
  padding: 10px;
}

#minimap {
  width: 150px;
  height: 150px;
  border: 2px solid var(--primary-color);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.5);
}

/* Chat */
#chat-container {
  width: 300px;
  max-height: 200px;
  display: flex;
  flex-direction: column;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  font-size: 0.85rem;
  max-height: 140px;
}

#chat-messages::-webkit-scrollbar {
  width: 5px;
}

#chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 5px;
}

.chat-message {
  margin-bottom: 5px;
  word-wrap: break-word;
}

.chat-message .sender {
  font-weight: 700;
  color: var(--primary-color);
}

.chat-message .text {
  color: var(--text-color);
}

.chat-message.system {
  color: var(--accent-color);
  font-style: italic;
}

#chat-input-container {
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#chat-input {
  width: 100%;
  padding: 8px;
  font-size: 0.9rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--primary-color);
  border-radius: 5px;
}

/* Controls Info */
#controls-info {
  display: flex;
  gap: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Death Screen */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.overlay-content {
  text-align: center;
  padding: 40px;
  background: var(--panel-bg);
  border: 2px solid var(--danger-color);
  border-radius: 20px;
  box-shadow: 0 0 50px rgba(255, 51, 102, 0.3);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.overlay-content h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.5rem;
  color: var(--danger-color);
  margin-bottom: 15px;
}

.overlay-content p {
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: var(--text-muted);
}

#final-score {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  color: var(--accent-color);
}

.overlay-content .btn {
  margin: 10px;
}

/* Loading Screen */
#loading-screen {
  background: var(--bg-color);
}

.loading-content {
  text-align: center;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--bg-secondary);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-content p {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2rem;
  color: var(--primary-color);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.modal-content {
  background: var(--panel-bg);
  border: 2px solid var(--danger-color);
  border-radius: 15px;
  padding: 30px;
  text-align: center;
  max-width: 400px;
}

.modal-content h3 {
  font-family: 'Orbitron', sans-serif;
  color: var(--danger-color);
  margin-bottom: 15px;
}

.modal-content p {
  margin-bottom: 20px;
  color: var(--text-color);
}

/* Responsive */
@media (max-width: 768px) {
  .game-title {
    font-size: 2rem;
  }
  
  .menu-container {
    padding: 20px;
  }
  
  #leaderboard {
    display: none;
  }
  
  #chat-container {
    width: 200px;
    max-height: 150px;
  }
  
  #minimap-container {
    bottom: 170px;
  }
  
  #controls-info {
    display: none;
  }
}
