/* ============================ TOP BLASTERS ============================ */

:root {
  --orange: #ff7a00;
  --orange-hot: #ffae3d;
  --blue: #1f8fff;
  --blue-deep: #0a4faf;
  --cyan: #35e8ff;
  --bg: #070b14;
  --panel: rgba(10, 16, 30, 0.88);
  --panel-line: rgba(53, 232, 255, 0.25);
  --text: #dce8f5;
  --dim: #7c8aa0;
  --danger: #ff3b3b;
  --green: #2bff88;
  --font-head: 'Bahnschrift', 'Arial Black', Impact, sans-serif;
  --font-body: 'Bahnschrift', 'Segoe UI', Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  user-select: none;
  -webkit-user-select: none;
}

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

.hidden { display: none !important; }
.dim { color: var(--dim); }

/* ============================== BUTTONS =============================== */

.btn {
  font-family: var(--font-head);
  font-size: 18px;
  letter-spacing: 2px;
  padding: 13px 34px;
  border: none;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(160deg, var(--blue) 0%, var(--blue-deep) 100%);
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  transition: transform 0.08s ease, filter 0.12s ease;
  text-transform: uppercase;
}
.btn:hover:not(:disabled) { filter: brightness(1.25); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; }

.btn-primary {
  background: linear-gradient(160deg, var(--orange-hot) 0%, var(--orange) 55%, #c95400 100%);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 22px rgba(255, 122, 0, 0.35);
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--panel-line);
  box-shadow: none;
  color: var(--dim);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--cyan); }
.btn-danger { background: linear-gradient(160deg, #ff5a5a, #a31212); }

/* ============================= MAIN MENU ============================== */

.screen {
  position: fixed; inset: 0;
  /* align-items:flex-start + margin:auto on the child centers when it fits
     but stays SCROLLABLE when it doesn't — flex `align-items:center` alone
     clips the overflowing top and the user can never reach it (the mobile
     "can't see the Deploy button" bug). overflow-y:auto makes it reachable. */
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  z-index: 50;
}

/* Translucent vignette over the live 3D arena orbit behind the menu. */
.menu-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% -10%, rgba(31, 143, 255, 0.16), transparent 60%),
    radial-gradient(ellipse 55% 45% at 50% 115%, rgba(255, 122, 0, 0.13), transparent 60%),
    radial-gradient(ellipse 90% 80% at 50% 45%, rgba(7, 11, 20, 0.34) 0%, rgba(7, 11, 20, 0.62) 60%, rgba(7, 11, 20, 0.92) 100%);
}
.menu-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(53, 232, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53, 232, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 75% 70% at 50% 45%, #000 30%, transparent 75%);
  animation: gridDrift 16s linear infinite;
}
@keyframes gridDrift { from { background-position: 0 0, 0 0; } to { background-position: 0 44px, 44px 0; } }

.menu-content {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  /* Title screens scale with viewport height so the column FITS without
     scrolling on roomy displays; margin:auto centers it in .screen, and
     when content is taller than the viewport (small phones, the tall
     character form) .screen scrolls to it instead of clipping. */
  gap: clamp(8px, 1.6vh, 18px);
  width: min(94vw, 860px);
  margin: auto;
  padding: clamp(6px, 1.2vh, 14px) 8px max(14px, env(safe-area-inset-bottom));
}

/* token contract banner — placeholder until launch, then shows the address */
#contract-banner {
  font-family: var(--font-head);
  font-size: clamp(12px, 1.6vh, 15px); letter-spacing: 2px;
  color: #fff;
  background: linear-gradient(180deg, #2a9bff, #1f7ae0);
  border: 1px solid rgba(120, 200, 255, 0.7);
  border-radius: 12px;
  padding: clamp(7px, 1.1vh, 11px) clamp(18px, 3vw, 30px);
  box-shadow: 0 4px 20px rgba(31, 143, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  text-align: center; user-select: text;
}

#menu-logo {
  /* the vh term is the fit guarantee: the logo shrinks before anything else */
  width: min(440px, 70vw, 31vh);
  filter: drop-shadow(0 6px 30px rgba(31, 143, 255, 0.45));
  animation: logoFloat 5s ease-in-out infinite;
}
@keyframes logoFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

/* Very short windows: drop the keybind footer before anything important. */
@media (max-height: 800px) {
  .menu-footer { display: none; }
}

.menu-card {
  /* solid panel — backdrop-filter blur over a live 3D canvas forces full
     repaints every frame and tanks menu performance */
  background: rgba(8, 13, 25, 0.93);
  border: 1px solid var(--panel-line);
  clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px);
  padding: clamp(14px, 2.4vh, 26px) 34px;
  width: 100%;
  max-width: 760px;
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(7px, 1.3vh, 14px);
}

.card-title {
  font-family: var(--font-head);
  font-size: 19px;
  letter-spacing: 3px;
  color: var(--cyan);
}

.wallet-list { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.wallet-btn {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--font-head);
  font-size: 17px; letter-spacing: 1.5px;
  color: #fff;
  padding: 13px 26px;
  background: linear-gradient(160deg, rgba(31, 143, 255, 0.25), rgba(10, 79, 175, 0.3));
  border: 1px solid rgba(31, 143, 255, 0.55);
  clip-path: polygon(9px 0, 100% 0, calc(100% - 9px) 100%, 0 100%);
  cursor: pointer;
  transition: all 0.12s ease;
}
.wallet-btn:hover { background: linear-gradient(160deg, rgba(31, 143, 255, 0.5), rgba(10, 79, 175, 0.55)); box-shadow: 0 0 18px rgba(31, 143, 255, 0.4); }
.wallet-btn img { width: 26px; height: 26px; border-radius: 6px; }

.no-wallet { text-align: center; line-height: 1.7; }
.wallet-links { display: flex; gap: 14px; justify-content: center; margin: 10px 0; }
.wallet-links a {
  color: var(--orange); text-decoration: none;
  font-family: var(--font-head); letter-spacing: 2px;
  border: 1px solid rgba(255, 122, 0, 0.5); padding: 8px 18px;
  clip-path: polygon(7px 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
}
.wallet-links a:hover { background: rgba(255, 122, 0, 0.15); }

.fine-print { font-size: 12px; color: var(--dim); letter-spacing: 0.4px; }

.menu-error {
  position: relative;
  color: var(--danger);
  background: rgba(255, 59, 59, 0.1);
  border: 1px solid rgba(255, 59, 59, 0.4);
  padding: 9px 22px;
  font-size: 14px;
  letter-spacing: 0.5px;
  max-width: 720px;
  text-align: center;
}

/* customization */
.custom-grid { display: flex; gap: 30px; width: 100%; }
.custom-left { flex: 1; display: flex; flex-direction: column; gap: clamp(6px, 1vh, 10px); }
.custom-right { width: 380px; display: flex; align-items: center; justify-content: center; }
#preview-canvas { width: min(340px, 36vh); height: min(400px, 42.5vh); }

.field-label { font-size: 12px; letter-spacing: 2px; color: var(--dim); margin-top: clamp(0px, 0.6vh, 6px); }

#callsign {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--panel-line);
  color: var(--text);
  font-family: var(--font-head);
  font-size: 19px; letter-spacing: 2px;
  padding: 10px 14px;
  outline: none;
  text-transform: uppercase;
}
#callsign:focus { border-color: var(--cyan); box-shadow: 0 0 12px rgba(53, 232, 255, 0.25); }

