:root {
  --green: #7bd88f;
  --amber: #ffcc66;
  --red: #ff5d5d;
  --ink: #0c0f0a;
  --panel: rgba(12, 16, 12, 0.72);
  --mono: "SF Mono", "JetBrains Mono", "Consolas", ui-monospace, monospace;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #11140e;
  font-family: var(--mono);
  color: #e7ecdf;
  cursor: none;
  user-select: none;
}

#game { display: block; width: 100vw; height: 100vh; }

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

#vitals { position: absolute; left: 22px; bottom: 22px; }

#healthbar {
  position: relative;
  width: 280px; height: 26px;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  overflow: hidden;
}
#healthfill {
  position: absolute; inset: 0;
  width: 100%;
  background: linear-gradient(90deg, #4caf6a, var(--green));
  transition: width 90ms linear, background 200ms;
}
#healthtext {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  text-shadow: 0 1px 2px #000;
}

#stambar {
  width: 280px; height: 7px; margin-top: 6px;
  background: var(--panel); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 3px; overflow: hidden;
}
#stamfill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #3a86b8, #6fd0ff);
  transition: width 80ms linear;
}

#armor { margin-top: 7px; font-size: 12px; color: #aeb8c9; }

#status { margin-bottom: 8px; display: flex; gap: 6px; }
#status span {
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  padding: 3px 7px; border-radius: 3px;
}
#status .bleed { background: rgba(160,20,20,0.9); color: #ffd9d9; animation: pulse 1s infinite; }
#status .wound { background: rgba(150,90,20,0.9); color: #ffe6c2; }
#status .tired { background: rgba(40,70,110,0.9); color: #cfe6ff; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }

#ammo {
  position: absolute; right: 22px; bottom: 22px;
  text-align: right;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 10px 16px 12px;
  min-width: 190px;
  pointer-events: auto; cursor: pointer; /* click to reload */
}
#weaponname {
  display: block;
  font-size: 13px; letter-spacing: 1px;
  color: #aebda0; text-transform: uppercase;
}
#optic { display: block; font-size: 11px; color: #8fb0c9; margin: 2px 0 4px; }
.firemode {
  display: inline-block; margin-bottom: 4px;
  font-size: 12px; font-weight: 700; letter-spacing: 1px;
  color: #07120a; background: var(--green);
  padding: 2px 9px; border-radius: 4px;
  pointer-events: auto; cursor: pointer;
}
.firemode.safe { background: var(--red); color: #fff; }
#ammocount { font-size: 34px; line-height: 1.1; font-weight: 700; }
#ammocount b { color: #fff; }
#ammocount .sep { color: #5e6b54; margin: 0 2px; font-weight: 400; }
#ammocount i { color: #9aa88d; font-style: normal; font-size: 22px; }

#reloadbar {
  margin-top: 6px; height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px; overflow: hidden;
  opacity: 0; transition: opacity 150ms;
}
#reloadbar.active { opacity: 1; }
#reloadfill { height: 100%; width: 0; background: var(--amber); }

#scale-readout {
  position: absolute; left: 22px; top: 18px;
  font-size: 12px; color: #8b9a7d;
  background: var(--panel); padding: 6px 10px; border-radius: 4px;
}
#scale-readout .sq-order {
  color: #7ad0b0; pointer-events: auto; cursor: pointer;
  text-decoration: underline dotted rgba(122,208,176,0.5);
}
#scale-readout .sq-order:hover { color: #a8ecd0; }

#minimap {
  position: absolute; right: 22px; top: 18px;
  width: 180px; height: 180px;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
}

#killfeed {
  position: absolute; right: 22px; top: 210px;
  width: 240px; text-align: right;
  font-size: 13px; line-height: 1.7;
}
#killfeed .k { background: var(--panel); padding: 2px 8px; border-radius: 3px; display: inline-block; margin-bottom: 4px; }
#killfeed .k .you { color: var(--green); }
#killfeed .k .dead { color: var(--red); }

#weapons-rack {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; gap: 6px;
}
#weapons-rack .slot {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 12px; color: #8b9a7d;
  display: flex; flex-direction: column; align-items: center; min-width: 64px;
  pointer-events: auto; cursor: pointer; /* click to switch weapon */
}
#weapons-rack .slot .n { color: #5e6b54; font-size: 10px; }
#weapons-rack .slot.nade { color: #c9d6bc; }
#weapons-rack .slot.nade.empty { opacity: 0.35; }
#weapons-rack .slot.active {
  border-color: var(--amber); color: #fff;
  box-shadow: 0 0 0 1px var(--amber) inset;
}

