/* ===================================================================
   Operation Haptic Strike — tactical FPS interface
   Design language: modern competitive shooter (CS:GO / Valorant era)
   Flat dark glass panels, condensed type, restrained accent colour.
   =================================================================== */

:root {
  /* Surfaces */
  --bg-deep: #07090c;
  --bg-base: #0a0d12;
  --surface: rgba(18, 22, 28, 0.94);
  --surface-2: rgba(255, 255, 255, 0.035);
  --surface-3: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);

  /* Type */
  --text: #e8ecf2;
  --text-dim: #9aa4b2;
  --text-faint: #6b7482;

  /* Accents */
  --accent: #e0a63c;
  --accent-hi: #f2bb56;
  --accent-soft: rgba(224, 166, 60, 0.14);
  --ct: #5d9de0;
  --ct-soft: rgba(93, 157, 224, 0.14);
  --t: #d9a13b;
  --red: #e2464c;
  --red-soft: rgba(226, 70, 76, 0.15);
  --green: #4ec97a;

  /* Fonts */
  --f-display: 'Barlow Condensed', 'Oswald', 'Arial Narrow', sans-serif;
  --f-num: 'Rajdhani', 'Barlow Condensed', 'Consolas', monospace;
  --f-body: 'Barlow', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'SFMono-Regular', 'Consolas', 'Roboto Mono', monospace;

  /* Geometry */
  --r-sm: 3px;
  --r-md: 5px;
  --r-lg: 8px;
  --crosshair-gap: 6px;

  /* Safe areas */
  --sa-t: env(safe-area-inset-top, 0px);
  --sa-r: env(safe-area-inset-right, 0px);
  --sa-b: env(safe-area-inset-bottom, 0px);
  --sa-l: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
  font-family: var(--f-body);
  color: var(--text);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ico {
  width: 1em;
  height: 1em;
  flex: none;
  fill: none;
  stroke: none;
  color: inherit;
}

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

/* Damage vignette ------------------------------------------------- */
#damage-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  opacity: 0;
  background: radial-gradient(circle at center,
              transparent 55%,
              rgba(150, 12, 14, 0.35) 88%,
              rgba(110, 0, 2, 0.8) 100%);
  transition: opacity 0.22s ease-out;
}

#damage-overlay.flash {
  opacity: 1;
  transition: none;
}

/* ===================================================================
   Shared primitives
   =================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--f-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--surface-3);
  color: var(--text);
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.08s ease;
  touch-action: manipulation;
}

.btn .ico {
  width: 17px;
  height: 17px;
}

.btn:active:not(:disabled) { transform: translateY(1px); }

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #14100a;
}

.btn-accent:hover:not(:disabled) { background: var(--accent-hi); border-color: var(--accent-hi); }

.btn-ghost {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost:hover:not(:disabled) { background: var(--surface-3); border-color: var(--line-strong); }

.btn-outline {
  background: transparent;
  border-color: rgba(93, 157, 224, 0.45);
  color: var(--ct);
}

.btn-outline:hover:not(:disabled) { background: var(--ct-soft); border-color: var(--ct); }

.btn-lg { font-size: 17px; padding: 13px 30px; }
.btn-block { width: 100%; }

.btn:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.4);
  font-family: var(--f-display);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--text-faint);
}

.chip.disconnected { color: #c9737a; border-color: rgba(226, 70, 76, 0.4); }
.chip.disconnected .status-dot { background: var(--red); box-shadow: 0 0 7px rgba(226, 70, 76, 0.8); }
.chip.connected { color: #7fdca0; border-color: rgba(78, 201, 122, 0.45); }
.chip.connected .status-dot { background: var(--green); box-shadow: 0 0 7px rgba(78, 201, 122, 0.85); }
.chip.connecting { color: var(--accent); border-color: rgba(224, 166, 60, 0.45); }
.chip.connecting .status-dot { background: var(--accent); animation: blink 0.8s infinite; }

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

kbd {
  font-family: var(--f-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 6px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
  color: var(--text);
  white-space: nowrap;
}

.mono { font-family: var(--f-mono); }

/* ===================================================================
   Combat HUD
   =================================================================== */
/* Sits above #touch-controls so the scoreboard and pause buttons stay
   tappable through the full-screen aim surface. Everything in here is
   pointer-events: none except the button cluster. */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 24;
  display: none;
  font-family: var(--f-display);
}

