:root {
  --pink: #ff2e88;
  --cyan: #24d6ff;
  --amber: #ffb52e;
  --panel: rgba(10, 12, 22, 0.82);
  --stroke: rgba(255, 255, 255, 0.14);
  /* themed by js/theme.js from the game's own ui block (root.game.ui); these are the fallbacks */
  --text: #ffffff;
  --dim: #8a93a6;
  --accent: #24d6ff;
  --font-body: "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  --font-title: "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  --font-button: "Segoe UI", Inter, Roboto, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #05070f;
  font-family: var(--font-body);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  /* it's a GAME: never select text or fire the long-press copy/share/callout while playing */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#renderCanvas {
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  touch-action: none;
}

/* Nothing in the game is selectable — no text selection, no long-press copy/share/callout anywhere
   (including the newspaper). It's a game, not a document. */
#newspaper, #newspaper *, #menu, #menu *, #briefing, #briefing *, #dialogue, #dialogue *,
#keypad, #keypad *, #quiz, #quiz *, #hud, #hud * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.hidden { display: none !important; }
.mono { font-family: "Cascadia Code", Consolas, "SF Mono", monospace; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud.has-modal { z-index: 35; }
body:not(.is-touch) #touchui, body.has-modal #touchui, #touchui.hidden { display: none !important; pointer-events: none !important; }

#crosshair {
  position: absolute;
  left: 50%; top: 50%;
  width: 6px; height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  box-shadow: 0 0 0 2px rgba(0,0,0,.35);
  pointer-events: none;
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
}
#crosshair.tactical-hover .ch,
#crosshair.tactical-disengage .ch,
#crosshair.tactical-engaged .ch {
  display: none !important;
}
#crosshair.tactical-hover {
  width: 28px; height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 4px;
  border: 2px solid rgba(255, 215, 0, 0.95);
  background: rgba(255, 215, 0, 0.15);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.8), inset 0 0 6px rgba(255, 215, 0, 0.4);
}
#crosshair.tactical-hover::before {
  content: '⚔';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  color: #ffd700;
  text-shadow: 0 0 4px #000;
}
#crosshair.tactical-hover::after {
  content: 'ENGAGE';
  position: absolute;
  top: 32px; left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ffd700;
  background: rgba(0, 0, 0, 0.75);
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
}
#crosshair.tactical-disengage {
  width: 28px; height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 50, 50, 0.95);
  background: rgba(220, 30, 30, 0.2);
  box-shadow: 0 0 12px rgba(255, 50, 50, 0.85);
}
#crosshair.tactical-disengage::before {
  content: '✕';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  font-weight: 900;
  color: #ff3333;
  text-shadow: 0 0 6px rgba(255, 0, 0, 0.85);
}
#crosshair.tactical-disengage::after {
  content: 'DISENGAGE';
  position: absolute;
  top: 32px; left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ff4444;
  background: rgba(0, 0, 0, 0.75);
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
}
#crosshair.tactical-engaged {
  width: 16px; height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: rgba(230,30,30,0.95);
  box-shadow: 0 0 14px rgba(230,30,30,1);
}

#topbar {
  position: absolute;
  top: 14px; left: 14px;
  display: flex; flex-wrap: wrap; gap: 8px;
  max-width: calc(100% - 220px);
}

.chip {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 7px;
}
.chip .label {
  font-size: 9px;
  letter-spacing: .16em;
  color: var(--cyan);
  font-weight: 700;
}
#hudMode { color: var(--amber); }
#hudWantedChip { border-color: rgba(255, 60, 60, 0.45); }
#hudWantedChip .label { color: #ff3b30; font-weight: 800; }
#hudWanted { color: #ffd000; letter-spacing: 2px; text-shadow: 0 0 8px rgba(255, 208, 0, 0.65); }
#hudBuilt { color: rgba(210, 220, 235, 0.55); font-weight: 500; font-size: 10px; letter-spacing: .02em; max-width: 210px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Minimap ---------- */
#minimapWrap {
  position: absolute;
  top: 14px; right: 14px;
  width: 176px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--stroke);
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
#minimap { display: block; width: 176px; height: 176px; }
.minimapLabel {
  text-align: center;
  font-size: 10px;
  letter-spacing: .28em;
  padding: 5px 0 7px;
  color: #ffd7ea;
  background: linear-gradient(90deg, rgba(255,46,136,.25), rgba(36,214,255,.25));
  font-weight: 700;
}

/* ---------- Controls (in the menu) / prompt / dialogue ---------- */
.menuControls {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--stroke);
  font-size: 11.5px;
  line-height: 1.8;
  color: #aeb4c4;
  text-align: center;
}
.menuControls b { color: var(--cyan); }

#prompt {
  position: absolute;
  left: 50%; bottom: 122px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.6);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
}
#prompt b { color: var(--cyan); }

#dialogue {
  position: absolute;
  left: 50%; bottom: 24px;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 48px));
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-left: 3px solid var(--pink);
  border-radius: 12px;
  padding: 13px 18px 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 50px rgba(0,0,0,.5);
  pointer-events: auto;
  touch-action: manipulation;
  z-index: 35;
}
#dialogue .speaker {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 800; letter-spacing: .12em;
  color: var(--pink);
  text-transform: uppercase;
  margin-bottom: 6px;
}
#dialogue .speaker .mode {
  font-size: 9px; letter-spacing: .18em;
  color: #9aa3b5;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 2px 8px;
}
#dialogue .line { font-size: 16px; line-height: 1.5; color: #f2f4f9; }
/* branching conversation: the replies the player may pick */
#dialogue .dlgChoices { display: grid; gap: 8px; margin-top: 13px; pointer-events: auto; }
#dialogue .dlgChoices:empty { display: none; }
#dialogue .dlgChoice {
  text-align: left; padding: 11px 14px; border-radius: 10px;
  background: rgba(255,255,255,.07); border: 1px solid var(--stroke);
  color: #e6ebf5; font-size: 14px; cursor: pointer; font-family: inherit; transition: .15s;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255,46,136,.3);
  user-select: none;
  -webkit-user-select: none;
}
#dialogue .dlgChoice:hover { background: rgba(255,255,255,.16); border-color: var(--pink); }
#dialogue .dlgChoice:active { background: rgba(255,46,136,.25); transform: translateY(1px); }
#dialogue .dlgChoice b { color: var(--cyan); margin-right: 8px; }

/* inner dialogue: the player character's own thoughts */
#inner {
  position: absolute;
  left: 50%; bottom: 176px;
  transform: translateX(-50%);
  max-width: min(560px, calc(100% - 48px));
  background: rgba(8,10,16,.6);
  border: 1px solid var(--stroke);
  border-left: 3px solid var(--cyan);
  border-radius: 10px;
  padding: 9px 16px 9px 30px;
  font-style: italic;
  font-size: 15px;
  line-height: 1.5;
  color: #dfe6f2;
  text-shadow: 0 1px 2px rgba(0,0,0,.85);
  backdrop-filter: blur(6px);
  pointer-events: none;
}
#inner::before {
  content: '\201C';
  position: absolute; left: 10px; top: 4px;
  font-size: 22px; color: var(--cyan); font-style: normal;
}