.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 9px; }
.swatch {
  width: 100%; aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  transition: transform 0.1s ease;
}
.swatch:hover { transform: scale(1.12); }
.swatch.selected { border-color: #fff; box-shadow: 0 0 14px currentColor; }

.custom-color-row { display: flex; align-items: center; gap: 12px; font-size: 12px; letter-spacing: 2px; }
#color-custom { width: 52px; height: 30px; background: none; border: 1px solid var(--panel-line); cursor: pointer; }

.wallet-badge {
  font-size: 12px; color: var(--green); letter-spacing: 1px;
  background: rgba(43, 255, 136, 0.07);
  border: 1px solid rgba(43, 255, 136, 0.25);
  padding: 7px 12px;
  margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lifetime-stats { font-size: 12.5px; color: var(--dim); letter-spacing: 1px; }

#deploy-btn { margin-top: clamp(4px, 1vh, 10px); font-size: 22px; padding: clamp(11px, 1.6vh, 16px) 34px; }

/* ============================== LOBBY ================================= */

.lobby-head { display: flex; align-items: center; gap: 14px; width: 100%; justify-content: center; }
.cluster-pill {
  font-size: 10.5px; letter-spacing: 1.6px; color: var(--green);
  border: 1px solid rgba(43, 255, 136, 0.35); padding: 3px 10px;
  text-transform: uppercase;
  width: fit-content; white-space: nowrap; flex: 0 0 auto;
}
.cluster-pill.live {
  color: var(--green);
  border-color: rgba(43, 255, 136, 0.65);
  background: rgba(43, 255, 136, 0.12);
  box-shadow: 0 0 10px rgba(43, 255, 136, 0.25) inset, 0 0 8px rgba(43, 255, 136, 0.2);
}

.rejoin-banner {
  display: flex; align-items: center; gap: 16px;
  width: 100%;
  background: rgba(255, 122, 0, 0.1);
  border: 1px solid rgba(255, 122, 0, 0.45);
  padding: 10px 16px;
  font-size: 14px; letter-spacing: 0.5px;
}
.rejoin-banner .btn { padding: 8px 22px; font-size: 14px; margin-left: auto; }

.lobby-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.match-list {
  width: 100%;
  max-height: 320px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
}
.match-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 16px; align-items: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(53, 232, 255, 0.12);
  border-left: 3px solid var(--blue);
  padding: 10px 16px;
  font-size: 13.5px;
}
.match-row.wagered { border-left-color: var(--orange); }
.match-row .m-name { font-family: var(--font-head); letter-spacing: 1.2px; font-size: 14.5px; }
.match-row .m-mode { color: var(--dim); letter-spacing: 1px; font-size: 11.5px; }
.match-row .m-wager { color: var(--orange-hot); font-family: var(--font-head); letter-spacing: 0.6px; }
.match-row .m-players { color: var(--cyan); }
.match-row .m-state { font-size: 11px; letter-spacing: 1.5px; color: var(--dim); }
.match-row .btn { padding: 7px 18px; font-size: 13px; }
.match-empty { color: var(--dim); text-align: center; padding: 18px; letter-spacing: 1px; font-size: 13px; }

.lobby-foot { display: flex; width: 100%; align-items: center; justify-content: space-between; }
.lobby-foot .btn { padding: 7px 16px; font-size: 12px; }

/* create match */
.create-grid { width: 100%; display: flex; flex-direction: column; gap: 9px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-btn {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--panel-line);
  color: var(--dim);
  font-family: var(--font-head);
  letter-spacing: 1.4px;
  font-size: 13px;
  padding: 9px 16px;
  cursor: pointer;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}
.seg-btn.active { color: #fff; background: linear-gradient(160deg, rgba(31, 143, 255, 0.45), rgba(10, 79, 175, 0.5)); border-color: var(--blue); }

/* controller/keyboard focus highlight on menu controls (gamepad navigation) */
#menu button:focus, #menu .wallet-btn:focus, #menu .seg-btn:focus,
#menu input:focus, #menu select:focus,
#pause-menu button:focus, #settings-panel button:focus,
#settings-panel input:focus, #settings-panel select:focus {
  outline: 2px solid var(--cyan); outline-offset: 2px;
  box-shadow: 0 0 14px rgba(53, 232, 255, 0.5);
}
#cm-name, #cm-mint, #cm-amount {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--panel-line);
  color: var(--text);
  font-family: var(--font-head);
  font-size: 16px; letter-spacing: 1.4px;
  padding: 10px 14px;
  outline: none;
  text-transform: uppercase;
}
#cm-mint { text-transform: none; font-size: 13px; }
#cm-wager-fields { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.row-btns { display: flex; gap: 12px; }

/* staging */
.stage-wager {
  font-family: var(--font-head); letter-spacing: 1.5px;
  color: var(--orange-hot); font-size: 17px;
}
.stage-roster { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.stage-row {
  display: grid; grid-template-columns: 14px 1fr auto auto auto; gap: 12px;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  padding: 9px 14px;
  border: 1px solid rgba(53, 232, 255, 0.1);
  font-size: 14px;
}
.stage-row .dot { width: 11px; height: 11px; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.stage-row .s-mic { font-size: 12px; opacity: 0.4; min-width: 18px; text-align: center; }
.stage-row .s-mic.on { opacity: 1; }
.stage-row.speaking { border-color: rgba(43, 255, 136, 0.65); box-shadow: inset 0 0 14px rgba(43, 255, 136, 0.12); }
.stage-row.speaking .s-mic { color: var(--green); opacity: 1; }
.stage-row .s-team { font-size: 10.5px; letter-spacing: 1.5px; font-family: var(--font-head); }
.stage-row .s-team.orange { color: #ff2a2a; }
.stage-row .s-team.blue { color: var(--blue); }
.stage-row .s-dep { font-size: 11.5px; letter-spacing: 1px; }
.stage-row .s-dep.yes { color: var(--green); }
.stage-row .s-dep.no { color: var(--dim); }
.stage-row.offline { opacity: 0.45; }
.stage-status {
  font-family: var(--font-head); letter-spacing: 2px;
  font-size: 15px; color: var(--cyan); min-height: 20px;
}
.stage-voice { display: flex; align-items: center; gap: 14px; width: 100%; justify-content: center; }
.stage-voice .btn { padding: 8px 18px; font-size: 13px; }
.stage-voice .btn.live { color: var(--green); border-color: rgba(43, 255, 136, 0.55); }
#stage-mic-status { font-size: 11.5px; letter-spacing: 1px; }

/* team scores + payout */
.team-score {
  font-family: var(--font-head); font-size: 21px; padding: 0 10px;
}
.team-score.orange { color: #ff5a5a; }
.team-score.blue { color: #6db8ff; }

.payout-panel {
  width: 100%;
  border: 1px solid rgba(43, 255, 136, 0.3);
  background: rgba(43, 255, 136, 0.06);
  padding: 13px 18px;
  font-size: 13.5px;
  display: flex; flex-direction: column; gap: 5px;
}
.payout-panel .p-row { display: flex; justify-content: space-between; gap: 18px; }
.payout-panel .p-amt { color: var(--green); font-family: var(--font-head); letter-spacing: 0.6px; }
.payout-panel .p-fee { color: var(--dim); font-size: 12px; }
.payout-panel .p-sig { color: var(--dim); font-size: 10.5px; }
.payout-panel .p-head { font-family: var(--font-head); letter-spacing: 2px; color: var(--green); font-size: 14px; }

.spinner {
  width: 46px; height: 46px;
  border: 3px solid rgba(53, 232, 255, 0.2);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#status-text { font-family: var(--font-head); letter-spacing: 2.5px; font-size: 16px; }

#menu-gear {
  position: fixed; left: 22px; bottom: 22px;
  width: 52px; height: 52px;
  font-size: 26px; line-height: 1;
  color: var(--dim);
  background: rgba(8, 13, 25, 0.9);
  border: 1px solid var(--panel-line);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 60;
}
#menu-gear:hover {
  color: var(--cyan);
  border-color: var(--cyan);
  transform: rotate(45deg) scale(1.08);
}

#menu-user {
  position: fixed; left: 84px; bottom: 22px;
  width: 52px; height: 52px;
  font-size: 24px; line-height: 1;
  color: var(--dim);
  background: rgba(8, 13, 25, 0.9);
  border: 1px solid var(--panel-line);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 60;
}
#menu-user:hover {
  color: var(--cyan);
  border-color: var(--cyan);
  transform: scale(1.08);
}
#menu-user.hidden { display: none; }

#style-options .seg-btn { flex: 1; }

#leaderboard-screen { min-width: 700px; z-index: 70; }
/* Layering over the menu screen (z 50) and its corner buttons (z 60):
   disconnect notices beat everything except settings; settings is topmost. */
#disconnect-screen { z-index: 76; }
#settings-panel { z-index: 80; }
#leaderboard-screen td.sol-pos { color: var(--green); }
#leaderboard-screen td.sol-neg { color: var(--danger); }

.menu-footer {
  display: flex; flex-wrap: wrap; gap: 7px 19px; justify-content: center;
  font-size: 11.5px; color: var(--dim); letter-spacing: 1.2px;
}

/* ================================ HUD ================================= */

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 30; }

#crosshair {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 0; height: 0;
}
.ch-dot {
  position: absolute; left: -1.5px; top: -1.5px;
  width: 3px; height: 3px; background: #fff; border-radius: 50%;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
}
.ch-line {
  position: absolute; background: #fff;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
}
.ch-t, .ch-b { width: 2px; height: 9px; left: -1px; }
.ch-l, .ch-r { width: 9px; height: 2px; top: -1px; }
.ch-t { bottom: var(--gap, 7px); }
.ch-b { top: var(--gap, 7px); }
.ch-l { right: var(--gap, 7px); }
.ch-r { left: var(--gap, 7px); }

