/* Last Stand — golden-hour palette: warm sun, deep dust shadow. */
:root {
  --sun: #ffb367;
  --ember: #ff6a3d;
  --dust: #d98f52;
  --ink: #16120e;
  --panel: rgba(22, 18, 14, 0.88);
  --edge: rgba(255, 179, 103, 0.28);
  --text: #f4e9dc;
  --muted: #b9a58f;
  --fs-accent: #ffb367;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#gameCanvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ── HUD ──────────────────────────────────────────────────────────── */

#hud { position: fixed; inset: 0; pointer-events: none; display: none; }

/* The sky is a bright golden wash, so HUD text needs its own ground to sit on
   or it disappears completely against the horizon. */
#hud::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 132px;
  background: linear-gradient(180deg, rgba(12,8,5,.72), rgba(12,8,5,0));
  pointer-events: none;
}
.hud-bottom::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 150px;
  background: linear-gradient(0deg, rgba(12,8,5,.75), rgba(12,8,5,0));
  z-index: -1; pointer-events: none;
}

#hitmark {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 26px; opacity: 0; transition: opacity .09s; font-weight: 700;
  text-shadow: 0 0 6px rgba(0,0,0,.9);
}
/* Crosshair: a four-arm reticle. The old 4 px dot vanished against the dust. */
#crosshair {
  position: absolute; left: 50%; top: 50%; width: 26px; height: 26px;
  margin: -13px 0 0 -13px;
}
#crosshair span {
  position: absolute; background: rgba(255,255,255,.92);
  box-shadow: 0 0 3px rgba(0,0,0,.95);
}
#crosshair span:nth-child(1) { left: 12px; top: 0;  width: 2px; height: 8px; }
#crosshair span:nth-child(2) { left: 12px; bottom: 0; width: 2px; height: 8px; }
#crosshair span:nth-child(3) { top: 12px; left: 0;  height: 2px; width: 8px; }
#crosshair span:nth-child(4) { top: 12px; right: 0; height: 2px; width: 8px; }
#crosshair span:nth-child(5) { left: 12px; top: 12px; width: 2px; height: 2px; }

#banner {
  position: absolute; left: 50%; top: 16%; transform: translateX(-50%);
  font-size: clamp(20px, 4vw, 40px); font-weight: 800; letter-spacing: .12em;
  color: var(--sun); text-shadow: 0 3px 14px rgba(0,0,0,.9);
  opacity: 0; transition: opacity .35s; white-space: nowrap;
}