.hud-corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-top-left {
  top: calc(14px + var(--sa-t));
  left: calc(14px + var(--sa-l));
  align-items: flex-start;
}

.hud-top-right {
  top: calc(14px + var(--sa-t));
  right: calc(14px + var(--sa-r));
  align-items: flex-end;
}

/* Radar ----------------------------------------------------------- */
.radar-frame {
  position: relative;
  width: 148px;
  height: 148px;
  border-radius: var(--r-lg);
  background: rgba(6, 12, 9, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.65), 0 4px 18px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  backdrop-filter: blur(3px);
}

.radar-canvas { width: 100%; height: 100%; display: block; }

.radar-tag {
  position: absolute;
  left: 8px;
  bottom: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.42);
}

.chip-mini { font-size: 10px; padding: 4px 9px; }

/* Round bar ------------------------------------------------------- */
.hud-roundbar {
  position: absolute;
  top: calc(12px + var(--sa-t));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: stretch;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(8, 11, 15, 0.72);
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}

.team-score {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
}

.team-tag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  opacity: 0.85;
}

.team-points {
  font-family: var(--f-num);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.team-score.ct { background: rgba(93, 157, 224, 0.14); color: var(--ct); }
.team-score.t { background: rgba(217, 161, 59, 0.14); color: var(--t); }

.round-clock {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  color: var(--text);
}

.round-clock .ico { width: 15px; height: 15px; opacity: 0.6; }

.clock-time {
  font-family: var(--f-num);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
}

.round-clock.is-urgent { color: var(--red); }
.round-clock.is-urgent .ico { opacity: 1; }

/* Quick buttons --------------------------------------------------- */
.hud-btn-cluster { display: flex; gap: 8px; pointer-events: auto; }

.hud-icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(8, 11, 15, 0.66);
  color: var(--text-dim);
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: color 0.14s ease, border-color 0.14s ease, background 0.14s ease;
  touch-action: manipulation;
}

.hud-icon-btn .ico { width: 19px; height: 19px; }
.hud-icon-btn:hover, .hud-icon-btn:active { color: var(--text); border-color: var(--line-strong); background: rgba(20, 26, 34, 0.85); }

/* Killfeed -------------------------------------------------------- */
.hud-killfeed {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-end;
  max-width: min(46vw, 420px);
}

.killfeed-item {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 11px;
  border-radius: var(--r-sm);
  background: rgba(8, 11, 15, 0.76);
  border-left: 2px solid var(--line-strong);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  animation: feed-in 0.18s ease-out;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.killfeed-item.hs { border-left-color: var(--accent); }
.killfeed-killer { color: var(--ct); }
.killfeed-victim { color: #e28b8b; }
.killfeed-weapon { color: var(--text-dim); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.killfeed-hs { color: var(--accent); font-size: 11px; letter-spacing: 0.1em; }

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

/* Crosshair ------------------------------------------------------- */
#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  pointer-events: none;
}

.ch-line {
  position: absolute;
  background: #3dff67;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.85);
}

.ch-top    { top: 0;    left: 21px; width: 2px; height: 9px; transform: translateY(calc(-1 * var(--crosshair-gap))); }
.ch-bottom { bottom: 0; left: 21px; width: 2px; height: 9px; transform: translateY(var(--crosshair-gap)); }
.ch-left   { top: 21px; left: 0;    width: 9px; height: 2px; transform: translateX(calc(-1 * var(--crosshair-gap))); }
.ch-right  { top: 21px; right: 0;   width: 9px; height: 2px; transform: translateX(var(--crosshair-gap)); }

.ch-dot {
  position: absolute;
  top: 21px;
  left: 21px;
  width: 2px;
  height: 2px;
  background: #3dff67;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.85);
}

#crosshair.is-aiming .ch-line { opacity: 0.25; }

#hitmarker {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
}

#hitmarker svg { width: 100%; height: 100%; fill: none; }
#hitmarker.show { opacity: 1; transition: none; }
#hitmarker.kill { color: var(--red); }

/* Vitals ---------------------------------------------------------- */
.hud-vitals {
  position: absolute;
  left: calc(20px + var(--sa-l));
  bottom: calc(18px + var(--sa-b));
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.vital {
  display: grid;
  grid-template-columns: 22px auto;
  grid-template-rows: auto 3px;
  align-items: center;
  column-gap: 9px;
  row-gap: 5px;
  color: var(--text);
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.85);
}

.vital-ico { width: 20px; height: 20px; opacity: 0.9; fill: currentColor; }
.vital-armor .vital-ico { color: var(--ct); }

.vital-val {
  font-family: var(--f-num);
  font-size: 34px;
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: 0.01em;
  min-width: 62px;
}

.vital-track {
  grid-column: 1 / -1;
  width: 92px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.vital-track i {
  display: block;
  height: 100%;
  background: #fff;
  transition: width 0.2s ease-out;
}

.vital-armor .vital-track i { background: var(--ct); }

.stat-box-critical { color: var(--red); }
.stat-box-critical .vital-track i { background: var(--red); }
.stat-box-critical .vital-val { animation: pulse-danger 0.75s infinite alternate; }

@keyframes pulse-danger { from { opacity: 0.62; } to { opacity: 1; } }

/* Cash ------------------------------------------------------------ */
.hud-money {
  position: absolute;
  left: 50%;
  bottom: calc(18px + var(--sa-b));
  transform: translateX(-50%);
  font-family: var(--f-num);
  font-size: 22px;
  font-weight: 700;
  color: #8fdca8;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
  opacity: 0.9;
}

.money-sign { opacity: 0.6; margin-right: 2px; }

/* Ammo ------------------------------------------------------------ */
.hud-ammo {
  position: absolute;
  right: calc(20px + var(--sa-r));
  bottom: calc(18px + var(--sa-b));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.85);
}

.ammo-head {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-dim);
}