/* ----- Spartan Laser spin-up meter: thin red bar under the crosshair ----- */
#laser-charge {
  position: absolute; left: 50%; top: calc(50% + 34px);
  transform: translateX(-50%);
  width: 150px; height: 7px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 60, 40, 0.65);
  border-radius: 4px; overflow: hidden;
  box-shadow: 0 0 8px rgba(255, 40, 24, 0.5);
}
.laser-charge-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #ff3a1a, #ff8a4a);
  box-shadow: 0 0 10px #ff3a1a;
}
.laser-charge-fill.full {
  background: linear-gradient(90deg, #fff, #ffd2b4);
  box-shadow: 0 0 16px #fff, 0 0 26px #ff5a2a;
}

/* ----- mounted chaingun reticle: hollow azure ring, 4 arcs, no dot ----- */
#turret-reticle {
  position: absolute; left: 0; top: 0;
  width: 118px; height: 118px;
  margin: 0; pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(96, 170, 255, 0.55));
  will-change: transform;
}
#turret-reticle .tr-arc {
  position: absolute; inset: 0;
  border: 4px solid transparent;
  border-top-color: #79b4e8;
  border-radius: 50%;
  box-sizing: border-box;
}
#turret-reticle .tr-arc:nth-child(1) { transform: rotate(45deg); }
#turret-reticle .tr-arc:nth-child(2) { transform: rotate(135deg); }
#turret-reticle .tr-arc:nth-child(3) { transform: rotate(225deg); }
#turret-reticle .tr-arc:nth-child(4) { transform: rotate(315deg); }
#turret-reticle.hot { filter: drop-shadow(0 0 7px rgba(255, 70, 60, 0.65)); }
#turret-reticle.hot .tr-arc { border-top-color: #ff5448; }

#hitmarker {
  position: absolute; left: 50%; top: 50%;
  width: 0; height: 0;
  opacity: 0;
}
#hitmarker span {
  position: absolute; width: 3px; height: 11px;
  background: #fff;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}
#hitmarker span:nth-child(1) { transform: translate(-9px, -14px) rotate(-45deg); }
#hitmarker span:nth-child(2) { transform: translate(6px, -14px) rotate(45deg); }
#hitmarker span:nth-child(3) { transform: translate(-9px, 3px) rotate(45deg); }
#hitmarker span:nth-child(4) { transform: translate(6px, 3px) rotate(-45deg); }
#hitmarker.show { animation: hitPop 0.22s ease-out; }
#hitmarker.kill span { background: var(--danger); height: 14px; }
#hitmarker.head span { background: var(--orange-hot); }
@keyframes hitPop { 0% { opacity: 1; transform: scale(1.35); } 100% { opacity: 0; transform: scale(0.9); } }

#scope-overlay { position: absolute; inset: 0; background: radial-gradient(circle at 50% 50%, transparent 31%, rgba(0, 0, 0, 0.985) 33.5%); }
.scope-ring {
  position: absolute; left: 50%; top: 50%;
  width: min(64vh, 64vw); height: min(64vh, 64vw);
  transform: translate(-50%, -50%);
  border: 2px solid rgba(53, 232, 255, 0.6);
  border-radius: 50%;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.85);
}
.scope-cross-h, .scope-cross-v { position: absolute; left: 50%; top: 50%; background: rgba(220, 235, 245, 0.85); }
.scope-cross-h { width: min(62vh, 62vw); height: 1px; transform: translate(-50%, -0.5px); }
.scope-cross-v { height: min(62vh, 62vw); width: 1px; transform: translate(-0.5px, -50%); }

/* ---- Spartan Laser optic: a solid red cross-in-circle. In .laser mode the
   sniper reticle hides and this bold red reticle takes over. ---- */
