/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a14;
  font-family: 'Courier New', 'Consolas', monospace;
  color: #e0e0e0;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  touch-action: none;
}

#ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  touch-action: none;
}

/* ===== HUD ===== */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 12px;
  pointer-events: none;
  z-index: 11;
}

.hud-left, .hud-center, .hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-center {
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* HUD Stats (HP, Money, Score) */
.hud-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(10, 10, 20, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 191, 255, 0.3);
  border-radius: 6px;
  padding: 4px 8px;
}

.hud-icon {
  font-size: 14px;
  font-weight: bold;
}

.hud-icon-heart {
  color: #f44336;
}

.hud-icon-coin {
  color: #ffc107;
}

.hud-icon-diamond {
  color: #2196f3;
}

.hud-icon-crystal {
  color: #00e5ff;
}

.hud-value {
  font-size: 14px;
  font-weight: bold;
  color: #ffffff;
}

/* Wave progress bar */
.wave-progress-bar {
  width: 100%;
  max-width: 200px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.wave-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00bfff, #00e5ff);
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

.hud-countdown {
  font-size: 10px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hud-wave {
  font-size: 14px;
  font-weight: bold;
  color: #ffffff;
  text-shadow: 0 0 10px rgba(0, 191, 255, 0.5);
}

/* HUD buttons */
.hud-btn {
  pointer-events: auto;
  background: rgba(10, 10, 20, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 191, 255, 0.3);
  border-radius: 6px;
  color: #ffffff;
  font-size: 16px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-btn:hover {
  border-color: #00bfff;
  background: rgba(0, 191, 255, 0.2);
  transform: scale(1.05);
}

/* Settings menu */
.settings-menu {
  position: absolute;
  top: 60px;
  right: 16px;
  background: rgba(10, 10, 20, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 191, 255, 0.3);
  border-radius: 8px;
  padding: 8px 0;
  z-index: 12;
  pointer-events: auto;
}

.settings-item {
  padding: 8px 16px;
  color: #e0e0e0;
  cursor: pointer;
  transition: background 0.2s ease;
}

.settings-item:hover {
  background: rgba(0, 191, 255, 0.2);
}

/* Settings input for player name */
.settings-item#settings-player-name {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 16px;
  cursor: default;
}

.settings-label {
  font-size: 12px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.settings-input {
  padding: 6px 10px;
  border: 1px solid rgba(0, 191, 255, 0.3);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
  color: #e0e0e0;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.settings-input:focus {
  border-color: #00bfff;
  box-shadow: 0 0 6px rgba(0, 191, 255, 0.2);
}

.settings-input::placeholder {
  color: #6b7280;
}

/* HP Bar (legacy, kept for compatibility) */
.hp-bar {
  width: 100px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #8bc34a);
  border-radius: 4px;
  transition: width 0.3s ease, background 0.3s ease;
  width: 100%;
}

.hp-fill.low {
  background: linear-gradient(90deg, #f44336, #ff5722);
}

.hp-fill.medium {
  background: linear-gradient(90deg, #ff9800, #ffc107);
}

/* ===== Tower Selection Panel ===== */
#tower-panel {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.tower-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(10, 10, 20, 0.7);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(0, 191, 255, 0.3);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 60px;
}

.tower-option:hover {
  border-color: #00bfff;
  background: rgba(0, 191, 255, 0.15);
  transform: translateY(-2px);
}

.tower-option.selected {
  border-color: #00bfff;
  background: rgba(0, 191, 255, 0.2);
  box-shadow: 0 0 15px rgba(0, 191, 255, 0.3);
}

.tower-option.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.tower-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
}

.canon-icon {
  background: linear-gradient(135deg, #4caf50, #66bb6a);
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
}

.arrow-icon {
  background: linear-gradient(135deg, #2196f3, #42a5f5);
  box-shadow: 0 0 8px rgba(33, 150, 243, 0.3);
}

.anti-air-icon {
  background: linear-gradient(135deg, #9c27b0, #ab47bc);
  box-shadow: 0 0 8px rgba(156, 39, 176, 0.3);
}

.slow-gen-icon {
  background: linear-gradient(135deg, #00bcd4, #26c6da);
  box-shadow: 0 0 8px rgba(0, 188, 212, 0.3);
}

.laser-icon {
  background: linear-gradient(135deg, #f44336, #ef5350);
  box-shadow: 0 0 8px rgba(244, 67, 54, 0.3);
}

.tower-name {
  font-size: 9px;
  color: #e0e0e0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tower-cost {
  font-size: 8px;
  color: #ffd700;
}

/* ===== Action Buttons ===== */
.action-btn {
  background: rgba(0, 191, 255, 0.15);
  border: 1px solid rgba(0, 191, 255, 0.4);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s ease;
  color: #00bfff;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.action-btn:hover {
  background: rgba(0, 191, 255, 0.3);
  border-color: #00bfff;
  box-shadow: 0 0 15px rgba(0, 191, 255, 0.3);
  transform: translateY(-2px);
}

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

.action-btn.sell {
  background: rgba(244, 67, 54, 0.15);
  border-color: rgba(244, 67, 54, 0.4);
  color: #f44336;
}

.action-btn.sell:hover {
  background: rgba(244, 67, 54, 0.3);
  border-color: #f44336;
  box-shadow: 0 0 15px rgba(244, 67, 54, 0.3);
}

.action-btn.small {
  padding: 6px 10px;
  font-size: 14px;
}

/* ===== Panels ===== */
.panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 10, 20, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 191, 255, 0.3);
  border-radius: 16px;
  min-width: 280px;
  pointer-events: auto;
  z-index: 30;
}

/* ===== Tower Info Panel ===== */
.tower-info {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  background: rgba(10, 10, 20, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 191, 255, 0.3);
  border-radius: 16px;
  min-width: 220px;
  pointer-events: auto;
  z-index: 30;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0, 191, 255, 0.2);
}

.panel-title {
  font-size: 16px;
  color: #00bfff;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.close-btn {
  background: none;
  border: none;
  color: #e0e0e0;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.close-btn:hover {
  opacity: 1;
  color: #00bfff;
}

.panel-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.stat-label {
  font-size: 12px;
  color: #9ca3af;
}

.stat-value {
  font-size: 14px;
  color: #ffffff;
  font-weight: bold;
}

/* ===== Notifications ===== */
.notification {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 191, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 191, 255, 0.4);
  border-radius: 12px;
  padding: 16px 32px;
  pointer-events: none;
  animation: fadeInOut 3s ease forwards;
}

.notification-text {
  font-size: 20px;
  color: #00bfff;
  text-transform: uppercase;
  letter-spacing: 2px;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* ===== Placement Preview ===== */
#placement-preview {
  position: absolute;
  pointer-events: none;
  z-index: 5;
}

/* ===== Hidden class ===== */
.hidden {
  display: none !important;
}

/* ===== Debug Panel ===== */
.debug-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 23, 42, 0.97);
  border: 2px solid #00bfff;
  border-radius: 12px;
  padding: 0;
  z-index: 1000;
  min-width: 280px;
  box-shadow: 0 0 30px rgba(0, 191, 255, 0.3);
}

.debug-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0, 191, 255, 0.3);
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: 16px;
  color: #00bfff;
}

