* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

#gameCanvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#crosshair::before,
#crosshair::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 1px;
}

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

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

#click-prompt {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.55);
  font-family: monospace;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
}

/* Muzzle flash — full-screen white burst on shoot */
#muzzle-flash {
  position: fixed;
  inset: 0;
  background: rgba(255, 220, 80, 0.35);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0s;
}

#muzzle-flash.active {
  opacity: 1;
  transition: opacity 0s;
}

/* Minimap — bottom-left corner overlay */
#minimap {
  position: fixed;
  bottom: 16px;
  left: 16px;
  image-rendering: pixelated;
  border: 1px solid rgba(80, 80, 255, 0.45);
  opacity: 0.82;
  pointer-events: none;
}

/* ── Join screen ──────────────────────────────────────────────────────── */
#join-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
  z-index: 100;
  font-family: monospace;
}

#join-screen h1 {
  margin: 0 0 2.5rem;
  font-size: 5rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: #e05020;
  text-shadow: 0 0 24px rgba(224, 80, 32, 0.55);
}

#join-form {
  display: flex;
  gap: 0.5rem;
}

#name-input {
  width: 220px;
  padding: 0.55rem 1rem;
  background: #111;
  border: 1px solid #555;
  color: #fff;
  font-family: monospace;
  font-size: 1rem;
  outline: none;
}

#name-input:focus {
  border-color: #e05020;
}

#join-btn,
#solo-btn {
  padding: 0.55rem 1.6rem;
  border: none;
  color: #fff;
  font-family: monospace;
  font-size: 1rem;
  font-weight: bold;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
}

#join-btn {
  background: #e05020;
}

#join-btn:hover:not(:disabled) {
  background: #ff6030;
}

#solo-btn {
  background: #2a4a2a;
  border: 1px solid #4a8a4a;
}

#solo-btn:hover:not(:disabled) {
  background: #3a6a3a;
}

#join-btn:disabled,
#solo-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

#join-status {
  margin-top: 1rem;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: #888;
  min-height: 1em;
}

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

/* ── HUD ──────────────────────────────────────────────────────────────── */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

/* HP bar */
#hud-hp {
  position: absolute;
  bottom: 28px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: monospace;
  font-size: 0.8rem;
  color: #fff;
  letter-spacing: 0.05em;
}

#hud-hp-label {
  opacity: 0.6;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
}

#hud-hp-track {
  width: 130px;
  height: 7px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  overflow: hidden;
}

#hud-hp-fill {
  height: 100%;
  border-radius: 3px;
  background: #4caf50;
  transition: width 0.12s, background 0.3s;
}

#hud-hp-value {
  width: 2.2em;
  text-align: right;
  opacity: 0.85;
}

/* Kill feed */
#hud-killfeed {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: monospace;
  font-size: 0.76rem;
  text-align: right;
  pointer-events: none;
}

.kill-entry {
  color: #ffccaa;
  background: rgba(0, 0, 0, 0.55);
  padding: 3px 8px;
  border-right: 2px solid #e05020;
  opacity: 1;
  transition: opacity 0.5s;
}

.kill-entry.fading {
  opacity: 0;
}

/* Player counter */
#hud-counter {
  position: absolute;
  top: 20px;
  left: 20px;
  font-family: monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.45);
}

/* Respawn overlay */
#hud-respawn {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

#hud-respawn-text {
  font-family: monospace;
  font-size: 2.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #e05020;
  text-shadow: 0 0 28px rgba(224, 80, 32, 0.55);
}

#hud-respawn.hidden {
  display: none;
}