#scope-overlay.laser .scope-ring,
#scope-overlay.laser .scope-cross-h,
#scope-overlay.laser .scope-cross-v { display: none; }
.scope-laser-ring, .scope-laser-h, .scope-laser-v, .scope-laser-circle,
.scope-laser-tick, .scope-laser-dot { position: absolute; left: 50%; top: 50%; display: none; }
#scope-overlay.laser .scope-laser-ring,
#scope-overlay.laser .scope-laser-h,
#scope-overlay.laser .scope-laser-v,
#scope-overlay.laser .scope-laser-circle,
#scope-overlay.laser .scope-laser-tick,
#scope-overlay.laser .scope-laser-dot { display: block; }
.scope-laser-ring {                                  /* optic frame at the lens edge */
  width: min(64vh, 64vw); height: min(64vh, 64vw);
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 50, 30, 0.5); border-radius: 50%;
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.9), 0 0 10px rgba(255, 42, 24, 0.35);
}
.scope-laser-h, .scope-laser-v { background: #ff2a18; box-shadow: 0 0 5px rgba(255, 42, 24, 0.95); }
.scope-laser-h { width: min(60vh, 60vw); height: 2px; transform: translate(-50%, -1px); }
.scope-laser-v { height: min(60vh, 60vw); width: 2px; transform: translate(-1px, -50%); }
.scope-laser-circle {                                /* the "circle" of the cross-in-circle */
  width: 16vh; height: 16vh; transform: translate(-50%, -50%);
  border: 2.5px solid #ff2a18; border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 42, 24, 0.85), inset 0 0 8px rgba(255, 42, 24, 0.45);
}
.scope-laser-tick { width: 2px; height: 1.7vh; background: #ff2a18; box-shadow: 0 0 4px rgba(255, 42, 24, 0.9); }
.scope-laser-tick.t { transform: translate(-50%, calc(-50% - 10vh)); }
.scope-laser-tick.b { transform: translate(-50%, calc(-50% + 10vh)); }
.scope-laser-tick.l { width: 1.7vh; height: 2px; transform: translate(calc(-50% - 10vh), -50%); }
.scope-laser-tick.r { width: 1.7vh; height: 2px; transform: translate(calc(-50% + 10vh), -50%); }
.scope-laser-dot {
  width: 4px; height: 4px; background: #ff2a18; border-radius: 50%;
  transform: translate(-50%, -50%); box-shadow: 0 0 7px #ff2a18;
}
/* keep the charge meter clear of the reticle while scoped */
#laser-charge.scoped { top: calc(50% + 13vh); }

/* ----- Orbital Drop call-in screen + aiming hint ----- */
#ordnance-menu {
  position: fixed; inset: 0; z-index: 78;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 8, 14, 0.72);
}
.ord-panel {
  background: linear-gradient(180deg, rgba(18, 26, 38, 0.98), rgba(10, 16, 24, 0.98));
  border: 1px solid rgba(255, 138, 24, 0.5); border-radius: 12px;
  padding: 22px 26px; min-width: 560px; max-width: 92vw;
  box-shadow: 0 0 40px rgba(255, 90, 24, 0.25);
}
.ord-title {
  font-size: 22px; font-weight: 800; letter-spacing: 2px; color: #ffb347;
  text-align: center; margin-bottom: 16px; text-shadow: 0 0 12px rgba(255, 120, 30, 0.5);
}
#ord-count { font-size: 15px; color: #cfe0f0; letter-spacing: 1px; margin-left: 8px; }
.ord-cols { display: flex; gap: 14px; }
.ord-col { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.ord-cat { font-size: 12px; letter-spacing: 1.5px; color: #8fb0d8; text-align: center; margin-bottom: 4px; }
.ord-item {
  background: rgba(40, 56, 80, 0.85); color: #eaf2ff;
  border: 1px solid rgba(120, 150, 190, 0.4); border-radius: 7px;
  padding: 10px 8px; font-size: 13px; font-weight: 600; letter-spacing: 0.5px;
  cursor: pointer; transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
.ord-item:hover:not(:disabled) {
  background: rgba(255, 138, 24, 0.85); border-color: #ffb347; color: #1a1206; transform: translateY(-1px);
}
.ord-item:disabled { opacity: 0.4; cursor: not-allowed; }
.ord-foot { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.ord-hint { flex: 1; font-size: 12px; color: #9fb4cc; }
.ord-btn {
  background: rgba(30, 42, 60, 0.9); color: #cfe0f0;
  border: 1px solid rgba(120, 150, 190, 0.45); border-radius: 7px;
  padding: 8px 14px; font-size: 12px; font-weight: 700; letter-spacing: 1px; cursor: pointer;
}
.ord-btn:hover { background: rgba(60, 82, 116, 0.95); }
#ordnance-hint {
  position: fixed; left: 50%; bottom: 130px; transform: translateX(-50%);
  z-index: 32; pointer-events: none;
  background: rgba(255, 42, 24, 0.16); border: 1px solid rgba(255, 80, 50, 0.6);
  color: #ffd2c4; font-size: 14px; font-weight: 700; letter-spacing: 0.6px;
  padding: 8px 16px; border-radius: 8px; text-shadow: 0 0 8px rgba(255, 60, 30, 0.6);
}

/* ----- Career Stats screen ----- */
#career-screen { z-index: 72; min-width: 640px; }
#career-body { display: flex; gap: 24px; align-items: stretch; margin: 10px 0 18px; }
#career-portrait {
  background: radial-gradient(circle at 50% 35%, rgba(53, 232, 255, 0.12), rgba(8, 12, 20, 0.6));
  border: 1px solid rgba(120, 150, 190, 0.35); border-radius: 12px; padding: 6px; flex: none;
}
#career-canvas { display: block; border-radius: 8px; }
#career-info { display: flex; flex-direction: column; min-width: 300px; flex: 1; }
#career-name { font-size: 26px; font-weight: 800; letter-spacing: 1px; color: #eaf2ff; }
#career-wallet { font-size: 12px; color: #2bff88; letter-spacing: 0.5px; margin: 3px 0 16px; font-family: ui-monospace, monospace; }
.career-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.career-stat {
  background: rgba(30, 42, 60, 0.7); border: 1px solid rgba(120, 150, 190, 0.3);
  border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column;
}
.cs-num { font-size: 22px; font-weight: 800; color: #35e8ff; }
.cs-lbl { font-size: 10px; letter-spacing: 1px; color: #8fb0d8; margin-top: 2px; }
.career-actions { display: flex; gap: 12px; justify-content: center; }

#vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(255, 20, 20, 0.55) 130%);
  opacity: 0; transition: opacity 0.25s ease;
}
#dmg-flash {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(255, 30, 30, 0.12), rgba(255, 30, 30, 0.42));
  opacity: 0;
}
#dmg-flash.show { animation: dmgFlash 0.3s ease-out; }
@keyframes dmgFlash { 0% { opacity: 1; } 100% { opacity: 0; } }

#dmg-indicators { position: absolute; left: 50%; top: 50%; }
.dmg-arc {
  position: absolute; left: -60px; top: -110px;
  width: 120px; height: 60px;
  border-top: 4px solid rgba(255, 45, 45, 0.95);
  border-radius: 60px 60px 0 0;
  transform-origin: 50% 110px;
  animation: arcFade 0.9s ease-out forwards;
}
@keyframes arcFade { from { opacity: 1; } to { opacity: 0; } }

#radar-wrap { position: absolute; top: 18px; left: 18px; }
#radar {
  border-radius: 50%;
  border: 2px solid var(--panel-line);
  background: rgba(7, 12, 22, 0.72);
}
#radar-label {
  text-align: center; font-size: 10px; letter-spacing: 2px;
  color: var(--dim); margin-top: 5px; font-family: var(--font-head);
}

#match-bar {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 22px; align-items: center;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  padding: 8px 26px;
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
  font-family: var(--font-head);
}
#match-timer { font-size: 21px; color: #fff; letter-spacing: 2px; }
#match-leader { font-size: 13px; color: var(--orange-hot); letter-spacing: 1px; }

#killfeed {
  position: absolute; top: 18px; right: 20px;
  display: flex; flex-direction: column; gap: 5px; align-items: flex-end;
  font-size: 13.5px;
}
.feed-row {
  background: rgba(7, 12, 22, 0.8);
  border-right: 3px solid var(--blue);
  padding: 5px 11px;
  letter-spacing: 0.4px;
  animation: feedIn 0.18s ease-out;
}
.feed-row.me { border-right-color: var(--orange); background: rgba(46, 26, 5, 0.85); }
.feed-row .k { font-weight: bold; }
.feed-row .w { color: var(--dim); margin: 0 7px; font-size: 11.5px; }
.feed-row .head { color: var(--orange-hot); margin: 0 3px; }
@keyframes feedIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

#center-banner {
  position: absolute; left: 50%; top: 31%;
  transform: translateX(-50%);
  font-family: var(--font-head);
  font-size: 30px; letter-spacing: 3px;
  color: var(--orange-hot);
  text-shadow: 0 0 24px rgba(255, 122, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.8);
  animation: bannerPop 1.6s ease-out forwards;
  text-align: center;
}
#center-banner .sub { display: block; font-size: 15px; color: var(--text); letter-spacing: 2px; margin-top: 5px; }
@keyframes bannerPop {
  0% { transform: translateX(-50%) scale(1.4); opacity: 0; }
  12% { transform: translateX(-50%) scale(1); opacity: 1; }
  78% { opacity: 1; }
  100% { opacity: 0; }
}

#pickup-toast {
  position: absolute; left: 50%; bottom: 27%;
  transform: translateX(-50%);
  font-family: var(--font-head); font-size: 16px; letter-spacing: 2.5px;
  color: var(--green);
  text-shadow: 0 0 14px rgba(43, 255, 136, 0.5);
  animation: bannerPop 1.3s ease-out forwards;
}

