/* Pastel Strike — mobile-first landscape FPS chrome */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a1a22;
  color: #f5f0e8;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Prevent browser gestures from stealing game input */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: fixed;
  inset: 0;
  z-index: 0;
}

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

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

#crosshair::before,
#crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.45);
}

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

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

/* Spawn protect — mint crosshair so invuln reads in first person */
#crosshair[data-protect="1"]::before,
#crosshair[data-protect="1"]::after {
  background: rgba(160, 245, 220, 0.95);
  box-shadow:
    0 0 6px rgba(120, 240, 200, 0.8),
    0 0 2px rgba(0, 0, 0, 0.4);
}

#prompt {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(40, 36, 48, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 14px;
  letter-spacing: 0.02em;
  text-align: center;
  max-width: min(90vw, 420px);
  line-height: 1.35;
  transition: opacity 0.25s ease;
}

#prompt.hidden {
  opacity: 0;
  visibility: hidden;
}

#stats {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

#round-timer {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  padding: 4px 14px;
  border-radius: 10px;
  background: rgba(30, 28, 40, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

#round-timer[data-low="1"] {
  color: #ffb0a8;
  border-color: rgba(255, 140, 130, 0.45);
}

#round-timer[data-ended="1"] {
  color: #f0e0b0;
  opacity: 0.85;
}

/* Live match label under timer; shows queued preset when chip differs */
#match-hint {
  position: absolute;
  top: max(36px, calc(env(safe-area-inset-top) + 32px));
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.7;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  pointer-events: none;
  max-width: min(70vw, 280px);
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

#match-hint[data-queued="1"] {
  color: #b8e8ff;
  opacity: 0.92;
}

/* ── Round end scoreboard ───────────────────────── */
.round-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 16, 28, 0.62);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

.round-overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Mid-fight hold-to-peek — lighter veil, combat continues (no pointer capture) */
.round-overlay.peek {
  background: rgba(18, 16, 28, 0.42);
  pointer-events: none;
}

.round-overlay.peek .round-card {
  max-height: min(70vh, 440px);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
  border-color: rgba(200, 220, 255, 0.22);
}

.round-overlay.peek #btn-restart {
  display: none;
}