.ammo-weapon { font-size: 13px; font-weight: 600; letter-spacing: 0.16em; }
.ammo-ico { width: 9px; height: 18px; fill: currentColor; opacity: 0.85; }

.ammo-counts { display: flex; align-items: baseline; gap: 6px; font-family: var(--f-num); line-height: 0.9; }
.ammo-clip { font-size: 40px; font-weight: 700; color: var(--text); }
.ammo-sep { font-size: 22px; color: rgba(255, 255, 255, 0.3); }
.ammo-reserve { font-size: 22px; font-weight: 600; color: var(--text-dim); }

.ammo-track {
  width: 92px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.ammo-track i { display: block; height: 100%; background: #fff; transition: width 0.12s linear; }

.ammo-low .ammo-clip { color: var(--red); }
.ammo-low .ammo-track i { background: var(--red); }

.reload-indicator {
  display: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.reload-indicator.show { display: block; animation: blink 0.7s infinite; }

/* Key hints ------------------------------------------------------- */
.hud-keyhints {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(54px + var(--sa-b));
  display: flex;
  gap: 16px;
  align-items: center;
  white-space: nowrap;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.hud-keyhints span { display: inline-flex; align-items: center; gap: 6px; }

/* Round banner ---------------------------------------------------- */
#round-banner {
  position: absolute;
  top: 26%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 18;
  display: none;
  padding: 12px 34px;
  border-radius: var(--r-md);
  font-family: var(--f-display);
  font-size: clamp(22px, 4.2vw, 36px);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-align: center;
  background: rgba(8, 11, 15, 0.82);
  border-left: 3px solid var(--line-strong);
  border-right: 3px solid var(--line-strong);
  backdrop-filter: blur(5px);
  animation: banner-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

#round-banner.ct-win { color: var(--ct); border-color: var(--ct); }
#round-banner.t-win { color: var(--t); border-color: var(--t); }

@keyframes banner-in {
  from { transform: translate(-50%, -50%) scale(0.88); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ===================================================================
   Scoreboard
   =================================================================== */
#scoreboard-modal {
  position: fixed;
  inset: 0;
  z-index: 26;
  display: none;
  justify-content: center;
  align-items: center;
  padding: calc(14px + var(--sa-t)) calc(14px + var(--sa-r)) calc(14px + var(--sa-b)) calc(14px + var(--sa-l));
  background: rgba(4, 6, 9, 0.7);
  backdrop-filter: blur(6px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.scoreboard {
  width: min(760px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.sb-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.sb-map {
  font-family: var(--f-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sb-meta { font-size: 11.5px; color: var(--text-faint); letter-spacing: 0.03em; }

.sb-head-right { display: flex; align-items: center; gap: 12px; }

.sb-round {
  font-family: var(--f-display);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.sb-round b { color: var(--accent); }

.sb-head-right .hud-icon-btn { pointer-events: auto; }

.sb-teams { overflow-y: auto; -webkit-overflow-scrolling: touch; }

.sb-team + .sb-team { border-top: 1px solid var(--line); }

.sb-team-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-family: var(--f-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.sb-team.ct .sb-team-head { background: rgba(93, 157, 224, 0.12); color: #9cc4ee; border-left: 3px solid var(--ct); }
.sb-team.t .sb-team-head { background: rgba(217, 161, 59, 0.12); color: #e8c584; border-left: 3px solid var(--t); }
.sb-team-score { color: var(--text); }

.sb-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.sb-table th {
  text-align: left;
  padding: 7px 16px;
  font-family: var(--f-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--line);
}

.sb-table th:not(:first-child), .sb-table td:not(:first-child) { width: 74px; }
.sb-table td { padding: 9px 16px; color: var(--text-dim); }
.sb-table tbody tr + tr td { border-top: 1px solid rgba(255, 255, 255, 0.05); }
.sb-you td { color: var(--text); font-weight: 600; background: rgba(224, 166, 60, 0.07); }

.sb-tag {
  display: inline-block;
  margin-left: 7px;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--f-display);
  font-size: 10px;
  letter-spacing: 0.12em;
}

/* ===================================================================
   Full-screen menu screens
   =================================================================== */
.screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: calc(14px + var(--sa-t)) calc(14px + var(--sa-r)) calc(14px + var(--sa-b)) calc(14px + var(--sa-l));
  background:
    radial-gradient(ellipse at 50% 40%, rgba(12, 16, 22, 0.72) 0%, rgba(4, 6, 9, 0.96) 72%),
    linear-gradient(0deg, rgba(4, 6, 9, 0.9), rgba(4, 6, 9, 0.9));
  backdrop-filter: blur(7px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.024) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 78%);
}

.panel {
  position: relative;
  z-index: 1;
  width: min(880px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.75);
  overflow: hidden;
}

.panel-narrow { width: min(460px, 100%); }

/* Panel header ---------------------------------------------------- */
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
  flex: none;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: var(--r-md);
  background: var(--accent);
  color: #14100a;
  font-family: var(--f-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.brand-title {
  font-family: var(--f-display);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-title b { color: var(--text); font-weight: 700; }

.brand-sub {
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Panel body: nav + content -------------------------------------- */
.panel-body {
  display: flex;
  min-height: 0;
  flex: 1;
}

.menu-nav {
  flex: none;
  width: 168px;
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 3px;
  border-right: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.24);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: none;
  border-left: 2px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--f-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
  touch-action: manipulation;
}

.nav-item .ico { width: 18px; height: 18px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }

.nav-item.active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--accent-hi);
}

.menu-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 20px 22px 22px;
}

.pane { display: none; flex-direction: column; gap: 16px; }
.pane.active { display: flex; }

.pane-head { display: flex; flex-direction: column; gap: 6px; }

.pane-head h2 {
  font-family: var(--f-display);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pane-head p { font-size: 13.5px; line-height: 1.55; color: var(--text-dim); max-width: 56ch; }

.hint { font-size: 12.5px; line-height: 1.5; color: var(--text-faint); }
.hint-warn { color: #c9a06a; }

.pane-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pane-actions-center { justify-content: center; }

/* Briefing grid --------------------------------------------------- */
.brief, .spec {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.brief-cell, .spec-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 13px;
  background: rgba(12, 15, 20, 0.9);
}

.brief-k {
  font-family: var(--f-display);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.brief-v {
  font-family: var(--f-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text);
}

.ct-text { color: var(--ct); }

/* Segmented control ---------------------------------------------- */
.segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(0, 0, 0, 0.3);
}

.seg {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--f-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
  touch-action: manipulation;
}

.seg.active { background: var(--accent-soft); color: var(--accent-hi); }

.mp-view { display: flex; flex-direction: column; gap: 11px; }

.room-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(0, 0, 0, 0.26);
}

.field-label {
  font-family: var(--f-display);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.room-code {
  font-family: var(--f-num);
  font-size: clamp(28px, 7vw, 38px);
  font-weight: 700;
  letter-spacing: 0.22em;
  text-align: center;
  color: var(--accent-hi);
  padding: 10px 6px;
  border: 1px dashed rgba(224, 166, 60, 0.45);
  border-radius: var(--r-md);
  background: rgba(224, 166, 60, 0.06);
  user-select: all;
  -webkit-user-select: all;
}

.input-code {
  width: 100%;
  font-family: var(--f-num);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: rgba(0, 0, 0, 0.42);
  color: var(--text);
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.input-code:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-code::placeholder { color: var(--text-faint); }

.status-line { font-size: 12.5px; letter-spacing: 0.04em; line-height: 1.5; color: var(--text-dim); }
.status-line.waiting { color: var(--accent); animation: blink 1.6s infinite; }
.status-line.connected { color: var(--green); }
.status-line.error { color: #ef7f84; }
.status-line.disconnected { color: var(--text-faint); }

/* Hardware log ---------------------------------------------------- */
.log {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: rgba(0, 0, 0, 0.45);
  border-left: 2px solid var(--green);
  font-family: var(--f-mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-dim);
  word-break: break-word;
  max-height: 74px;
  overflow-y: auto;
}

.log-caret { color: var(--green); flex: none; }

/* Settings rows --------------------------------------------------- */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.setting-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.setting-name {
  font-family: var(--f-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.setting-desc { font-size: 12px; color: var(--text-faint); line-height: 1.4; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: none;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--f-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  touch-action: manipulation;
}

.switch-track {
  position: relative;
  width: 44px;
  height: 24px;
  flex: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid var(--line);
  transition: background 0.16s ease, border-color 0.16s ease;
}

.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 0.16s ease, background 0.16s ease;
}

.switch.is-on { color: var(--accent-hi); }
.switch.is-on .switch-track { background: var(--accent-soft); border-color: rgba(224, 166, 60, 0.5); }
.switch.is-on .switch-knob { transform: translateX(20px); background: var(--accent); }

.slider-wrap { display: flex; align-items: center; gap: 11px; flex: none; }

.range {
  -webkit-appearance: none;
  appearance: none;
  width: clamp(110px, 22vw, 170px);
  height: 22px;
  background: transparent;
  cursor: pointer;
}

.range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.16);
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  margin-top: -6.5px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #14100a;
}

.range::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.16); }
.range::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--accent); border: 2px solid #14100a; }

.slider-val {
  font-family: var(--f-num);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 46px;
  text-align: right;
}

/* Keymap ---------------------------------------------------------- */
.keymap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 7px 18px;
  padding-top: 4px;
}

.keymap-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
}

.keymap-row kbd { min-width: 62px; text-align: center; }

/* End / pause panels --------------------------------------------- */
.end-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  padding: 28px 24px;
  text-align: center;
}

.end-ico { width: 46px; height: 46px; color: var(--red); fill: currentColor; }

.end-title {
  font-family: var(--f-display);
  font-size: clamp(26px, 5.4vw, 38px);
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--red);
}

.end-title.small { font-size: clamp(22px, 4.4vw, 28px); color: var(--text); }
.end-title.win { color: var(--ct); }
.end-sub { font-size: 13.5px; line-height: 1.55; color: var(--text-dim); max-width: 42ch; }

.end-stats {
  display: flex;
  gap: 1px;
  width: 100%;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.end-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 8px;
  background: rgba(12, 15, 20, 0.9);
}

.end-stat-val { font-family: var(--f-num); font-size: 26px; font-weight: 700; line-height: 1; }
.end-stat-k {
  font-family: var(--f-display);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ===================================================================
   Orientation blocker
   =================================================================== */
#orientation-lock {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 24px;
  background: rgba(4, 6, 9, 0.97);
  backdrop-filter: blur(10px);
}

#orientation-lock.show { display: flex; }

.rotate-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  max-width: 320px;
}

.rotate-ico {
  width: 92px;
  height: 62px;
  color: var(--accent);
  animation: rotate-hint 2.4s ease-in-out infinite;
}

@keyframes rotate-hint {
  0%, 42% { transform: rotate(0deg); }
  62%, 88% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}

.rotate-title {
  font-family: var(--f-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rotate-sub { font-size: 13px; color: var(--text-dim); }

/* ===================================================================
   On-screen touch controls (PUBG-style layout)
   Layer order: look surface (full screen) < move pad < action buttons
   =================================================================== */
#touch-controls {
  position: fixed;
  inset: 0;
  z-index: 22;
  display: none;
  pointer-events: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#touch-controls.show { display: block; }

/* Full-screen aim surface: drag here only turns the camera. */
#touch-look {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  touch-action: none;
}

/* Movement stick: fixed base, knob follows the finger. */
#touch-move-pad {
  position: absolute;
  left: calc(16px + var(--sa-l));
  bottom: calc(16px + var(--sa-b));
  width: 172px;
  height: 172px;
  display: grid;
  place-items: center;
  pointer-events: auto;
  touch-action: none;
}

.stick-base {
  position: relative;
  width: 126px;
  height: 126px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 40%, rgba(6, 9, 13, 0.5) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.26);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.45);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.stick-tick {
  position: absolute;
  width: 2px;
  height: 8px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.28);
  top: 6px;
  left: calc(50% - 1px);
  transform-origin: 50% 57px;
}

.stick-knob {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.16) 55%, rgba(255, 255, 255, 0.07) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.5);
  will-change: transform;
}

#touch-move-pad.active .stick-base {
  border-color: rgba(224, 166, 60, 0.7);
  background: radial-gradient(circle, rgba(224, 166, 60, 0.12) 40%, rgba(6, 9, 13, 0.55) 100%);
}

#touch-move-pad.active .stick-knob {
  background: radial-gradient(circle at 38% 32%, rgba(255, 255, 255, 0.7), rgba(224, 166, 60, 0.55) 60%, rgba(224, 166, 60, 0.3) 100%);
  border-color: rgba(255, 255, 255, 0.8);
}