#vitals { position: absolute; left: 26px; bottom: 26px; width: 290px; }
.bar {
  height: 13px; margin-top: 6px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--panel-line);
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  overflow: hidden;
}
.bar > div { height: 100%; width: 100%; transition: width 0.12s ease-out; }
#shield-fill { background: linear-gradient(90deg, #1f8fff, var(--cyan)); box-shadow: 0 0 10px rgba(53, 232, 255, 0.7); }
/* overshield tiers ride the same bar: purple = 50-100, orange = 100-150 */
.shield-bar { position: relative; }
.shield-tier {
  position: absolute; left: 0; top: 0; height: 100%; width: 0;
  transition: width 0.12s ease-out; pointer-events: none;
}
.shield-tier.tier-purple { background: linear-gradient(90deg, #7a3fd9, #b266ff); box-shadow: 0 0 10px rgba(178, 102, 255, 0.75); }
.shield-tier.tier-orange { background: linear-gradient(90deg, #ff8c1a, #ffd24d); box-shadow: 0 0 12px rgba(255, 170, 60, 0.85); }
#health-fill { background: linear-gradient(90deg, #1f9e4d, var(--green)); }
#health-fill.low { background: linear-gradient(90deg, #b3210f, var(--danger)); }
#hp-num {
  position: absolute; right: -52px; bottom: -3px;
  font-family: var(--font-head); font-size: 31px; color: #fff;
  text-shadow: 0 0 9px rgba(53, 232, 255, 0.45);
}

/* ===================== POWER-UP TIMERS + SCREEN TINT ==================== */
#powerup-timers {
  position: absolute; left: 26px; bottom: 92px;
  display: flex; flex-direction: column; gap: 6px;
  pointer-events: none;
}
.pu-chip {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-head); font-size: 14px; letter-spacing: 1.5px;
  padding: 5px 12px;
  background: rgba(8, 13, 25, 0.78);
  border-left: 3px solid var(--c);
  color: #fff;
  clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
  text-shadow: 0 0 8px var(--c);
}
.pu-chip .pu-time { margin-left: auto; opacity: 0.85; font-variant-numeric: tabular-nums; }
.pu-chip.ending { animation: puBlink 0.6s steps(2) infinite; }   /* last 5s */
@keyframes puBlink { 50% { opacity: 0.4; } }

/* full-screen edge wash telling the local (first-person) player a buff is live */
#fx-tint {
  position: fixed; inset: 0; z-index: 8; pointer-events: none;
  opacity: 0; transition: opacity 0.3s ease;
  box-shadow: inset 0 0 140px 30px var(--fxc, transparent);
}
#fx-tint.on { opacity: 0.5; }

#ammo-panel { position: absolute; right: 30px; bottom: 24px; text-align: right; }
#weapon-name { font-family: var(--font-head); font-size: 14px; letter-spacing: 2.5px; color: var(--cyan); }
#ammo-counts { font-family: var(--font-head); color: #fff; }
#ammo-mag { font-size: 45px; }
#ammo-mag.empty { color: var(--danger); }
#ammo-res { font-size: 19px; color: var(--dim); margin-left: 7px; }
#reload-hint { font-size: 12px; color: var(--orange-hot); letter-spacing: 2.5px; animation: blink 0.7s linear infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
#nade-pips { display: flex; gap: 5px; justify-content: flex-end; margin-top: 7px; }
.nade-pip {
  width: 13px; height: 13px;
  background: var(--green);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  opacity: 0.25;
}
.nade-pip.full { opacity: 1; box-shadow: 0 0 7px rgba(43, 255, 136, 0.6); }
.nade-pip.sticky { background: #4d8cff; }
.nade-pip.sticky.full { box-shadow: 0 0 7px rgba(77, 140, 255, 0.75); }
.nade-pip.offtype { transform: scale(0.78); filter: saturate(0.45) brightness(0.7); }

#fps-counter {
  position: absolute; left: 18px; bottom: 96px;
  font-family: var(--font-head); font-size: 14px;
  color: var(--green); letter-spacing: 1px;
  background: rgba(7, 12, 22, 0.6); padding: 3px 9px;
}

#voice-indicators {
  position: absolute; left: 18px; top: 196px;
  display: flex; flex-direction: column; gap: 4px;
}
.voice-chip {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; letter-spacing: 1px;
  color: var(--green);
  background: rgba(7, 12, 22, 0.72);
  border-left: 2px solid var(--green);
  padding: 3px 10px;
}
.voice-chip.muted { color: var(--dim); border-left-color: var(--dim); }

#weapon-strip {
  position: absolute; right: 30px; bottom: 132px;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-end;
}
.ws-item {
  font-size: 11px; letter-spacing: 1.6px; color: var(--dim);
  background: rgba(7, 12, 22, 0.65);
  padding: 4px 10px;
  border-right: 2px solid transparent;
}
.ws-item.active { color: #fff; border-right-color: var(--orange); background: rgba(7, 12, 22, 0.9); }
.ws-item .key { color: var(--orange-hot); margin-right: 7px; font-family: var(--font-head); }

/* ============================== OVERLAYS ============================== */

.overlay {
  position: fixed; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel);
  border: 1px solid var(--panel-line);
  clip-path: polygon(20px 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%, 0 20px);
  padding: 34px 44px;
  z-index: 40;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  background: rgba(8, 13, 25, 0.95);
  min-width: 420px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
}
.overlay h2 { font-family: var(--font-head); letter-spacing: 3px; font-size: 27px; }
.overlay h3 { font-family: var(--font-head); letter-spacing: 2.5px; color: var(--cyan); }

#scoreboard { min-width: 620px; }
.overlay table { border-collapse: collapse; width: 100%; }
.overlay th {
  font-size: 11px; letter-spacing: 2px; color: var(--dim);
  padding: 6px 13px; text-align: left;
  border-bottom: 1px solid var(--panel-line);
}
.overlay td { padding: 7px 13px; font-size: 14.5px; letter-spacing: 0.4px; }
.overlay tr.me td { color: var(--orange-hot); }
.overlay td.mono { font-size: 12px; color: var(--dim); }

#death-screen h2 { color: var(--danger); text-shadow: 0 0 26px rgba(255, 59, 59, 0.5); }
#death-by { font-size: 16px; letter-spacing: 1px; }
#death-by .by-name { color: var(--orange-hot); font-weight: bold; }

#match-end h2 { color: var(--orange-hot); text-shadow: 0 0 26px rgba(255, 122, 0, 0.5); }

.pause-logo { width: 240px; margin-bottom: 6px; }
#pause-menu .btn { width: 260px; }

.setting-row {
  display: grid; grid-template-columns: 200px 200px 50px;
  gap: 14px; align-items: center; width: 100%;
  font-size: 13px; letter-spacing: 1.4px;
}
.setting-row input[type="range"] { accent-color: var(--orange); }
.setting-row select {
  background: rgba(0, 0, 0, 0.5); color: var(--text);
  border: 1px solid var(--panel-line); padding: 6px 10px;
  font-family: var(--font-body); letter-spacing: 1px;
}

/* CONTROLS / key-binding panel */
#controls-panel { z-index: 81; min-width: 460px; }
.ctrl-tabs { display: flex; gap: 8px; }
.ctrl-tab {
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--panel-line); color: var(--dim);
  font-family: var(--font-head); letter-spacing: 1.4px; font-size: 12px; padding: 8px 18px; cursor: pointer;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}
.ctrl-tab.active { color: #fff; background: linear-gradient(160deg, rgba(31, 143, 255, 0.45), rgba(10, 79, 175, 0.5)); border-color: var(--blue); }
.ctrl-hint { font-size: 12px; letter-spacing: 0.6px; margin: 0; text-align: center; }
.ctrl-list { display: flex; flex-direction: column; gap: 6px; width: 100%; max-height: 52vh; overflow-y: auto; padding-right: 4px; }
.ctrl-row { display: grid; grid-template-columns: 1fr 150px; gap: 12px; align-items: center; font-size: 13px; letter-spacing: 1px; }
.ctrl-row label { color: var(--text); }
.ctrl-bind {
  background: rgba(0, 0, 0, 0.5); border: 1px solid var(--panel-line); color: var(--cyan);
  font-family: var(--font-head); letter-spacing: 1px; font-size: 12.5px; padding: 8px 10px; cursor: pointer;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); text-align: center; min-width: 0;
}
.ctrl-bind:hover { border-color: var(--cyan); }
.ctrl-bind.listening { color: #061018; background: var(--orange); border-color: var(--orange); animation: ctrlPulse 0.8s ease-in-out infinite; }
@keyframes ctrlPulse { 50% { opacity: 0.5; } }
.ctrl-foot { display: flex; gap: 12px; width: 100%; }
.ctrl-foot .btn { flex: 1; }

/* ---- text chat: bare white lines on the right (no box), Tab toggles scope ---- */
#chat-log {
  position: fixed; right: 16px; bottom: 130px; z-index: 60;
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
  max-width: 42vw; pointer-events: none;
}
#chat-log.hidden { display: none; }
.chat-line {
  color: #fff; font-family: var(--font-body); font-size: 14px; letter-spacing: 0.3px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 2px rgba(0, 0, 0, 0.9);
  text-align: right; line-height: 1.35; transition: opacity 1.1s ease;
}
.chat-line.fade { opacity: 0; }
.chat-line .chat-ic svg { vertical-align: -0.18em; margin-right: 3px; }
.chat-line .chat-name { color: var(--cyan); font-family: var(--font-head); letter-spacing: 0.6px; }
#chat-entry {
  position: fixed; right: 16px; bottom: 92px; z-index: 61;
  display: flex; align-items: center; gap: 8px;
}
#chat-entry.hidden { display: none; }
.chat-scope {
  font-family: var(--font-head); font-size: 12px; letter-spacing: 1px;
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  text-shadow: 0 1px 3px #000;
}
#chat-input {
  width: min(46vw, 420px);
  background: rgba(8, 13, 25, 0.8); border: 1px solid var(--panel-line);
  color: #fff; font-family: var(--font-body);
  font-size: 14px; letter-spacing: 0.4px; padding: 7px 10px; outline: none;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}