.hud-top {
  position: absolute; top: 0; left: 0; right: 0; padding: 14px 18px;
  display: flex; justify-content: space-between; align-items: flex-start;
  text-shadow: 0 2px 8px rgba(0,0,0,.9);
}
.hud-top, .hud-bottom { position: absolute; }
.wave-block .label { font-size: 11px; letter-spacing: .18em; color: #f0d9bd; }
.wave-block #waveNum { font-size: 34px; font-weight: 800; margin-left: 6px;
                       color: #fff3e4; }
.wave-state { display: block; font-size: 12px; letter-spacing: .16em;
              color: var(--sun); font-weight: 600; }
/* The audio strip docks top-right during a match (~350 px wide); drop the
   score below it rather than fighting for the same corner. */
.score-block { text-align: right; margin-top: 46px; }
.score-block #score { font-size: 26px; font-weight: 700; color: #fff3e4; }
.combo { display: block; font-size: 13px; color: var(--ember); font-weight: 700; }

.powerup {
  position: absolute; top: 96px; left: 50%; transform: translateX(-50%);
  font-size: 13px; letter-spacing: .16em; color: var(--sun); font-weight: 700;
}

.downed {
  position: absolute; left: 50%; top: 58%; transform: translateX(-50%);
  display: none; padding: 10px 18px; border: 1px solid var(--ember);
  background: rgba(60, 12, 6, .78); color: #ffd9c9; border-radius: 6px;
  font-weight: 700; letter-spacing: .06em; white-space: nowrap;
}
.revive-prompt {
  position: absolute; left: 50%; top: 64%; transform: translateX(-50%);
  display: none; font-size: 13px; letter-spacing: .14em; color: var(--sun);
  text-shadow: 0 2px 8px rgba(0,0,0,.9);
}

.hud-bottom {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  display: flex; justify-content: space-between; align-items: flex-end;
  text-shadow: 0 2px 8px rgba(0,0,0,.9);
}
.vitals { display: flex; align-items: center; gap: 10px; }
.bar { width: 210px; height: 12px; background: rgba(0,0,0,.55);
       border: 1px solid var(--edge); border-radius: 3px; overflow: hidden; }
.bar .fill { height: 100%; width: 100%; transition: width .12s linear; }
.bar.hp .fill { background: linear-gradient(90deg, #d63b23, var(--ember)); }
.bar.shield { width: 140px; display: none; }
.bar.shield .fill { background: linear-gradient(90deg, #4f7ad6, #8fb4ff); }
.vitals span { font-size: 20px; font-weight: 700; min-width: 44px; }
.weapon { text-align: right; }
.weapon #weaponName { font-size: 12px; letter-spacing: .16em; color: var(--muted); }
.weapon #ammo { font-size: 24px; font-weight: 700; }

.hud-audio { position: absolute; top: 12px; right: 14px; pointer-events: auto; }
/* Once relocated into the HUD the strip must stop being position:fixed, or it
   stays pinned to the viewport and sits on top of the score. */
.hud-audio .audio-controls { position: static; }

/* ── Overlay ──────────────────────────────────────────────────────── */

#lobbyOverlay {
  position: fixed; inset: 0; display: flex; align-items: center;
  justify-content: center; padding: 20px;
  background: radial-gradient(circle at 50% 35%,
              rgba(217,143,82,.22), rgba(10,8,6,.94) 70%);
  overflow-y: auto;
}
.card {
  width: min(560px, 100%); background: var(--panel);
  border: 1px solid var(--edge); border-radius: 12px; padding: 26px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6); text-align: center;
}
h1 { margin: 0 0 6px; font-size: clamp(28px, 6vw, 44px); letter-spacing: .14em;
     color: var(--sun); }
h2 { margin: 0 0 12px; letter-spacing: .1em; }
.tagline { color: var(--muted); margin: 0 0 18px; line-height: 1.5; }
.muted { color: var(--muted); font-size: 13px; }

input[type="text"] {
  width: 100%; padding: 11px 13px; margin-bottom: 12px; border-radius: 7px;
  border: 1px solid var(--edge); background: rgba(0,0,0,.4); color: var(--text);
  font-size: 15px; font-family: inherit;
}
button.primary {
  width: 100%; padding: 13px; border: 0; border-radius: 7px; cursor: pointer;
  background: linear-gradient(180deg, var(--sun), var(--ember));
  color: #24140a; font-weight: 800; letter-spacing: .1em; font-size: 15px;
  font-family: inherit;
}
button.primary:hover { filter: brightness(1.08); }

.squad-count { color: var(--dust); letter-spacing: .12em; font-size: 13px;
               margin-bottom: 10px; }
.player-list { margin-bottom: 16px; }
.player-row { padding: 7px 10px; margin-bottom: 5px; border-radius: 5px;
              background: rgba(255,179,103,.07); font-size: 14px; }

.briefing { margin-top: 16px; text-align: left; }
.briefing summary { cursor: pointer; color: var(--sun); font-size: 13px;
                    letter-spacing: .1em; }
.briefing ul { color: var(--muted); font-size: 13px; line-height: 1.7;
               padding-left: 18px; }

.load-bar { height: 10px; background: rgba(0,0,0,.5); border-radius: 5px;
            overflow: hidden; margin: 14px 0 8px; border: 1px solid var(--edge); }
#loadBar { height: 100%; width: 0; background: linear-gradient(90deg, var(--sun), var(--ember));
           transition: width .2s; }
.peers { margin-top: 10px; }

.countdown { font-size: clamp(64px, 18vw, 140px); font-weight: 900;
             color: var(--sun); text-shadow: 0 6px 30px rgba(255,106,61,.5); }

.back-link { display: inline-block; margin-top: 16px; color: var(--muted);
             text-decoration: none; font-size: 13px; }
.back-link:hover { color: var(--sun); }

/* ── Audio strip ──────────────────────────────────────────────────── */

.audio-controls {
  position: fixed; top: 12px; right: 12px; z-index: 60;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 7px 9px; border-radius: 8px; background: rgba(22,18,14,.82);
  border: 1px solid var(--edge);
}
.audio-controls button {
  background: rgba(255,179,103,.12); color: var(--text); cursor: pointer;
  border: 1px solid var(--edge); border-radius: 5px; padding: 5px 9px;
  font-size: 12px; font-family: inherit;
}
.audio-controls button:hover { background: rgba(255,179,103,.24); }
.audio-controls button.muted { opacity: .5; }
.volume-slider { width: 74px; accent-color: var(--sun); }

@media (max-width: 640px) {
  .bar { width: 130px; }
  .volume-slider { width: 52px; }
  .hud-audio { top: 78px; }
  .audio-controls { top: 8px; right: 8px; padding: 5px 6px; }
}