/* ---------- Menu ---------- */
#menu {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background:
    radial-gradient(1200px 600px at 70% 10%, rgba(255,46,136,.22), transparent 60%),
    radial-gradient(900px 500px at 20% 90%, rgba(36,214,255,.18), transparent 60%),
    linear-gradient(180deg, #0b1024, #05070f);
  transition: opacity .35s ease;
}
#menu.gone, #menu.hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  display: none !important;
  visibility: hidden !important;
}
body.menu-open #hud,
body.menu-open #touchui,
body.menu-open #prompt,
body.menu-open #targetHealth {
  display: none !important;
  pointer-events: none !important;
}
#menu .panel {
  width: min(560px, calc(100% - 24px));
  max-height: 96vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: clamp(8px, 2vh, 18px);
  padding: clamp(6px, 1.8vh, 26px) clamp(10px, 3vw, 32px);
  text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  position: relative;
  z-index: 2;
  margin-bottom: clamp(2px, 0.8vh, 12px);
}
.eyebrow {
  font-size: clamp(8px, 1.6vh, 10px); letter-spacing: .34em; color: var(--cyan); font-weight: 700;
  margin-bottom: clamp(2px, 0.8vh, 12px);
}
#menuTitle {
  margin: 0;
  font-size: clamp(16px, 4.5vh, 48px);
  line-height: .95;
  letter-spacing: .04em;
  font-weight: 900;
  background: linear-gradient(180deg, #fff, #ffd0e6 45%, var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 16px rgba(255,46,136,.45));
}
.tagline {
  margin-top: clamp(1px, 0.4vh, 6px);
  margin-bottom: clamp(2px, 0.6vh, 10px);
  color: #cfd6e6;
  font-size: clamp(9px, 1.8vh, 14px);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.segmented { display: flex; flex: 1; background: rgba(255,255,255,.06); border: 1px solid var(--stroke); border-radius: clamp(6px, 1.2vh, 10px); padding: 3px; }
.seg {
  flex: 1; padding: clamp(4px, 1vh, 8px) clamp(4px, 1vw, 6px); border: 0; border-radius: clamp(5px, 1vh, 8px);
  background: transparent; color: #aeb6c8; font-weight: 700; font-size: clamp(9px, 1.8vh, 11px);
  letter-spacing: .08em; cursor: pointer; transition: .18s;
}
.seg.active { background: linear-gradient(180deg, var(--pink), #c91f6d); color: #fff; }
.play {
  margin-top: clamp(6px, 1.8vh, 20px);
  width: 100%;
  padding: clamp(7px, 1.8vh, 15px) clamp(12px, 2.5vw, 24px);
  border: 0;
  border-radius: clamp(8px, 1.5vh, 12px);
  font-size: clamp(12px, 2.4vh, 16px);
  font-weight: 900;
  letter-spacing: .22em;
  color: #12121a;
  cursor: pointer;
  background: linear-gradient(180deg, #fff, var(--amber));
  box-shadow: 0 12px 30px rgba(255,181,46,.35);
  transition: transform .12s ease;
}
.play:hover { transform: translateY(-1px); }
.play:active { transform: translateY(1px); }
.hint { margin-top: clamp(6px, 1.2vh, 14px); font-size: clamp(9px, 1.8vh, 12px); color: #98a1b5; }
.credit { margin-top: clamp(6px, 1.2vh, 16px); font-size: clamp(9px, 1.6vh, 11px); color: #6f788c; }
.credit .mono { color: var(--cyan); }

#loading {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  background: #05070f;
  color: var(--cyan);
  font-size: 13px; letter-spacing: .3em;
}
#loading.hidden { display: none; }
#loading .loadText { margin-bottom: 14px; }
#loading .loadBar {
  width: min(280px, 64vw); height: 6px; border-radius: 999px;
  background: rgba(255,255,255,.12); overflow: hidden;
}
#loading #loadFill {
  width: 0%; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #24d6ff, #ff2e88);
  transition: width .18s ease;
}

/* ---------- Status panel (health / weapon / vehicle) ---------- */
#statusPanel {
  position: absolute;
  left: 14px; bottom: 14px;
  width: 232px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.barWrap {
  position: relative;
  height: 18px;
  border-radius: 9px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
  border: 1px solid var(--stroke);
}
.barFill {
  position: absolute; inset: 0;
  width: 100%;
  background: linear-gradient(90deg, #ff3b5c, #ffb52e 45%, #43d17a);
  transition: width .18s ease;
}
.barText {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800;
  text-shadow: 0 1px 2px rgba(0,0,0,.7);
}
.statRow {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px;
  font-size: 13px;
  overflow: hidden;
}
.statName { font-weight: 700; color: #fff; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 135px; }
#ammoText { color: var(--amber); font-weight: 700; white-space: nowrap; }
#vehicleSpeed { color: var(--cyan); font-weight: 700; }
.stateText {
  margin-top: 6px;
  font-size: 10px; letter-spacing: .22em;
  color: var(--cyan); font-weight: 700;
  text-align: right; min-height: 12px;
}

/* ---------- Combat feedback ---------- */
#hitmarker {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-size: 22px; color: #fff;
  text-shadow: 0 0 8px rgba(255,60,60,.9);
  pointer-events: none;
  opacity: .95;
}
#hitmarker.pop-a { animation: hm-pop .22s ease-out; }
#hitmarker.pop-b { animation: hm-pop-alt .22s ease-out; }
#hitmarker.kill { color: #ff4d4d; font-size: 30px; text-shadow: 0 0 14px rgba(255,32,32,1); }

/* target health bar: shown under the crosshair when you aim at / hit a hostile */
#targetHealth {
  position: absolute; left: 50%; top: calc(50% + 26px);
  transform: translateX(-50%);
  width: 168px; pointer-events: none; text-align: center;
}
#targetHealth .thName {
  font: 800 11px/1.2 system-ui, sans-serif; letter-spacing: .1em; text-transform: uppercase;
  color: #e8eefc; text-shadow: 0 1px 3px rgba(0,0,0,.95); margin-bottom: 4px;
}
#targetHealth .thBar {
  height: 7px; border-radius: 4px; overflow: hidden;
  background: rgba(6,8,14,.62); border: 1px solid rgba(255,255,255,.3);
  box-shadow: 0 1px 4px rgba(0,0,0,.6);
}
#targetHealth .thFill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #ff3b3b, #ff8a3b);
  transition: width .08s linear;
}
#targetHealth .thFill.low { background: linear-gradient(90deg, #b01414, #ff3b3b); }

/* AA lock-on indicator (stinger): fills, then reads LOCKED */
#lockUI {
  position: absolute; left: 50%; top: calc(50% - 46px);
  transform: translateX(-50%);
  width: 150px; pointer-events: none; text-align: center;
}
#lockUI .lkText {
  font: 800 11px/1.2 system-ui, sans-serif; letter-spacing: .14em;
  color: #8ad4ff; text-shadow: 0 1px 3px rgba(0,0,0,.95); margin-bottom: 4px;
}
#lockUI.locked .lkText { color: #ff4d4d; }
#lockUI .lkBar {
  height: 5px; border-radius: 3px; overflow: hidden;
  background: rgba(6,8,14,.6); border: 1px solid rgba(138,212,255,.45);
}
#lockUI .lkFill { height: 100%; width: 0%; background: #8ad4ff; transition: width .05s linear; }
#lockUI.locked .lkBar { border-color: #ff4d4d; }
#lockUI.locked .lkFill { width: 100% !important; background: #ff4d4d; }
@keyframes hm-pop {
  0%   { transform: translate(-50%, -50%) scale(.45); opacity: 0; }
  35%  { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.12); opacity: .9; }
}
@keyframes hm-pop-alt {
  0%   { transform: translate(-50%, -50%) scale(.45); opacity: 0; }
  35%  { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.12); opacity: .9; }
}
#vignette {
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(255,0,30,.0) 70%, rgba(255,0,30,.55) 100%);
  opacity: 0;
  transition: opacity .25s ease;
}
#vignette.hurt { opacity: 1; transition: opacity .05s ease; }