.round-card {
  width: min(360px, 92vw);
  max-height: min(80vh, 520px);
  overflow: auto;
  padding: 20px 18px 18px;
  border-radius: 16px;
  background: linear-gradient(165deg, rgba(55, 50, 68, 0.94), rgba(32, 30, 42, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  text-align: center;
  color: #f5f0e8;
}

.round-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

.round-card .round-sub {
  font-size: 12px;
  opacity: 0.65;
  margin-bottom: 8px;
}

/* Mid-round juice recap under the match line (first blood / SD / streak) */
.round-card .round-highlights {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #e8d8b8;
  opacity: 0.92;
  margin: 0 0 12px;
  line-height: 1.35;
  min-height: 0;
}

.round-card .round-highlights[hidden] {
  display: none;
}

.scoreboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  text-align: left;
}

.scoreboard .row {
  display: grid;
  grid-template-columns: 2.2em 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.scoreboard .row.player {
  background: rgba(160, 220, 190, 0.18);
  border: 1px solid rgba(180, 230, 200, 0.28);
}

/* Winner crown row — warm cream edge */
.scoreboard .row.winner {
  background: rgba(240, 210, 140, 0.16);
  border: 1px solid rgba(240, 210, 140, 0.42);
  box-shadow: 0 0 0 1px rgba(240, 200, 120, 0.12);
}

.scoreboard .row.winner.player {
  background: linear-gradient(
    100deg,
    rgba(160, 220, 190, 0.22),
    rgba(240, 210, 140, 0.2)
  );
  border-color: rgba(220, 230, 170, 0.5);
}

/* First-blood row tint when not also winner (winner already golden) */
.scoreboard .row.first-blood:not(.winner) {
  box-shadow: inset 3px 0 0 rgba(255, 140, 120, 0.75);
}

.scoreboard .row.shutdown:not(.winner) {
  box-shadow: inset 3px 0 0 rgba(180, 140, 255, 0.7);
}

.scoreboard .row.first-blood.shutdown:not(.winner) {
  box-shadow:
    inset 3px 0 0 rgba(255, 140, 120, 0.75),
    inset 6px 0 0 rgba(180, 140, 255, 0.55);
}

.scoreboard .rank {
  opacity: 0.55;
  font-weight: 600;
}

.scoreboard .row.winner .rank {
  opacity: 0.95;
  color: #f0d878;
}

.scoreboard .name-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.scoreboard .name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scoreboard .badges {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.scoreboard .badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 4px;
  line-height: 1.35;
  white-space: nowrap;
}

.scoreboard .badge-first {
  color: #ffe8e0;
  background: rgba(220, 100, 80, 0.45);
  border: 1px solid rgba(255, 160, 140, 0.45);
}

.scoreboard .badge-shutdown {
  color: #f0e8ff;
  background: rgba(120, 80, 200, 0.45);
  border: 1px solid rgba(180, 140, 255, 0.45);
}

.scoreboard .badge-streak {
  color: #fff4d8;
  background: rgba(200, 140, 40, 0.4);
  border: 1px solid rgba(240, 190, 80, 0.5);
}

.scoreboard .badge-scavenge {
  color: #e0f4ff;
  background: rgba(60, 130, 180, 0.4);
  border: 1px solid rgba(120, 190, 230, 0.45);
}

.scoreboard .badge-assist {
  color: #fff6d8;
  background: rgba(180, 150, 50, 0.4);
  border: 1px solid rgba(230, 200, 100, 0.5);
}

.scoreboard .kd {
  opacity: 0.85;
  font-weight: 600;
}

#btn-restart {
  appearance: none;
  border: 2px solid rgba(180, 230, 210, 0.55);
  background: rgba(130, 210, 180, 0.35);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 12px 28px;
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  min-width: 160px;
}

#btn-restart:hover,
#btn-restart:focus-visible {
  background: rgba(140, 220, 190, 0.5);
  outline: none;
}

#btn-restart:active {
  transform: scale(0.97);
}

#weapon-hud {
  position: absolute;
  left: 50%;
  bottom: max(42px, calc(env(safe-area-inset-bottom) + 28px));
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 8px;
  background: rgba(30, 28, 40, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  opacity: 0.88;
  pointer-events: none;
}

#weapon-hud[data-weapon="shotgun"] {
  color: #ffd0a0;
  border-color: rgba(255, 180, 100, 0.45);
  background: rgba(60, 40, 28, 0.55);
}

#weapon-hud[data-weapon="smg"] {
  color: #b8e8ff;
  border-color: rgba(120, 200, 240, 0.5);
  background: rgba(28, 44, 56, 0.58);
}

/* PWA update toast — pointer-events on so Refresh is tappable.
   Default: bottom-center. Short landscape: top-center so it clears fire/HP chrome. */
.sw-update-toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  top: auto;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border-radius: 12px;
  background: rgba(32, 36, 48, 0.92);
  border: 1px solid rgba(200, 230, 208, 0.35);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  color: #f0f4f0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: auto;
  max-width: min(92vw, 360px);
}

@media (orientation: landscape) and (max-height: 420px) {
  .sw-update-toast {
    bottom: auto;
    top: max(10px, env(safe-area-inset-top));
    /* Nudge under timer/stats on very short viewports */
    max-width: min(70vw, 320px);
  }
}

.sw-update-toast[hidden] {
  display: none !important;
}

.sw-update-toast #btn-sw-refresh {
  pointer-events: auto;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1a2420;
  background: #c8e6d0;
  cursor: pointer;
  min-height: 36px;
  min-width: 72px;
}

