* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #0a0a0f;
  color: #e8e8ef;
}

body.launch-active #hud,
body.launch-active #crosshair-wrap {
  visibility: hidden;
}

#launch-screen {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: "Courier New", Courier, ui-monospace, monospace;
  background: #050806;
  background-image: radial-gradient(
      ellipse 130% 90% at 50% -15%,
      rgba(0, 100, 75, 0.28),
      transparent 55%
    ),
    radial-gradient(ellipse 70% 55% at 100% 40%, rgba(0, 50, 100, 0.16), transparent 50%),
    radial-gradient(ellipse 55% 45% at 0% 85%, rgba(0, 70, 55, 0.14), transparent 50%);
}

#launch-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

#launch-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 160, 0.04) 2px,
    rgba(0, 255, 160, 0.04) 4px
  );
}

.launch-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
}

.launch-title {
  margin: 0 0 2.25rem;
  font-size: clamp(1.6rem, 4.5vw, 2.8rem);
  font-weight: bold;
  letter-spacing: 0.08em;
  color: #5fff7a;
  text-shadow: 0 0 8px #00ff88, 0 0 18px #00dd77, 0 0 36px #00aa55, 0 0 64px rgba(0, 255, 130, 0.35);
}

.launch-box {
  margin: 0;
  padding: 1.35rem 1.85rem;
  min-width: min(320px, 92vw);
  text-align: left;
  color: #c8f0d8;
  font-size: 0.95rem;
  line-height: 1.9;
  border: 2px solid #1a5c3a;
  background: rgba(0, 0, 0, 0.42);
  box-shadow: inset 0 0 24px rgba(0, 80, 50, 0.12), 0 0 1px rgba(0, 255, 120, 0.15);
}

.launch-box p {
  margin: 0;
}

.launch-tip {
  margin: 1.35rem 0 0;
  font-size: 0.88rem;
  font-style: italic;
  color: #ff9a2e;
  text-shadow: 0 0 14px rgba(255, 150, 60, 0.45);
  text-align: center;
}

.launch-start {
  margin-top: 2.25rem;
  cursor: pointer;
  font-family: "Courier New", Courier, ui-monospace, monospace;
  font-size: 1rem;
  font-weight: bold;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #0a0a0a;
  background: #39ff6a;
  border: none;
  padding: 14px 40px;
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(57, 255, 106, 0.95), 0 0 28px rgba(0, 255, 100, 0.55),
    0 0 48px rgba(0, 200, 80, 0.25);
  transition: filter 0.15s ease, transform 0.1s ease;
}

.launch-start:hover {
  filter: brightness(1.1);
}

.launch-start:active {
  transform: translateY(2px);
}

#launch-screen.hidden {
  display: none;
}

#c {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── Big health bars ── */
#health-hud {
  position: fixed;
  top: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 14px;
  pointer-events: none;
  z-index: 5;
  gap: 12px;
}

.hh-panel {
  width: 42%;
  font-family: "Courier New", Courier, monospace;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
}

.hh-panel-right {
  text-align: right;
}

.hh-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(200, 215, 230, 0.7);
  margin-bottom: 4px;
}

.hh-bar-wrap {
  width: 100%;
  height: 16px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.hh-fill {
  height: 100%;
  width: 100%;
  border-radius: 3px;
  transition: transform 0.1s ease-out;
}

.hh-fill-player {
  transform-origin: left center;
  background: linear-gradient(90deg, #00bb44, #44ff88);
  box-shadow: 0 0 12px rgba(0, 255, 100, 0.45);
}

.hh-fill-enemy {
  transform-origin: right center;
  background: linear-gradient(90deg, #ff4422, #ff7755);
  box-shadow: 0 0 12px rgba(255, 80, 40, 0.45);
}

.hh-num {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-top: 4px;
}

#hh-player .hh-num { color: #44ff88; text-shadow: 0 0 14px rgba(0, 255, 100, 0.5), 0 1px 4px rgba(0,0,0,0.9); }
#hh-enemy  .hh-num { color: #ff7755; text-shadow: 0 0 14px rgba(255, 80, 40, 0.5), 0 1px 4px rgba(0,0,0,0.9); }

@keyframes low-health-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.low-health .hh-num {
  color: #ff2222 !important;
  text-shadow: 0 0 18px rgba(255, 0, 0, 0.85) !important;
  animation: low-health-pulse 0.5s ease-in-out infinite;
}

.low-health .hh-fill-player,
.low-health .hh-fill-enemy {
  background: linear-gradient(90deg, #aa0000, #ff2222) !important;
  box-shadow: 0 0 16px rgba(255, 0, 0, 0.7) !important;
  animation: low-health-pulse 0.5s ease-in-out infinite;
}

/* ── Overlay win / lose / level colours ── */
.overlay-win   #overlay-title { color: #44ff88; text-shadow: 0 0 22px rgba(0, 255, 100, 0.65); }
.overlay-lose  #overlay-title { color: #ff3333; text-shadow: 0 0 22px rgba(255, 40, 40, 0.65); }
.overlay-level #overlay-title { color: #ffe566; text-shadow: 0 0 18px #ffaa00, 0 0 40px rgba(255, 170, 0, 0.4); }

/* ── Level badge (centre of health HUD) ── */
#hh-level-badge {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: bold;
  letter-spacing: 0.12em;
  color: #ffcc44;
  text-shadow: 0 0 8px #ff8800;
  white-space: nowrap;
  pointer-events: none;
  padding-top: 2px;
}

#damage-vignette {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.08s ease-out;
  box-shadow: inset 0 0 100px 50px rgba(200, 30, 45, 0.45);
}

#damage-vignette.show {
  opacity: 1;
}

#hud {
  position: fixed;
  inset: 0;
  padding: 12px 14px 16px;
  pointer-events: none;
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  font-family: "Courier New", Courier, ui-monospace, monospace;
}