/* ---------- Customization ---------- */
.customHeader {
  margin-top: 20px; margin-bottom: 8px;
  font-size: 10px; letter-spacing: .3em; color: var(--cyan); font-weight: 800;
  text-align: left;
}
.customWrap {
  display: flex; gap: 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px;
}
.previewCol { display: flex; flex-direction: column; align-items: center; }
#previewCanvas {
  width: 150px; height: 210px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(36,214,255,.10), rgba(255,46,136,.10));
  cursor: grab;
}
.previewHint { margin-top: 6px; font-size: 9px; letter-spacing: .16em; color: #7f89a0; }
.customCol {
  flex: 1;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}
.customCol::-webkit-scrollbar { width: 6px; }
.customCol::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 3px; }
.optRow { margin-bottom: 9px; }
.optLabel {
  font-size: 9px; letter-spacing: .18em; color: #8f98ac; font-weight: 700;
  margin-bottom: 4px;
}
.swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.swatch {
  width: 20px; height: 20px; border-radius: 6px;
  border: 2px solid rgba(255,255,255,.25);
  cursor: pointer; padding: 0;
}
.swatch.active { border-color: var(--pink); box-shadow: 0 0 0 2px rgba(255,46,136,.4); }
.chipBtns { display: flex; flex-wrap: wrap; gap: 5px; }
.optBtn {
  padding: 4px 8px; font-size: 10px; font-weight: 700;
  letter-spacing: .04em; text-transform: capitalize;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--stroke); border-radius: 7px;
  color: #c3cad9; cursor: pointer;
}
.optBtn.active { background: linear-gradient(180deg, var(--pink), #c91f6d); color: #fff; border-color: transparent; }
.optRow input[type=range] { width: 100%; }
.mini {
  flex: 1; padding: 8px; margin-top: 0;
  background: rgba(255,255,255,.07); border: 1px solid var(--stroke);
  border-radius: 9px; color: #cfd6e6; font-weight: 700; font-size: 11px;
  letter-spacing: .1em; cursor: pointer;
}
.mini:hover { background: rgba(255,255,255,.12); }
#menu .panel { max-height: 94vh; overflow-y: auto; }

/* keep PLAY reachable while the customization panel scrolls */
#menu .panel .play { position: sticky; bottom: 8px; z-index: 3; }

/* ---------- Quest HUD ---------- */
#questPanel {
  position: absolute;
  top: 62px; left: 50%;
  transform: translateX(-50%);
  width: min(330px, calc(100% - 460px));
  min-width: 210px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-left: 3px solid var(--amber);
  border-radius: 12px;
  padding: 9px 13px 11px;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
#questPanel .qTop { display: flex; align-items: center; justify-content: space-between; }
.qTag {
  font-size: 9px; letter-spacing: .22em; font-weight: 800;
  color: var(--amber);
}
.qArrow {
  font-size: 15px; line-height: 1;
  color: var(--amber);
  transform-origin: 50% 50%;
  filter: drop-shadow(0 0 5px rgba(255,181,46,.7));
}
#questTask { margin-top: 4px; font-size: 14px; font-weight: 700; color: #fff; }
#questPanel .qMeta {
  margin-top: 5px; display: flex; justify-content: space-between;
  font-size: 11px; color: #cfd6e6;
}
#questProgress { color: var(--cyan); }

/* ---------- Newspaper ---------- */
#newspaper {
  position: absolute; inset: 0;
  pointer-events: auto;
  display: grid; place-items: center;
  background: rgba(4,6,12,.72);
}
.npSheet {
  position: relative;
  width: min(560px, calc(100% - 60px));
  background: #efe9d8;
  color: #1b1a17;
  border-radius: 4px;
  padding: 22px 26px 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  transform: rotate(-.4deg);
}
.npMasthead {
  font-family: "Times New Roman", Georgia, serif;
  font-weight: 900; letter-spacing: .12em;
  text-align: center; font-size: 22px;
  color: #16150f;
}
.npRule { height: 3px; background: #16150f; margin: 8px 0 12px; }
.npHeadline {
  font-family: "Times New Roman", Georgia, serif;
  font-weight: 900; line-height: 1.05;
  font-size: 27px; margin-bottom: 10px;
  text-transform: uppercase;
}
.npBody {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14.5px; line-height: 1.55; color: #2a2820;
  column-count: 2; column-gap: 20px;
}
.npHint { margin-top: 14px; text-align: right; font-size: 11px; color: #6a6350; letter-spacing: .08em; }
.npHint b { color: #16150f; }

#newspaper { z-index: 35; touch-action: manipulation; }

/* ---------- Passcode keypad (period-neutral: aged brass/stone by default) ---------- */
#keypad {
  position: absolute; inset: 0; z-index: 35; touch-action: manipulation;
  pointer-events: auto;
  display: grid; place-items: center;
  background: rgba(4,6,12,.72);
  --kpBg1: #2b241b; --kpBg2: #1c1712; --kpEdge: #5a4a30; --kpInk: #efe6d2;
  --kpDim: #b8a884; --kpCell: rgba(232,195,74,.10); --kpCellEdge: #6f5c37;
  --kpKeyBg: linear-gradient(180deg, #4a3f2c, #2f2718); --kpKeyEdge: #6f5c37;
  --kpAccent: #e8c34a; --kpAccentInk: #201a0c;
}
#keypad[data-theme="ancient"] {
  --kpBg1: #3a3227; --kpBg2: #241d14; --kpEdge: #7a6a4a; --kpInk: #f3ecd9;
  --kpDim: #c8b892; --kpCell: rgba(224,176,80,.12); --kpCellEdge: #8a7444;
  --kpKeyBg: linear-gradient(180deg, #5a4a33, #382d1d); --kpKeyEdge: #8a7444;
  --kpAccent: #e0b050; --kpAccentInk: #241a08;
}
#keypad[data-theme="modern"] {
  --kpBg1: #1b2630; --kpBg2: #0e151c; --kpEdge: #31566b; --kpInk: #eaf6ff;
  --kpDim: #8fb3c8; --kpCell: rgba(36,214,255,.10); --kpCellEdge: #2c6f88;
  --kpKeyBg: linear-gradient(180deg, #24343f, #16232c); --kpKeyEdge: #2c6f88;
  --kpAccent: #35c6ff; --kpAccentInk: #04202b;
}
.kpSheet {
  position: relative;
  width: min(330px, calc(100% - 60px));
  background: radial-gradient(120% 100% at 50% 0%, var(--kpBg1), var(--kpBg2));
  border: 1px solid var(--kpEdge);
  border-radius: 6px;
  padding: 20px 22px 16px;
  text-align: center;
  box-shadow: inset 0 0 0 3px rgba(0,0,0,.35), 0 30px 80px rgba(0,0,0,.65);
  transition: border-color .15s ease, box-shadow .15s ease;
}
#keypad.kp-good .kpSheet { border-color: #7fd06a; box-shadow: inset 0 0 0 3px rgba(0,0,0,.35), 0 0 40px rgba(127,208,106,.45); }
#keypad.kp-bad .kpSheet { border-color: #d8534e; box-shadow: inset 0 0 0 3px rgba(0,0,0,.35), 0 0 40px rgba(216,83,78,.45); }
.kpTitle { font-size: 13px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--kpInk); font-family: Georgia, "Times New Roman", serif; }
.kpHint { margin-top: 5px; font-size: 11px; color: var(--kpDim); min-height: 14px; font-style: italic; }
.kpDisplay { display: flex; justify-content: center; gap: 8px; margin: 16px 0 14px; }
.kpDot {
  width: 34px; height: 42px; border-radius: 4px;
  background: var(--kpCell);
  border: 1px solid var(--kpCellEdge);
  box-shadow: inset 0 2px 6px rgba(0,0,0,.45);
  display: grid; place-items: center;
  font-size: 20px; font-weight: 800; color: var(--kpDim);
  font-family: Georgia, "Times New Roman", serif;
}
.kpDot.filled { color: var(--kpInk); border-color: var(--kpAccent); box-shadow: 0 0 12px rgba(232,195,74,.25), inset 0 2px 6px rgba(0,0,0,.45); }
.kpGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpKey {
  padding: 12px 0; border-radius: 5px;
  background: var(--kpKeyBg);
  border: 1px solid var(--kpKeyEdge);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.10), 0 2px 0 rgba(0,0,0,.4);
  color: var(--kpInk); font-size: 16px; font-weight: 800;
  font-family: Georgia, "Times New Roman", serif;
  cursor: pointer;
}
.kpKey:hover { filter: brightness(1.18); }
.kpKey:active { transform: translateY(1px); box-shadow: inset 0 1px 3px rgba(0,0,0,.5); }
.kpOk { background: linear-gradient(180deg, var(--kpAccent), var(--kpKeyEdge)); color: var(--kpAccentInk); border-color: var(--kpAccent); }
.kpWide { font-size: 12px; letter-spacing: .12em; }
.kpHintBottom { margin-top: 12px; font-size: 10px; color: var(--kpDim); letter-spacing: .04em; }
.kpHintBottom b { color: var(--kpAccent); }

/* ---------- Quiz ---------- */
#quiz {
  position: absolute; inset: 0; z-index: 35; touch-action: manipulation;
  pointer-events: auto;
  display: grid; place-items: center;
  background: rgba(4,6,12,.72);
}
.qzSheet {
  position: relative;
  width: min(460px, calc(100% - 60px));
  max-height: 94vh;
  overflow-y: auto;
  pointer-events: auto;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-left: 3px solid var(--pink);
  border-radius: 16px;
  padding: 20px 22px 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  transition: border-color .15s ease;
}
#quiz.qz-good .qzSheet { border-color: #43d17a; box-shadow: 0 0 40px rgba(67,209,122,.5); }
#quiz.qz-bad .qzSheet { border-color: #ff3b5c; box-shadow: 0 0 40px rgba(255,59,92,.5); }
.qzTop { display: flex; align-items: center; justify-content: space-between; }
.qzTitle { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--pink); }
.qzProgress { font-size: 11px; font-weight: 700; color: #9aa3b5; }
.qzWho { margin-top: 4px; font-size: 12px; color: var(--cyan); }
.qzQ { margin: 14px 0 14px; font-size: 16px; font-weight: 700; line-height: 1.45; color: #f2f4f9; }
.qzOpts { display: grid; gap: 8px; pointer-events: auto; }
.qzOpt {
  text-align: left; padding: 11px 14px; border-radius: 10px;
  background: rgba(255,255,255,.07); border: 1px solid var(--stroke);
  color: #e6ebf5; font-size: 14px; cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(36,214,255,.3);
  user-select: none;
  -webkit-user-select: none;
  font-family: inherit;
}
.qzOpt:hover { background: rgba(255,255,255,.14); }
.qzOpt:active { background: rgba(36,214,255,.2); transform: translateY(1px); }
.qzOpt b { color: var(--cyan); margin-right: 8px; }
.qzHint { margin-top: 12px; font-size: 10px; color: #7f89a0; }
.qzHint b { color: var(--cyan); }

/* Modal close button (shared across dialogue, newspaper, keypad, quiz) */
.modalClose {
  position: absolute;
  top: 10px; right: 10px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.08);
  color: #e8eefc;
  font-size: 15px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  z-index: 10;
  padding: 0;
  line-height: 1;
}
.modalClose:hover, .modalClose:active {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.45);
}
.npSheet .modalClose {
  color: #1b1a17;
  border-color: rgba(0,0,0,.25);
  background: rgba(0,0,0,.06);
}
.npSheet .modalClose:hover, .npSheet .modalClose:active {
  background: rgba(0,0,0,.15);
  border-color: rgba(0,0,0,.4);
}
#dialogue .dlgClose {
  top: 10px; right: 10px;
  width: 28px; height: 28px;
  font-size: 13px;
}