.sw-update-toast #btn-sw-refresh:hover,
.sw-update-toast #btn-sw-refresh:focus-visible {
  background: #d8f0e0;
  outline: none;
}

.sw-update-toast #btn-sw-refresh:active {
  transform: scale(0.97);
}

#hp-bar {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(220px, 46vw);
  text-align: center;
  pointer-events: none;
}

#hp-bar .hp-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  opacity: 0.9;
}

#hp-bar .hp-track {
  height: 8px;
  border-radius: 6px;
  background: rgba(20, 18, 28, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

#hp-fill {
  height: 100%;
  width: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, #7ec8a8, #b8e8c8);
  transition: width 0.08s linear;
}

#hp-bar[data-low="1"] #hp-fill {
  background: linear-gradient(90deg, #e87888, #f0b0a0);
}

/* Spawn protection — mint pulse so invuln reads clearly */
#hp-bar[data-protect="1"] #hp-fill {
  background: linear-gradient(90deg, #7ed4c8, #e8fff4);
  box-shadow: 0 0 10px rgba(140, 240, 210, 0.65);
  animation: protect-pulse 0.35s ease-in-out infinite alternate;
}

#hp-bar[data-protect="1"] .hp-label {
  color: #c8f5e8;
  letter-spacing: 0.06em;
}

@keyframes protect-pulse {
  from {
    filter: brightness(1);
  }
  to {
    filter: brightness(1.25);
  }
}

#damage-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 42%,
    rgba(180, 40, 60, 0.55) 100%
  );
  transition: opacity 0.05s linear;
}

/* Spawn protect — mint edge glow (wins over damage/heartbeat while invuln) */
#damage-vignette.protect {
  animation: protect-vignette-pulse 0.35s ease-in-out infinite alternate;
  background: radial-gradient(
    ellipse at center,
    transparent 50%,
    rgba(90, 210, 180, 0.38) 100%
  );
  opacity: 0.55;
}

@keyframes protect-vignette-pulse {
  from {
    opacity: 0.38;
  }
  to {
    opacity: 0.62;
  }
}

/* Soft low-HP pulse (audio heartbeat paired in main) */
#damage-vignette.heartbeat {
  animation: hp-heartbeat 1.15s ease-in-out infinite;
  background: radial-gradient(
    ellipse at center,
    transparent 48%,
    rgba(160, 30, 50, 0.42) 100%
  );
}

@keyframes hp-heartbeat {
  0%,
  100% {
    opacity: 0.12;
  }
  12% {
    opacity: 0.28;
  }
  24% {
    opacity: 0.14;
  }
  36% {
    opacity: 0.24;
  }
  50% {
    opacity: 0.12;
  }
}

/* Touch: lift HP / weapon chrome above larger fire button */
body.touch-ui #hp-bar {
  bottom: max(120px, calc(env(safe-area-inset-bottom) + 108px));
}

body.touch-ui #weapon-hud {
  bottom: max(144px, calc(env(safe-area-inset-bottom) + 132px));
}

/* Settings tray — primary combat chips + overflow for settings (SCR stays primary) */
#settings-tray {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 25;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(24, 22, 34, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  pointer-events: none;
}

#settings-tray .tray-primary,
#settings-tray .tray-more-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  pointer-events: none;
}

#settings-tray .tray-more-wrap {
  position: relative;
}

#settings-tray button {
  pointer-events: auto;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(30, 28, 40, 0.55);
  color: #f0ebe3;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 6px 10px;
  border-radius: 8px;
  min-width: 48px;
  min-height: 32px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

#settings-tray button:active {
  transform: scale(0.97);
}

/* Overflow drawer — HQ / SND / SEMI; collapsed on short/narrow landscape + touch */
#tray-overflow {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  pointer-events: none;
}

#tray-overflow button {
  pointer-events: auto;
}

#btn-tray-more {
  min-width: 36px;
  letter-spacing: 0.12em;
  padding-left: 8px;
  padding-right: 8px;
}