/* ---------- Ability / support prompts (bottom-left, above vitals) ---------- */
#abilities {
  position: absolute; left: 22px; bottom: 122px;
  display: flex; flex-direction: column; gap: 3px;
  font-size: 11px; pointer-events: none; width: 178px;
}
#abilities .ab {
  background: var(--panel); border-radius: 4px; padding: 2px 7px;
  border-left: 3px solid #3a4433; color: #7d8a70;
  display: flex; align-items: baseline; gap: 6px; white-space: nowrap;
  pointer-events: auto; cursor: pointer; /* click a chip to use it */
}
#abilities .ab:hover { filter: brightness(1.25); }
#abilities .ab kbd {
  background: #20261b; border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px; padding: 0 5px; font-family: var(--mono);
  font-size: 11px; color: #cdd8bf;
}
#abilities .ab .nm { color: #aebba0; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
#abilities .ab .st { margin-left: auto; font-family: var(--mono); font-size: 11px; opacity: 0.9; flex: none; }
#abilities .ab .how { color: #61705a; font-size: 10.5px; }
#abilities .ab.ready { border-left-color: var(--green); color: #b7e6c4; }
#abilities .ab.ready .st { color: #7bd88f; }
#abilities .ab.active { border-left-color: var(--amber); color: #ffe6a8; }
#abilities .ab.active .st { color: var(--amber); }
#abilities .ab.cool { opacity: 0.6; }

/* ---------- Scoreboard (hold Tab) ---------- */
#scoreboard {
  position: absolute; left: 50%; top: 12%; transform: translateX(-50%);
  background: rgba(8, 11, 6, 0.94); border: 1px solid rgba(123,216,143,0.3);
  border-radius: 10px; padding: 16px 26px; min-width: 380px;
  pointer-events: none; box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
#scoreboard.hidden { display: none; }
#scoreboard .sb-title { text-align: center; letter-spacing: 3px; font-weight: 700; color: #cfe0d6; margin-bottom: 10px; font-size: 14px; }
#scoreboard table { width: 100%; border-collapse: collapse; }
#scoreboard th.you { color: #7fe0c0; text-align: left; }
#scoreboard th.foe { color: #ff7a6a; text-align: right; }
#scoreboard th.mid { width: 40%; }
#scoreboard th { font-size: 12px; letter-spacing: 1px; padding: 3px 6px; }
#scoreboard td { font-size: 16px; font-weight: 700; color: #e6f0dc; padding: 3px 6px; font-family: var(--mono); }
#scoreboard td.l { text-align: left; color: #9fe0c8; }
#scoreboard td.r { text-align: right; color: #ffb0a4; }
#scoreboard tr th:nth-child(2) { color: #8b9a7d; font-weight: 500; text-align: center; }
#scoreboard .sb-you { margin-top: 10px; text-align: center; font-size: 12px; color: #aebba0; }
#scoreboard .sb-you b { color: #fff; }
#scoreboard .sb-hint { margin-top: 6px; text-align: center; font-size: 10.5px; color: #61705a; }

/* ---------- In-game controls help ---------- */
#help-btn {
  position: fixed; right: 22px; bottom: 150px; z-index: 20;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--panel); color: #c7d2b9;
  border: 1px solid rgba(255,255,255,0.18);
  font-family: var(--mono); font-size: 15px; font-weight: 700;
  cursor: pointer; pointer-events: auto;
}
#help-btn:hover { color: #fff; border-color: var(--green); }
#die-btn {
  position: fixed; right: 56px; bottom: 150px; z-index: 20; height: 28px; min-width: 28px; padding: 0 7px; border-radius: 14px;
  background: var(--panel); color: #c7d2b9; border: 1px solid rgba(255,255,255,0.18); font-size: 13px; cursor: pointer; pointer-events: auto;
}
#die-btn:hover, #die-btn.armed { color: #ffb3b3; border-color: var(--red); background: #3a1714; }
#die-btn.hidden { display: none; }
#menu-btn { position: fixed; right: 92px; bottom: 150px; z-index: 20; height: 28px; width: 28px; border-radius: 50%; background: var(--panel); color: #c7d2b9;
  border: 1px solid rgba(255,255,255,0.18); font-size: 14px; cursor: pointer; pointer-events: auto; }
#menu-btn:hover { color: #fff; border-color: var(--green); }
#menu-btn.hidden { display: none; }
#stance-btns { position: fixed; left: 306px; bottom: 98px; z-index: 20; display: flex; gap: 3px; pointer-events: auto; }
#stance-btns.hidden { display: none; }
#stance-btns button { font: 600 9.5px system-ui, sans-serif; letter-spacing: 0.5px; text-transform: uppercase; padding: 3px 6px; border-radius: 4px; cursor: pointer;
  background: var(--panel); color: #9aa88c; border: 1px solid rgba(255,255,255,0.14); }
#stance-btns button.on { color: #0b1408; background: #9fe0c8; border-color: #9fe0c8; }
#help-panel {
  position: fixed; inset: 0; z-index: 80;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 12px;
  justify-content: safe center; /* centred, but never pushed off the top when it's taller than the window */
  background: rgba(6, 9, 5, 0.9); padding: 24px; overflow-y: auto; cursor: default;
}
#help-panel.hidden { display: none; }
.help-close { position: sticky; top: 0; align-self: flex-end; z-index: 2; background: #20261b; color: #e6f0dc; border: 1px solid rgba(123,216,143,0.4);
  border-radius: 6px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; margin-bottom: -40px; }