/* ---------- Top-screen navigation compass ---------- */
#compass {
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  width: min(520px, 46%);
  min-width: 220px;
  z-index: 4;
  pointer-events: none;
}
.compassStrip {
  position: relative;
  height: 44px;
  background: linear-gradient(180deg, rgba(10,12,22,.88), rgba(10,12,22,.58));
  border: 1px solid var(--stroke);
  border-radius: 10px;
  overflow: hidden;
}
.compassTicks {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(90deg,
    rgba(255,255,255,.30) 0, rgba(255,255,255,.30) 2px,
    transparent 2px, transparent 33px);
  opacity: .55;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
}
.compassStrip::after {
  content: '';
  position: absolute; left: 50%; top: 0; bottom: 0; width: 1px;
  background: rgba(255,255,255,.35);
}
#compassMarker {
  position: absolute;
  top: 4px;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
  transition: left .06s linear;
  color: var(--amber);
}
.cmArrow { font-size: 15px; line-height: 1; transform-origin: 50% 62%; }
.cmDist {
  margin-top: 1px; font-size: 10px; font-weight: 800;
  letter-spacing: .04em; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}

/* compass as a full-width top bar; push the other top HUD down */
#compass {
  top: 0; left: 0; right: 0;
  width: auto; min-width: 0;
  transform: none;
  height: 34px;
}
.compassStrip {
  height: 34px;
  border-radius: 0;
  border-left: 0; border-right: 0; border-top: 0;
}
#compassMarker { top: 3px; }
#topbar { top: 46px; }
#minimapWrap { top: 46px; }
#questPanel { top: 98px; }

/* navigation pill (replaces the full-width compass bar) */
#compass {
  position: absolute;
  top: 12px; left: 50%; right: auto;
  width: auto; min-width: 0; height: auto;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 11px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--amber);
  box-shadow: 0 8px 22px rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  z-index: 6;
}
#compass .cmArrow {
  font-size: 16px; line-height: 1;
  transform-origin: 50% 55%;
  display: inline-block;
  color: var(--amber);
}
#compass .cmDist {
  font-size: 12px; font-weight: 800; letter-spacing: .03em;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}

/* clear shafted arrow for the navigation pill */
#compass .cmArrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  transform-origin: 50% 50%;
  color: var(--amber);
  line-height: 0;
}
#compass .cmArrow svg { display: block; }

/* ---------- GTA-style targeting reticle ---------- */
#crosshair {
  position: absolute; left: 50%; top: 50%;
  width: 0; height: 0; margin: 0;
  border-radius: 0; background: transparent; box-shadow: none;
  z-index: 6;
  transition: transform .07s linear;
}
#crosshair .ch { position: absolute; background: #f2f4f8; box-shadow: 0 0 2px rgba(0,0,0,.9); }
#crosshair .ch-dot { left: -1.5px; top: -1.5px; width: 3px; height: 3px; border-radius: 50%; background: #ff3b5c; }
#crosshair .ch-t { left: -1px; top: -16px; width: 2px; height: 9px; }
#crosshair .ch-b { left: -1px; top: 7px;  width: 2px; height: 9px; }
#crosshair .ch-l { top: -1px; left: -16px; width: 9px; height: 2px; }
#crosshair .ch-r { top: -1px; left: 7px;  width: 9px; height: 2px; }
#crosshair.aim { transform: scale(.72); }
#crosshair.aim .ch-t { top: -9px; }
#crosshair.aim .ch-b { top: 5px; }
#crosshair.aim .ch-l { left: -9px; }
#crosshair.aim .ch-r { left: 5px; }

/* ---------- Scope overlay ---------- */
#scope { position: absolute; inset: 0; z-index: 7; pointer-events: none; }
#scope .scopeMask {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(0,0,0,0) 0 24%, rgba(0,0,0,.98) 26%);
}
#scope .scopeV { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: rgba(0,0,0,.75); }
#scope .scopeH { position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: rgba(0,0,0,.75); }

