* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0e1626;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: #fff8e6;
}

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

#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  transform: translate(-50%, -50%);
  border: 2px solid #fff8e6cc;
  border-radius: 50%;
  pointer-events: none;
  z-index: 15;
  mix-blend-mode: difference;
}

.back-link {
  position: fixed;
  top: 12px;
  left: 14px;
  color: #ffe9a8;
  text-decoration: none;
  font-weight: bold;
  font-size: 12px;
  letter-spacing: 0.5px;
  background: rgba(20, 16, 12, 0.5);
  padding: 6px 12px;
  border-radius: 20px;
  z-index: 20;
}

.back-link:hover {
  text-decoration: underline;
}

.hud {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  z-index: 15;
  pointer-events: none;
}

.hud.hidden {
  display: none;
}

.hp-block { width: 300px; max-width: 34vw; }
.hp-block.rival { display: flex; flex-direction: column; align-items: flex-end; }

.hp-name {
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
  margin-bottom: 3px;
}

.hp-track {
  height: 14px;
  border-radius: 7px;
  border: 2px solid #2b2010;
  background: rgba(20,16,8,0.55);
  overflow: hidden;
}

.hp-fill { height: 100%; width: 100%; }
.hp-fill.you { background: linear-gradient(180deg, #ffcf4d, #d99a1e); }
.hp-fill.rival { background: linear-gradient(180deg, #ff5f6d, #c62828); margin-left: auto; }

.squad-status {
  position: fixed;
  top: 46px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.5px;
  color: #fff;
  background: rgba(20, 16, 12, 0.55);
  padding: 5px 14px;
  border-radius: 14px;
  z-index: 15;
  pointer-events: none;
}

.squad-status.hidden {
  display: none;
}

.squad-blue { color: #6fb3ff; }
.squad-red { color: #ff6f6f; }

.build-hint {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.5px;
  color: #ffe9a8;
  background: rgba(20, 16, 12, 0.55);
  padding: 6px 14px;
  border-radius: 14px;
  z-index: 15;
}

.build-hint.hidden {
  display: none;
}

.spectator-note {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.5px;
  color: #ffb3b3;
  background: rgba(20, 16, 12, 0.65);
  border: 1px solid rgba(255, 111, 111, 0.35);
  padding: 7px 16px;
  border-radius: 14px;
  z-index: 15;
  pointer-events: none;
}

.spectator-note.hidden {
  display: none;
}

.debug-readout {
  position: fixed;
  top: 46px;
  right: 14px;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #7fffb0;
  background: rgba(0, 0, 0, 0.7);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 25;
  margin: 0;
  pointer-events: none;
  white-space: pre;
}

.debug-readout.hidden {
  display: none;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  background: rgba(14, 22, 38, 0.92);
  z-index: 30;
  padding: 20px;
}

.overlay.hidden {
  display: none;
}

.overlay h1 {
  margin: 0;
  font-size: 48px;
  letter-spacing: 5px;
  color: #ffe9a8;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4), 0 0 24px rgba(255, 179, 71, 0.35);
}

.overlay .tagline {
  margin: 0 0 8px;
  color: #fff8e6cc;
  font-size: 15px;
  font-weight: bold;
  max-width: 480px;
}

.overlay .result {
  font-size: 28px;
  color: #ffe9a8;
  margin: 0 0 4px;
  letter-spacing: 1px;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 4px 26px;
  margin: 6px 0 4px;
  font-size: 13px;
  text-align: left;
  color: #fff8e6dd;
}

.controls-grid b {
  color: #ffe9a8;
}

.overlay .hint {
  max-width: 460px;
  color: #fff8e6bb;
  font-size: 13px;
  margin: 4px 0 14px;
}

#startBtn {
  padding: 14px 42px;
  font-size: 19px;
  font-weight: bold;
  letter-spacing: 2px;
  color: #201530;
  background: linear-gradient(180deg, #ffe9a8, #ffb347);
  border: none;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 4px 0 #b5762a, 0 6px 16px rgba(0, 0, 0, 0.25);
  transition: transform 0.05s ease;
}

#startBtn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #b5762a, 0 2px 8px rgba(0, 0, 0, 0.25);
}

.secondary-btn {
  margin-top: 4px;
  padding: 10px 30px;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 1.5px;
  color: #fff8e6;
  background: rgba(255, 248, 230, 0.08);
  border: 1px solid rgba(255, 233, 168, 0.35);
  border-radius: 24px;
  cursor: pointer;
}

.secondary-btn:hover {
  background: rgba(255, 248, 230, 0.16);
}

.footnote {
  margin-top: 4px;
  font-size: 11px;
  color: #fff8e680;
}

/* Shown while a match is running but the mouse is not captured, so the player
   is told why looking around does nothing instead of assuming it is broken. */
.lock-hint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 14px 24px;
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 0.08em;
  color: #0a0908;
  background: rgba(232, 178, 60, 0.94);
  border-radius: 6px;
  pointer-events: none;
  z-index: 40;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.lock-hint.hidden { display: none; }

/* ---------- extra-life prompt ----------
   Centred and deliberately loud: it is on screen for a few seconds at most,
   competing with a firefight, and it is asking to spend something the player
   paid for. pointer-events stay on -- unlike the other HUD notes, this one is
   the only clickable thing on screen at that moment. */
.revive-prompt {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  text-align: center;
  padding: 22px 30px;
  border-radius: 18px;
  background: rgba(20, 16, 12, 0.92);
  border: 1px solid rgba(255, 179, 71, 0.55);
  box-shadow: 0 0 40px rgba(255, 111, 111, 0.18);
  font-family: inherit;
}

.revive-prompt.hidden { display: none; }

.revive-title {
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 2px;
  color: #ff8a8a;
  margin-bottom: 6px;
}

.revive-sub {
  font-size: 13px;
  color: #fff8e6;
  margin-bottom: 16px;
}

.revive-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 1px;
  color: #201530;
  background: linear-gradient(180deg, #ffe9a8, #ffb347);
  border: none;
  border-radius: 20px;
  padding: 11px 24px;
  cursor: pointer;
  box-shadow: 0 3px 0 #b5762a;
}

.revive-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #b5762a; }
.revive-btn:disabled { opacity: 0.6; cursor: default; }

/* Draining left-to-right, so the time remaining is readable at a glance
   without anyone having to parse a number mid-fight. */
.revive-timer {
  height: 4px;
  margin: 14px 0 10px;
  border-radius: 2px;
  background: rgba(255, 248, 230, 0.15);
  overflow: hidden;
}

.revive-timer-fill {
  height: 100%;
  width: 100%;
  background: #ffb347;
  transform-origin: left center;
}

.revive-hint {
  font-size: 11px;
  color: #fff8e680;
}
.revive-hint strong { color: #ffe9a8; }

/* ---------- extra life, under your own health bar ----------
   .hud sets pointer-events:none so the HUD never eats clicks meant for the
   arena; this one control has to opt back in or it could not be pressed. */
.extra-life-btn {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 1px;
  color: #201530;
  background: linear-gradient(180deg, #ffe9a8, #ffb347);
  border: 2px solid #2b2010;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 2px 0 #b5762a;
}

.extra-life-btn.hidden { display: none; }
.extra-life-btn:active { transform: translateY(2px); box-shadow: 0 0 0 #b5762a; }

/* Visible but plainly not yet usable: the player learns the button exists,
   and where it is, before the moment they need it. */
.extra-life-btn.locked {
  background: rgba(20, 16, 8, 0.55);
  color: rgba(255, 248, 230, 0.5);
  box-shadow: none;
  cursor: default;
}

/* Armed. Pulsing is justified here and almost nowhere else: it appears only
   when you are a couple of hits from dying, and it has to win attention
   against a firefight. */
.extra-life-btn.ready {
  animation: extraLifePulse 0.9s ease-in-out infinite;
}

@keyframes extraLifePulse {
  0%, 100% { box-shadow: 0 2px 0 #b5762a, 0 0 0 0 rgba(255, 179, 71, 0.55); }
  50%      { box-shadow: 0 2px 0 #b5762a, 0 0 0 7px rgba(255, 179, 71, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .extra-life-btn.ready { animation: none; outline: 2px solid #ffe9a8; }
}

.extra-life-icon { font-size: 13px; line-height: 1; }
.extra-life-count { opacity: 0.75; font-weight: normal; }