#btn-tray-more[aria-expanded="true"] {
  color: #d8e8ff;
  border-color: rgba(180, 210, 255, 0.5);
  background: rgba(36, 44, 64, 0.65);
}

/*
 * Expanded pack (wide desktop, not touch): HQ/SND/SEMI inline, ··· hidden.
 * Compact / touch: ··· toggles a popover so primary STD/GO/SCR clear the timer.
 * Viewport media mirrors .tray-compact so first paint collapses without waiting for JS.
 */
body:not(.touch-ui):not(.tray-compact) #btn-tray-more {
  display: none;
}

body:not(.touch-ui):not(.tray-compact) #tray-overflow,
body:not(.touch-ui):not(.tray-compact) #tray-overflow[hidden] {
  display: flex !important; /* override [hidden] in expanded mode */
}

/* Drawer opens *upward* so HQ/MUTE never cover the right look/fire zone */
body.touch-ui #tray-overflow:not([hidden]),
body.tray-compact #tray-overflow:not([hidden]) {
  position: absolute;
  bottom: calc(100% + 6px);
  top: auto;
  right: 0;
  z-index: 26;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 5px;
  border-radius: 10px;
  background: rgba(24, 22, 34, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
  min-width: 72px;
  pointer-events: auto;
}

body.touch-ui #tray-overflow:not([hidden]) button,
body.tray-compact #tray-overflow:not([hidden]) button {
  width: 100%;
  min-width: 64px;
  justify-content: center;
}

/* First-paint compact: short/narrow landscape collapses before body classes land */
@media (orientation: landscape) and (max-height: 420px),
  (orientation: landscape) and (max-width: 720px) {
  body:not(.touch-ui):not(.tray-compact) #btn-tray-more {
    display: inline-block; /* restore ··· until .tray-compact is applied */
  }

  body:not(.touch-ui):not(.tray-compact) #tray-overflow,
  body:not(.touch-ui):not(.tray-compact) #tray-overflow[hidden] {
    display: none !important; /* stay closed until ··· open */
  }
}

#btn-quality[data-quality="low"] {
  color: #c8e8d8;
  border-color: rgba(160, 220, 190, 0.4);
}

#btn-autofire[data-autofire="1"] {
  color: #f0d090;
  border-color: rgba(240, 192, 112, 0.55);
  background: rgba(50, 40, 28, 0.62);
}

/* Desktop auto-fire chip; hidden on touch-ui (hold-fire is default) */
body.touch-ui #btn-autofire {
  display: none;
}

#btn-match[data-match="quick"] {
  color: #b8e8ff;
  border-color: rgba(120, 200, 240, 0.5);
  background: rgba(28, 44, 56, 0.58);
}

#btn-match[data-match="chaos"] {
  color: #ffc0b0;
  border-color: rgba(255, 150, 130, 0.5);
  background: rgba(56, 32, 32, 0.58);
}

/* Mid-round: restart into queued preset (only when chip ≠ live) */
#btn-go {
  color: #b8f0d8;
  border-color: rgba(120, 230, 180, 0.55);
  background: rgba(28, 52, 42, 0.62);
  min-width: 40px;
  letter-spacing: 0.08em;
}

#btn-go:hover,
#btn-go:focus-visible {
  background: rgba(40, 72, 56, 0.72);
  outline: none;
}

/* Hold for live standings (Tab / SCR) */
#btn-board[data-held="1"] {
  color: #e8f0ff;
  border-color: rgba(180, 210, 255, 0.55);
  background: rgba(36, 48, 72, 0.68);
}

#btn-mute[data-muted="1"] {
  color: #c8b8d8;
  border-color: rgba(180, 160, 210, 0.5);
  background: rgba(40, 32, 52, 0.62);
}

/* End card: secondary line when Play again adopts a different preset */
.round-card .round-sub[data-next="1"] {
  color: #b8e8ff;
  opacity: 0.9;
}