/* back link on the in-game menu */
.backLink {
  display: inline-block;
  margin-top: 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  color: #24d6ff;
  text-decoration: none;
  border-bottom: 1px solid rgba(36,214,255,.35);
  padding-bottom: 2px;
}
.backLink:hover { color: #fff; border-color: #fff; }

/* ---------- Chapter menu (New Game / Load Game) ---------- */
.menuBtns { display: flex; gap: clamp(4px, 1.2vw, 10px); margin: clamp(2px, 0.6vh, 8px) 0; }
.menuBtns .play { flex: 1; margin-top: 0; padding: clamp(5px, 1.4vh, 15px) clamp(8px, 2vw, 24px); font-size: clamp(10px, 2.2vh, 16px); }

/* sound: one mute switch + a volume slider, in the start/pause menu (works in game and menu alike) */
.soundRow { display: flex; align-items: center; justify-content: center; gap: clamp(4px, 1vw, 12px); margin: clamp(1px, 0.35vh, 6px) 0; }
.soundRow input[type="range"] { width: clamp(70px, 18vw, 140px); height: clamp(12px, 2.2vh, 18px); accent-color: var(--accent); cursor: pointer; }
.soundRow .mini { padding: clamp(2px, 0.5vh, 7px) clamp(5px, 1.2vw, 12px); font-size: clamp(8.5px, 1.6vh, 11px); }
.play.secondary { background: rgba(255,255,255,.10); color: #e6ebf5; border: 1px solid var(--stroke); }
.chapterLine { font-size: clamp(8.5px, 1.6vh, 11px); letter-spacing: .16em; color: #24d6ff; text-transform: uppercase; min-height: clamp(8px, 1.8vh, 14px); margin: clamp(1px, 0.4vh, 4px) 0; }

/* ---------- Mission briefing (narrator + objectives, click NEXT to start) ---------- */
#briefing {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  background:
    radial-gradient(1100px 560px at 50% 0%, rgba(255,46,136,.18), transparent 65%),
    linear-gradient(180deg, #06080f, #0b0e1a 55%, #05070f);
}
#briefing.hidden { display: none; }
#briefing .brSheet {
  width: min(720px, calc(100% - 24px));
  max-height: 94vh; overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: clamp(10px, 2.5vh, 16px);
  padding: clamp(12px, 3vh, 26px) clamp(16px, 4vw, 32px);
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
#briefing .brTag { font-size: clamp(8px, 1.6vh, 10px); letter-spacing: .34em; color: var(--cyan); font-weight: 700; }
#briefing .brChapter {
  font-size: clamp(16px, 4.2vh, 28px); font-weight: 900; letter-spacing: .03em;
  margin: clamp(2px, 0.8vh, 6px) 0 clamp(4px, 1.2vh, 12px);
  background: linear-gradient(180deg, #fff, #ffd0e6 50%, var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#briefing .brText { font-size: clamp(11px, 2.4vh, 16px); line-height: 1.45; color: #dfe5f2; min-height: 0; }
#briefing .brObjectives { margin: clamp(4px, 1vh, 8px) 0 0; padding-left: clamp(14px, 3vw, 20px); color: #cfd6e6; font-size: clamp(10px, 2.2vh, 14px); line-height: 1.45; }
#briefing .brObjectives.hidden { display: none; }
#briefing .brObjectives li::marker { color: var(--amber); }
#briefing .brFoot { display: flex; align-items: center; justify-content: space-between; margin-top: clamp(8px, 2vh, 18px); gap: clamp(8px, 2vw, 16px); }
#briefing .brCount { font-size: clamp(9px, 1.6vh, 11px); letter-spacing: .18em; color: #8f98ac; }
#briefing .brFoot .play { width: auto; margin-top: 0; padding: clamp(6px, 1.8vh, 12px) clamp(14px, 3vw, 32px); font-size: clamp(11px, 2.4vh, 15px); }
#briefing .brBtns { display: flex; align-items: center; gap: clamp(6px, 1.5vw, 10px); }
#briefing .brVoice {
  background: transparent; border: 1px solid var(--stroke); color: #cfd6e4;
  border-radius: clamp(7px, 1.5vh, 10px); padding: clamp(6px, 1.5vh, 11px) clamp(10px, 2vw, 16px);
  font-size: clamp(9px, 1.8vh, 11px); font-weight: 700;
  letter-spacing: .14em; cursor: pointer; transition: .18s;
}
#briefing .brVoice:hover { border-color: var(--pink); color: #fff; }

/* ---------- Touch controls (mobile) ---------- */
#touchui { position: fixed; inset: 0; z-index: 25; pointer-events: none; }
#touchui .tLook { position: absolute; right: 0; top: clamp(30px, 8vh, 56px); bottom: 0; width: 62%; pointer-events: auto; touch-action: none; }
#touchui .tStick {
  position: absolute;
  left: calc(clamp(8px, 2vw, 22px) + env(safe-area-inset-left, 0px));
  bottom: calc(clamp(8px, 2vh, 22px) + env(safe-area-inset-bottom, 0px));
  width: clamp(76px, 20vmin, 136px);
  height: clamp(76px, 20vmin, 136px);
  border-radius: 50%;
  background: rgba(10,12,20,.28);
  border: 2px solid rgba(255,255,255,.28);
  pointer-events: auto;
  touch-action: none;
}
#touchui .tKnob {
  position: absolute; left: 50%; top: 50%;
  width: clamp(32px, 8vmin, 56px);
  height: clamp(32px, 8vmin, 56px);
  margin: calc(clamp(32px, 8vmin, 56px) * -0.5) 0 0 calc(clamp(32px, 8vmin, 56px) * -0.5);
  border-radius: 50%;
  background: rgba(255,255,255,.75);
}
#touchui #tBtns {
  position: absolute;
  right: calc(clamp(8px, 2vw, 18px) + env(safe-area-inset-right, 0px));
  bottom: calc(clamp(8px, 2vh, 18px) + env(safe-area-inset-bottom, 0px));
  width: clamp(120px, 28vw, 195px);
  display: flex; flex-wrap: wrap;
  gap: clamp(3px, 0.8vmin, 8px);
  justify-content: flex-end; align-items: flex-end;
  pointer-events: none;
}
#touchui .tBtn {
  pointer-events: auto; touch-action: none;
  min-width: clamp(36px, 8vmin, 60px);
  min-height: clamp(26px, 6vmin, 44px);
  padding: clamp(4px, 1vmin, 10px) clamp(5px, 1.2vmin, 10px);
  border-radius: clamp(6px, 1.2vmin, 12px);
  border: 1px solid rgba(255,255,255,.3);
  background: rgba(10,12,20,.5);
  color: #e8eefc;
  font: 800 clamp(8.5px, 1.8vmin, 11px)/1 system-ui, sans-serif;
  letter-spacing: .08em;
}
#touchui .tBtn.on { background: rgba(255,181,46,.85); color: #10131a; }
#touchui .tFire { background: rgba(255,46,136,.62); border-color: rgba(255,255,255,.45); }
#touchui .tFire.auto { background: rgba(255,46,136,.95); border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.5), 0 0 18px rgba(255,46,136,.9); }
#touchui .tFire.engaged { background: rgba(220,20,20,.95) !important; border-color: #ffd700 !important; box-shadow: 0 0 16px rgba(220,20,20,.9) !important; color: #fff !important; }
#touchui #tFormations {
  position: absolute;
  right: calc(clamp(8px, 2vw, 18px) + env(safe-area-inset-right, 0px));
  bottom: calc(clamp(90px, 22vh, 145px) + env(safe-area-inset-bottom, 0px));
  display: flex; gap: clamp(3px, 0.8vmin, 8px);
  pointer-events: none;
  z-index: 99;
}
#touchui .tFormBtn {
  pointer-events: auto; touch-action: none;
  background: rgba(14,18,28,0.78);
  border: 1.5px solid rgba(216,180,90,0.45);
  color: #ffd76a;
}
#touchui .tFormBtn.on { background: rgba(216,180,90,0.92); color: #0c1014; font-weight: 900; border-color: #fff; }
#touchui .tFormBtn.engaged { background: rgba(220,20,20,0.88); color: #fff; border-color: #ff5555; }
/* the context/action button: appears only when something is actionable, sits just left of the
   action pad so the right thumb can reach it without leaving the buttons */
#touchui .tCtx {
  position: absolute;
  right: calc(clamp(130px, 30vw, 225px) + env(safe-area-inset-right, 0px));
  bottom: calc(clamp(10px, 2.5vh, 26px) + env(safe-area-inset-bottom, 0px));
  max-width: 40vw; pointer-events: auto; touch-action: none;
  padding: clamp(6px, 1.5vh, 14px) clamp(10px, 2.5vw, 18px);
  border-radius: clamp(8px, 1.8vh, 14px);
  border: 2px solid rgba(255,255,255,.5);
  background: rgba(10,12,20,.72);
  color: #fff;
  font: 800 clamp(10px, 2.2vh, 14px)/1.1 system-ui, sans-serif;
  letter-spacing: .04em;
  box-shadow: 0 4px 16px rgba(0,0,0,.45);
  min-height: clamp(28px, 6vh, 48px);
}
#touchui .tCtx.ok { background: rgba(63,159,110,.9); border-color: rgba(255,255,255,.7); }
#touchui .tCtx.hidden { display: none; }
/* explicit fullscreen toggle (top-left, clear of the HUD and thumbs) */
#touchui .tFs {
  position: absolute;
  left: calc(clamp(8px, 2vw, 12px) + env(safe-area-inset-left, 0px));
  top: calc(clamp(8px, 1.5vh, 12px) + env(safe-area-inset-top, 0px));
  pointer-events: auto; touch-action: manipulation;
  width: clamp(34px, 8vmin, 46px); height: clamp(30px, 7vmin, 42px);
  border-radius: clamp(6px, 1.2vmin, 10px);
  border: 1px solid rgba(255,255,255,.3);
  background: rgba(10,12,20,.55); color: #e8eefc;
  font: 800 clamp(13px, 3vmin, 18px)/1 system-ui, sans-serif;
}
body.is-touch #touchui .tFs { top: clamp(6px, 1.5vh, 10px); }
@media (pointer: coarse) {
  #touchui .tBtn { min-width: clamp(38px, 8.5vmin, 66px); min-height: clamp(28px, 6.5vmin, 50px); font-size: clamp(9px, 1.9vmin, 12px); }
  #touchui .tStick { width: clamp(78px, 21vmin, 148px); height: clamp(78px, 21vmin, 148px); }
  #touchui .tKnob { width: clamp(34px, 8.5vmin, 62px); height: clamp(34px, 8.5vmin, 62px); margin: calc(clamp(34px, 8.5vmin, 62px) * -0.5) 0 0 calc(clamp(34px, 8.5vmin, 62px) * -0.5); }
  #touchui .tCtx { min-height: clamp(30px, 6.5vh, 52px); font-size: clamp(10px, 2.2vh, 14px); }
  .qzOpt { min-height: clamp(32px, 6.5vh, 48px); padding: clamp(6px, 1.5vh, 12px) clamp(10px, 2vw, 16px); font-size: clamp(11px, 2.4vh, 15px); }
  #dialogue .dlgChoice { min-height: clamp(32px, 6.5vh, 48px); padding: clamp(6px, 1.5vh, 12px) clamp(10px, 2vw, 16px); font-size: clamp(11px, 2.4vh, 15px); }
}