#hud-stats {
  align-self: flex-start;
  margin-top: 82px;
  padding: 8px 0;
  font-size: 15px;
  font-weight: bold;
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-accent {
  width: 3px;
  align-self: stretch;
  min-height: 1.1em;
  background: linear-gradient(180deg, #00ff66, #00aa44);
  border-radius: 1px;
  box-shadow: 0 0 8px rgba(0, 255, 100, 0.45);
}

.stat-accent-dim {
  opacity: 0.45;
  box-shadow: none;
}

.stat-sub {
  margin-top: 4px;
  font-size: 11px;
  font-weight: normal;
  opacity: 0.85;
}

.stat-subline {
  color: rgba(200, 210, 220, 0.75);
}

.txt-health {
  color: #ff5a5a;
  text-shadow: 0 0 10px rgba(255, 80, 80, 0.5);
}

.txt-kills {
  color: #d8f070;
  text-shadow: 0 0 8px rgba(200, 255, 100, 0.35);
}

.txt-score {
  color: #5ee8ff;
  text-shadow: 0 0 10px rgba(80, 220, 255, 0.4);
}

.txt-diff {
  color: #5dff7a;
  text-shadow: 0 0 10px rgba(0, 255, 120, 0.4);
}

.combo-popup {
  position: fixed;
  left: 50%;
  top: 38%;
  transform: translateX(-50%);
  z-index: 6;
  font-family: "Courier New", Courier, ui-monospace, monospace;
  font-size: clamp(1rem, 2.8vw, 1.35rem);
  font-weight: bold;
  color: #ffe566;
  text-shadow: 0 0 12px rgba(255, 220, 80, 0.9), 0 0 28px rgba(255, 180, 0, 0.45);
  pointer-events: none;
  white-space: nowrap;
}

.combo-popup.hidden {
  display: none;
}

.combo-popup.pop {
  animation: combo-pop 0.95s ease-out forwards;
}

@keyframes combo-pop {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(12px) scale(0.85);
  }
  20% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1.05);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-28px) scale(1);
  }
}

#minimap {
  position: fixed;
  right: 14px;
  bottom: 96px;
  z-index: 4;
  border: 2px solid #00ff66;
  border-radius: 2px;
  background: #06040a;
  box-shadow: 0 0 14px rgba(0, 255, 100, 0.25), inset 0 0 20px rgba(0, 40, 30, 0.5);
  image-rendering: pixelated;
}

.enemy-float-hp {
  position: fixed;
  z-index: 5;
  width: 72px;
  height: 6px;
  margin-left: -36px;
  margin-top: -20px;
  pointer-events: none;
}

.enemy-float-hp.hidden {
  display: none;
}

.enemy-float-hp-track {
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(0, 255, 100, 0.35);
  border-radius: 1px;
  overflow: hidden;
}

.enemy-float-hp-fill {
  height: 100%;
  width: 100%;
  transform: scaleX(1);
  transform-origin: left center;
  background: linear-gradient(90deg, #0a5, #2f5);
  box-shadow: 0 0 8px rgba(0, 255, 100, 0.5);
}

.hud-muted {
  color: rgba(200, 205, 220, 0.5);
  font-weight: 400;
}

#hud-bottom {
  align-self: center;
  width: 100%;
  max-width: 520px;
  text-align: center;
}