.debug-panel-body {
  padding: 16px;
}

.debug-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.debug-toggle:last-child {
  border-bottom: none;
}

.debug-label {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #e2e8f0;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #334155;
  border-radius: 26px;
  transition: 0.3s;
}

.toggle-slider:before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #00bfff;
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(22px);
}

/* ===== Start Wave Button ===== */
#start-wave-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center;
  font-size: 18px;
  padding: 12px 24px;
  animation: pulse 2s ease-in-out infinite;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(0, 191, 255, 0.2); }
  50% { box-shadow: 0 0 30px rgba(0, 191, 255, 0.5); }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hud-item {
    padding: 4px 8px;
  }

  .hud-label {
    font-size: 8px;
  }

  .hud-value {
    font-size: 12px;
  }

  .hp-bar {
    width: 60px;
  }

  #tower-panel {
    bottom: 8px;
    gap: 8px;
  }

  .tower-option {
    padding: 8px 12px;
    min-width: 60px;
  }

  .tower-icon {
    width: 24px;
    height: 24px;
  }

  .tower-name {
    font-size: 9px;
  }

  .tower-cost {
    font-size: 8px;
  }

  .panel {
    min-width: 240px;
  }
}

@media (max-width: 480px) {
  #hud {
    padding: 8px;
  }

  .hud-item {
    gap: 4px;
    padding: 3px 6px;
  }

  .hud-label {
    font-size: 7px;
  }

  .hud-value {
    font-size: 10px;
  }

  .hp-bar {
    width: 40px;
    height: 6px;
  }

  #tower-panel {
    gap: 4px;
  }

  .tower-option {
    padding: 6px 8px;
    min-width: 50px;
  }

  .tower-name {
    font-size: 8px;
  }

  .tower-cost {
    font-size: 7px;
  }
}

/* ===== Placement Confirmation Dialog ===== */
#placement-confirm {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
}

.confirm-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
}