/* Narrow landscape: tighter primary chips (overflow holds HQ/SND) */
@media (orientation: landscape) and (max-width: 720px) {
  #settings-tray {
    gap: 4px;
    padding: 3px;
  }

  #settings-tray .tray-primary,
  #settings-tray .tray-more-wrap {
    gap: 4px;
  }

  #settings-tray button {
    min-width: 42px;
    padding: 5px 8px;
    font-size: 10px;
    letter-spacing: 0.04em;
  }

  #btn-tray-more {
    min-width: 32px;
    padding-left: 6px;
    padding-right: 6px;
  }

  /* Keep match-hint from colliding with tray on phones */
  #match-hint {
    max-width: min(52vw, 220px);
  }
}

/* Short landscape: timer/hint vs primary tray clearance (i27 overflow) */
@media (orientation: landscape) and (max-height: 420px) {
  #round-timer {
    font-size: 15px;
    padding: 3px 10px;
  }

  #match-hint {
    top: max(30px, calc(env(safe-area-inset-top) + 26px));
    font-size: 9px;
    max-width: min(50vw, 200px);
    letter-spacing: 0.04em;
  }

  #settings-tray {
    gap: 3px;
    padding: 2px;
  }

  #settings-tray .tray-primary,
  #settings-tray .tray-more-wrap {
    gap: 3px;
  }

  #settings-tray button {
    min-width: 36px;
    min-height: 28px;
    padding: 4px 6px;
    font-size: 10px;
  }

  #btn-tray-more {
    min-width: 28px;
    letter-spacing: 0.08em;
  }

  #kill-feed {
    /* Primary row is shorter with overflow — feed can sit closer under tray */
    top: max(40px, calc(env(safe-area-inset-top) + 36px));
    max-width: min(36vw, 150px);
    font-size: 11px;
    /* ~3 lines — feed soft-caps in JS too */
    max-height: 4.4em;
    overflow: hidden;
  }

  #streak-banner {
    top: 30%;
    font-size: clamp(14px, 3.6vw, 22px);
    letter-spacing: 0.1em;
  }

  #stats {
    font-size: 11px;
  }
}

/* Very narrow landscape width: further shrink center cue vs right tray */
@media (orientation: landscape) and (max-width: 560px) {
  #match-hint {
    max-width: min(48vw, 180px);
  }

  #settings-tray button {
    min-width: 34px;
    padding: 4px 5px;
    font-size: 9px;
    letter-spacing: 0.03em;
  }

  #btn-tray-more {
    min-width: 26px;
    padding-left: 4px;
    padding-right: 4px;
  }
}

/* Multi-kill center banner */
#streak-banner {
  position: absolute;
  left: 50%;
  top: 28%;
  transform: translate(-50%, -8px);
  font-size: clamp(18px, 4.5vw, 28px);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff6d0;
  text-shadow:
    0 0 12px rgba(255, 180, 80, 0.75),
    0 2px 6px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s ease;
}

#streak-banner.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  animation: streak-pop 0.35s ease-out;
}

#streak-banner[data-streak="3"] {
  color: #ffe0a8;
}

#streak-banner[data-streak="4"] {
  color: #ffc090;
}

#streak-banner[data-streak="5"] {
  color: #ffb0c8;
  letter-spacing: 0.18em;
}

/* First-blood / lead / shutdown reuse the streak banner with cooler tints */
#streak-banner[data-kind="first"] {
  color: #ffd0c8;
  letter-spacing: 0.1em;
}

#streak-banner[data-kind="shutdown"] {
  color: #e8c0ff;
  letter-spacing: 0.12em;
}

#streak-banner[data-kind="lead"] {
  color: #c8f0d8;
  letter-spacing: 0.12em;
}

@keyframes streak-pop {
  from {
    opacity: 0;
    transform: translate(-50%, 10px) scale(0.85);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

#hitmarker {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0;
  pointer-events: none;
  transition: none;
}

#hitmarker::before,
#hitmarker::after {
  content: "";
  position: absolute;
  background: #fff6c8;
  box-shadow: 0 0 4px rgba(255, 180, 80, 0.9);
}