/* Action buttons -------------------------------------------------- */
.tbtn {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
  cursor: pointer;
  border: 1.5px solid rgba(255, 255, 255, 0.34);
  background: rgba(10, 14, 19, 0.42);
  color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(3px);
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.07s ease, background 0.1s ease, border-color 0.1s ease;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
}

.tbtn .ico { fill: none; }
.tbtn svg { width: 46%; height: 46%; }

.tbtn-label {
  position: absolute;
  bottom: 7px;
  font-family: var(--f-display);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.72;
}

.tbtn.pressed {
  transform: scale(0.93);
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.75);
}

#btn-touch-fire {
  right: calc(22px + var(--sa-r));
  bottom: calc(24px + var(--sa-b));
  width: 92px;
  height: 92px;
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(10, 14, 19, 0.34);
}

#btn-touch-fire svg { width: 42%; height: 42%; }
#btn-touch-fire.pressed { background: rgba(226, 70, 76, 0.5); border-color: rgba(255, 255, 255, 0.9); }

#btn-touch-fire-alt {
  left: calc(18px + var(--sa-l));
  top: 50%;
  margin-top: -34px;
  width: 62px;
  height: 62px;
}

#btn-touch-fire-alt.pressed { background: rgba(226, 70, 76, 0.5); }

#btn-touch-aim {
  right: calc(128px + var(--sa-r));
  bottom: calc(96px + var(--sa-b));
  width: 62px;
  height: 62px;
}

