/* LunaSea - Deep Ocean Combat */
/* Dark underwater theme with blue-green accents */

:root {
  --deep-ocean: #001520;
  --mid-ocean: #002535;
  --light-ocean: #003850;
  --accent-blue: #00aaff;
  --accent-cyan: #00ddcc;
  --danger-red: #ff4444;
  --warning-orange: #ff8844;
  --text-light: #aaccdd;
  --text-bright: #eeffff;
  --font-main: 'Orbitron', 'Courier New', monospace;
}

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

body {
  font-family: var(--font-main);
  background: var(--deep-ocean);
  color: var(--text-light);
  overflow: hidden;
  cursor: none;
}

#game-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

/* Crosshair - Sonar targeting with trajectory prediction */
#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  pointer-events: none;
  z-index: 100;
  transition: transform 0.1s ease-out;
}

#crosshair.locked {
  animation: crosshairLock 0.3s ease-out;
}

@keyframes crosshairLock {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.3); }
}

#crosshair::before,
#crosshair::after {
  content: '';
  position: absolute;
  background: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
}

#crosshair::before {
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  transform: translateY(-50%);
}

#crosshair::after {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  transform: translateX(-50%);
}

#crosshair::before {
  background: linear-gradient(90deg, 
    transparent 0%, 
    transparent 35%, 
    var(--accent-cyan) 35%, 
    var(--accent-cyan) 45%,
    transparent 45%,
    transparent 55%,
    var(--accent-cyan) 55%,
    var(--accent-cyan) 65%,
    transparent 65%,
    transparent 100%
  );
}

#crosshair::after {
  background: linear-gradient(180deg, 
    transparent 0%, 
    transparent 35%, 
    var(--accent-cyan) 35%, 
    var(--accent-cyan) 45%,
    transparent 45%,
    transparent 55%,
    var(--accent-cyan) 55%,
    var(--accent-cyan) 65%,
    transparent 65%,
    transparent 100%
  );
}

/* HUD */
#game-ui {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  transition: opacity 0.3s;
}

#game-ui.hidden {
  opacity: 0;
}

/* Health Bar */
#health-bar {
  position: fixed;
  bottom: 30px;
  left: 30px;
  width: 200px;
  height: 8px;
  background: rgba(0, 30, 50, 0.8);
  border: 1px solid var(--accent-blue);
  border-radius: 2px;
  overflow: hidden;
}

#health-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
  transition: width 0.3s, background 0.3s;
  box-shadow: 0 0 10px var(--accent-cyan);
}

#health-fill.low {
  background: linear-gradient(90deg, var(--danger-red), var(--warning-orange));
  animation: pulse-danger 0.5s infinite;
}

@keyframes pulse-danger {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Ammo/Torpedo Bar */
#ammo-bar {
  position: fixed;
  bottom: 50px;
  left: 30px;
  width: 200px;
  height: 6px;
  background: rgba(0, 30, 50, 0.8);
  border: 1px solid var(--accent-blue);
  border-radius: 2px;
  overflow: hidden;
}

#ammo-fill {
  height: 100%;
  width: 100%;
  background: var(--accent-blue);
  transition: width 0.2s;
}

#ammo-text {
  position: absolute;
  top: -18px;
  left: 0;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--accent-blue);
}

/* Depth Display */
#depth-display {
  position: fixed;
  top: 30px;
  left: 30px;
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--accent-cyan);
  text-shadow: 0 0 10px var(--accent-cyan);
}

#depth {
  font-weight: 700;
  font-size: 24px;
}

/* Score Display */
#score-display {
  position: fixed;
  top: 30px;
  right: 30px;
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--accent-blue);
}

#score {
  font-weight: 700;
  font-size: 24px;
}

/* Notifications */
#notifications {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.notification {
  background: rgba(0, 50, 80, 0.9);
  border: 1px solid var(--accent-cyan);
  padding: 10px 24px;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text-bright);
  animation: notification-in 0.3s ease-out, notification-out 0.5s ease-in 2.5s forwards;
  text-shadow: 0 0 10px var(--accent-cyan);
}

@keyframes notification-in {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes notification-out {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* Leaderboard / Contacts */
#leaderboard {
  position: fixed;
  top: 80px;
  right: 30px;
  background: rgba(0, 20, 40, 0.85);
  border: 1px solid var(--accent-blue);
  padding: 15px 20px;
  min-width: 180px;
  z-index: 50;
  backdrop-filter: blur(5px);
}

#leaderboard.hidden {
  display: none;
}

#leaderboard h3 {
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--accent-blue);
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(0, 170, 255, 0.3);
  padding-bottom: 8px;
}