/* X hitmarker */
#hitmarker::before {
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  transform: translateX(-50%) rotate(45deg);
}

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

#hitmarker.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Kill feed sits below settings tray on the right */
#kill-feed {
  position: absolute;
  top: max(50px, calc(env(safe-area-inset-top) + 46px));
  right: max(10px, env(safe-area-inset-right));
  font-size: 12px;
  text-align: right;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  line-height: 1.45;
  opacity: 0.9;
  max-width: min(46vw, 220px);
}

#kill-feed div {
  animation: feed-in 0.2s ease-out;
}

/* Multi-kill feed lines — warm accent by streak tier */
#kill-feed div.streak {
  font-weight: 700;
  color: #ffe8b0;
}

#kill-feed div.streak[data-streak="3"] {
  color: #ffd090;
}

#kill-feed div.streak[data-streak="4"] {
  color: #ffb878;
}

#kill-feed div.streak[data-streak="5"] {
  color: #ffb0c0;
}

/* Bot special-weapon arm voice (shotgun orange / SMG sky) */
#kill-feed div.special {
  font-weight: 700;
  letter-spacing: 0.02em;
}

#kill-feed div.special[data-weapon="shotgun"] {
  color: #ffc080;
}

#kill-feed div.special[data-weapon="smg"] {
  color: #9ad8f0;
}

/* Corpse scavenge — softer than hard pad ARMED (same weapon hue, lower contrast) */
#kill-feed div.special.scav[data-weapon="shotgun"] {
  color: #e8c8a0;
  font-weight: 600;
}

#kill-feed div.special.scav[data-weapon="smg"] {
  color: #b0d4e4;
  font-weight: 600;
}

/* Coalesced score-juice feed lines (first blood / shutdown / lead) */
#kill-feed div.juice[data-kind="first"] {
  font-weight: 700;
  color: #ffd0c8;
}

#kill-feed div.juice[data-kind="shutdown"] {
  font-weight: 700;
  color: #e8c0ff;
}

#kill-feed div.juice[data-kind="assist"] {
  color: #e8d090;
  font-weight: 600;
  letter-spacing: 0.02em;
}

#kill-feed div.juice[data-kind="lead"] {
  font-weight: 700;
  color: #c8f0d8;
}

@keyframes feed-in {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Touch controls ──────────────────────────────── */
#touch-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  display: none;
}

body.touch-ui #touch-layer {
  display: block;
}

.touch-zone {
  position: absolute;
  bottom: 0;
  top: 0;
  width: 50%;
  pointer-events: auto;
}

#zone-move {
  left: 0;
}

#zone-look {
  right: 0;
}

.stick-base {
  position: absolute;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.stick-base.active {
  opacity: 1;
}

.stick-knob {
  position: absolute;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.5);
  left: 50%;
  top: 50%;
  pointer-events: none;
}

#btn-fire {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  /* Larger hit target for landscape thumbs (pillar §1) */
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 2px solid rgba(255, 200, 210, 0.55);
  background: rgba(255, 150, 170, 0.35);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  /* Expand touch without shifting visual if browser supports */
  touch-action: manipulation;
}

#btn-fire:active,
#btn-fire.held {
  background: rgba(255, 120, 150, 0.55);
  transform: scale(0.96);
}

#btn-jump {
  position: absolute;
  right: max(112px, calc(env(safe-area-inset-right) + 104px));
  bottom: max(24px, env(safe-area-inset-bottom));
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2px solid rgba(180, 230, 210, 0.5);
  background: rgba(150, 220, 200, 0.32);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#btn-jump:active {
  background: rgba(120, 210, 185, 0.5);
}

/* Desktop: hide fire/jump chrome unless touch-ui forced */
body:not(.touch-ui) #btn-fire,
body:not(.touch-ui) #btn-jump {
  display: none;
}