.confirm-box {
  position: relative;
  background: rgba(10, 10, 20, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 191, 255, 0.4);
  border-radius: 16px;
  padding: 24px 32px;
  min-width: 280px;
  text-align: center;
}

.confirm-title {
  font-size: 18px;
  color: #00bfff;
  font-weight: bold;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.confirm-cost {
  font-size: 14px;
  color: #ffd700;
  margin-bottom: 20px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-btn {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: bold;
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 1px solid rgba(0, 191, 255, 0.4);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.confirm-btn.yes {
  background: rgba(0, 191, 255, 0.2);
  color: #00bfff;
}

.confirm-btn.yes:hover {
  background: rgba(0, 191, 255, 0.4);
  border-color: #00bfff;
}

.confirm-btn.no {
  background: rgba(244, 67, 54, 0.15);
  color: #f44336;
  border-color: rgba(244, 67, 54, 0.4);
}

.confirm-btn.no:hover {
  background: rgba(244, 67, 54, 0.3);
  border-color: #f44336;
}

/* ===== Wave Progress Bar ===== */
#wave-progress {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 20px;
  border: 1px solid rgba(0, 191, 255, 0.3);
}

.wave-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.5);
  transition: all 0.3s ease;
}

.wave-dot.completed {
  background: #00bfff;
  border-color: #00bfff;
  box-shadow: 0 0 8px rgba(0, 191, 255, 0.6);
}

.wave-dot.current {
  background: #ffd700;
  border-color: #ffd700;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.8);
  animation: pulse 1.5s infinite;
}

.wave-dot.upcoming {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

.wave-line {
  width: 20px;
  height: 2px;
  background: rgba(255, 255, 255, 0.3);
  transition: background 0.3s ease;
}

.wave-line.completed {
  background: #00bfff;
  box-shadow: 0 0 4px rgba(0, 191, 255, 0.4);
}

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

/* ===== Wave Complete Screen ===== */
.wave-complete-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  text-align: center;
  pointer-events: none;
}

.wave-complete-content {
  background: rgba(0, 0, 0, 0.85);
  border: 2px solid #00bfff;
  border-radius: 16px;
  padding: 32px 48px;
  box-shadow: 0 0 30px rgba(0, 191, 255, 0.5);
  animation: fadeInUp 0.5s ease;
}

.wave-complete-title {
  font-size: 32px;
  font-weight: bold;
  color: #00bfff;
  margin-bottom: 16px;
  text-shadow: 0 0 10px rgba(0, 191, 255, 0.8);
}

.wave-bonus {
  font-size: 24px;
  color: #ffd700;
  margin-bottom: 12px;
  font-weight: bold;
}

.wave-countdown {
  font-size: 18px;
  color: #e0e0e0;
}

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

/* ===== HUD Sections ===== */
.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-center {
  display: flex;
  align-items: center;
}

