@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;900&family=Press+Start+2P&display=swap');

:root {
  --neon-cyan: #00e5ff;
  --neon-pink: #ff007f;
  --neon-yellow: #ffd700;
  --neon-green: #39ff14;
  --neon-purple: #b026ff;
  --dark-bg: #060913;
  --panel-bg: rgba(10, 16, 29, 0.85);
  --border-glow: 0 0 10px rgba(0, 229, 255, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--dark-bg);
  font-family: 'Orbitron', 'Segoe UI', sans-serif;
  color: #ffffff;
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* UI Overlay Layer */
.ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.interactive {
  pointer-events: auto;
}

/* Glassmorphism panel base */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 229, 255, 0.35);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), var(--border-glow);
}

/* --- TOP HUD BAR --- */
#hud-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  gap: 16px;
}

.hud-title-card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hud-title-card h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.15rem;
  letter-spacing: 1px;
  color: var(--neon-yellow);
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.8), 2px 2px #000;
}

.status-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
}

.status-online {
  background: rgba(57, 255, 20, 0.2);
  color: var(--neon-green);
  border: 1px solid var(--neon-green);
}

.status-offline {
  background: rgba(255, 0, 127, 0.2);
  color: var(--neon-pink);
  border: 1px solid var(--neon-pink);
}

/* Round & Timer display */
.round-timer-box {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 20px;
}

.round-info {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.8rem;
  color: var(--neon-cyan);
}

.timer-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timer-label {
  font-size: 0.75rem;
  color: #8899aa;
}

.timer-val {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.3rem;
  color: var(--neon-yellow);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.8);
}

.timer-warning {
  color: var(--neon-pink) !important;
  animation: pulse-danger 0.5s infinite alternate;
}

@keyframes pulse-danger {
  from { transform: scale(1.0); text-shadow: 0 0 5px red; }
  to { transform: scale(1.15); text-shadow: 0 0 15px #ff007f; }
}

/* Wind Gauge */
.wind-gauge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
}

.wind-compass {
  width: 32px;
  height: 32px;
  border: 2px dashed rgba(0, 229, 255, 0.6);
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wind-arrow {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 16px solid var(--neon-cyan);
  transition: transform 0.6s ease;
  filter: drop-shadow(0 0 4px var(--neon-cyan));
}

.wind-details {
  display: flex;
  flex-direction: column;
}

.wind-label {
  font-size: 0.65rem;
  color: #8899aa;
  letter-spacing: 1px;
}

.wind-speed {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.85rem;
  color: var(--neon-cyan);
}

/* Top Right Audio/Camera Controls */
.top-controls {
  display: flex;
  gap: 10px;
}

.action-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--neon-cyan);
  color: #ffffff;
  padding: 8px 14px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: var(--neon-cyan);
  color: #000;
  box-shadow: 0 0 12px var(--neon-cyan);
  transform: translateY(-2px);
}

.action-btn.active {
  background: var(--neon-pink);
  border-color: var(--neon-pink);
  color: #fff;
  box-shadow: 0 0 12px var(--neon-pink);
}

/* --- TARGET OPPONENT HUD (CENTER-TOP) --- */
#target-hud {
  align-self: center;
  margin-top: -8px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 24px;
  border: 1px solid rgba(255, 0, 127, 0.4);
  box-shadow: 0 0 14px rgba(255, 0, 127, 0.3);
}

.target-badge {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.65rem;
  color: var(--neon-pink);
  letter-spacing: 1px;
}

.target-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.target-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.85rem;
  color: #ffffff;
}

.target-hp-bar-bg {
  width: 140px;
  height: 12px;
  background: #1a1a24;
  border: 1px solid #333;
  border-radius: 6px;
  overflow: hidden;
}

.target-hp-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ff0055, #39ff14);
  transition: width 0.3s ease;
}

.target-distance {
  font-size: 0.75rem;
  color: #99aabb;
}

/* --- ROUND BANNER OVERLAY --- */
#round-banner {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0;
  font-family: 'Press Start 2P', monospace;
  font-size: 1.8rem;
  color: var(--neon-yellow);
  text-align: center;
  padding: 24px 44px;
  background: rgba(10, 15, 28, 0.94);
  border: 2px solid var(--neon-yellow);
  border-radius: 16px;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
  pointer-events: none;
  z-index: 100;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.banner-show {
  transform: translate(-50%, -50%) scale(1.0) !important;
  opacity: 1 !important;
}