#chat-input:focus { border-color: var(--cyan); box-shadow: 0 0 10px rgba(53, 232, 255, 0.35); }

/* ---- friends panel: voice bar, invites, in-match players, DM thread ---- */
#friends-panel { position: relative; }
.friends-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.friends-voicebar { display: flex; gap: 6px; }
.voicebtn {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--panel-line); color: var(--dim);
  font-family: var(--font-head); font-size: 10px; letter-spacing: 0.8px; padding: 5px 8px; cursor: pointer;
  clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%);
}
.voicebtn.on { color: #fff; border-color: var(--blue); }
.voicebtn.danger { color: #ff6a6a; border-color: rgba(255, 80, 80, 0.5); }
.voicebtn svg { vertical-align: -0.15em; }
.friend-actions { display: inline-flex; gap: 4px; margin-left: auto; }
.f-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; cursor: pointer;
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--panel-line); color: var(--dim); border-radius: 3px;
}
.f-icon:hover { color: #fff; border-color: var(--cyan); }
.f-icon.on { color: var(--cyan); border-color: var(--cyan); }
.f-icon.danger:hover { color: #ff6a6a; border-color: #ff6a6a; }
.f-icon svg { width: 15px; height: 15px; }
.friends-section-label { font-family: var(--font-head); font-size: 10px; letter-spacing: 1.5px; color: var(--dim); margin: 8px 0 3px; }
.invite-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: rgba(31, 143, 255, 0.12); border: 1px solid var(--panel-line); margin-bottom: 4px; font-size: 12px; }
.invite-row .iv-name { color: var(--cyan); font-family: var(--font-head); }
.f-unread { color: var(--orange); }
/* DM thread overlays the panel body */
#dm-thread { position: absolute; inset: 0; background: rgba(8, 13, 25, 0.98); display: flex; flex-direction: column; gap: 6px; padding: 14px; }
#dm-thread.hidden { display: none; }
.dm-head { display: flex; align-items: center; gap: 8px; }
.dm-head #dm-who { font-family: var(--font-head); letter-spacing: 1px; color: var(--cyan); }
.dm-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; min-height: 200px; max-height: 50vh; }
.dm-msg { font-size: 13px; line-height: 1.35; max-width: 85%; }
.dm-msg.me { align-self: flex-end; text-align: right; color: var(--cyan); }
.dm-msg.them { align-self: flex-start; text-align: left; color: var(--text); }
.dm-entry { display: flex; gap: 6px; }
.dm-entry input { flex: 1; background: rgba(0, 0, 0, 0.5); border: 1px solid var(--panel-line); color: #fff; padding: 8px 10px; font-family: var(--font-body); outline: none; }
.dm-entry input:focus { border-color: var(--cyan); }
#friends-fab { position: fixed; }
#friends-fab.has-unread { box-shadow: 0 0 0 2px var(--orange), 0 0 14px rgba(255, 122, 0, 0.5); }
#friends-fab.has-unread::after {
  content: ''; position: absolute; top: -4px; right: -4px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--orange);
}

@media (max-width: 900px) {
  /* reclaim horizontal room: thinner card gutters on phones */
  .menu-card { padding-left: 16px; padding-right: 16px; }
  .card-title { font-size: 17px; letter-spacing: 2px; }
  /* match rows go two-line so nothing overflows or clips the JOIN button:
     name+mode on top, then wager / players / state / JOIN beneath */
  .match-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 13px; }
  .match-row > div:first-child { flex: 1 1 100%; }
  .match-row .btn { margin-left: auto; padding: 8px 22px; }
  .match-list { max-height: 46vh; }
  .custom-grid { flex-direction: column-reverse; gap: 14px; }   /* preview on top, form below */
  .custom-fields { grid-template-columns: 1fr; }                /* single column on phones */
  .custom-right { width: 100%; }
  #scoreboard { min-width: 0; }
  /* lobby action buttons stack full-width instead of overflowing the card */
  .lobby-actions { flex-direction: column; width: 100%; }
  .lobby-actions > * { width: 100%; }
  /* the marine preview shouldn't eat the screen on a phone — keep the form
     fields the priority since they hold the Deploy button */
  #preview-canvas { width: min(60vw, 220px); height: min(66vw, 250px); }
  #menu-custom { max-width: 100%; padding-left: 18px; padding-right: 18px; }
  #menu-custom .swatches { grid-template-columns: repeat(8, 1fr); }
  /* roomier tap targets on touch */
  #style-options .seg-btn, #class-options .seg-btn { font-size: 12.5px; padding: 10px 10px; }
  .deploy-row { flex-direction: column; gap: 8px; }
  #menu-custom .deploy-row #deploy-btn,
  #menu-custom .deploy-row #switch-wallet { width: 100%; }
  /* CREATE MATCH: tile every option chip so a row never runs off the card,
     and stack the CREATE/BACK buttons full-width. The screen scrolls, so the
     whole form (incl. the CREATE button) stays reachable on a phone. */
  #menu-create { max-width: 100%; padding-left: 16px; padding-right: 16px; }
  .create-grid .seg { gap: 6px; }
  .create-grid .seg-btn {
    flex: 1 1 auto; min-width: 0; text-align: center;
    font-size: 12px; padding: 10px 9px; letter-spacing: 0.5px;
  }
  /* the long ARENA list + the player-count / time / kills rows pack into even
     columns instead of a few oversized chips */
  #cm-map .seg-btn, #cm-size .seg-btn { flex: 1 1 29%; }
  #cm-time .seg-btn, #cm-kills .seg-btn { flex: 1 1 21%; }
  #cm-name, #cm-mint, #cm-amount { font-size: 15px; padding: 11px 12px; width: 100%; }
  .row-btns { flex-direction: column; width: 100%; gap: 8px; }
  .row-btns .btn { width: 100%; }
}

/* ====================== MOTION (ease in/out polish) ===================== */
/* Cards and overlays glide in; respects reduced-motion preferences. */