.hud-wave {
  font-size: 14px;
  font-weight: bold;
  color: #00bfff;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ===== Buttons ===== */
.btn {
  background: rgba(0, 191, 255, 0.15);
  border: 1px solid rgba(0, 191, 255, 0.4);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  color: #00bfff;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s ease;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  background: rgba(0, 191, 255, 0.3);
  border-color: #00bfff;
  box-shadow: 0 0 15px rgba(0, 191, 255, 0.3);
  transform: translateY(-2px);
}

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

.btn-primary {
  background: rgba(0, 191, 255, 0.25);
  border-color: #00bfff;
  color: #ffffff;
  font-size: 14px;
  padding: 10px 20px;
}

.btn-primary:hover {
  background: rgba(0, 191, 255, 0.4);
  box-shadow: 0 0 20px rgba(0, 191, 255, 0.5);
}

.btn-secondary {
  background: rgba(107, 114, 167, 0.15);
  border-color: rgba(107, 114, 167, 0.4);
  color: #9ca3af;
}

.btn-secondary:hover {
  background: rgba(107, 114, 167, 0.3);
  border-color: #9ca3af;
}

/* ===== Stage Selector ===== */
.stage-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.stage-label {
  font-size: 14px;
  color: #9ca3af;
  font-weight: bold;
}

.stage-btn {
  padding: 8px 16px;
  border: 2px solid rgba(107, 114, 167, 0.4);
  border-radius: 6px;
  background: rgba(107, 114, 167, 0.15);
  color: #9ca3af;
  font-family: inherit;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stage-btn:hover {
  background: rgba(107, 114, 167, 0.3);
  border-color: #9ca3af;
  color: #e0e0e0;
}

.stage-btn.selected {
  border-color: #00bfff;
  background: rgba(0, 191, 255, 0.2);
  color: #00bfff;
  box-shadow: 0 0 8px rgba(0, 191, 255, 0.3);
}

.stage-btn:active {
  transform: scale(0.95);
}

.btn-upgrade {
  background: rgba(76, 175, 80, 0.2);
  border-color: rgba(76, 175, 80, 0.5);
  color: #4caf50;
}

.btn-upgrade:hover {
  background: rgba(76, 175, 80, 0.4);
  border-color: #4caf50;
}

.btn-sell {
  background: rgba(244, 67, 54, 0.15);
  border-color: rgba(244, 67, 54, 0.4);
  color: #f44336;
}

.btn-sell:hover {
  background: rgba(244, 67, 54, 0.3);
  border-color: #f44336;
}

.btn-icon {
  background: none;
  border: none;
  color: #e0e0e0;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0.6;
  transition: opacity 0.2s, color 0.2s;
}

.btn-icon:hover {
  opacity: 1;
  color: #00bfff;
}

.btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== Screen Overlays (Game Over / Victory) ===== */
.screen-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(10, 10, 20, 0.92);
  z-index: 300;
  pointer-events: auto;
}

.overlay-title {
  font-size: 48px;
  font-weight: bold;
  color: #f44336;
  text-transform: uppercase;
  letter-spacing: 3px;
  text-shadow: 0 0 20px rgba(244, 67, 54, 0.6);
  margin-bottom: 24px;
}

.victory-title {
  color: #ffd700;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.overlay-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.stat-label {
  font-size: 16px;
  color: #9ca3af;
}

.stat-value {
  font-size: 20px;
  color: #ffffff;
  font-weight: bold;
}

/* ===== Wave Notification ===== */
.wave-notification {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(10, 10, 20, 0.9);
  backdrop-filter: blur(8px);
  border: 2px solid #00bfff;
  border-radius: 16px;
  padding: 20px 40px;
  pointer-events: none;
  z-index: 250;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.wave-notification.show {
  opacity: 1;
  animation: waveNotifPulse 2.5s ease forwards;
}

.wave-notification span {
  font-size: 24px;
  font-weight: bold;
  color: #00bfff;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.wave-notification span:nth-child(2) {
  font-size: 36px;
  color: #ffd700;
}

@keyframes waveNotifPulse {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  25% { transform: translate(-50%, -50%) scale(1); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}

/* ===== Pause Menu ===== */
.pause-menu {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(10, 10, 20, 0.85);
  z-index: 250;
  pointer-events: auto;
}

.pause-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: rgba(26, 26, 46, 0.98);
  border: 2px solid #16213e;
  border-radius: 16px;
  padding: 32px 48px;
}

.pause-title {
  font-size: 36px;
  font-weight: bold;
  color: #00bfff;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 8px;
}

/* ===== Tower Info Panel ===== */
.tower-info {
  position: absolute;
  bottom: 80px;
  right: 16px;
  width: 260px;
  background: rgba(10, 10, 20, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 191, 255, 0.3);
  border-radius: 12px;
  z-index: 150;
  pointer-events: auto;
}

.tower-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0, 191, 255, 0.2);
}

#info-tower-name {
  font-size: 14px;
  font-weight: bold;
  color: #00bfff;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.tower-info-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.info-label {
  font-size: 12px;
  color: #9ca3af;
}

.info-row span:last-child {
  font-size: 13px;
  color: #ffffff;
  font-weight: bold;
}

.tower-info-actions {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid rgba(0, 191, 255, 0.2);
}

.tower-info-actions .btn {
  flex: 1;
  text-align: center;
}

/* ===== Wave Complete ===== */
.wave-complete {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  pointer-events: none;
}

.wave-complete-content {
  background: rgba(10, 10, 20, 0.92);
  border: 2px solid #00bfff;
  border-radius: 16px;
  padding: 32px 48px;
  text-align: center;
  box-shadow: 0 0 30px rgba(0, 191, 255, 0.5);
  animation: fadeInUp 0.5s ease;
}

.wave-complete-title {
  font-size: 32px;
  font-weight: bold;
  color: #00bfff;
  margin-bottom: 16px;
  text-shadow: 0 0 10px rgba(0, 191, 255, 0.8);
}

.wave-complete-bonus {
  font-size: 24px;
  color: #ffd700;
  margin-bottom: 12px;
  font-weight: bold;
}

.wave-complete-crystals {
  font-size: 20px;
  color: #00e5ff;
  margin-bottom: 12px;
  font-weight: bold;
}

.wave-complete-countdown {
  font-size: 16px;
  color: #e0e0e0;
  margin-bottom: 24px;
}