#btn-touch-aim.active { background: rgba(93, 157, 224, 0.42); border-color: rgba(160, 205, 255, 0.85); }

#btn-touch-jump {
  right: calc(28px + var(--sa-r));
  bottom: calc(128px + var(--sa-b));
  width: 62px;
  height: 62px;
}

#btn-touch-reload {
  right: calc(124px + var(--sa-r));
  bottom: calc(22px + var(--sa-b));
  width: 62px;
  height: 62px;
}

/* ===================================================================
   Responsive: small viewports & phone landscape
   =================================================================== */

/* Stack the menu nav horizontally when narrow or short. */
@media (max-width: 720px), (max-height: 540px) {
  .panel-body { flex-direction: column; }

  .menu-nav {
    width: 100%;
    flex-direction: row;
    padding: 8px;
    gap: 6px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .menu-nav::-webkit-scrollbar { display: none; }

  .nav-item {
    flex: 1 0 auto;
    justify-content: center;
    padding: 9px 13px;
    border-left: none;
    border-bottom: 2px solid transparent;
    font-size: 13.5px;
    letter-spacing: 0.08em;
  }

  .nav-item.active { border-left: none; border-bottom-color: var(--accent); }
  .menu-content { padding: 16px 16px 18px; }
}

@media (max-width: 560px) {
  .brand-mark { width: 32px; height: 32px; font-size: 14px; }
  .brand-title { font-size: 15.5px; letter-spacing: 0.1em; }
  .brand-sub { display: none; }
  .panel-head { padding: 11px 13px; }
  .pane-head h2 { font-size: 20px; }
  .pane-actions .btn { flex: 1 1 auto; }
  .setting-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .slider-wrap { width: 100%; }
  .range { flex: 1; width: auto; }
  .keymap { grid-template-columns: 1fr; }
  .sb-meta { display: none; }
  .sb-table th:not(:first-child), .sb-table td:not(:first-child) { width: 54px; }
  .sb-table { font-size: 12.5px; }
  .sb-table th, .sb-table td { padding-left: 12px; padding-right: 12px; }
}

/* Phone landscape: compact chrome so the HUD never eats the view. */
@media (max-height: 500px) {
  .panel-head { padding: 9px 13px; }
  .brand-mark { width: 30px; height: 30px; font-size: 13px; }
  .brand-title { font-size: 15px; }
  .brand-sub { display: none; }
  .menu-content { padding: 13px 15px 15px; }
  .pane { gap: 12px; }
  .pane-head h2 { font-size: 18px; }
  .pane-head p { font-size: 12.5px; }
  .brief-cell, .spec-cell { padding: 8px 11px; }
  .brief-v { font-size: 14px; }
  .btn { padding: 9px 16px; font-size: 14px; }
  .btn-lg { padding: 10px 22px; font-size: 15px; }
  .setting-row { padding: 9px 0; }
  .log { max-height: 56px; }
  .end-body { padding: 18px 18px; gap: 11px; }
  .end-ico { width: 34px; height: 34px; }
  .end-stat { padding: 9px 6px; }
  .end-stat-val { font-size: 21px; }

  .radar-frame { width: 104px; height: 104px; }
  .radar-tag { font-size: 8.5px; }
  .hud-top-left, .hud-top-right, .hud-roundbar { top: calc(8px + var(--sa-t)); }
  .hud-top-left { left: calc(8px + var(--sa-l)); }
  .hud-top-right { right: calc(8px + var(--sa-r)); }
  .team-points, .clock-time { font-size: 19px; }
  .team-score, .round-clock { padding: 5px 11px; }
  .vital-val { font-size: 25px; min-width: 46px; }
  .vital-ico { width: 16px; height: 16px; }
  .vital { grid-template-columns: 18px auto; column-gap: 7px; }
  .vital-track { width: 74px; }
  .ammo-clip { font-size: 29px; }
  .ammo-sep, .ammo-reserve { font-size: 17px; }
  .ammo-track { width: 74px; }
  .hud-money { font-size: 17px; }
  .hud-vitals { left: calc(12px + var(--sa-l)); bottom: calc(12px + var(--sa-b)); }
  .hud-ammo { right: calc(12px + var(--sa-r)); bottom: calc(12px + var(--sa-b)); }
  .hud-money { bottom: calc(12px + var(--sa-b)); }
  .killfeed-item { font-size: 12px; padding: 4px 9px; }
  .hud-icon-btn { width: 34px; height: 34px; }
}

/* Hide desktop-only affordances on touch devices. */
@media (hover: none) and (pointer: coarse) {
  .hud-keyhints { display: none; }
  .keymap { display: none; }
}

@media (max-width: 760px), (max-height: 500px) {
  .hud-keyhints { display: none; }
}

/* When the on-screen stick is active the HUD corners shift up a bit
   so the vitals never sit under the thumb. */
body.touch-active .hud-vitals { bottom: calc(196px + var(--sa-b)); }
body.touch-active .hud-money { display: none; }
body.touch-active .hud-ammo { bottom: calc(126px + var(--sa-b)); right: calc(20px + var(--sa-r)); }

@media (max-height: 420px) {
  body.touch-active .hud-vitals { bottom: calc(150px + var(--sa-b)); }
  #touch-move-pad { width: 148px; height: 148px; }
  .stick-base { width: 108px; height: 108px; }
  .stick-knob { width: 48px; height: 48px; }
  .stick-tick { transform-origin: 50% 48px; }
  #btn-touch-fire { width: 78px; height: 78px; }
  #btn-touch-aim, #btn-touch-jump, #btn-touch-reload, #btn-touch-fire-alt { width: 54px; height: 54px; }
  #btn-touch-aim { right: calc(112px + var(--sa-r)); bottom: calc(84px + var(--sa-b)); }
  #btn-touch-jump { bottom: calc(112px + var(--sa-b)); }
  #btn-touch-reload { right: calc(108px + var(--sa-r)); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}
