/* Hacks — one stylesheet. Dark, one accent, monospace where code lives. */
:root {
  --bg: #0a0e13;
  --panel: #111821;
  --panel2: #16202b;
  --line: #243142;
  --text: #e7eef6;
  --muted: #8a9ab0;
  --accent: #39c6e8;
  --accent2: #6fdc7a;
  --warn: #ffd24a;
  --bad: #ff5f7e;
  --orange: #ff8a3d;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font: 15px/1.45 var(--sans); -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
body { touch-action: none; user-select: none; -webkit-user-select: none; }
input, textarea, select, button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.spacer { flex: 1; }
code, kbd { font-family: var(--mono); font-size: 0.92em; }
kbd { background: #1f2a37; border: 1px solid #33455a; border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; white-space: nowrap; }
.ico { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }

/* Force landscape on a phone held upright (orient.js): the whole game but the hacks panel takes a quarter
   turn. A transformed box is what position: fixed children measure from, so every full-screen layer inside
   simply fills the turned box. --tw and --th are the window's height and width, set from JavaScript, since
   100vh is not the visible height on a phone. */
body.turned #app { position: fixed; left: 0; top: 0; width: var(--tw); height: var(--th); transform-origin: 0 0; transform: translateX(var(--th)) rotate(90deg); overflow: hidden; }
/* a turned list scrolls along the screen's other axis */
body.turned #menus, body.turned #info-sheet, body.turned .binds { touch-action: pan-x pan-y; }

/* The canvases fill exactly the box the HUD fills (fixed, inset 0), never 100vw x 100vh: on a phone
   100vh is the height with the address bar hidden, so a 100vh canvas hangs below the visible screen
   and its centre — where the shots go — sits under the crosshair instead of on it. */
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#overlay { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
#tags { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
.ntag { position: absolute; left: 0; top: 0; font: 600 12px var(--sans); color: #bfefff; text-shadow: 0 1px 2px #000; white-space: nowrap; }

/* ---------- buttons, fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; font-weight: 600; transition: background .15s, border-color .15s, transform .08s; }
.btn:hover { border-color: #37506a; background: #1b2734; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #041018; }
.btn.primary:hover { background: #5fd6f2; }
.btn.ghost { background: transparent; }
.btn.big { padding: 14px 20px; font-size: 17px; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: default; }
.iconBtn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; }
.iconBtn.small { width: 28px; height: 28px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.info { background: none; border: 0; padding: 0 2px; color: var(--muted); cursor: pointer; vertical-align: middle; }
.info:hover { color: var(--accent); }
.txt { background: #0c131b; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; user-select: text; -webkit-user-select: text; }
.txt:focus { outline: none; border-color: var(--accent); }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=color] { width: 44px; height: 30px; border: 1px solid var(--line); border-radius: 6px; background: none; padding: 2px; }
.seg { display: flex; gap: 4px; background: #0c131b; border: 1px solid var(--line); border-radius: 10px; padding: 3px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 56px; padding: 7px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 13px; }
.seg button.on { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px #33455a; }
.seg.tabs { margin: 4px 0 14px; }
.seg.small button { padding: 4px 10px; min-width: 0; }
.field { margin: 12px 0; }
.field > label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.setrow { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 12px 0; }
.setrow > label { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.setrow.small { margin: 8px 0; }
.num { color: var(--text); font-family: var(--mono); font-weight: 600; }
.tog { display: flex; align-items: center; gap: 10px; margin: 10px 0; cursor: pointer; }
.tog .info { margin-left: -4px; }
.tog input { width: 18px; height: 18px; accent-color: var(--accent); }
.tog.small { margin: 6px 0; font-size: 13px; }
.modes { display: grid; gap: 6px; }
.mode { display: grid; grid-template-columns: minmax(90px, 30%) 1fr; gap: 10px; align-items: center; font-size: 14px; }
.mode .seg { padding: 2px; }
.mode .seg button { padding: 5px 6px; min-width: 0; }
.stackbtns { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.trow { display: flex; gap: 8px; }
.trow > * { flex: 1; }

/* ---------- screens ---------- */
#menus { position: fixed; inset: 0; z-index: 20; overflow: auto; background: radial-gradient(1200px 600px at 50% -10%, rgba(57,198,232,0.12), transparent 60%), rgba(6,9,13,0.72); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); touch-action: pan-y; }
body.atTitle #menus { background: linear-gradient(180deg, rgba(6,9,13,0.25), rgba(6,9,13,0.8)); backdrop-filter: none; -webkit-backdrop-filter: none; }
.screen { min-height: 100%; display: grid; place-items: center; padding: calc(24px + var(--safe-t)) calc(16px + var(--safe-r)) calc(24px + var(--safe-b)) calc(16px + var(--safe-l)); }
.panel { width: min(460px, 100%); background: rgba(17,24,33,0.96); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); user-select: text; -webkit-user-select: text; }
.panel.wide { width: min(720px, 100%); }
.panel h2 { margin: 0 0 10px; font-size: 22px; }
.panel h3.sub { margin: 18px 0 8px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.gold { color: var(--warn); }

.title-wrap { text-align: center; width: min(440px, 100%); }
.logo { font-family: var(--mono); font-size: clamp(48px, 13vw, 88px); letter-spacing: 0.04em; margin: 0; line-height: 1; color: #f2fbff; text-shadow: 0 0 24px rgba(57,198,232,0.55), 0 2px 0 #062833; }
.logo .prompt { color: var(--accent); margin-right: 0.12em; }
.logo .cursor { display: inline-block; width: 0.5em; height: 0.82em; background: var(--accent2); margin-left: 0.08em; vertical-align: -0.04em; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.tag { color: #b8c7d8; margin: 12px 0 24px; }
.menu-col { display: flex; flex-direction: column; gap: 10px; }
.ver { margin-top: 18px; font-size: 13px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.card { text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.card small { color: var(--muted); font-size: 12px; }
.card.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.card .stats { display: grid; gap: 3px; margin-top: 6px; }
.card .stats i { display: block; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--accent) calc(var(--v) * 100%), #243142 0); }

.binds { display: grid; gap: 4px; max-height: 50vh; overflow: auto; }
.bind { display: grid; grid-template-columns: 1fr 110px 110px; gap: 6px; align-items: center; font-size: 14px; }
.key { padding: 6px 8px; border-radius: 7px; border: 1px solid #33455a; background: #0c131b; cursor: pointer; font-family: var(--mono); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.key.empty { color: var(--muted); }
#bindCapture { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(0,0,0,0.6); }
#bindCapture .panel { text-align: center; width: min(320px, 90vw); }

/* multiplayer lists */
.mlist { display: grid; gap: 6px; }
.mrow { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; border-left: 3px solid var(--c, var(--accent)); }
.mrow .mt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mrow .mt small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow.off { opacity: 0.5; }
.mrow .cnt { display: flex; gap: 4px; align-items: center; color: var(--muted); font-family: var(--mono); font-size: 13px; }
.chev { opacity: 0.5; }
.coderow { display: flex; gap: 8px; margin-top: 12px; }
.coderow .txt { text-transform: uppercase; letter-spacing: .2em; }
.empty { text-align: center; padding: 14px 0; }
.roomhead { display: flex; gap: 12px; align-items: flex-start; }
.roomhead .rh { flex: 1; min-width: 0; }
.codebox { text-align: center; background: #0c131b; border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; }
.codebox small { display: block; color: var(--muted); font-size: 11px; }
.codebox b { font-size: 20px; letter-spacing: .15em; color: var(--accent); }
.prow { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--panel2); margin: 4px 0; }
.prow.me { box-shadow: inset 0 0 0 1px #33506a; }
.prow.away { opacity: 0.55; }
.rdy { color: var(--accent2); display: inline-flex; gap: 4px; align-items: center; font-size: 13px; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.team h3 { margin: 4px 0; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.team.t0 h3 { color: #39c6e8; } .team.t1 h3 { color: #ff8a3d; }
.tdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; background: #888; }
.tdot.t0 { background: #39c6e8; } .tdot.t1 { background: #ff8a3d; }
table.board { width: 100%; border-collapse: collapse; font-size: 14px; }
table.board th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.board td { padding: 6px; border-bottom: 1px solid #1a2531; }
table.board td:not(:first-child), table.board th:not(:first-child) { text-align: right; width: 64px; font-family: var(--mono); }
table.board tr.me td { color: var(--accent); }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#crosshair { position: absolute; left: 50%; top: 50%; --gap: 6px; --cc: #fff; }
#crosshair.hide { opacity: 0; }
#crosshair .ch { position: absolute; background: var(--cc); box-shadow: 0 0 0 1px rgba(0,0,0,0.55); }
#crosshair .t, #crosshair .b { width: 2px; height: 8px; left: -1px; }
#crosshair .l, #crosshair .r { height: 2px; width: 8px; top: -1px; }
#crosshair .t { bottom: var(--gap); } #crosshair .b { top: var(--gap); }
#crosshair .l { right: var(--gap); } #crosshair .r { left: var(--gap); }
#crosshair .dot { position: absolute; width: 2px; height: 2px; left: -1px; top: -1px; background: var(--cc); }
#hitmark { position: absolute; left: 50%; top: 50%; opacity: 0; }
#hitmark i { position: absolute; width: 10px; height: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
#hitmark i:nth-child(1) { transform: translate(-14px,-10px) rotate(45deg); } #hitmark i:nth-child(2) { transform: translate(4px,-10px) rotate(-45deg); }
#hitmark i:nth-child(3) { transform: translate(-14px,8px) rotate(-45deg); } #hitmark i:nth-child(4) { transform: translate(4px,8px) rotate(45deg); }
#hitmark.head i { background: var(--bad); }
#lungeRing { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; transform: translate(-50%,-50%); }
#lungeRing svg { width: 100%; height: 100%; transform: rotate(-90deg); }
#lungeRing .track { fill: none; stroke: rgba(255,255,255,0.15); stroke-width: 3; }
#lungeRing .arc { fill: none; stroke: var(--warn); stroke-width: 3; stroke-dasharray: 163.4; stroke-dashoffset: 163.4; }
#lungeRing.stuck .arc { stroke: var(--accent2); }
#lungeRing b { position: absolute; left: 0; right: 0; top: 64px; text-align: center; font: 700 12px var(--mono); color: #fff; text-shadow: 0 1px 2px #000; }
#hudTop { position: absolute; top: calc(10px + var(--safe-t)); left: 50%; transform: translateX(-50%); text-align: center; }
.pill { display: inline-flex; gap: 10px; align-items: center; background: rgba(8,12,17,0.72); border: 1px solid rgba(255,255,255,0.08); border-radius: 999px; padding: 5px 14px; font-size: 13px; white-space: nowrap; }
.pill b { color: var(--accent); }
#netLine { margin-top: 6px; font-size: 13px; color: var(--warn); }
#killfeed { position: absolute; right: calc(12px + var(--safe-r)); top: calc(12px + var(--safe-t)); display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.kf { background: rgba(8,12,17,0.72); border-radius: 6px; padding: 3px 9px; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.kf.mine { box-shadow: inset 0 0 0 1px var(--accent); }
.kf .kw { color: var(--muted); font-size: 12px; display: inline-flex; gap: 3px; align-items: center; }
.kf .kw .ico { color: var(--bad); }
#hudBL { position: absolute; left: calc(16px + var(--safe-l)); bottom: calc(16px + var(--safe-b)); display: flex; align-items: flex-end; gap: 16px; }
.hpbox { display: flex; align-items: center; gap: 10px; background: rgba(8,12,17,0.72); padding: 8px 12px; border-radius: 10px; }
.hpbox b { font: 700 26px var(--mono); min-width: 48px; }
.hpbox .bar { width: 150px; height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
.hpbox .bar i { display: block; height: 100%; width: 100%; background: var(--accent2); transition: width .12s; }
.hpbox .bar i.low { background: var(--bad); }
#speedo { background: rgba(8,12,17,0.6); padding: 6px 10px; border-radius: 10px; }
#speedo b { font-size: 20px; } #speedo small { color: var(--muted); margin-left: 4px; }
#speedo.fast b { color: var(--accent2); }
#hudBR { position: absolute; right: calc(16px + var(--safe-r)); bottom: calc(16px + var(--safe-b)); text-align: right; background: rgba(8,12,17,0.72); padding: 8px 12px; border-radius: 10px; }
#slots { display: flex; gap: 6px; justify-content: flex-end; font-size: 11px; color: var(--muted); }
#slots span { padding: 1px 6px; border-radius: 5px; }
#slots span.on { color: var(--text); background: rgba(57,198,232,0.18); }
#slots b { margin-right: 4px; color: var(--accent); }
.ammo b { font-size: 30px; font-weight: 700; } .ammo small { color: var(--muted); margin-left: 4px; }
#gunName { font-size: 13px; color: #c7d4e2; }
#hackChip { position: absolute; left: calc(16px + var(--safe-l)); top: calc(12px + var(--safe-t)); display: flex; gap: 6px; align-items: center; background: rgba(111,220,122,0.14); border: 1px solid rgba(111,220,122,0.35); color: var(--accent2); padding: 3px 10px; border-radius: 999px; font: 600 12px var(--mono); }
#fps { position: absolute; left: calc(16px + var(--safe-l)); top: calc(40px + var(--safe-t)); font-size: 12px; color: var(--muted); }
#dmgdir { position: absolute; left: 50%; top: 50%; }
#dmgdir .arc { position: absolute; left: 0; top: 0; width: 120px; height: 120px; border-radius: 50%; border: 4px solid transparent; border-top-color: rgba(255,70,90,0.85); }
#killNote { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; font: 700 14px var(--sans); color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.8); white-space: nowrap; animation: killIn .18s ease-out; }
#killNote .ico { color: var(--bad); }
#killNote.fade { opacity: 0; transition: opacity .4s; }
@keyframes killIn { from { transform: translateX(-50%) scale(1.25); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
#hitmark.kill i { background: var(--bad); width: 14px; }
#killNote .medal { display: inline-flex; gap: 4px; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 12px; letter-spacing: .02em; background: rgba(8,12,17,0.6); border: 1px solid rgba(255,255,255,0.18); }
#killNote .medal.t2 { color: var(--warn); border-color: rgba(255,210,74,0.5); }
#killNote .medal.t3 { color: #fff; background: rgba(255,95,126,0.35); border-color: var(--bad); }
#killNote .medal .ico { width: 14px; height: 14px; color: currentColor; }
/* the loudest medal of a kill, once across the middle */
#medal { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; font: 800 clamp(22px, 5vmin, 42px) var(--sans); letter-spacing: .06em; text-transform: uppercase; color: #fff; text-shadow: 0 0 18px rgba(255,95,126,0.85), 0 2px 4px #000; white-space: nowrap; animation: medalIn .32s cubic-bezier(.2,1.6,.4,1); }
#medal.nut { color: var(--warn); text-shadow: 0 0 18px rgba(255,210,74,0.8), 0 2px 4px #000; }
#medal .ico { width: 1em; height: 1em; }
#medal.fade { opacity: 0; transition: opacity .35s; }
@keyframes medalIn { from { transform: translateX(-50%) scale(2.2); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
/* beside the crosshair: a reload or a bolt (left of the scope's post when scoped), the grapple, a blade's bonus */
#cycleRing { position: absolute; left: calc(50% + 26px); top: calc(50% + 18px); width: 30px; height: 30px; }
#cycleRing.scoped { left: calc(50% + 34px); top: calc(50% + 30px); }
#cycleRing svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
#cycleRing .track { fill: rgba(8,12,17,0.45); stroke: rgba(255,255,255,0.18); stroke-width: 3; }
#cycleRing .arc { fill: none; stroke: var(--warn); stroke-width: 3; stroke-dasharray: 100.5; stroke-dashoffset: 100.5; }
#cycleRing #cycleIco { position: absolute; inset: 7px; color: #fff; }
#cycleRing #cycleIco .ico { width: 16px; height: 16px; display: block; }
#hookInd { position: absolute; left: calc(50% - 64px); top: calc(50% + 16px); display: flex; gap: 4px; align-items: center; color: var(--accent); font-size: 12px; text-shadow: 0 1px 2px #000; }
#hookInd .ico { width: 16px; height: 16px; }
#hookInd.grab { color: var(--bad); }
#meleeMul { position: absolute; left: calc(50% + 22px); top: calc(50% - 30px); font-size: 13px; font-weight: 700; color: var(--accent2); text-shadow: 0 1px 2px #000; }
#meleeMul.hot { color: var(--warn); font-size: 15px; }
#scope #scopeZoom { position: absolute; left: 50%; top: calc(50% + 36vmin); transform: translateX(-50%); color: rgba(255,255,255,0.75); font-size: 12px; }
/* a blade at speed: lines streaming in from the edges */
#speedLines { position: absolute; inset: -10%; opacity: 0; pointer-events: none; transition: opacity .15s;
  background: repeating-conic-gradient(from 0deg, rgba(255,255,255,0.22) 0deg 0.6deg, transparent 0.6deg 7deg);
  -webkit-mask: radial-gradient(circle at center, transparent 34%, #000 78%); mask: radial-gradient(circle at center, transparent 34%, #000 78%);
  animation: rush .35s linear infinite; }
@keyframes rush { from { transform: rotate(0deg) scale(1); } to { transform: rotate(3deg) scale(1.04); } }
#centerMsg { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); background: rgba(8,12,17,0.75); padding: 8px 16px; border-radius: 10px; font-weight: 600; }
#toast { position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%); background: rgba(8,12,17,0.85); padding: 8px 14px; border-radius: 10px; }
#hurtFlash { position: fixed; inset: 0; pointer-events: none; z-index: 4; opacity: 0; background: radial-gradient(ellipse at center, transparent 45%, rgba(255,40,60,0.55)); }
/* the scope: a lens with a faint tint and a darkening edge, black beyond it, and the reticle centred on the
   same box as the crosshair (fixed, inset 0) so its centre is where the shot goes */
#scope { position: fixed; inset: 0; pointer-events: none; z-index: 4; background: radial-gradient(circle at center, rgba(110,160,220,0.07) 0 26vmin, rgba(0,0,0,0.35) 32.4vmin, #000 33.2vmin); }
#scope .reticle { position: absolute; left: 50%; top: 50%; width: 66.4vmin; height: 66.4vmin; transform: translate(-50%, -50%); overflow: visible; }
#scope .rim { fill: none; stroke: #000; stroke-width: 3; }
#scope .post { stroke: #050607; stroke-width: 3.2; fill: none; }
#scope .fine { stroke: #050607; stroke-width: 0.5; fill: none; }
#scope .mil circle { fill: #050607; }
#scope .dot { fill: #ff3b4e; }
#scoreboard { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; pointer-events: none; }
#scoreboard .panel { width: min(560px, 92vw); background: rgba(10,14,20,0.9); }
/* on a phone the bottom corners belong to thumbs: the readouts move up, smaller */
body.touchOn #hackChip { display: none; }
body.touchOn #hudBL { bottom: auto; top: calc(44px + var(--safe-t)); gap: 8px; }
body.touchOn .hpbox { padding: 4px 9px; gap: 7px; }
body.touchOn .hpbox b { font-size: 18px; min-width: 34px; }
body.touchOn .hpbox .bar { width: 80px; }
body.touchOn #speedo { padding: 3px 8px; } body.touchOn #speedo b { font-size: 15px; }
body.touchOn #hudBR { bottom: auto; right: auto; top: calc(80px + var(--safe-t)); left: calc(16px + var(--safe-l)); text-align: left; padding: 3px 9px; display: flex; gap: 8px; align-items: baseline; }
body.touchOn #slots { display: none; }
body.touchOn .ammo b { font-size: 18px; }
body.touchOn #gunName { font-size: 12px; }
body.touchOn #killfeed { top: calc(64px + var(--safe-t)); }
body.touchOn #hudTop .pill { font-size: 12px; padding: 4px 10px; }

/* ---------- touch ---------- */
#touch { position: fixed; inset: 0; z-index: 6; touch-action: none; }
#touchLook { position: absolute; inset: 0; }
.tbtn { position: absolute; border-radius: 50%; display: grid; place-items: center; background: rgba(12,18,26,0.42); border: 1.5px solid rgba(255,255,255,0.28); color: #e9f3ff; touch-action: none; }
.tbtn .ico { width: 42%; height: 42%; }
.tbtn.on, .tbtn.latched { background: rgba(57,198,232,0.35); border-color: var(--accent); }
.tbtn[data-id="fire"], .tbtn[data-id="fire2"] { background: rgba(255,95,126,0.25); border-color: rgba(255,95,126,0.6); }
.tbtn.stick { background: rgba(12,18,26,0.3); }
.tbtn.stick .knob { width: 42%; height: 42%; border-radius: 50%; background: rgba(255,255,255,0.35); border: 1.5px solid rgba(255,255,255,0.5); }
/* the run lock: shown once the stick is pushed out to run, sitting where letting go turns on auto-run */
.tbtn.stick .runlock { position: absolute; left: 50%; top: calc(50% - 92.5%); width: 38px; height: 38px; transform: translate(-50%, -50%); border-radius: 50%; display: grid; place-items: center; background: rgba(12,18,26,0.55); border: 1.5px dashed rgba(255,255,255,0.45); opacity: 0; transition: opacity 0.12s; pointer-events: none; }
.tbtn.stick .runlock .ico { width: 58%; height: 58%; }
.tbtn.stick.run .runlock { opacity: 1; }
.tbtn.stick.armed .runlock, .tbtn.stick.autorun .runlock { opacity: 1; background: rgba(57,198,232,0.45); border: 1.5px solid var(--accent); }
.tbtn.stick.run .knob, .tbtn.stick.autorun .knob { background: rgba(57,198,232,0.55); border-color: var(--accent); }
.tbtn.stick.autorun .knob { transform: translateY(-55%); }
body.touchEditing .tbtn { border-style: dashed; }
body.touchEditing .tbtn.sel { border-color: var(--warn); border-style: solid; box-shadow: 0 0 0 3px rgba(255,210,74,0.3); }
/* editing, the readouts that cannot move show faintly, so buttons are placed around them (touch.js keeps them clear) */
body.touchEditing #hud, body.touchEditing #hud[hidden] { display: block !important; opacity: 0.45; }
body.touchEditing #hud > :not(#hudTop):not(#hudBL):not(#hudBR), body.touchEditing #netLine { display: none !important; }
/* the editor's bar is only as big as itself (it once spanned the whole top of the screen and swallowed
   the touches meant for the buttons under it); touch.js puts it wherever it covers no button */
#touchEdit { position: fixed; left: 0; top: 0; z-index: 30; width: min(330px, calc(100vw - 16px)); }
#touchEdit .bar { display: flex; flex-direction: column; gap: 6px; background: rgba(12,18,26,0.95); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,0.45); }
.te-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
#teSel { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.te-size { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; } .te-size input { flex: 1; min-width: 0; }

/* ---------- the hacks panel ---------- */
#hackPanel { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; background: rgba(8,11,15,0.94); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l); user-select: text; -webkit-user-select: text; touch-action: auto; }
.hp-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.hp-head > b { color: var(--accent2); font-size: 16px; }
.hp-head .seg { margin: 0; }
.rules { font: 600 12px var(--mono); padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.rules.r-full { color: var(--accent2); border-color: rgba(111,220,122,0.4); }
.rules.r-assist { color: var(--warn); border-color: rgba(255,210,74,0.4); }
.rules.r-visual { color: var(--accent); border-color: rgba(57,198,232,0.4); }
.hp-body { flex: 1; display: grid; grid-template-columns: 210px 1fr; min-height: 0; }
.hp-list { border-right: 1px solid var(--line); padding: 10px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.hrow { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.hrow:hover { background: #121b25; }
.hrow.sel { background: #162230; box-shadow: inset 0 0 0 1px #2a3d52; }
.hrow .hn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #33455a; flex: none; }
.dot.on { background: var(--accent2); box-shadow: 0 0 6px var(--accent2); } .dot.err { background: var(--bad); } .dot.wait { background: var(--warn); }
.sw { position: relative; width: 32px; height: 18px; flex: none; }
.sw input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; }
.sw span { position: absolute; inset: 0; border-radius: 999px; background: #243142; pointer-events: none; transition: background .15s; }
.sw span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #c9d6e4; transition: transform .15s; }
.sw input:checked + span { background: var(--accent2); }
.sw input:checked + span::after { transform: translateX(14px); background: #07210c; }
#hpNew { margin-top: 6px; }
.hp-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 10px 12px; gap: 8px; position: relative; }
.hp-bar { display: flex; gap: 8px; align-items: center; }
.hp-bar .txt { flex: 1; font-size: 14px; }
.hp-menu { position: absolute; right: 12px; top: 52px; z-index: 5; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px; min-width: 170px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.hp-menu button { background: none; border: 0; text-align: left; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.hp-menu button:hover { background: var(--panel2); }
.hp-menu .danger { color: var(--bad); }
.hp-ui { border: 1px solid var(--line); border-radius: 10px; padding: 4px 12px; max-height: 26vh; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 16px; background: #0c131b; }
.hp-console { border: 1px solid var(--line); border-radius: 10px; background: #070b10; display: flex; flex-direction: column; height: 24vh; min-height: 110px; }
.hc-head { display: flex; align-items: center; gap: 10px; padding: 5px 10px; border-bottom: 1px solid var(--line); font-size: 12px; }
#hpLog { flex: 1; overflow: auto; padding: 6px 10px; font-size: 12.5px; }
.ll { white-space: pre-wrap; word-break: break-word; padding: 1px 0; color: #cfe0ef; }
.ll.error { color: var(--bad); } .ll.warn { color: var(--warn); } .ll.info { color: var(--accent); }
/* Learn and API take the whole body: the hack list's column is empty while they are up. */
.hp-main.doc { grid-column: 1 / -1; grid-row: 1 / -1; overflow: auto; padding: 0; }
.hp-main.doc h2 { margin: 2px 0 8px; font-size: 22px; line-height: 1.25; }
#hpLearn { height: 100%; }
.hp-main[data-hpane="learn"] { overflow: hidden; }
.learn { display: grid; grid-template-columns: 250px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100%; }
.lnav { border-right: 1px solid var(--line); padding: 14px 10px; overflow: auto; min-height: 0; }
.lscroll { overflow: auto; min-height: 0; }
.lprog { margin: 0 6px 10px; font-size: 12px; color: var(--muted); }
.lprog b { color: var(--accent2); font-family: var(--mono); }
.lprog i { display: block; height: 4px; margin-top: 6px; border-radius: 2px; background: linear-gradient(90deg, var(--accent2) calc(var(--p) * 100%), #1b2633 0); }
.lrows { display: flex; flex-direction: column; gap: 2px; }
.lrow { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 7px 8px; border: 0; border-radius: 8px; background: none; color: #c7d4e2; cursor: pointer; font-size: 14px; }
.lrow:hover { background: #121b25; }
.lrow.on { background: #162230; color: var(--text); box-shadow: inset 0 0 0 1px #2a3d52; }
.lrow .lnum { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #1b2633; font: 600 12px var(--mono); color: var(--muted); }
.lrow.on .lnum { background: var(--accent); color: #041018; }
.lrow.done .lnum { background: rgba(111,220,122,0.16); color: var(--accent2); }
.lrow.done .lnum .ico { width: 14px; height: 14px; }
.lrow .lt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson { padding: 18px 26px 40px; max-width: 820px; width: 100%; }
.lkick { margin: 0 0 2px; color: var(--accent2); font: 600 12px var(--mono); letter-spacing: .02em; }
.lbody { color: #c7d4e2; line-height: 1.6; }
.lbody p { margin: 0 0 12px; }
.lbody code, .apidoc p code { background: #121b25; border: 1px solid #1f2b38; border-radius: 4px; padding: 0 4px; color: #e7eef6; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.lcode { margin: 16px 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #070b10; }
.lcode-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--line); background: #0b1118; font-size: 12px; color: var(--muted); }
.lcode-head .linkbtn { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; font-size: 12px; }
.lcode pre.code { margin: 0; border: 0; border-radius: 0; max-height: none; white-space: pre; tab-size: 2; }
.lact { display: flex; gap: 8px; flex-wrap: wrap; }
.lpager { display: flex; justify-content: space-between; gap: 8px; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
.lpager .btn { max-width: 48%; min-width: 0; }
.lpager .btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
pre.code { background: #070b10; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow: auto; font: 12.5px/1.55 var(--mono); color: #cfe0ef; }
pre.code .c { color: #5d7086; font-style: italic; } pre.code .s { color: #a5e07a; } pre.code .n { color: #ffb46b; } pre.code .k { color: #ff7ab8; }
pre.code .g { color: #39c6e8; font-weight: 600; } pre.code .f { color: #ffd98a; } pre.code .p { color: #b9c9ff; } pre.code .b { color: #8a9ab0; } pre.code .o { color: #c38bff; }
.apidoc { max-width: 900px; padding: 18px 26px 40px; }
.apidoc > p { color: #c7d4e2; line-height: 1.6; }
.apifind { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; padding: 8px 0; background: rgba(8,11,15,0.96); color: var(--muted); }
.apifind .txt { flex: 1; }
.apisec h3 { margin: 18px 0 6px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
dl.api { display: grid; gap: 0; margin: 0 0 8px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.apiitem { display: grid; grid-template-columns: minmax(180px, 36%) 1fr; gap: 6px 16px; padding: 8px 12px; border-top: 1px solid #16202b; }
.apiitem:first-child { border-top: 0; }
.apiitem:nth-child(even) { background: #0c131b; }
dl.api dt code { color: var(--accent2); word-break: break-word; } dl.api dd { margin: 0; color: #c7d4e2; font-size: 14px; line-height: 1.5; }

/* the editor: a transparent textarea over a coloured <pre> */
.ed { --lh: 19px; --pad: 10px; flex: 1; min-height: 160px; display: flex; border: 1px solid var(--line); border-radius: 10px; background: #070b10; overflow: hidden; font: 13.5px/var(--lh) var(--mono); }
.ed-gutter { width: 44px; flex: none; overflow: hidden; padding: var(--pad) 8px var(--pad) 0; text-align: right; color: #45566a; background: #0a1017; border-right: 1px solid #16202b; user-select: none; }
.ed-gutter div { height: var(--lh); }
.ed-gutter .err { color: #fff; background: var(--bad); border-radius: 0 4px 4px 0; }
.ed-scroll { position: relative; flex: 1; overflow: auto; }
.ed-pre, .ed-ta { margin: 0; padding: var(--pad) 14px; font: inherit; line-height: var(--lh); tab-size: 2; white-space: pre; letter-spacing: 0; border: 0; }
.ed-pre { position: absolute; left: 0; top: 0; min-width: 100%; color: #cfe0ef; pointer-events: none; }
.ed-ta { position: relative; display: block; width: 100%; min-height: 100%; height: 100%; resize: none; background: transparent; color: transparent; caret-color: #fff; outline: none; overflow: hidden; }
.ed-ta::selection { background: rgba(57,198,232,0.3); color: transparent; }
.ed-pre .c { color: #5d7086; font-style: italic; } .ed-pre .s { color: #a5e07a; } .ed-pre .n { color: #ffb46b; } .ed-pre .k { color: #ff7ab8; }
.ed-pre .g { color: #39c6e8; font-weight: 600; } .ed-pre .f { color: #ffd98a; } .ed-pre .p { color: #b9c9ff; } .ed-pre .b { color: #8a9ab0; } .ed-pre .o { color: #c38bff; }
.errline { position: absolute; left: 0; right: 0; height: var(--lh); background: rgba(255,95,126,0.14); border-left: 2px solid var(--bad); }

/* ---------- info sheet, update bar ---------- */
#info-scrim { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,0.5); }
#info-sheet { position: fixed; z-index: 71; left: 50%; bottom: 0; transform: translateX(-50%); width: min(560px, 100vw); max-height: 80vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px 16px 0 0; padding: 16px 20px calc(24px + var(--safe-b)); user-select: text; -webkit-user-select: text; touch-action: pan-y; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-head h2 { margin: 0; font-size: 19px; }
#info-body p { color: #c7d4e2; }
#update-bar { position: fixed; top: calc(8px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 80; display: flex; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--accent); border-radius: 12px; padding: 6px 8px 6px 14px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; }

@media (max-width: 720px) {
  .hp-head { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  .hp-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .hp-list { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px; }
  .hrow { flex: none; max-width: 180px; }
  #hpNew { width: auto; margin: 0; flex: none; }
  .hp-console { height: 20vh; }
  .bind { grid-template-columns: 1fr 88px 88px; font-size: 13px; }
  .apiitem { grid-template-columns: 1fr; gap: 2px; }
  .mode { grid-template-columns: 1fr; gap: 3px; margin-bottom: 4px; }
  .learn { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .lnav { border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 10px; overflow: hidden; }
  .lprog { display: none; }
  .lrows { flex-direction: row; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .lrow { flex: none; width: auto; padding: 5px 10px 5px 5px; font-size: 13px; }
  .lrow:not(.on) .lt { display: none; }
  .lrow:not(.on) { padding-right: 5px; }
  .lesson, .apidoc { padding: 14px 14px 32px; }
  .hp-main.doc h2 { font-size: 19px; }
  .hpbox .bar { width: 90px; }
  .teams { grid-template-columns: 1fr; }
}
/* a phone on its side: little height, so the panel's chrome gets out of the way */
@media (max-height: 500px) and (min-width: 721px) {
  .hp-head { padding: 6px 12px; }
  .hp-body { grid-template-columns: 170px 1fr; }
  .learn { grid-template-columns: 200px minmax(0, 1fr); }
  .lnav { padding: 8px 6px; }
  .lprog { margin-bottom: 6px; }
  .lrow { padding: 4px 6px; font-size: 13px; }
  .lrow .lnum { width: 20px; height: 20px; font-size: 11px; }
  .lesson, .apidoc { padding: 12px 18px 28px; }
  .hp-console { height: 30vh; min-height: 80px; }
}

/* ============ v7: screen effects, shields, utilities, the buy menu, hack buttons ============ */
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
/* the shield over the health: cells of 50 in the level's colour, the way to the next level under them */
.hpbox .bars { display: flex; flex-direction: column; gap: 4px; }
.shbar { --cells: 1; --sc: #e8eef5; position: relative; width: 150px; height: 7px; border-radius: 3px; background: rgba(255,255,255,0.08); overflow: hidden; }
.shbar i { display: block; height: 100%; width: 100%; background: var(--sc); box-shadow: 0 0 8px var(--sc); transition: width .1s; }
.shbar::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(100% / var(--cells) - 2px), rgba(8,12,17,0.9) calc(100% / var(--cells) - 2px), rgba(8,12,17,0.9) calc(100% / var(--cells))); }
.shbar em { position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: rgba(255,255,255,0.75); }
.shbar.charging i { animation: shcharge .6s ease-in-out infinite alternate; }
.shbar.empty { background: rgba(255,80,80,0.12); }
@keyframes shcharge { from { opacity: .65; } to { opacity: 1; } }
body.touchOn .shbar { width: 80px; height: 5px; }
@media (max-width: 760px) { .shbar { width: 90px; } }
#hitmark.sh i { background: var(--hc, #3f9bff); box-shadow: 0 0 4px var(--hc, #3f9bff), 0 0 0 1px rgba(0,0,0,.5); }
#slots span.out { opacity: .45; }
#utilChip { --u: 100%; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 4px; padding: 1px 8px 1px 4px; border-radius: 9px; font-size: 12px; color: var(--text);
  background: linear-gradient(90deg, rgba(57,198,232,0.28) var(--u), rgba(255,255,255,0.06) var(--u)); }
#utilChip .ico { width: 16px; height: 16px; display: block; }
#utilChip.out { color: var(--muted); }
body.touchOn #utilChip { margin: 0; }
/* the buy menu: over the game, under the menus; keys on a computer, taps on a phone */
#buy { position: fixed; left: calc(16px + var(--safe-l)); top: 50%; transform: translateY(-50%); z-index: 12; width: min(320px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  background: rgba(8,12,17,0.9); border: 1px solid var(--line); border-radius: 12px; padding: 8px; pointer-events: auto; touch-action: pan-y; }
#buy .bhead { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 6px; }
#buy .bhead b { font-size: 15px; letter-spacing: .04em; text-transform: uppercase; }
.brow { display: grid; grid-template-columns: 28px 1fr; grid-template-rows: auto auto; column-gap: 8px; width: 100%; text-align: left; padding: 6px 8px; margin: 2px 0; border-radius: 8px; border: 1px solid transparent; background: rgba(255,255,255,0.04); color: var(--text); }
.brow kbd { grid-row: span 2; align-self: center; text-align: center; font: 700 14px var(--mono); color: var(--accent); }
.brow b { font-size: 14px; }
.brow span { font-size: 11px; color: var(--muted); }
.brow.on { border-color: var(--accent); background: rgba(57,198,232,0.14); }
.brow:hover { background: rgba(255,255,255,0.09); }
#buyNote { display: block; padding: 6px 4px 2px; }
body.turned #buy { left: calc(16px + var(--safe-l)); }
/* a hack's button: its name instead of an icon */
.tbtn.custom { border-style: dashed; border-color: rgba(255,210,74,0.7); background: rgba(40,30,8,0.4); }
.tbtn.custom.on { background: rgba(255,210,74,0.35); border-style: solid; }
.tbtn .tlab { font: 700 11px var(--mono); text-align: center; line-height: 1.05; padding: 0 3px; pointer-events: none; overflow: hidden; }
.tbtn.na { opacity: .35 !important; }
#gyroSet { padding-left: 8px; border-left: 2px solid var(--line); margin: 4px 0 8px; }
