/* ─── RESET & BASE ─────────────────────────────────────────────────────────── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #000;
  overflow: hidden;
  font-family: 'Courier New', monospace;
}

#canvas {
  display: block;
}

/* ─── UI OVERLAY ───────────────────────────────────────────────────────────── */
#ui {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* ─── HUD TOP ──────────────────────────────────────────────────────────────── */
#hud-top {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 40px;
  align-items: center;
}

.hud-block {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #f97316;
  padding: 8px 18px;
  color: #f97316;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.hud-block span {
  color: #fff;
  font-size: 20px;
  font-weight: bold;
}

/* ─── HP BAR ───────────────────────────────────────────────────────────────── */
#hp-bar-wrap {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  text-align: center;
}

#hp-label {
  color: #f97316;
  font-size: 11px;
  letter-spacing: 3px;
  margin-bottom: 6px;
}

#hp-bar-bg {
  width: 100%;
  height: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #f97316;
}

#hp-bar {
  height: 100%;
  background: #f97316;
  transition: width 0.3s;
  width: 100%;
}

/* ─── CROSSHAIR ────────────────────────────────────────────────────────────── */
#crosshair {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 20px; height: 20px;
  pointer-events: none;
}

#crosshair::before,
#crosshair::after {
  content: '';
  position: absolute;
  background: rgba(249, 115, 22, 0.8);
}

#crosshair::before {
  width: 2px; height: 100%;
  left: 50%;
  transform: translateX(-50%);
}

#crosshair::after {
  width: 100%; height: 2px;
  top: 50%;
  transform: translateY(-50%);
}

/* ─── WAVE ANNOUNCE ────────────────────────────────────────────────────────── */
#wave-announce {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: #f97316;
  font-size: 36px;
  letter-spacing: 6px;
  text-transform: uppercase;
  text-shadow: 0 0 30px #f97316;
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
  text-align: center;
}

/* ─── LIGHTS INDICATOR ─────────────────────────────────────────────────────── */
#lights-indicator {
  position: absolute;
  top: 20px; right: 20px;
  color: #f97316;
  font-size: 11px;
  letter-spacing: 2px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #f97316;
  padding: 6px 12px;
}

/* ─── CONTROLS HINT ────────────────────────────────────────────────────────── */
#controls-hint {
  position: absolute;
  right: 20px;
  bottom: 72px;
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 6px 12px;
  padding: 12px 14px;
  color: rgba(255, 232, 210, 0.9);
  background: linear-gradient(135deg, rgba(12, 8, 4, 0.82), rgba(37, 18, 6, 0.72));
  border: 1px solid rgba(249, 115, 22, 0.55);
  box-shadow: 0 0 24px rgba(249, 115, 22, 0.18);
  font-size: 11px;
  letter-spacing: 0.8px;
  line-height: 1.2;
  text-align: left;
}

#controls-hint span {
  white-space: nowrap;
}

/* ─── GAME OVER SCREEN ─────────────────────────────────────────────────────── */
#game-over {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: all;
}

#game-over h1 {
  color: #f97316;
  font-size: 52px;
  letter-spacing: 8px;
  text-shadow: 0 0 40px #f97316;
  margin-bottom: 10px;
}

#game-over .sub {
  color: #aaa;
  font-size: 14px;
  letter-spacing: 3px;
  margin-bottom: 40px;
}

#game-over .stats {
  color: #fff;
  font-size: 16px;
  letter-spacing: 2px;
  margin-bottom: 30px;
  line-height: 2;
  text-align: center;
}

#restart-btn {
  background: transparent;
  border: 2px solid #f97316;
  color: #f97316;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  letter-spacing: 4px;
  padding: 14px 40px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.2s;
  pointer-events: all;
  outline: none;
}

#restart-btn:focus-visible {
  outline: 2px solid #f97316;
  outline-offset: 2px;
}

#restart-btn:hover {
  background: #f97316;
  color: #000;
}

/* Prevent focus outlines on all interactive elements during mouse use */
#config-panel input:focus,
#config-panel select:focus,
#config-panel button:focus {
  outline: none;
}

#config-panel input:focus-visible,
#config-panel select:focus-visible,
#config-panel button:focus-visible {
  outline: 2px solid #f97316;
  outline-offset: 1px;
}

/* ─── LOW HP OVERLAY ──────────────────────────────────────────────────────── */
#low-hp-overlay {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 5;
  border: 4px solid transparent;
  transition: border-color 0.3s;
  box-sizing: border-box;
}
#low-hp-overlay.active {
  border-color: rgba(255, 0, 0, 0.2);
  box-shadow: inset 0 0 60px rgba(255, 0, 0, 0.12);
}

@keyframes hp-pulse {
  from { opacity: 0.5; }
  to   { opacity: 1; }
}

#hp-bar-wrap.low-hp #hp-bar {
  animation: hp-pulse 0.6s ease-in-out infinite alternate;
}

/* ─── CONFIG PANEL ────────────────────────────────────────────────────────── */
#config-panel {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  min-width: 260px;
  background: rgba(0,0,0,0.88);
  border: 1px solid #f97316;
  padding: 24px 32px;
  z-index: 20;
  flex-direction: column;
  gap: 12px;
  pointer-events: all;
  font-family: 'Courier New', monospace;
  color: #f97316;
  font-size: 12px;
  letter-spacing: 1px;
}
#config-panel h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  letter-spacing: 4px;
  text-align: center;
}
#config-panel label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
#config-panel input[type="color"] {
  width: 48px;
  height: 28px;
  border: 1px solid #f97316;
  background: transparent;
  cursor: pointer;
}
#config-panel select {
  background: #111;
  color: #f97316;
  border: 1px solid #f97316;
  padding: 4px 8px;
  font-family: 'Courier New', monospace;
  cursor: pointer;
}
.cfg-hint {
  text-align: center;
  opacity: 0.5;
  margin-top: 8px;
  font-size: 10px;
}