/* ===== Bottom Panel ===== */
#wave-progress {
  margin-top: 8px;
}

/* ===== Pause Button ===== */
#pause-btn {
  position: absolute;
  top: 56px;
  right: 16px;
  z-index: 12;
  font-size: 11px;
  padding: 6px 12px;
}

/* ===== Screen Content (Game Over / Victory) ===== */
.screen-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

/* ===== Highscore Panel ===== */
.highscore-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 420px;
  max-height: 80vh;
  background: rgba(10, 10, 20, 0.95);
  border: 2px solid rgba(107, 114, 167, 0.5);
  border-radius: 12px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
  animation: fadeInUp 0.3s ease;
}

.highscore-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(107, 114, 167, 0.3);
  font-size: 18px;
  font-weight: bold;
  color: #ffd700;
}

.highscore-body {
  overflow-y: auto;
  padding: 12px;
  flex: 1;
}

#highscore-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#highscore-table th {
  position: sticky;
  top: 0;
  background: rgba(10, 10, 20, 0.98);
  padding: 8px 6px;
  text-align: left;
  color: #9ca3af;
  font-weight: bold;
  border-bottom: 1px solid rgba(107, 114, 167, 0.3);
}

#highscore-table td {
  padding: 8px 6px;
  border-bottom: 1px solid rgba(107, 114, 167, 0.15);
  color: #e0e0e0;
}

#highscore-table tbody tr:nth-child(odd) {
  background: rgba(107, 114, 167, 0.08);
}

#highscore-table tbody tr:nth-child(1) td {
  color: #ffd700;
}

#highscore-table tbody tr:nth-child(2) td {
  color: #c0c0c0;
}

#highscore-table tbody tr:nth-child(3) td {
  color: #cd7f32;
}

.highscore-empty {
  text-align: center;
  padding: 32px;
  color: #9ca3af;
  font-size: 14px;
}

.highscore-panel::-webkit-scrollbar {
  width: 6px;
}

.highscore-panel::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.highscore-panel::-webkit-scrollbar-thumb {
  background: rgba(107, 114, 167, 0.4);
  border-radius: 3px;
}

/* ===== Start Screen ===== */
#start-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 20, 0.95);
  backdrop-filter: blur(12px);
  z-index: 100;
  pointer-events: auto;
}

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

.start-title {
  font-size: 48px;
  color: #00bfff;
  text-transform: uppercase;
  letter-spacing: 4px;
  margin-bottom: 8px;
  text-shadow: 0 0 20px rgba(0, 191, 255, 0.5);
}

.start-subtitle {
  font-size: 16px;
  color: #9ca3af;
  margin-bottom: 32px;
  letter-spacing: 2px;
}

.start-player-name-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.start-player-name-row label {
  font-size: 12px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#start-player-name {
  padding: 10px 16px;
  border: 1px solid rgba(0, 191, 255, 0.3);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  color: #e0e0e0;
  font-family: 'Courier New', monospace;
  font-size: 18px;
  text-align: center;
  outline: none;
  width: 250px;
  transition: border-color 0.2s ease;
}

#start-player-name:focus {
  border-color: #00bfff;
  box-shadow: 0 0 10px rgba(0, 191, 255, 0.2);
}

.start-stage-selector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
}

.start-stage-label {
  font-size: 12px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.start-stage-btns {
  display: flex;
  gap: 12px;
}

.start-stage-btn {
  padding: 10px 24px;
  border: 1px solid rgba(0, 191, 255, 0.3);
  border-radius: 8px;
  background: rgba(0, 191, 255, 0.1);
  color: #e0e0e0;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.start-stage-btn:hover {
  border-color: #00bfff;
  background: rgba(0, 191, 255, 0.2);
  transform: translateY(-2px);
}

.start-stage-btn.selected {
  border-color: #00bfff;
  background: rgba(0, 191, 255, 0.25);
  color: #00bfff;
  box-shadow: 0 0 15px rgba(0, 191, 255, 0.3);
}

#start-game-btn {
  padding: 14px 48px;
  border: 2px solid #00bfff;
  border-radius: 12px;
  background: rgba(0, 191, 255, 0.15);
  color: #00bfff;
  font-family: 'Courier New', monospace;
  font-size: 20px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  pointer-events: auto;
}

#start-game-btn:hover {
  background: rgba(0, 191, 255, 0.3);
  box-shadow: 0 0 25px rgba(0, 191, 255, 0.4);
  transform: translateY(-3px);
}

.start-controls {
  margin-top: 32px;
  font-size: 11px;
  color: #6b7280;
  text-align: center;
  line-height: 1.8;
}