#weapon-strip {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  background: linear-gradient(180deg, rgba(12, 14, 22, 0.88), rgba(8, 9, 14, 0.75));
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 10px 18px;
  margin-bottom: 8px;
  backdrop-filter: blur(8px);
}

.weapon-name {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(180, 195, 230, 0.75);
}

.weapon-ammo {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #b8e0ff;
}

.weapon-reload {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #ffb44a;
  animation: pulse-reload 0.7s ease-in-out infinite;
}

.weapon-reload.hidden {
  display: none;
}

@keyframes pulse-reload {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

.hud-hint {
  font-size: 12px;
  opacity: 0.78;
  line-height: 1.4;
}

#shield-strip {
  text-align: center;
  margin-bottom: 5px;
}

.shield-status {
  display: inline-block;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  padding: 3px 12px;
  border-radius: 3px;
}

.shield-ready {
  color: #44ccff;
  border: 1px solid rgba(68, 204, 255, 0.35);
  text-shadow: 0 0 8px rgba(68, 204, 255, 0.4);
}

.shield-active {
  color: #00ffff;
  border: 1px solid rgba(0, 255, 255, 0.65);
  text-shadow: 0 0 12px rgba(0, 255, 255, 0.85);
  animation: shield-pulse-hud 0.7s ease-in-out infinite;
}

.shield-cooldown {
  color: rgba(80, 130, 160, 0.65);
  border: 1px solid rgba(80, 130, 160, 0.22);
}

@keyframes shield-pulse-hud {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.teleport-status {
  display: inline-block;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  padding: 3px 12px;
  border-radius: 3px;
  color: #bb88ff;
  border: 1px solid rgba(180, 120, 255, 0.35);
  text-shadow: 0 0 8px rgba(180, 120, 255, 0.4);
  margin-left: 8px;
}
.teleport-empty {
  color: rgba(100, 70, 140, 0.5);
  border-color: rgba(100, 70, 140, 0.2);
  text-shadow: none;
}

/* Launch screen kbd key badges */
.launch-box kbd {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 3px;
  padding: 1px 6px;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.82em;
  letter-spacing: 0.04em;
  color: #aaddff;
}

#crosshair-wrap {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 5;
}

.crosshair-plus {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
}

.ch-line {
  position: absolute;
  left: 50%;
  top: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.35);
}

.ch-v {
  width: 2px;
  height: 20px;
  margin: -10px 0 0 -1px;
}

.ch-h {
  width: 20px;
  height: 2px;
  margin: -1px 0 0 -10px;
}

.crosshair-hit {
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  opacity: 0.55;
  pointer-events: none;
}

.crosshair-hit.hidden {
  display: none;
}

.crosshair-hit::before,
.crosshair-hit::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 2px;
  margin: -1px 0 0 -13px;
  background: #ff3030;
  box-shadow: 0 0 8px rgba(255, 60, 60, 0.8);
}

.crosshair-hit::before {
  transform: rotate(45deg);
}

.crosshair-hit::after {
  transform: rotate(-45deg);
}

#crosshair-wrap.reload .crosshair-plus {
  opacity: 0.35;
}

#overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 14, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#overlay.hidden {
  display: none;
}

#overlay-card {
  background: linear-gradient(145deg, #1a1d28, #12141c);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

#overlay-card h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 10px;
}

#overlay-card p {
  font-size: 14px;
  opacity: 0.85;
  margin-bottom: 12px;
  line-height: 1.45;
}

.overlay-time {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: rgba(180, 200, 255, 0.9);
  margin-bottom: 6px !important;
}

.overlay-time.hidden {
  display: none;
}

.overlay-score {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #ffe566;
  text-shadow: 0 0 14px rgba(255, 220, 80, 0.6);
  margin-bottom: 18px !important;
  letter-spacing: 0.04em;
}

.overlay-score.hidden {
  display: none;
}

.overlay-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.overlay-btns button {
  pointer-events: auto;
  cursor: pointer;
  border: none;
  font-size: 15px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-key {
  font-size: 11px;
  font-weight: 700;
  font-family: "Courier New", monospace;
  letter-spacing: 0.05em;
  background: rgba(255,255,255,0.18);
  border-radius: 4px;
  padding: 2px 6px;
}

#restart {
  background: linear-gradient(180deg, #3d7cff, #2563eb);
  color: #fff;
}

#restart:hover { filter: brightness(1.08); }
#restart:active { transform: translateY(1px); }

#end-game {
  background: linear-gradient(180deg, #cc3333, #991a1a);
  color: #fff;
}

#end-game:hover { filter: brightness(1.1); }
#end-game:active { transform: translateY(1px); }