/* ---------- Mobile HUD trim (body.is-touch) ----------
   On a phone screen the debug/ambient chips, minimap, FULL objective panel and status text cover
   too much of the world. Keep only what you act on: crosshair, health + ammo, the objective
   compass pill, hit marker, prompts and the pause button. Everything else is hidden. */
body.is-touch #minimapWrap,
body.is-touch #questPanel,
body.is-touch #stateText,
body.is-touch #hudMute,
body.is-touch #vignette { display: none !important; }

/* Mobile FPS display: clean translucent badge at top-left, clear of fullscreen toggle & pause */
body.is-touch #topbar {
  display: flex !important;
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  max-width: none;
  gap: 0;
  pointer-events: none;
  z-index: 10;
}
body.is-touch:not(.is-embedded) #topbar {
  left: calc(66px + env(safe-area-inset-left, 0px));
}
body.is-touch #topbar .chip {
  display: none !important;
}
body.is-touch #topbar #hudFpsChip {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 8px;
  background: rgba(10, 12, 20, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #e8eefc;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
  line-height: 1;
  min-height: 0;
  height: auto;
}
body.is-touch #hudFpsChip .label {
  font-size: 8px;
  letter-spacing: .12em;
  color: var(--cyan);
}
/* Mobile WANTED stars badge: clear top-right position adjacent to pause button */
body.is-touch #topbar #hudWantedChip:not(.hidden) {
  display: inline-flex !important;
  position: fixed;
  top: calc(clamp(6px, 1.5vh, 10px) + env(safe-area-inset-top, 0px));
  right: calc(clamp(48px, 12vw, 62px) + env(safe-area-inset-right, 0px));
  align-items: center;
  gap: clamp(4px, 1vw, 6px);
  padding: clamp(3px, 0.8vh, 4px) clamp(6px, 1.2vw, 8px);
  font-size: clamp(9px, 1.8vh, 11px);
  font-weight: 700;
  border-radius: clamp(6px, 1.2vh, 8px);
  background: rgba(10, 12, 20, 0.75);
  border: 1px solid rgba(255, 60, 60, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
  line-height: 1;
  min-height: 0;
  height: auto;
  z-index: 10;
  box-shadow: 0 0 10px rgba(255, 60, 60, 0.2);
}
body.is-touch #hudWantedChip .label {
  font-size: clamp(7px, 1.4vh, 8px);
  letter-spacing: .12em;
  color: #ff3b30;
  font-weight: 800;
}
body.is-touch #hudWanted {
  color: #ffd000;
  letter-spacing: 2px;
  font-size: clamp(10px, 2vh, 12px);
  text-shadow: 0 0 6px rgba(255, 208, 0, 0.7);
  line-height: 1;
}
/* compact health+ammo at bottom-centre: clear of the move stick (bottom-left) and the action pad
   (bottom-right) */
body.is-touch #statusPanel {
  left: 50%;
  bottom: clamp(6px, 1.5vh, 10px);
  width: clamp(140px, 32vw, 200px);
  transform: translateX(-50%);
  padding: clamp(4px, 1vh, 6px) clamp(8px, 1.5vw, 10px);
}
body.is-touch #statusPanel .statRow { font-size: clamp(9.5px, 1.8vh, 12px); margin-top: clamp(3px, 0.6vh, 5px); }
body.is-touch .barWrap { height: clamp(10px, 2vh, 14px); }
body.is-touch #hudBtns {
  top: clamp(6px, 1.5vh, 10px);
  right: clamp(6px, 1.5vw, 10px);
  gap: clamp(4px, 1vw, 6px);
}
body.is-touch #hudBtns .hudBtn {
  min-width: clamp(34px, 8vmin, 44px);
  min-height: clamp(28px, 6.5vmin, 40px);
  padding: clamp(4px, 1vmin, 6px) clamp(6px, 1.2vmin, 10px);
  font-size: clamp(9px, 1.8vmin, 11px);
}

/* ---------- HUD action buttons (voice + pause) ---------- */
#hudBtns { position: absolute; top: clamp(8px, 1.8vh, 12px); right: clamp(8px, 1.8vw, 12px); z-index: 9; display: flex; gap: clamp(6px, 1.2vw, 8px); }
#hudBtns .hudBtn { pointer-events: auto; touch-action: manipulation; min-width: clamp(36px, 8vmin, 46px); min-height: clamp(28px, 6.5vmin, 40px); padding: clamp(4px, 1vmin, 8px) clamp(6px, 1.2vmin, 12px); border-radius: clamp(7px, 1.5vmin, 10px); border: 1px solid rgba(255,255,255,.28); background: rgba(8,10,16,.5); color: #e8eefc; font: 800 clamp(9px, 1.8vmin, 11px)/1 system-ui, sans-serif; letter-spacing: .08em; cursor: pointer; }
#hudBtns .hudBtn:hover { border-color: #ff2e88; }
#hudBtns .hudBtn.off { color: #ff8a8a; border-color: rgba(255,90,90,.5); }
@media (pointer: coarse) { #hudBtns .hudBtn { min-width: clamp(40px, 9vmin, 58px); min-height: clamp(32px, 7vmin, 48px); font-size: clamp(10px, 2vmin, 12px); } }

/* ---------- Difficulty Selection ---------- */
.diffSelect {
  margin-top: clamp(2px, 0.6vh, 10px);
  display: flex;
  flex-direction: column;
  gap: clamp(2px, 0.6vh, 8px);
  text-align: center;
}
.diffSelect.hidden { display: none !important; }
.diffTitle {
  font-size: clamp(8.5px, 1.6vh, 11px);
  font-weight: 800;
  letter-spacing: .2em;
  color: var(--cyan);
  text-transform: uppercase;
  margin-bottom: 2px;
}
.diffBtns {
  display: flex;
  flex-direction: row;
  gap: clamp(4px, 1vw, 8px);
}
.diffBtn {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(4px, 1vh, 10px) clamp(4px, 1vw, 10px);
  border-radius: clamp(6px, 1.2vh, 12px);
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.06);
  color: #fff;
  cursor: pointer;
  transition: all .18s ease;
}
.diffBtn:hover {
  background: rgba(255,255,255,.14);
  transform: translateY(-1px);
}
.diffBtn[data-diff="easy"]:hover { border-color: #43d17a; }
.diffBtn[data-diff="medium"]:hover { border-color: var(--amber); }
.diffBtn[data-diff="hard"]:hover { border-color: #ff3b5c; }
.diffName {
  font-size: clamp(9.5px, 1.8vh, 13px);
  font-weight: 900;
  letter-spacing: .12em;
}
.diffBtn[data-diff="easy"] .diffName { color: #43d17a; }
.diffBtn[data-diff="medium"] .diffName { color: var(--amber); }
.diffBtn[data-diff="hard"] .diffName { color: #ff4d4d; }
.diffDesc {
  font-size: clamp(8px, 1.5vh, 10.5px);
  color: #9aa3b5;
  margin-top: 2px;
  letter-spacing: .02em;
  line-height: 1.25;
}
.diffBack {
  align-self: center;
  background: transparent;
  border: 1px solid var(--stroke);
  color: #cfd6e6;
  border-radius: 8px;
  padding: clamp(2.5px, 0.6vh, 6px) clamp(8px, 1.8vw, 18px);
  font-size: clamp(8.5px, 1.6vh, 11px);
  font-weight: 700;
  letter-spacing: .1em;
  cursor: pointer;
  margin-top: 2px;
  transition: .18s;
}
.diffBack:hover {
  border-color: #fff;
  color: #fff;
}

/* Compact viewports / touch devices: hide keyboard hint/legend and lengthy difficulty descriptions */
@media (max-height: 480px) {
  #menu .hint, #menu .credit, #menu .menuControls { display: none !important; }
  .diffDesc { display: none !important; }
}
body.is-touch #menu .hint,
body.is-touch #menu .credit,
body.is-touch #menu .menuControls,
body.is-touch .diffDesc,
body.is-compact #menu .hint,
body.is-compact #menu .credit,
body.is-compact #menu .menuControls,
body.is-compact .diffDesc {
  display: none !important;
}

/* Modals & sheets: fluid scaling for all window sizes */
#newspaper .npSheet {
  width: min(560px, calc(100% - 24px));
  max-height: 92vh;
  overflow-y: auto;
  padding: clamp(12px, 2.5vh, 22px) clamp(14px, 3vw, 26px);
}
#newspaper .npHeadline { font-size: clamp(16px, 4vh, 24px); }
#newspaper .npBody { font-size: clamp(11px, 2.2vh, 14px); line-height: 1.4; }
.kpSheet {
  width: min(330px, calc(100% - 24px));
  max-height: 92vh;
  overflow-y: auto;
  padding: clamp(10px, 2vh, 20px) clamp(12px, 2.5vw, 22px);
}
.kpTitle { font-size: clamp(11px, 2.2vh, 13px); }
.kpDot { width: clamp(26px, 6vmin, 34px); height: clamp(32px, 7vmin, 42px); font-size: clamp(15px, 3.5vmin, 20px); }
.kpKey { padding: clamp(6px, 1.5vh, 12px) 0; font-size: clamp(12px, 2.5vh, 16px); }
.qzSheet {
  width: min(460px, calc(100% - 24px));
  max-height: 92vh;
  overflow-y: auto;
  padding: clamp(10px, 2vh, 20px) clamp(12px, 2.5vw, 22px);
}
.qzTitle { font-size: clamp(10px, 2vh, 12px); }
.qzQ { margin: clamp(6px, 1.2vh, 14px) 0; font-size: clamp(12px, 2.6vh, 16px); }
.qzOpt { min-height: clamp(30px, 5.5vh, 44px); padding: clamp(6px, 1.2vh, 11px) clamp(10px, 2vw, 14px); font-size: clamp(11px, 2.2vh, 14px); }
#dialogue {
  bottom: clamp(6px, 1.5vh, 20px);
  width: min(600px, calc(100% - 24px));
  max-height: 88vh;
  overflow-y: auto;
  padding: clamp(8px, 1.8vh, 14px) clamp(10px, 2.5vw, 18px);
  border-radius: clamp(10px, 2vh, 16px);
}
#dialogue .line { font-size: clamp(11px, 2.2vh, 15px); }
#dialogue .dlgChoices { gap: clamp(4px, 1vh, 8px); margin-top: clamp(4px, 1vh, 8px); }
#dialogue .dlgChoice { min-height: clamp(28px, 5vh, 40px); padding: clamp(5px, 1vh, 10px) clamp(8px, 2vw, 14px); font-size: clamp(10px, 2vh, 14px); }


/* ---- Multiplayer & Co-op UI (Squad Voice Call Room) ---- */
.lobbySheet {
  width: min(880px, calc(100% - 28px));
  max-height: 90vh;
  background: radial-gradient(900px 520px at 50% -10%, rgba(34, 197, 94, 0.10), rgba(10, 14, 26, 0.96) 65%, #05070e);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 30px rgba(34, 197, 94, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #fff;
  z-index: 50;
}
#lobbyModal, #joinModal {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 15, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
#lobbyModal.hidden, #joinModal.hidden { display: none !important; }

.lobbyHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}
.lobbyTag {
  font-size: 11px;
  letter-spacing: 0.18em;
  font-weight: 800;
  color: #22c55e;
  text-transform: uppercase;
}
.lobbyHeader h2 {
  margin: 4px 0 0 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fff;
}
.lobbyClose {
  background: transparent;
  border: none;
  color: #8a93a6;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: 0.15s;
}
.lobbyClose:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }

.lobbyTopBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px 8px 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.roomCodeBox {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.28);
  border-radius: 10px;
  padding: 6px 14px;
}
.codeLbl {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #8a93a6;
  font-weight: 700;
}
.codeVal {
  font-family: monospace;
  font-size: 18px;
  font-weight: 900;
  color: #22c55e;
  letter-spacing: 0.12em;
}
.copyBtn {
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.45);
  color: #22c55e;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: 0.15s;
}
.copyBtn:hover {
  background: rgba(34, 197, 94, 0.35);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.voiceCallBadge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
}
.voiceLiveDot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: liveDotPulse 1.4s infinite ease-in-out;
}
@keyframes liveDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}
.voiceCallLabel {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #22c55e;
}