@media (prefers-reduced-motion: no-preference) {
  .menu-card {
    animation: cardIn 0.30s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .overlay:not(.hidden) {
    animation: overlayIn 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  }
  #menu-logo { transition: transform 0.3s ease; }
  .match-row {
    transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
  }
  .match-row:hover {
    transform: translateX(4px);
    border-color: rgba(53, 232, 255, 0.4);
    background: rgba(0, 0, 0, 0.5);
  }
  .seg-btn { transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease; }
  .stage-row { transition: border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease; }
  .swatch { transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.12s ease; }
  #menu-gear, #menu-user { transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1); }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@keyframes overlayIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ============================== FRIENDS ============================== */

/* always-visible top-left friends button + dropdown */
#friends-fab {
  position: fixed; left: 18px; top: 16px; z-index: 73;
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(10, 16, 30, 0.88);
  border: 1px solid var(--panel-line);
  color: var(--cyan);
  font-family: var(--font-head); font-size: 13px; letter-spacing: 1.5px;
  padding: 9px 15px; cursor: pointer;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  transition: all 0.12s ease;
}
#friends-fab:hover { color: #fff; border-color: var(--cyan); box-shadow: 0 0 14px rgba(53, 232, 255, 0.3); }
#friends-fab.hidden { display: none; }
#friends-fab svg { width: 16px; height: 16px; }
.friends-dd {
  position: fixed; left: 18px; top: 60px; z-index: 74;
  width: min(420px, 92vw); max-height: 72vh; overflow-y: auto;
  background: rgba(8, 13, 25, 0.97);
  border: 1px solid rgba(53, 232, 255, 0.35);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6), 0 0 28px rgba(53, 232, 255, 0.14);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.friends-dd.hidden { display: none; }
.friends-dd h3 { margin: 0; font-family: var(--font-head); color: var(--cyan); letter-spacing: 2px; font-size: 16px; }

/* pause-menu: add/remove bots */
.pause-bots { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; max-width: 380px; }
.pause-bots-label { width: 100%; text-align: center; font-family: var(--font-head); font-size: 12px; letter-spacing: 2px; color: var(--dim); }
.pause-bots .btn { padding: 8px 14px; font-size: 12px; }
.friend-add-row { display: flex; gap: 10px; width: 100%; }
.friend-add-row input {
  flex: 1;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--panel-line);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px; letter-spacing: 0.5px;
  padding: 10px 14px;
  outline: none;
}
.friend-add-row .btn { padding: 9px 22px; font-size: 14px; }
.friends-list {
  width: 100%; max-height: 320px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.friend-row {
  display: grid; grid-template-columns: 12px 1fr auto auto; gap: 12px;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(53, 232, 255, 0.1);
  padding: 8px 14px;
  font-size: 14px;
}
.friend-row .f-dot { width: 10px; height: 10px; border-radius: 50%; background: #3a4254; }
.friend-row.online .f-dot { background: var(--green); box-shadow: 0 0 8px rgba(43, 255, 136, 0.7); }
.friend-row .f-sub { color: var(--dim); font-size: 11px; letter-spacing: 0.6px; }
.friend-row .btn { padding: 6px 14px; font-size: 12px; }
.friend-row .f-remove {
  background: none; border: none; color: var(--dim);
  cursor: pointer; font-size: 15px; padding: 4px 6px;
}
.friend-row .f-remove:hover { color: var(--danger); }
.friends-empty { color: var(--dim); text-align: center; padding: 16px; font-size: 13px; letter-spacing: 1px; }

#invite-toast {
  position: fixed; top: 24px; right: 24px;
  z-index: 85;
  background: rgba(8, 13, 25, 0.96);
  border: 1px solid rgba(255, 122, 0, 0.55);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 12px;
  max-width: 340px;
}
#invite-toast .row-btns .btn { padding: 8px 18px; font-size: 13px; }
#invite-text { font-size: 14px; letter-spacing: 0.5px; line-height: 1.5; }
#invite-text .inv-name { color: var(--orange-hot); font-family: var(--font-head); }
@media (prefers-reduced-motion: no-preference) {
  #invite-toast:not(.hidden) { animation: cardIn 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
}

/* Customize step: use the horizontal room a title screen has — wide card,
   2-column field grid, single-row swatches, compact pickers — so it NEVER
   scrolls on desktop. */
#menu-custom { max-width: 1160px; }
/* the menu column otherwise caps at 860px (.menu-content) — let the character
   screen use real width so the 2-col form + preview + bigger swatches fit in
   fewer rows. Scoped to when the custom card is showing; responsive cap. */
.menu-content:has(#menu-custom:not(.hidden)) { width: min(96vw, 1180px); }
/* the field groups flow in two columns beside the preview (collapses to one
   on narrow/mobile via the max-width:900px block) */
.custom-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(5px, 0.9vh, 11px) 24px;
  width: 100%;
}
.cl-group { display: flex; flex-direction: column; gap: clamp(3px, 0.6vh, 7px); min-width: 0; }
/* collapse to one column on phones — must follow the 2-col base to win the cascade */
@media (max-width: 900px) { .custom-fields { grid-template-columns: 1fr; } }
#menu-custom .swatches { grid-template-columns: repeat(12, 1fr); gap: 6px; }
#style-options .seg-btn, #class-options .seg-btn, #death-class .seg-btn {
  font-size: 11.5px; padding: 7px 11px; letter-spacing: 1.1px; flex: 1;
}
#menu-custom #callsign { padding: 8px 14px; font-size: 17px; }
#menu-custom .wallet-badge { padding: 5px 12px; margin-top: 2px; }
#menu-custom .custom-color-row { font-size: 11px; }
#menu-custom .custom-color-row input { height: 26px; }
#menu-custom .deploy-row { width: 100%; align-items: center; }
#menu-custom .deploy-row #deploy-btn { flex: 1; }
#menu-custom .deploy-row #switch-wallet { padding: 11px 18px; font-size: 13px; }
#menu-custom .card-title { font-size: 16px; letter-spacing: 2.4px; }

/* Late override: must come after the base .menu-footer rule in the cascade.
   Title screens shouldn't need a keybind strip — drop it whenever vertical
   space is anything less than generous. */
@media (max-height: 900px) {
  .menu-footer { display: none; }
}
@media (max-height: 800px) {
  #lifetime-stats { display: none; }
}

/* Trim/armor color rows: single 13-wide strip with the custom picker inline
   in the label — two full color systems with zero extra vertical cost. */
/* swatches size to a tappable minimum and WRAP, instead of cramming 13 into
   one narrow row — they were ~17px slivers in the 2-column form, too small to
   click. ~36px min keeps them comfortably selectable on desktop and touch. */
.trim-swatches { grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)) !important; gap: 8px !important; }
.inline-color {
  width: 42px; height: 18px; margin-left: 10px;
  vertical-align: middle;
  background: none; border: 1px solid var(--panel-line); cursor: pointer;
}

/* Big lobbies (16p): two-column roster, capped height, scroll as last resort */
.stage-roster {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  max-height: 38vh;
  overflow-y: auto;
  scrollbar-width: thin;
}
@media (max-width: 980px) { .stage-roster { grid-template-columns: 1fr; } }
#menu-staging { max-width: 880px; }

/* Jupiter swap pill — bottom-right of the menu screens */
#menu-swap {
  position: fixed; right: 18px; bottom: 16px; z-index: 60;
  background: rgba(10, 16, 30, 0.88);
  border: 1px solid var(--panel-line);
  color: var(--cyan);
  font-family: var(--font-head);
  font-size: 13px; letter-spacing: 1.5px;
  padding: 10px 16px;
  cursor: pointer;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  transition: all 0.12s ease;
}
#menu-swap:hover { color: #fff; border-color: var(--cyan); box-shadow: 0 0 14px rgba(53, 232, 255, 0.3); }

/* ===================== IN-APP SWAP MODAL (Jupiter) ===================== */
#swap-modal { position: fixed; inset: 0; z-index: 96; }
.swap-backdrop { position: absolute; inset: 0; background: rgba(4, 7, 14, 0.72); }
.swap-panel {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  /* height wraps the plugin form (was a fixed 680px → big empty gap below) */
  width: min(440px, 94vw); height: auto; max-height: 90vh;
  background: #0c111d;
  border: 1px solid var(--panel-line);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6), 0 0 28px rgba(53, 232, 255, 0.12);
  display: flex; flex-direction: column;
}
.swap-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  font-family: var(--font-head); font-size: 12.5px; letter-spacing: 2px;
  color: var(--cyan);
  border-bottom: 1px solid var(--panel-line);
}
#swap-close {
  background: none; border: none; color: var(--dim);
  font-size: 16px; cursor: pointer; padding: 2px 6px;
}
#swap-close:hover { color: #fff; }
/* fixed to the Jupiter swap form's natural height so the panel hugs it
   (the plugin's containerStyles height:100% fills exactly this, no excess);
   internal route/token lists scroll within it on the rare taller state */