/* --- BOTTOM HUD (AIM & LAUNCH CONTROLS) --- */
#hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 16px 24px;
  gap: 20px;
}

.cam-switch-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
}

.cam-btn-row {
  display: flex;
  gap: 8px;
}

.cam-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(0, 229, 255, 0.4);
  color: #ccc;
  padding: 6px 12px;
  font-size: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}

.cam-btn.active {
  background: var(--neon-cyan);
  color: #000;
  font-weight: 700;
  box-shadow: 0 0 8px var(--neon-cyan);
}

/* Aim Control Center */
.aim-center-deck {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
}

.control-slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 140px;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
}

.val-readout {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.75rem;
  color: var(--neon-cyan);
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #1a2538;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
  cursor: pointer;
  transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

/* Lock In Ready Button */
.launch-btn-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

#ready-btn {
  background: linear-gradient(135deg, #00e5ff, #0099ff);
  color: #000;
  border: none;
  padding: 14px 28px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.6);
  transition: all 0.2s ease;
}

#ready-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.9);
}

.ready-active {
  background: linear-gradient(135deg, #39ff14, #00cc66) !important;
  color: #000 !important;
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.8) !important;
}

/* Emote & Chat Buttons */
.emotes-group {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
}

.emote-btn {
  background: rgba(20, 28, 48, 0.8);
  border: 1px solid rgba(255, 215, 0, 0.4);
  font-size: 1.1rem;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s;
}

.emote-btn:hover {
  transform: scale(1.2);
  border-color: var(--neon-yellow);
}

/* --- SIDE LEADERBOARD --- */
#side-leaderboard {
  position: absolute;
  right: 24px;
  top: 100px;
  width: 280px;
  padding: 14px 18px;
  max-height: 400px;
  overflow-y: auto;
}

#side-leaderboard h3 {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.75rem;
  color: var(--neon-yellow);
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.leaderboard-table th {
  text-align: left;
  color: #8899aa;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-table td {
  padding: 6px 0;
}

.my-row {
  background: rgba(0, 229, 255, 0.15);
  font-weight: 700;
}

.bot-tag {
  font-size: 0.6rem;
  background: #2a3a52;
  color: #aaccff;
  padding: 2px 4px;
  border-radius: 4px;
  margin-left: 4px;
}

/* --- LOBBY OVERLAY MODAL --- */
#lobby-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 7, 15, 0.88);
  backdrop-filter: blur(14px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lobby-modal {
  width: 580px;
  max-width: 92%;
  padding: 36px 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.lobby-header {
  text-align: center;
}

.lobby-header h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.6rem;
  color: var(--neon-yellow);
  text-shadow: 0 0 18px rgba(255, 215, 0, 0.7), 2px 2px #000;
  margin-bottom: 8px;
}

.lobby-header p {
  color: var(--neon-cyan);
  font-size: 0.85rem;
  letter-spacing: 1px;
}

.lobby-form-row {
  display: flex;
  gap: 16px;
}

.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.75rem;
  color: #8899aa;
  font-weight: 700;
  letter-spacing: 1px;
}

.text-input, .select-input {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(0, 229, 255, 0.4);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 8px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  outline: none;
}

.text-input:focus, .select-input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 10px var(--neon-cyan);
}

.lobby-players-box {
  background: rgba(6, 10, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  max-height: 180px;
  overflow-y: auto;
}

.lobby-players-title {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #8899aa;
  margin-bottom: 8px;
}

.lobby-players-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lobby-player-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(20, 28, 48, 0.6);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
}

.player-ready-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 215, 0, 0.2);
  color: var(--neon-yellow);
}

.player-ready-badge.is-ready {
  background: rgba(57, 255, 20, 0.2);
  color: var(--neon-green);
}

.lobby-actions {
  display: flex;
  gap: 12px;
}

.btn-primary {
  flex: 1;
  background: linear-gradient(135deg, #00e5ff, #0077ff);
  color: #000;
  border: none;
  padding: 12px 18px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.6);
  transition: all 0.2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.9);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 12px 18px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-success {
  background: linear-gradient(135deg, #39ff14, #00aa44);
  color: #000;
  border: none;
  padding: 12px 20px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(57, 255, 20, 0.6);
  transition: all 0.2s;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.9);
}

.hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  #hud-bottom {
    flex-direction: column;
    align-items: center;
  }
  .aim-center-deck {
    flex-wrap: wrap;
    justify-content: center;
  }
  #side-leaderboard {
    display: none;
  }
}