.lobbyBodyVoice {
  padding: 10px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  min-height: 240px;
  max-height: 360px;
}
.squadHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.14em;
  font-weight: 800;
  color: #aab2c6;
  text-transform: uppercase;
}
.hostBadge {
  background: rgba(255, 181, 46, 0.2);
  color: #ffb52e;
  border: 1px solid rgba(255, 181, 46, 0.4);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
}

/* Operatives Grid */
.lobbyPlayerGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.lobbyCard {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}
.lobbyCard.is-me {
  background: rgba(36, 214, 255, 0.05);
  border-color: rgba(36, 214, 255, 0.3);
}
.lobbyCard.is-speaking {
  border-color: #22c55e !important;
  background: rgba(34, 197, 94, 0.08) !important;
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.28);
}
.lobbyCard.is-disc {
  opacity: 0.65;
  border-color: rgba(255, 46, 136, 0.4);
}

.cardAvatarWrap {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cardAvatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #101626;
  border: 2px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.lobbyCard.is-speaking .cardAvatar {
  border-color: #22c55e;
  box-shadow: 0 0 10px #22c55e;
}
.avatarPulseRing {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid #22c55e;
  box-shadow: 0 0 12px #22c55e;
  animation: pulseRing 1.2s infinite ease-out;
  pointer-events: none;
}
@keyframes pulseRing {
  0% { transform: scale(0.95); opacity: 1; }
  100% { transform: scale(1.28); opacity: 0; }
}

.cardInfo {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.cardNameRow {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cardName {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.badgeTag {
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.06em;
}
.badgeTag.you { background: rgba(36, 214, 255, 0.2); color: #24d6ff; }
.badgeTag.host { background: rgba(255, 181, 46, 0.2); color: #ffb52e; }
.badgeTag.role { background: rgba(57, 255, 20, 0.15); color: #39ff14; border: 1px solid rgba(57, 255, 20, 0.3); }

.cardVoiceStatus {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}
.statusText { font-weight: 700; letter-spacing: 0.06em; }
.statusText.speaking { color: #22c55e; }
.statusText.open { color: #8a93a6; }
.statusText.muted { color: #ff2e88; }
.statusText.disc { color: #ff9999; }

.vWave, .hudWave {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 12px;
}
.vWave span, .hudWave span {
  width: 2px;
  height: 100%;
  background: #22c55e;
  border-radius: 1px;
  animation: vWaveAnim 0.5s infinite ease-in-out alternate;
}
.vWave span:nth-child(2), .hudWave span:nth-child(2) { animation-delay: 0.15s; height: 75%; }
.vWave span:nth-child(3), .hudWave span:nth-child(3) { animation-delay: 0.3s; height: 45%; }
@keyframes vWaveAnim {
  0% { transform: scaleY(0.25); }
  100% { transform: scaleY(1.0); }
}

.cardActions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.voiceActionBtn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 8px;
  cursor: pointer;
  transition: 0.15s;
}
.voiceActionBtn:hover { background: rgba(255, 255, 255, 0.16); }
.voiceActionBtn.muted {
  background: rgba(255, 46, 136, 0.18);
  border-color: rgba(255, 46, 136, 0.4);
  color: #ff2e88;
}
.kickBtn {
  background: rgba(255, 46, 136, 0.15);
  border: 1px solid rgba(255, 46, 136, 0.3);
  color: #ff2e88;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 8px;
  cursor: pointer;
}
.kickBtn:hover { background: #ff2e88; color: #fff; }

/* Voice Controls Bar */
.voiceControlsPanel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  margin: 8px 24px 12px 24px;
}
.voiceBtnGroup {
  display: flex;
  align-items: center;
  gap: 10px;
}
.voiceBtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #22c55e;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: 0.15s;
}
.voiceBtn:hover { background: rgba(34, 197, 94, 0.28); }
.voiceBtn.secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}
.voiceBtn.secondary:hover { background: rgba(255, 255, 255, 0.12); }
.voiceBtn.muted {
  background: rgba(255, 46, 136, 0.15);
  border-color: rgba(255, 46, 136, 0.35);
  color: #ff2e88;
}

.voiceVolGroup {
  display: flex;
  align-items: center;
  gap: 10px;
}
.volLabel {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #8a93a6;
}
.voiceVolGroup input[type="range"] {
  width: 90px;
  accent-color: #22c55e;
}
.voiceHint {
  font-size: 11px;
  color: #8a93a6;
}
.hotkeyHint b {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.hostOptions {
  padding: 0 24px 8px 24px;
}
.hostOptions .toggleRow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #c0c8db;
  cursor: pointer;
}

.lobbyFooter {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}
.lobbyFooter .play {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 800;
}
#lobbyStartBtn {
  background: linear-gradient(90deg, #ffb52e, #ff7ac2);
  color: #070912;
  box-shadow: 0 0 20px rgba(255, 181, 46, 0.4);
}

.joinSheet {
  width: min(440px, calc(100% - 24px));
  background: #0d111e;
  border: 1px solid rgba(36, 214, 255, 0.35);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}
.modalTop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.modalTop h3 { margin: 0; font-size: 18px; color: #fff; }
.joinDesc { font-size: 13px; color: #aab2c6; line-height: 1.4; margin-bottom: 16px; }
#joinCodeInput {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(36, 214, 255, 0.3);
  border-radius: 8px;
  font-family: monospace;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #24d6ff;
  text-transform: uppercase;
  margin-bottom: 20px;
  outline: none;
}
#joinCodeInput:focus { border-color: #24d6ff; box-shadow: 0 0 12px rgba(36, 214, 255, 0.3); }
.joinBtns { display: flex; justify-content: flex-end; gap: 10px; }

/* In-game HUD Squad Voice Comms */
#hudSquad {
  position: absolute;
  top: 64px;
  left: 16px;
  background: rgba(10, 14, 26, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 190px;
  z-index: 15;
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.hudSquadHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.hudSquadTitle {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #8a93a6;
  text-transform: uppercase;
}
.hudSquadBadge {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
  padding: 1px 5px;
  border-radius: 8px;
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.hudSquadList {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hudSquadRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: #fff;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  transition: 0.15s;
}
.hudSquadRow.is-me {
  background: rgba(36, 214, 255, 0.06);
}
.hudSquadRow.talking {
  background: rgba(34, 197, 94, 0.16) !important;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
  color: #22c55e !important;
}
.hudSquadRow .hudSName {
  font-weight: 800;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hudSquadRow .hudSHp {
  font-size: 10px;
  font-weight: 700;
  color: #24d6ff;
}
.hudSquadRow .hudSBadge {
  font-size: 8px;
  font-weight: 900;
  background: rgba(36, 214, 255, 0.2);
  color: #24d6ff;
  padding: 1px 4px;
  border-radius: 3px;
}
.hudSVoiceBtn, .hudSVoiceIcon {
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
}
.hudDisc {
  font-size: 9px;
  color: #ff2e88;
  font-weight: 800;
}
.hudMicStatus {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 8px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.08em;
  color: #22c55e;
  transition: 0.15s;
}
.hudMicStatus:hover {
  background: rgba(34, 197, 94, 0.22);
}
.hudMicStatus.muted {
  background: rgba(255, 46, 136, 0.12);
  border-color: rgba(255, 46, 136, 0.3);
  color: #ff2e88;
}

#hudReconnectBanner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 46, 136, 0.9);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.08em;
  padding: 6px 18px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 0 20px rgba(255, 46, 136, 0.6);
  z-index: 30;
}
.reconnDot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: pulseReconn 1s infinite alternate;
}
@keyframes pulseReconn {
  0% { opacity: 0.3; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1.2); }
}


/* ==========================================================================
   Mobile & Responsive Adaptations (No crowding, finger-friendly touch UI)
   ========================================================================== */

/* Touch screens & Mobile HUD Squad Placement:
   Tucked top-left, ultra-compact, clear of move joystick at bottom-left */
body.is-touch #hudSquad,
@media (max-width: 768px) {
  #hudSquad {
    top: calc(44px + env(safe-area-inset-top, 0px)) !important;
    left: calc(10px + env(safe-area-inset-left, 0px)) !important;
    right: auto !important;
    padding: 6px 10px;
    min-width: 130px;
    max-width: clamp(140px, 36vw, 190px);
    border-radius: 10px;
    background: rgba(8, 10, 18, 0.82);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
    z-index: 25;
  }
  #hudSquad .hudSquadHeader {
    margin-bottom: 4px;
  }
  #hudSquad .hudSquadTitle {
    font-size: 9px;
  }
  #hudSquad .hudSquadList {
    gap: 4px;
    max-height: clamp(60px, 18vh, 110px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  #hudSquad .hudSquadRow {
    padding: 2px 4px;
    font-size: 10px;
    gap: 4px;
  }
  #hudSquad .hudSquadRow .hudSName {
    max-width: clamp(50px, 14vw, 75px);
    font-size: 9.5px;
  }
  #hudSquad .hudSquadRow .hudSHp {
    font-size: 9px;
  }
  #hudSquad .hudMicStatus {
    margin-top: 5px;
    padding: 5px 8px;
    font-size: 9.5px;
    min-height: 30px;
    justify-content: center;
    touch-action: manipulation;
  }
}

/* Mobile Portrait & Narrow Viewports (<680px) */
@media (max-width: 680px) {
  .lobbySheet {
    width: calc(100% - 16px);
    margin: 8px;
    max-height: calc(100dvh - 16px);
    border-radius: 14px;
  }
  .lobbyHeader {
    padding: 10px 16px;
  }
  .lobbyHeader h2 {
    font-size: 17px;
  }
  .lobbyTopBar {
    padding: 10px 16px 6px 16px;
    gap: 8px;
  }
  .roomCodeBox {
    flex: 1;
    padding: 5px 10px;
    gap: 8px;
  }
  .codeVal {
    font-size: 15px;
  }
  .copyBtn {
    padding: 4px 8px;
    font-size: 10px;
  }
  .voiceCallBadge {
    padding: 4px 10px;
    font-size: 10px;
  }
  .lobbyBodyVoice {
    padding: 6px 16px;
    min-height: 0;
    max-height: 40vh;
  }
  .lobbyPlayerGrid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .lobbyCard {
    padding: 8px 10px;
    gap: 10px;
    border-radius: 10px;
  }
  .cardAvatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  .cardName {
    font-size: 12px;
  }
  .voiceActionBtn {
    padding: 4px 8px;
    font-size: 9.5px;
  }
  .voiceControlsPanel {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 14px;
    margin: 6px 16px 8px 16px;
    gap: 10px;
  }
  .voiceBtnGroup {
    width: 100%;
  }
  .voiceBtn {
    flex: 1;
    justify-content: center;
    padding: 8px 10px;
    font-size: 11px;
    min-height: 40px;
  }
  .voiceVolGroup {
    justify-content: space-between;
    width: 100%;
  }
  .voiceVolGroup input[type="range"] {
    flex: 1;
    max-width: 160px;
  }
  .voiceHint {
    text-align: center;
    font-size: 10px;
  }
  .hostOptions {
    padding: 0 16px 6px 16px;
  }
  .lobbyFooter {
    padding: 10px 16px;
    gap: 8px;
  }
  .lobbyFooter button {
    flex: 1;
    padding: 9px 14px;
    font-size: 12.5px;
    min-height: 42px;
  }
  .joinSheet {
    width: calc(100% - 24px);
    padding: 18px;
  }
}

/* Mobile Landscape & Low Height Displays (<520px) */
@media (max-height: 520px) {
  .lobbySheet {
    max-height: calc(100dvh - 12px);
    border-radius: 12px;
  }
  .lobbyHeader {
    padding: 6px 16px;
  }
  .lobbyHeader h2 {
    font-size: 15px;
  }
  .lobbyTag {
    font-size: 9px;
  }
  .lobbyTopBar {
    padding: 4px 16px;
    gap: 8px;
  }
  .roomCodeBox {
    padding: 3px 8px;
  }
  .codeVal {
    font-size: 14px;
  }
  .voiceCallBadge {
    padding: 3px 8px;
    font-size: 9px;
  }
  .lobbyBodyVoice {
    padding: 4px 16px;
    min-height: 0;
    max-height: calc(100dvh - 180px);
  }
  .lobbyPlayerGrid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 6px;
  }
  .lobbyCard {
    padding: 6px 8px;
    gap: 8px;
    border-radius: 8px;
  }
  .cardAvatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  .cardName {
    font-size: 11px;
  }
  .voiceControlsPanel {
    padding: 6px 12px;
    margin: 4px 16px;
    gap: 8px;
  }
  .voiceBtn {
    padding: 4px 10px;
    font-size: 10.5px;
    min-height: 32px;
  }
  .hostOptions {
    padding: 0 16px 4px 16px;
    font-size: 10.5px;
  }
  .lobbyFooter {
    padding: 6px 16px;
  }
  .lobbyFooter button {
    padding: 6px 14px;
    font-size: 11px;
    min-height: 34px;
  }
}

body.is-touch .hotkeyHint b {
  display: none !important;
}