.leaderboard-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 11px;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(0, 100, 150, 0.2);
}

.leaderboard-entry:last-child {
  border-bottom: none;
}

.leaderboard-entry.self {
  color: var(--accent-cyan);
  text-shadow: 0 0 5px var(--accent-cyan);
}

.leaderboard-rank {
  color: var(--accent-blue);
  font-weight: 700;
  min-width: 25px;
}

.leaderboard-name {
  flex: 1;
  margin: 0 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-score {
  color: var(--accent-cyan);
  font-weight: 700;
}

/* Controls Hint */
#controls-hint {
  position: fixed;
  bottom: 100px;
  left: 30px;
  font-size: 10px;
  letter-spacing: 1px;
  line-height: 2;
  color: rgba(170, 200, 220, 0.5);
  z-index: 50;
}

#controls-hint.hidden {
  display: none;
}

kbd {
  display: inline-block;
  background: rgba(0, 50, 80, 0.6);
  border: 1px solid rgba(0, 170, 255, 0.3);
  padding: 2px 6px;
  margin: 0 2px;
  font-family: var(--font-main);
  font-size: 9px;
  color: var(--accent-cyan);
}

/* Loading Screen */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(180deg, var(--deep-ocean) 0%, var(--mid-ocean) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: default;
}

#loading-screen h1 {
  font-size: 64px;
  font-weight: 400;
  letter-spacing: 20px;
  color: var(--accent-cyan);
  text-shadow: 0 0 30px var(--accent-cyan), 0 0 60px rgba(0, 220, 200, 0.3);
  margin-bottom: 50px;
  animation: sonar-pulse 2s infinite;
}

@keyframes sonar-pulse {
  0%, 100% { text-shadow: 0 0 30px var(--accent-cyan), 0 0 60px rgba(0, 220, 200, 0.3); }
  50% { text-shadow: 0 0 50px var(--accent-cyan), 0 0 100px rgba(0, 220, 200, 0.5); }
}

.loading-bar {
  width: 300px;
  height: 4px;
  background: rgba(0, 50, 80, 0.5);
  border: 1px solid var(--accent-blue);
  overflow: hidden;
}

#loadingProgress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
  transition: width 0.3s;
  box-shadow: 0 0 20px var(--accent-cyan);
}

#loadingStatus {
  margin-top: 20px;
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--accent-blue);
}

/* Join Screen */
#join-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(180deg, var(--deep-ocean) 0%, var(--mid-ocean) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  cursor: default;
}

#join-screen.hidden {
  display: none;
}

.join-card {
  background: rgba(0, 30, 50, 0.9);
  border: 1px solid var(--accent-blue);
  padding: 50px 60px;
  text-align: center;
  backdrop-filter: blur(10px);
}

.join-card h2 {
  font-size: 36px;
  font-weight: 400;
  letter-spacing: 15px;
  color: var(--accent-cyan);
  margin-bottom: 10px;
  text-shadow: 0 0 20px var(--accent-cyan);
}

.join-card p {
  font-size: 11px;
  letter-spacing: 5px;
  color: var(--accent-blue);
  margin-bottom: 40px;
}

.form-group {
  margin-bottom: 25px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--accent-blue);
  margin-bottom: 8px;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 12px 15px;
  background: rgba(0, 20, 40, 0.8);
  border: 1px solid var(--accent-blue);
  color: var(--text-bright);
  font-family: var(--font-main);
  font-size: 14px;
  letter-spacing: 2px;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input[type="text"]:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 220, 200, 0.3);
}

.form-group input[type="text"]::placeholder {
  color: rgba(170, 200, 220, 0.3);
}

.form-group input[type="color"] {
  width: 50px;
  height: 35px;
  border: 1px solid var(--accent-blue);
  background: var(--deep-ocean);
  cursor: pointer;
  padding: 2px;
}

#join-game-button {
  width: 100%;
  padding: 15px;
  background: transparent;
  border: 2px solid var(--accent-cyan);
  color: var(--accent-cyan);
  font-family: var(--font-main);
  font-size: 14px;
  letter-spacing: 5px;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
}

#join-game-button:hover {
  background: var(--accent-cyan);
  color: var(--deep-ocean);
  box-shadow: 0 0 30px rgba(0, 220, 200, 0.5);
}

/* Death Screen */
#death-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 10, 20, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  cursor: default;
}

#death-screen.hidden {
  display: none;
}

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

.death-content h2 {
  font-size: 42px;
  font-weight: 400;
  letter-spacing: 15px;
  color: var(--danger-red);
  margin-bottom: 30px;
  text-shadow: 0 0 30px var(--danger-red);
}