.help-close:hover { background: #2b3424; border-color: var(--green); }
#help-panel:not(.hidden) ~ #help-btn, body:has(#help-panel:not(.hidden)) #help-btn { z-index: 81; }
#help-panel h3 { color: var(--green); margin: 0; letter-spacing: 1px; }
#help-panel h4 { color: #9fd6b0; margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.help-cols { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.help-sec {
  background: rgba(8, 11, 6, 0.95);
  border: 1px solid rgba(123,216,143,0.22); border-radius: 10px;
  padding: 12px 16px; min-width: 300px;
}
#help-panel table { border-collapse: collapse; width: 100%; }
#help-panel td { padding: 4px 10px; font-size: 13px; color: #c7d2b9; }
#help-panel td:first-child { color: #8b9a7d; text-align: right; white-space: nowrap; }
#help-panel .muted { color: #6e7c60; }
#help-panel .tip { font-size: 11.5px; margin: 8px 2px 0; line-height: 1.5; }
.help-notes { max-width: 630px; }
.help-notes ul { margin: 0; padding-left: 18px; }
.help-notes li { font-size: 12.5px; color: #c2cfb6; margin-bottom: 5px; line-height: 1.5; }
.help-notes b { color: #e6f0dc; }
#help-panel .hint { color: #6e7c60; font-size: 12px; margin: 0; }
#help-panel kbd {
  background: #20261b; border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px; padding: 0 5px; font-family: var(--mono); font-size: 11px; color: #cdd8bf;
}

/* ---------- Start overlay ---------- */
#overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #1b2114, #0a0c07 80%);
  cursor: default;
}
#overlay.hidden { display: none; }
.card {
  background: rgba(8, 11, 6, 0.85);
  border: 1px solid rgba(123, 216, 143, 0.25);
  border-radius: 12px;
  padding: 30px 40px;
  text-align: center;
  max-width: calc(100vw - 24px);
  max-height: 94vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

/* ---- Loadout selector ---- */
#loadout { margin: 6px 0 18px; text-align: left; }
.ldrow { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.ldlabel {
  flex: 0 0 64px; padding-top: 6px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #8b9a7d;
}
.ldopts { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; }
.ldopt {
  background: #161c11; border: 1px solid #2f3a26; border-radius: 5px;
  color: #c7d2b9; font-family: var(--mono); cursor: pointer;
  padding: 5px 9px; font-size: 12px; line-height: 1.25; text-align: left;
  transition: border-color 80ms, background 80ms;
}
.ldopt small { display: block; color: #6e7c60; font-size: 10px; }
.ldopt:hover { border-color: #4a5a39; }
.ldopt.selected { border-color: var(--green); background: #1c2a17; color: #fff; }
.ldopt.selected small { color: #9ad6a8; }
#carry { margin-top: 6px; font-size: 12px; color: #ffcc66; text-align: right; }

/* magazine count next to the ammo counter */
.magcount { display: block; font-size: 11px; color: #8b9a7d; margin-top: 2px; }
.card h1 { font-size: 34px; letter-spacing: -1px; }
.card h1 span { color: var(--green); }
.beta {
  font-size: 12px; font-weight: 700; letter-spacing: 1px; vertical-align: super;
  color: #07120a; background: var(--green); padding: 2px 7px; border-radius: 5px;
  margin-left: 8px; text-transform: uppercase;
}
.tag { color: #9aa88d; margin: 8px 0 10px; font-size: 14px; }
.community { margin: 0 0 20px; font-size: 14px; }
.community a {
  color: #07120a; background: var(--green); text-decoration: none;
  padding: 6px 14px; border-radius: 6px; font-weight: 600; display: inline-block;
  transition: filter 0.12s ease;
}
.community a:hover { filter: brightness(1.12); }
.controls { margin: 0 auto 22px; border-collapse: collapse; }
.controls td { padding: 5px 12px; font-size: 13px; text-align: left; color: #c7d2b9; }
.controls td:first-child { color: #8b9a7d; text-align: right; }
kbd {
  background: #20271a; border: 1px solid #36412c;
  border-radius: 4px; padding: 2px 7px; font-size: 12px; margin: 0 2px;
  font-family: var(--mono);
}
#play {
  background: var(--green); color: #07120a;
  border: none; border-radius: 6px;
  font-family: var(--mono); font-weight: 700; font-size: 16px;
  padding: 12px 40px; cursor: pointer;
  transition: transform 80ms, filter 120ms;
}
#play:hover { filter: brightness(1.1); transform: translateY(-1px); }
.note { margin-top: 20px; font-size: 11px; color: #6e7c60; line-height: 1.5; }
.privacy { margin-top: 8px; font-size: 10px; color: #566049; }

/* ---------- Menu screens ---------- */
.hidden { display: none !important; }
#menu { width: min(640px, 100%); transition: width 160ms ease; }
#menu[data-screen="mp"] { width: min(1080px, 100%); padding: 24px 28px; }
#menu[data-screen="sp"] .menu-head { display: none; }
#menu[data-screen="mp"] .menu-head { margin-bottom: 10px; }
#menu[data-screen="mp"] .menu-head h1 { font-size: 26px; }
.menu-head { margin-bottom: 18px; }
.menu-head .tag { margin-bottom: 0; }

/* home: two big mode tiles */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 4px 0 18px; }
.mode-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  text-align: left; padding: 20px 20px 18px; min-height: 190px;
  background: linear-gradient(160deg, #18200f, #0e130a);
  border: 1px solid #34422a; border-radius: 10px;
  color: #dfe9d6; font-family: var(--mono); cursor: pointer;
  transition: border-color 100ms, transform 100ms, box-shadow 100ms;
}
.mode-tile:hover { border-color: var(--green); transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,0.45); }
.mode-tile.mp { background: linear-gradient(160deg, #13202a, #0b1116); border-color: #2c3f4c; }
.mode-tile.mp:hover { border-color: #6fb8ff; }
.mode-kicker { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: #8b9a7d; }
.mode-tile.mp .mode-kicker { color: #86a6bd; }
.mode-name { font-size: 24px; font-weight: 700; color: #fff; letter-spacing: -0.5px; }
.mode-desc { font-size: 12px; line-height: 1.5; color: #a9b69c; flex: 1; }
.mode-cta { font-size: 13px; font-weight: 700; color: var(--green); }
.mode-tile.mp .mode-cta { color: #8cc8ff; }
.controls-box { margin: 0 auto 6px; max-width: 460px; text-align: left; }
.controls-box summary {
  cursor: pointer; font-size: 12px; color: #8b9a7d; text-align: center;
  letter-spacing: 1px; text-transform: uppercase; padding: 6px; list-style: none;
}
.controls-box summary::-webkit-details-marker { display: none; }
.controls-box summary::after { content: ' ▾'; }
.controls-box[open] summary::after { content: ' ▴'; }
.controls-box .controls { margin-top: 6px; }

/* screen header bar */
.scr-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #252f1e; }
.scr-bar h2 { font-size: 20px; color: #fff; letter-spacing: -0.3px; flex: 1; text-align: left; }
.back {
  background: none; border: 1px solid #2f3a26; border-radius: 6px; color: #b9c6ab;
  font-family: var(--mono); font-size: 12px; padding: 6px 11px; cursor: pointer;
}
.back:hover { border-color: var(--green); color: #fff; }
.namefield { display: flex; align-items: center; gap: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #8b9a7d; }

/* inputs + buttons */
#mp-name, #mp-code {
  background: #161c11; border: 1px solid #2f3a26; border-radius: 6px; color: #e6efe6;
  font-family: var(--mono); font-size: 13px; padding: 8px 10px; min-width: 0; width: 170px;
}
#mp-name:focus, #mp-code:focus { outline: none; border-color: var(--green); }
#mp-code { width: 130px; text-transform: uppercase; letter-spacing: 2px; }
.mp-btn {
  background: #1a2214; border: 1px solid #34422a; border-radius: 6px; color: #e6efe6;
  font-family: var(--mono); font-size: 13px; padding: 8px 14px; cursor: pointer; white-space: nowrap;
}
.mp-btn:hover:not([disabled]) { border-color: var(--green); }
.mp-btn[disabled] { opacity: 0.45; cursor: default; }
.mp-btn.primary { background: var(--green); color: #07120a; border-color: var(--green); font-weight: 700; }
.mp-btn.primary:hover:not([disabled]) { filter: brightness(1.1); }
.mp-btn.small { font-size: 12px; padding: 5px 11px; }
.mp-btn.big { font-size: 15px; padding: 11px 26px; }
.mp-btn.danger:hover { border-color: var(--red); color: #ffb3b3; }
.mp-btn.danger.armed { background: #4a1714; border-color: var(--red); color: #ffd0cc; font-weight: 700; }
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: #a9b69c; cursor: pointer; }
.chk input { accent-color: var(--green); width: 15px; height: 15px; }
.pill {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: #24301c; color: #b9d8a8; margin-left: 8px; vertical-align: middle; letter-spacing: 0.5px;
}
.pill.live { background: #3a1d19; color: #ffb0a6; }

/* multiplayer layout: browser/room on the left, loadout on the right */
.mp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; text-align: left; align-items: start; }
.pane { background: #0f140b; border: 1px solid #263020; border-radius: 10px; padding: 14px 16px; }
.pane-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.pane-head h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px; color: #c9d6bc; }
.mp-side #loadout { margin: 0; }
.mp-side .ldlabel { flex-basis: 58px; }
.mp-side .ldopt { padding: 4px 8px; font-size: 11.5px; }

.mp-list { min-height: 210px; max-height: 340px; overflow-y: auto; border: 1px solid #1f281a; border-radius: 8px; background: #0b0f08; }
.mp-empty { padding: 60px 20px; text-align: center; font-size: 13px; color: #c2cfb6; line-height: 1.9; }
.mp-empty .muted { color: #6e7c60; font-size: 12px; }
.spin {
  display: inline-block; width: 12px; height: 12px; margin-right: 9px; vertical-align: -1px;
  border: 2px solid #34422a; border-top-color: var(--green); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.mp-rooms { width: 100%; border-collapse: collapse; font-size: 13px; }
.mp-rooms th {
  position: sticky; top: 0; background: #11170c; font-size: 10px; font-weight: 400;
  text-transform: uppercase; letter-spacing: 1px; color: #7d8b6f; padding: 8px 10px; text-align: center;
}
.mp-rooms td { padding: 8px 10px; border-top: 1px solid #1a2216; text-align: center; color: #c7d2b9; }
.mp-rooms .l { text-align: left; }
.mp-rooms .r { text-align: right; }
.mp-rooms td.name { color: #fff; font-weight: 700; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-rooms tr:hover td { background: #131a0f; }
.mp-rooms .st { font-size: 12px; color: #9ad6a8; }
.mp-rooms .st.live { color: #ff9d90; }
.mp-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; }
.act { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* room lobby */
.room-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.room-id { display: flex; align-items: center; }
.room-kicker { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: #7d8b6f; margin-right: 10px; }
#mp-roomcode { font-size: 24px; letter-spacing: 4px; color: #fff; cursor: pointer; border-radius: 5px; padding: 0 4px; transition: background 0.15s; }
#mp-roomcode:hover { background: #1c2a17; }
#mp-roomcode.copied { background: var(--green); color: #07120a; }
.room-btns { display: flex; gap: 8px; }
.mp-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mp-team { border: 1px solid #263020; border-radius: 8px; padding: 10px 12px; min-height: 92px; background: #0b0f08; }
.mp-team h4 { margin: 0 0 6px; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; }
.mp-team.team-A { border-top: 3px solid #6fb8ff; }
.mp-team.team-B { border-top: 3px solid #ff7a6b; }
.mp-team.team-A h4 { color: #6fb8ff; }
.mp-team.team-B h4 { color: #ff7a6b; }
.mp-team ul { list-style: none; margin: 0; padding: 0; font-size: 13px; color: #dfe9d6; }
.mp-team li { padding: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-team li.me { color: #fff; font-weight: 700; }
.mp-team li.muted { color: #5d6a52; }
.mp-team li { display: flex; align-items: center; gap: 6px; }
.mp-team li .pn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-team.team-S { grid-column: 1 / -1; min-height: 0; border-top: 3px solid #9aa88c; }
.mp-team.team-S h4 { color: #c9d6bc; }
.pcs { display: inline-flex; gap: 3px; }
.pc { font-family: var(--mono); font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; cursor: pointer;
  background: #1a2214; border: 1px solid #34422a; color: #c7d2b9; }
.pc:hover { border-color: var(--green); }
.pc-A { color: #6fb8ff; } .pc-B { color: #ff7a6b; }
.pc.kick:hover, .pc.kick.armed { border-color: var(--red); color: #ffb3b3; background: #3a1714; }
.pc.crown:hover, .pc.crown.armed { border-color: #ffd257; color: #ffe9a8; background: #3a3214; }
.mp-ai { display: inline-flex; gap: 4px; }
.mp-ai .pc { font-size: 11px; padding: 3px 9px; }
.mp-ai .pc.sel { border-color: var(--green); color: #fff; background: #1c2a17; }
.mp-ai .pc[disabled] { cursor: default; }
#mp-ai-row { justify-content: flex-start; }
#mp-ai-note { margin: 0; flex-basis: 100%; }
.room-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px; }
h4.sub { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: #8b9a7d; margin: 14px 0 8px; font-weight: 400; }
.mp-maps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.mp-map small { display: none; }
.mp-map:hover small, .mp-map.selected small { display: block; }
.mp-map {
  display: flex; flex-direction: column; gap: 8px; padding: 8px; text-align: left;
  background: #0b0f08; border: 1px solid #263020; border-radius: 8px; cursor: pointer;
  font-family: var(--mono); color: #c7d2b9;
}
.mp-map img { width: 100%; aspect-ratio: 1; border-radius: 5px; display: block; image-rendering: pixelated; }
.mp-map b { display: block; font-size: 13px; color: #fff; }
.mp-map small { display: block; font-size: 10.5px; line-height: 1.4; color: #7d8b6f; margin-top: 2px; }
.mp-map:hover:not([disabled]) { border-color: #4a5a39; }
.mp-map.selected { border-color: var(--green); box-shadow: 0 0 0 1px var(--green) inset; }
.mp-map.selected b { color: var(--green); }
.mp-map[disabled] { cursor: default; opacity: 0.4; }
.mp-map.selected[disabled] { opacity: 1; }
.room-go { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.mp-wait { font-size: 13px; color: #c2cfb6; }
.mp-note { font-size: 11px; color: #7d8b6f; line-height: 1.5; margin: 10px 0 0; }
.mp-status { font-size: 12px; color: #ffcc66; min-height: 16px; margin-top: 10px; }
.mp-status.bad { color: var(--red); }
#scr-sp .scr-bar #play { padding: 9px 30px; font-size: 15px; }

@media (max-width: 900px) {
  .mp-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .card { padding: 20px 16px; }
  #menu[data-screen="mp"] { padding: 18px 16px; }
  .modes { grid-template-columns: 1fr; }
  .mode-tile { min-height: 0; }
  .mp-teams, .mp-maps { grid-template-columns: 1fr; }
  .mp-map { flex-direction: row; align-items: center; }
  .mp-map img { width: 64px; }
  .scr-bar { flex-wrap: wrap; }
  .mp-rooms th:nth-child(2), .mp-rooms td:nth-child(2) { display: none; }
}

/* build stamp (menu only) */
.build-tag {
  position: fixed; right: 12px; bottom: 8px; z-index: 101; font-size: 10px; color: #566049;
  font-family: var(--mono); pointer-events: auto; cursor: default;
}
#overlay.hidden ~ .build-tag { display: none; }
.build-tag.new { color: #ffcc66; font-size: 12px; }
.build-tag button { margin-left: 8px; font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 3px 9px;
  border-radius: 5px; border: none; background: #ffcc66; color: #1a1406; cursor: pointer; }

.online { font-size: 12px; font-weight: 400; color: #7bd88f; margin-left: 10px; letter-spacing: 0; }

.guide-btn {
  font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap;
  color: #07120a; background: var(--green); padding: 6px 12px; border-radius: 6px;
}
.guide-btn:hover { filter: brightness(1.1); }
.discord-btn {
  font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap;
  color: #fff; background: #5865f2; padding: 6px 12px; border-radius: 6px;
}
.discord-btn:hover { filter: brightness(1.12); }

/* gear + settings */
#menu { position: relative; }
.gear {
  position: absolute; top: 12px; right: 14px; z-index: 2;
  background: none; border: 1px solid #2f3a26; border-radius: 6px; color: #b9c6ab;
  font-size: 16px; width: 34px; height: 30px; cursor: pointer; line-height: 1;
}
.gear:hover { border-color: var(--green); color: #fff; }
#menu[data-screen="mp"] .gear, #menu[data-screen="sp"] .gear { top: 22px; right: 26px; }
#menu[data-screen="mp"] #mp-name-apply { margin-right: 44px; }
#scr-sp .scr-bar #play { margin-right: 44px; }
#settings {
  position: fixed; inset: 0; z-index: 130; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.55); cursor: default;
}
.settings-card {
  background: #0d120a; border: 1px solid rgba(123,216,143,0.3); border-radius: 12px; padding: 22px 24px;
  width: min(460px, calc(100vw - 32px)); text-align: left; box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.settings-card h3 { font-size: 16px; color: #fff; margin-bottom: 14px; letter-spacing: 0.5px; }
.set-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #c7d2b9; margin: 12px 0; }
.set-row > span { width: 70px; color: #9aa88c; }
.set-row input[type="range"] { flex: 1; accent-color: var(--green); }
.set-row b { width: 36px; text-align: right; color: #fff; }
.set-go { text-align: right; margin-top: 16px; }
/* changelog */
#news { position: fixed; inset: 0; z-index: 130; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.55); cursor: default; }
#news.hidden { display: none; }
.news-card { width: min(620px, calc(100vw - 32px)); }
.news-body { max-height: min(62vh, 560px); overflow-y: auto; padding-right: 6px; }
.news-body h4 { color: var(--green); font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; margin: 14px 0 6px; }
.news-body h4:first-child { margin-top: 0; }
.news-body ul { margin: 0; padding-left: 18px; }
.news-body li { font-size: 13px; color: #c7d2b9; line-height: 1.55; margin-bottom: 6px; }
.news-body b { color: #eef5e6; }
.news-btn { position: relative; font: inherit; font-size: 12px; font-weight: 700; padding: 6px 12px; white-space: nowrap; border-radius: 6px; cursor: pointer;
  background: #1b2314; color: #dfe9d6; border: 1px solid #3a4a2e; }
.news-btn:hover { border-color: var(--green); }
.news-dot { position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: #ffd257; box-shadow: 0 0 0 2px #0d120a; }
.news-dot.hidden { display: none; }

/* emote picker */
#emote-panel { position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%); display: grid; grid-template-columns: repeat(4, auto); gap: 4px;
  background: var(--panel); border: 1px solid rgba(255,255,255,0.14); border-radius: 8px; padding: 8px; pointer-events: auto; cursor: default; }
#emote-panel .emb { font-family: system-ui, sans-serif; font-size: 13px; padding: 5px 10px; border-radius: 5px; cursor: pointer;
  background: #141a10; border: 1px solid #2f3a26; color: #e6efe6; white-space: nowrap; }
#emote-panel .emb:hover { border-color: var(--green); }
#emote-panel .emb kbd { font-size: 10px; padding: 0 4px; }
#emote-panel .emh { grid-column: 1 / -1; text-align: center; font-size: 10px; color: #6e7c60; }

/* team panel: teammates' health (multiplayer) */
#team-panel { position: absolute; left: 22px; top: 62px; width: 190px; background: var(--panel); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; padding: 6px 8px; font-size: 11px; }
#team-panel .tph { font-size: 10px; letter-spacing: 1px; color: #7fe0c0; font-weight: 700; margin-bottom: 3px; }
#team-panel .tpr { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
#team-panel .tpn { flex: 0 0 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #dfe9d6; }
#team-panel .tpr.mine .tpn { color: #9fcfff; }
#team-panel .tpr.dead .tpn { color: #6e7c60; text-decoration: line-through; }
#team-panel .tpb { flex: 1; height: 5px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
#team-panel .tpb i { display: block; height: 100%; }
#scoreboard tr.dead td { color: #6e7c60 !important; }
#scoreboard .hpb { display: inline-block; width: 40px; height: 4px; background: rgba(255,255,255,0.12); border-radius: 2px; vertical-align: middle; margin-left: 4px; overflow: hidden; }
#scoreboard .hpb i { display: block; height: 100%; background: #7bd88f; }

/* AI command panel (multiplayer) */
#ai-panel { position: absolute; left: 22px; bottom: 236px; width: 230px; display: flex; flex-wrap: wrap; gap: 4px;
  pointer-events: auto; background: var(--panel); border: 1px solid rgba(255,255,255,0.12); border-radius: 6px; padding: 7px; }
#ai-panel .aih { width: 100%; font-size: 10px; letter-spacing: 1px; color: #9fcfff; font-weight: 700; display: flex; justify-content: space-between; }
#ai-panel .aih span { color: #6e7c60; font-weight: 400; }
#ai-panel .aib { flex: 1 1 45%; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); font-size: 11px; padding: 5px 6px; white-space: nowrap; border-radius: 4px; cursor: pointer;
  background: #141a10; border: 1px solid #2f3a26; color: #c7d2b9; }
#ai-panel .aib:hover { border-color: #6fb8ff; }
#ai-panel .aib.on { border-color: #6fb8ff; color: #fff; background: #13202a; }
#ai-panel .aib[data-ai="fire"] { flex-basis: 100%; }
#ai-panel .aitabs { width: 100%; display: flex; gap: 3px; margin: 2px 0 1px; }
#ai-panel .ait { flex: 1; font-family: var(--mono); font-size: 10px; padding: 3px 0; border-radius: 4px; cursor: pointer; background: #10150c; color: #9aa88c; border: 1px solid #2a3322; }
#ai-panel .aitake { width: 100%; display: flex; gap: 4px; }
#ai-panel .aib.off { opacity: 0.45; }
#ai-panel .aib.take { border-color: #ffd257; color: #ffe9a8; background: #2a2410; }
#ai-panel .ait.dead { opacity: 0.45; cursor: default; text-decoration: line-through; }
#ai-panel .ait.on { background: #6fb8ff; color: #07131f; border-color: #6fb8ff; font-weight: 700; }
#ai-panel .aif { width: 100%; font-size: 9.5px; letter-spacing: 1px; color: #6e7c60; margin: 1px 0 -2px; }
#ai-panel .aib[data-ai="follow"], #ai-panel .aib[data-ai="mid"], #ai-panel .aib[data-ai="far"] { flex: 1 1 28%; }
#ai-panel .aib[data-ai="fire"].on { border-color: var(--red); background: #3a1714; color: #ffd0cc; }

/* spectators: no body, so no vitals / gun / support panels */
#hud.spectator #vitals, #hud.spectator #ammo, #hud.spectator #weapons-rack, #hud.spectator #abilities, #hud.spectator #ai-panel, #hud.spectator #team-panel { display: none; }

/* chat */
#chat { position: absolute; left: 214px; bottom: 122px; width: min(420px, calc(100vw - 208px)); font-size: 13px; }
#chat-log .cl { background: rgba(8,11,6,0.55); padding: 2px 8px; border-radius: 3px; margin-top: 3px; width: fit-content; max-width: 100%;
  color: #e6efe6; text-shadow: 0 1px 2px #000; transition: opacity 0.6s; overflow-wrap: anywhere; }
#chat-log .cl .ct { color: #ffd257; font-weight: 700; font-size: 11px; }
#chat-log .cl.old { opacity: 0; }
#chat.open #chat-log .cl.old { opacity: 0.85; }
#chat-bar { display: flex; align-items: center; gap: 6px; margin-top: 6px; pointer-events: auto; }
#chat-mode { font-size: 11px; font-weight: 700; padding: 4px 7px; border-radius: 4px; background: var(--green); color: #07120a; }
#chat-mode.team { background: #6fb8ff; }
#chat-input { flex: 1; background: rgba(10,14,8,0.9); border: 1px solid var(--green); border-radius: 5px; color: #fff;
  font-family: var(--mono); font-size: 13px; padding: 6px 8px; outline: none; }
.room-chat { margin-top: 10px; border: 1px solid #263020; border-radius: 8px; background: #0b0f08; padding: 6px 8px; }
.room-chat-log { height: 86px; overflow-y: auto; font-size: 12px; color: #dfe9d6; line-height: 1.5; }
.room-chat-log .ct { color: #ffd257; font-size: 10px; font-weight: 700; }
#room-chat-input { width: 100%; margin-top: 6px; background: #161c11; border: 1px solid #2f3a26; border-radius: 5px; color: #e6efe6;
  font-family: var(--mono); font-size: 12px; padding: 6px 8px; outline: none; }
#room-chat-input:focus { border-color: var(--green); }
#abilities .ab.pts { color: #ffd257; font-weight: 700; }

/* multiplayer scoreboard (Tab) */
#scoreboard .mp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
#scoreboard table.mp-team { border: none; }
#scoreboard table.mp-team th, #scoreboard table.mp-team td { font-size: 12px; text-align: center; }
#scoreboard table.mp-team .l { text-align: left; }
#scoreboard table.mp-team td.l { color: #dfe9d6; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#scoreboard table.mp-team tr.me td { color: #fff; }
#scoreboard table.mp-team .muted { color: #5d6a52; }
#scoreboard table.mp-team td.pg { color: #8b9a7d; font-size: 11px; }
@media (max-width: 560px) {
  .menu-head { padding-right: 40px; }
  #menu .menu-head h1, .card h1 { font-size: 22px; }
}

/* The game hides the system cursor over the battlefield (it draws a crosshair),
   but over panels and buttons you need a real pointer to see what you click. */
#help-panel, #ai-panel, #abilities, #weapons-rack, #ammo, #minimap, #chat-bar, #scoreboard, #settings, #overlay { cursor: default; }
#ai-panel button, #abilities .ab, #weapons-rack .slot, #help-btn, #ammo, #firemode, .sq-order, #minimap { cursor: pointer; }
/* keep the top-left readout clear of the round strip (it wraps instead) */
#scale-readout { max-width: calc(50vw - 200px); line-height: 1.5; }
#team-panel { top: 84px; }

/* Team picker in the room: Blue / Red / Spectator */
.mp-teampick { display: inline-flex; border: 1px solid #2f3a26; border-radius: 6px; overflow: hidden; }
.mp-teampick .tp { background: #161c11; color: #c9d6bc; border: 0; border-right: 1px solid #2f3a26; padding: 5px 12px; font: inherit; font-size: 12px; cursor: pointer; }
.mp-teampick .tp:last-child { border-right: 0; }
.mp-teampick .tp:hover:not([disabled]) { background: #1f2818; }
.mp-teampick .tp[disabled] { opacity: 0.45; cursor: default; }
.mp-teampick .tp.sel.tp-A { background: #6fb8ff; color: #08131f; font-weight: 700; opacity: 1; }
.mp-teampick .tp.sel.tp-B { background: #ff7a6b; color: #1f0a08; font-weight: 700; opacity: 1; }
.mp-teampick .tp.sel.tp-S { background: #c9d6bc; color: #10140c; font-weight: 700; opacity: 1; }
.mp-mapopts { flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.mp-teampick .tp.sel:not(.tp-A):not(.tp-B):not(.tp-S) { background: #7bd88f; color: #0b1408; font-weight: 700; opacity: 1; }
/* Ping next to each name in the room */
.mp-team li .pg { font-size: 10.5px; font-variant-numeric: tabular-nums; color: #7fe08f; }
.mp-team li .pg.mid { color: #ffd257; }
.mp-team li .pg.bad { color: #ff7a6b; }
.mp-team li .pg.hs { color: #9aa88c; }
/* Peeking at open games from inside a room */
.peek-note { font-size: 12px; color: #c9d6bc; background: #18200f; border: 1px solid #2f3a26; border-radius: 6px; padding: 6px 10px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.peek-note b { color: #ffd257; letter-spacing: 1px; }
/* Global chat */
.gchat { margin-top: 12px; }
.gchat .pane-head { margin-bottom: 6px; gap: 8px; flex-wrap: wrap; }
.gchat-hint { font-size: 11px; color: #6f7c63; }
.gchat-log { height: 150px; overflow-y: auto; font-size: 12.5px; color: #dfe9d6; line-height: 1.55; background: #0b0f08; border: 1px solid #263020; border-radius: 6px; padding: 6px 8px; overflow-wrap: anywhere; }
.gchat-log .gt { color: #5d6a52; font-size: 10.5px; margin-right: 4px; font-variant-numeric: tabular-nums; }
.gchat-log b { color: #7fe0c0; }
.gchat-log .mine b { color: #ffd257; }
.gchat-log .muted { color: #5d6a52; }
#gchat-input { width: 100%; margin-top: 6px; background: #161c11; border: 1px solid #2f3a26; border-radius: 5px; color: #e6efe6; padding: 6px 8px; font: inherit; font-size: 12.5px; box-sizing: border-box; }
#gchat-input:focus { border-color: var(--green); outline: none; }