#jupiter-plugin { flex: 0 0 auto; width: 100%; height: min(500px, calc(90vh - 96px)); overflow: hidden; }

/* approved-token quick-select chips above the plugin */
.swap-tokens {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 8px 12px; border-bottom: 1px solid var(--panel-line);
  background: rgba(31, 143, 255, 0.05);
}
.swap-tokens-label {
  font-family: var(--font-head); font-size: 10px; letter-spacing: 2px;
  color: var(--dim); margin-right: 2px;
}
.swap-chip {
  font-family: var(--font-head); font-size: 11px; letter-spacing: 1px;
  color: var(--cyan); background: rgba(53, 232, 255, 0.08);
  border: 1px solid rgba(53, 232, 255, 0.3);
  padding: 5px 11px; cursor: pointer; transition: background 0.12s, color 0.12s;
}
.swap-chip:hover { background: rgba(53, 232, 255, 0.18); color: #fff; }
.swap-chip.active {
  background: linear-gradient(160deg, rgba(53, 232, 255, 0.9), rgba(31, 143, 255, 0.9));
  color: #04121c; border-color: rgba(53, 232, 255, 0.9);
  box-shadow: 0 0 12px rgba(53, 232, 255, 0.5);
}

/* ==================== THEMED SCROLLBARS (site-wide) ==================== */
* { scrollbar-width: thin; scrollbar-color: rgba(53, 232, 255, 0.45) rgba(10, 16, 30, 0.6); }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: rgba(8, 13, 25, 0.7); }
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(53, 232, 255, 0.55), rgba(31, 143, 255, 0.45));
  border: 2px solid rgba(8, 13, 25, 0.8);
  border-radius: 0;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(53, 232, 255, 0.8); }
*::-webkit-scrollbar-corner { background: transparent; }

/* match-browser filter row */
.match-filter { align-self: flex-start; }
.match-filter .seg-btn[data-v="wagered"].active {
  background: linear-gradient(160deg, rgba(255, 122, 0, 0.85), rgba(201, 84, 0, 0.85));
  color: #fff;
}

/* ============== SWAP MODAL: full Top Blasters theming ============== */
.swap-panel {
  background: rgba(8, 13, 25, 0.97);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
  border: 1px solid rgba(53, 232, 255, 0.35);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.65), 0 0 34px rgba(53, 232, 255, 0.18);
}
.swap-head {
  background: linear-gradient(90deg, rgba(31, 143, 255, 0.16), transparent 70%);
  text-shadow: 0 0 12px rgba(53, 232, 255, 0.5);
}
.swap-head::before { content: "\2748"; margin-right: 8px; }
#jupiter-plugin { background: #0b0f1a; }
.swap-backdrop {
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(31, 143, 255, 0.08), transparent 70%),
    rgba(4, 7, 14, 0.78);
}

/* ========================= TOUCH CONTROLS (mobile) ====================== */
/* Shown only when the touch setting is on (defaults on for touch devices).
   Sits above the HUD, below every menu overlay. */

#touch-overlay { position: fixed; inset: 0; z-index: 35; }
#touch-overlay.hidden { display: none; }
#touch-move-zone {
  position: absolute; left: 0; top: 0; bottom: 0; width: 38%;
  touch-action: none;
}
#touch-look-zone {
  position: absolute; right: 0; top: 0; bottom: 0; width: 62%;
  touch-action: none;
}
.touch-stick-base {
  position: absolute; width: 124px; height: 124px; margin: -62px 0 0 -62px;
  border: 2px solid rgba(160, 190, 255, 0.4); border-radius: 50%;
  background: rgba(20, 30, 50, 0.25); pointer-events: none;
}
.touch-stick-base.hidden { display: none; }
.touch-stick-nub {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px;
  transform: translate(-50%, -50%);
  border-radius: 50%; background: rgba(160, 190, 255, 0.55);
  box-shadow: 0 0 12px rgba(120, 160, 255, 0.5);
}
.touch-btn {
  position: absolute; display: flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 50%;
  border: 2px solid rgba(160, 190, 255, 0.45);
  background: rgba(18, 26, 44, 0.45); color: rgba(220, 235, 255, 0.9);
  font-family: inherit; font-size: 13px; letter-spacing: 1px;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.touch-btn.pressed { background: rgba(80, 130, 255, 0.5); }
.touch-btn.active { border-color: var(--green, #2bff88); color: var(--green, #2bff88); }
.touch-fire {
  right: 26px; bottom: 96px; width: 92px; height: 92px; font-size: 16px;
  border-color: rgba(255, 120, 80, 0.55); color: rgba(255, 190, 170, 0.95);
}
.touch-fire.pressed { background: rgba(255, 110, 60, 0.45); }
/* ascend / descend (flying vehicles) — under the FIRE button, UP left, DOWN right */
.touch-up, .touch-down {
  bottom: 28px; width: 58px; height: 58px; font-size: 22px;
  border-color: rgba(90, 200, 255, 0.6); color: rgba(185, 235, 255, 0.95);
}
.touch-up { right: 90px; }
.touch-down { right: 26px; }
.touch-up.pressed, .touch-down.pressed { background: rgba(60, 180, 255, 0.5); }
.touch-aim { right: 132px; bottom: 64px; }
.touch-jump { right: 44px; bottom: 204px; }
.touch-sprint { left: 26px; bottom: 196px; }
.touch-reload { right: 150px; bottom: 148px; width: 54px; height: 54px; font-size: 20px; }
.touch-nade { right: 26px; bottom: 204px; display: none; }
.touch-swap { right: 216px; bottom: 56px; width: 54px; height: 54px; font-size: 18px; }
.touch-pause {
  right: 14px; top: 14px; width: 44px; height: 44px; font-size: 12px;
  border-radius: 10px;
}
/* grenade gets its own spot above jump */
.touch-nade { display: flex; right: 44px; bottom: 286px; width: 56px; height: 56px; font-size: 18px; }
.touch-sticky {
  right: 118px; bottom: 250px; width: 56px; height: 56px; font-size: 18px;
  border-color: rgba(77, 140, 255, 0.6); color: #9dc2ff;
}
.touch-use {
  left: 26px; bottom: 280px; width: 56px; height: 56px; font-size: 16px;
  border-color: rgba(255, 210, 77, 0.55); color: #ffe49a;
}

/* ===================== WALLETCONNECT QR MODAL =========================== */
.wc-modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 8, 15, 0.82);
}
.wc-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; width: min(92vw, 360px);
  padding: 26px 26px 22px;
  background: rgba(8, 13, 25, 0.97);
  border: 1px solid var(--panel-line);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
  text-align: center;
}
.wc-card h3 {
  font-family: var(--font-head); font-size: 17px; letter-spacing: 3px; color: var(--cyan);
}
.wc-qr {
  width: 240px; height: 240px; image-rendering: pixelated;
  background: #fff; padding: 10px; border-radius: 6px;
}
.wc-card p { font-size: 13px; line-height: 1.6; color: var(--dim); }
.wc-cancel { margin-top: 2px; }

/* ===================== MOBILE FORCE-LANDSCAPE ===========================
   Rotate the whole app 90° for wallet in-app browsers that lock the phone
   to portrait. The math here is mirrored exactly in client/js/orient.js
   (viewport / rotateDelta / rotatePoint) — change them together. */
html.force-landscape, html.force-landscape body { overflow: hidden; }
html.force-landscape body {
  position: fixed;
  top: 0; left: 0;
  width: 100vh;            /* landscape extent = the portrait viewport height */
  height: 100vw;
  transform-origin: top left;
  transform: rotate(90deg) translateY(-100vw);
}