.respawn-timer {
  font-size: 72px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 20px;
  animation: countdown-pulse 1s infinite;
}

@keyframes countdown-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

#killed-by {
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--text-light);
}

/* Mobile Controls */
#mobile-controls {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  z-index: 80;
  pointer-events: none;
}

#move-joystick {
  position: absolute;
  bottom: 30px;
  left: 30px;
  width: 100px;
  height: 100px;
  background: rgba(0, 50, 80, 0.5);
  border: 2px solid var(--accent-blue);
  border-radius: 50%;
  pointer-events: auto;
}

#fire-button {
  position: absolute;
  bottom: 40px;
  right: 30px;
  width: 80px;
  height: 80px;
  background: rgba(255, 100, 50, 0.3);
  border: 2px solid var(--warning-orange);
  border-radius: 50%;
  color: var(--warning-orange);
  font-family: var(--font-main);
  font-size: 10px;
  letter-spacing: 2px;
  pointer-events: auto;
  cursor: pointer;
}

/* Trajectory Indicator */
#trajectory-indicator {
  position: fixed;
  pointer-events: none;
  z-index: 99;
}

.trajectory-dot {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-cyan);
  opacity: 0.6;
  animation: trajectoryPulse 1s ease-in-out infinite;
}

@keyframes trajectoryPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}

/* Off-Screen Enemy Indicators */
.enemy-indicator {
  position: fixed;
  pointer-events: none;
  z-index: 90;
  animation: enemyIndicatorPulse 1.5s ease-in-out infinite;
}

.enemy-indicator svg {
  filter: drop-shadow(0 0 6px currentColor);
}

.enemy-indicator.close {
  color: var(--warning-orange);
  animation: enemyIndicatorUrgent 0.5s ease-in-out infinite;
}

.enemy-indicator.medium {
  color: var(--accent-yellow);
}

.enemy-indicator.far {
  color: var(--accent-cyan);
}

@keyframes enemyIndicatorPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

@keyframes enemyIndicatorUrgent {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Range Finder */
#range-finder {
  position: fixed;
  top: 50%;
  right: 40px;
  transform: translateY(-50%);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 14px;
  text-shadow: 0 0 10px var(--accent-cyan);
  pointer-events: none;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s;
}

#range-finder.active {
  opacity: 1;
}

#range-finder .range-value {
  font-size: 24px;
  letter-spacing: 2px;
  margin-bottom: 5px;
}

#range-finder .range-label {
  font-size: 10px;
  letter-spacing: 3px;
  opacity: 0.7;
}

/* Depth Gauge Enhancement */
#depth-gauge {
  position: fixed;
  top: 40px;
  right: 40px;
  width: 80px;
  height: 200px;
  background: rgba(0, 20, 40, 0.8);
  border: 2px solid var(--accent-cyan);
  border-radius: 4px;
  pointer-events: none;
  z-index: 100;
  padding: 10px 5px;
  box-shadow: 0 0 20px rgba(0, 200, 255, 0.3);
}

#depth-gauge-fill {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  background: linear-gradient(180deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
  border-radius: 2px;
  transition: height 0.2s ease-out;
  box-shadow: 0 0 15px var(--accent-cyan);
}

#depth-gauge-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-light);
  font-family: var(--font-mono);
  font-size: 20px;
  text-shadow: 0 0 10px var(--accent-cyan);
  z-index: 1;
}

#depth-gauge-label {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2px;
  z-index: 1;
}

/* Speed Indicator */
#speed-indicator {
  position: fixed;
  top: 40px;
  left: 40px;
  background: rgba(0, 20, 40, 0.8);
  border: 2px solid var(--accent-cyan);
  border-radius: 4px;
  padding: 15px 25px;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 0 20px rgba(0, 200, 255, 0.3);
}

#speed-value {
  color: var(--text-light);
  font-family: var(--font-mono);
  font-size: 28px;
  text-shadow: 0 0 10px var(--accent-cyan);
  letter-spacing: 3px;
}

#speed-label {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 3px;
  margin-top: 5px;
  text-align: center;
}

/* Animations */
.fade-in {
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
  #loading-screen h1 {
    font-size: 36px;
    letter-spacing: 10px;
  }
  
  .join-card {
    padding: 30px 40px;
    margin: 20px;
  }
  
  .join-card h2 {
    font-size: 24px;
    letter-spacing: 8px;
  }
  
  #health-bar, #ammo-bar {
    width: 120px;
  }
  
  #mobile-controls {
    display: block;
  }
  
  #controls-hint {
    display: none !important;
  }
  
  #crosshair {
    display: none;
  }
}

/* Utility */
.hidden {
  display: none !important;
}
