:root {
  --ink: #14161c;
  --panel: rgba(18, 20, 28, 0.78);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f3f1ea;
  --dim: #a9adb8;
  --gold: #ffd23f;
  --red: #ff5a52;
  --green: #4be07c;
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #163e78; color: var(--text); font-family: var(--font); user-select: none; -webkit-user-select: none; }
/* A big crosshair in white and hot pink with a black edge, so it shows on grass, sand, snow and water alike. */
canvas.layer { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; } /* the 3D models and what is drawn over them; clicks go through to #c */
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cg fill='none' stroke-linecap='round'%3E%3Ccircle cx='24' cy='24' r='13' stroke='%23000' stroke-width='6'/%3E%3Cpath d='M24 2v11M24 35v11M2 24h11M35 24h11' stroke='%23000' stroke-width='7'/%3E%3Ccircle cx='24' cy='24' r='13' stroke='%23ff2d95' stroke-width='3'/%3E%3Cpath d='M24 2v11M24 35v11M2 24h11M35 24h11' stroke='%23fff' stroke-width='3.5'/%3E%3C/g%3E%3Ccircle cx='24' cy='24' r='3' fill='%23ff2d95' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E") 24 24, crosshair; }
[hidden] { display: none !important; }
kbd { font: 700 11px var(--font); padding: 1px 5px; border-radius: 4px; background: rgba(255, 255, 255, 0.16); border: 1px solid var(--line); }
.gold { color: var(--gold); }
.note { color: var(--dim); font-size: 13px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(6px); }

button { font: 700 14px var(--font); color: var(--text); background: rgba(255, 255, 255, 0.1); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; cursor: pointer; }
button:hover { background: rgba(255, 255, 255, 0.18); }
button:disabled { opacity: 0.45; cursor: default; }
button.big { font-size: 18px; font-weight: 800; padding: 13px 22px; color: var(--ink); background: var(--gold); border: 0; box-shadow: 0 4px 0 #b8901a; }
button.big:hover { background: #ffdd66; }
button.big:active { transform: translateY(2px); box-shadow: 0 2px 0 #b8901a; }
button.ghost { background: transparent; }
input { font: 600 16px var(--font); color: var(--text); background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; outline: none; user-select: text; -webkit-user-select: text; min-width: 0; }
input:focus { border-color: var(--gold); }

/* ---------------------------------------------------------------- HUD */
#hud > * { position: fixed; z-index: 2; }
#status { top: 14px; left: 14px; width: 250px; padding: 10px 12px; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.small { font-size: 12px; color: var(--dim); margin-top: 6px; }
#hpBar { position: relative; height: 18px; margin-top: 7px; border-radius: 9px; background: rgba(0, 0, 0, 0.45); overflow: hidden; }
#hpFill { position: absolute; inset: 0; width: 100%; background: linear-gradient(#6bea8f, #35b95f); border-radius: 9px; transition: width 0.12s; }
#stBar { position: relative; height: 14px; margin-top: 5px; border-radius: 7px; background: rgba(0, 0, 0, 0.45); overflow: hidden; }
#stFill { position: absolute; inset: 0; width: 100%; background: linear-gradient(#ffe07a, #e0b21f); border-radius: 7px; }
#stFill.winded { background: #c0392b; }
#stText { position: absolute; inset: 0; text-align: center; font: 800 9px/14px var(--font); letter-spacing: 0.08em; color: #1a1c22; }
#stBar.winded #stText { color: #fff; }
#shFill { position: absolute; left: 0; top: 0; height: 5px; width: 0; background: #5aaaff; box-shadow: 0 0 6px #5aaaff; transition: width 0.12s; }
#hpFill.low { background: linear-gradient(#ff7a6e, #d93a32); }
#hpText { position: absolute; inset: 0; text-align: center; font: 800 12px/18px var(--font); text-shadow: 0 1px 2px #000; }

#side { top: 14px; right: 14px; width: min(260px, 34vw); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
#mini { pointer-events: auto; cursor: crosshair; width: 100%; aspect-ratio: 1; height: auto; border-radius: 50%; border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }
#lb { padding: 8px 10px; font-size: 12px; }
#lb h4 { margin: 0 0 4px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); display: flex; justify-content: space-between; }
#lb .r { display: flex; gap: 6px; line-height: 1.55; }
#lb .r span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lb .r.me { color: var(--gold); font-weight: 700; }
#lb .r i { font-style: normal; color: var(--dim); }

#feed { top: 104px; left: 14px; width: 330px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
#feed div { align-self: flex-start; font-size: 12.5px; padding: 4px 9px; border-radius: 8px; background: rgba(18, 20, 28, 0.62); animation: in 0.15s; }
#feed div.mine { background: rgba(40, 32, 6, 0.85); border: 1px solid rgba(255, 210, 63, 0.7); }
#feed em { font-style: normal; color: var(--dim); }
#feed .gold { font-size: 11px; }

#banner { top: 22%; left: 0; right: 0; text-align: center; pointer-events: none; font: 900 34px var(--font); letter-spacing: 0.01em; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.5); opacity: 0; transition: opacity 0.4s; }
#banner.on { opacity: 1; transition: none; }
#banner small { display: block; font: 700 15px var(--font); color: var(--gold); margin-top: 2px; }

#hotbar { bottom: 14px; left: 50%; transform: translateX(-50%); transform-origin: bottom center; display: flex; gap: 4px; }
.slot { position: relative; width: 62px; height: 60px; border-radius: 10px; background: var(--panel); border: 2px solid var(--line); cursor: pointer; }
.slot canvas { position: absolute; left: 2px; top: 12px; width: 54px; height: 30px; }
.slot .n { position: absolute; left: 6px; top: 3px; font: 800 11px var(--font); color: var(--dim); }
.slot .l { position: absolute; left: 0; right: 0; bottom: 3px; text-align: center; font: 700 10px var(--font); color: var(--dim); }
.slot .pips { position: absolute; right: 6px; top: 6px; display: flex; gap: 2px; }
.slot .pips i { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }
.slot.on { border-color: var(--gold); background: rgba(60, 50, 12, 0.85); }
.slot.locked canvas { opacity: 0.35; filter: grayscale(1); }
.slot.locked .l { color: var(--gold); }
.slot:hover { border-color: rgba(255, 255, 255, 0.4); }
.slot.loot { border-style: dashed; border-color: rgba(127, 214, 255, 0.7); }
.slot.loot.on { border-style: solid; border-color: #7fd6ff; background: rgba(12, 44, 60, 0.85); }
.slot .tagloot { position: absolute; left: 5px; top: 3px; font: 800 8px var(--font); letter-spacing: 0.05em; color: var(--dim); }
.slot.loot .tagloot { color: #7fd6ff; }
.slot { cursor: pointer; opacity: 0.72; }
.slot.on { opacity: 1; }
.gun.picked { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.gun .buy button.up { color: var(--text); background: rgba(255, 255, 255, 0.1); border: 1px solid var(--line); font-weight: 700; font-size: 12px; }
.gun .buy button.up:hover { background: rgba(255, 255, 255, 0.18); }
.slot.loot .pips { top: 13px; }
#hotbar.repo .slot { filter: grayscale(1); opacity: 0.5; }
/* Hit by an EMP: every gun dearer than $2 is dead until it wears off. */
#hotbar.jam .slot.tech canvas, #hotbar.jam .slot.tech .l { filter: grayscale(1); opacity: 0.3; }
#hotbar.jam .slot.tech::after { content: 'JAMMED'; position: absolute; inset: 0; display: grid; place-items: center; font: 900 10px var(--font); letter-spacing: 0.08em; color: #7fd6ff; text-shadow: 0 2px 3px #000; pointer-events: none; }
#hotbar.repo::after { content: 'REPOSSESSED'; position: absolute; inset: 0; display: grid; place-items: center; white-space: nowrap; font: 900 13px var(--font); letter-spacing: 0.12em; color: var(--gold); text-shadow: 0 2px 3px #000; pointer-events: none; }
.gun .alt { font-size: 12px; color: var(--dim); }
.gun .alt b { color: var(--gold); font-weight: 800; }
.gun .trait { font-size: 12px; font-weight: 700; color: #7fd6ff; }
.gun .buy .lootnote { color: #7fd6ff; }
.gun .buy s { opacity: 0.6; font-weight: 600; }

#heliHint { top: 16px; left: 50%; transform: translateX(-50%); padding: 7px 14px; border-radius: 10px; background: rgba(12, 13, 18, 0.82); border: 1px solid var(--line); font: 800 13px var(--font); letter-spacing: 0.02em; white-space: nowrap; pointer-events: none; }
.gun.wide { grid-column: 1 / -1; }
.gun.wide canvas { width: 190px; height: 100px; }

#btns { bottom: 14px; right: 14px; display: flex; gap: 6px; }
#btns button { background: var(--panel); }

#previewTag { position: fixed; z-index: 3; top: 14px; left: 50%; transform: translateX(-50%); padding: 6px 14px; border-radius: 10px; background: rgba(40, 32, 6, 0.9); border: 1px solid var(--gold); color: var(--gold); font: 800 12px var(--font); letter-spacing: 0.05em; }
#previewTag a { color: #fff; }
#toast { position: fixed; z-index: 9; left: 50%; bottom: 248px; transform: translateX(-50%); padding: 9px 16px; border-radius: 10px; background: rgba(12, 13, 18, 0.9); border: 1px solid var(--line); font-weight: 600; font-size: 14px; opacity: 0; transition: opacity 0.3s; pointer-events: none; max-width: 80vw; text-align: center; }
#toast.on { opacity: 1; }

/* ------------------------------------------------------------ screens */
.screen, .modal { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; }
.screen { background: radial-gradient(ellipse at center, rgba(10, 12, 20, 0.35), rgba(10, 12, 20, 0.8)); }
#dead { background: radial-gradient(ellipse at center, rgba(90, 10, 10, 0.3), rgba(40, 6, 6, 0.82)); }
.modal { background: rgba(8, 9, 14, 0.55); z-index: 6; }
.screen { overflow-y: auto; align-items: safe center; } /* on a short window the card scrolls and its top stays reachable */
.card { width: min(520px, 100%); padding: 30px 30px 24px; text-align: center; border-radius: 20px; background: rgba(16, 18, 26, 0.88); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
h1 { margin: 0; font: italic 900 58px/0.95 var(--font); letter-spacing: -0.02em; text-shadow: 0 5px 0 rgba(0, 0, 0, 0.45); }
h1 span { color: var(--gold); }
h2 { margin: 0; font: 900 26px var(--font); }
.card h2 { font-size: 36px; }
.tag { color: #d6d8df; line-height: 1.5; margin: 16px 0 20px; }
.tag b { color: var(--gold); }
#joinForm { display: flex; gap: 8px; }
#joinForm input { flex: 1; }
.keys { margin: 20px 0 0; font-size: 12.5px; color: var(--dim); line-height: 2; }
.card .note { margin: 10px 0 0; }
.actions { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; }

.sheet { width: min(940px, 100%); max-height: min(86vh, 760px); overflow: auto; padding: 18px 20px 20px; border-radius: 18px; background: rgba(18, 20, 28, 0.96); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); }
.sheet.narrow { width: min(520px, 100%); }
.sheet.tiny { width: min(380px, 100%); text-align: center; }
.setrow { display: grid; grid-template-columns: 70px 1fr 64px; align-items: center; gap: 12px; padding: 10px 2px; text-align: left; font-weight: 700; }
.setrow input[type="range"] { width: 100%; padding: 0; accent-color: var(--gold); background: none; border: 0; }
.setrow input[type="checkbox"] { width: 20px; height: 20px; padding: 0; accent-color: var(--gold); justify-self: start; }
.setrow b { text-align: right; color: var(--gold); font-variant-numeric: tabular-nums; }
#settings .sheet.tiny { text-align: left; }
#settings .sheet.tiny { width: min(460px, 100%); }
.setrow.wide { grid-template-columns: 70px 1fr; align-items: start; }
.movebox { margin: 18px 0 0; padding: 12px 12px 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); text-align: left; }
.movebox > b { display: block; font: 800 14px var(--font); margin-bottom: 8px; }
.moveopts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mv { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 9px 11px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); }
.mv b { font: 800 14px var(--font); }
.mv span { font-size: 12px; font-weight: 600; line-height: 1.5; color: var(--dim); }
.mv.picked { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.mv.picked b { color: var(--gold); }
.card .movebox .note { margin: 8px 0 0; font-size: 12px; }
.sheet header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; text-align: left; }
.sheet header .note { flex: 1; }
.sheet header h2 { flex: none; }
.sheet.tiny header h2 { flex: 1; }
.x { font-size: 20px; line-height: 1; padding: 4px 10px; }
.mapbox { --side: min(calc(100vw - 32px), calc(100vh - 92px)); width: var(--side); display: flex; flex-direction: column; gap: 8px; }
.mapbox header { display: flex; align-items: center; gap: 12px; padding: 6px 8px 6px 14px; border-radius: 12px; background: rgba(18, 20, 28, 0.96); border: 1px solid var(--line); }
.mapbox header .note { flex: 1; font-size: 12px; line-height: 1.7; }
.mapbox header h2 { font-size: 20px; }
#bigmap { cursor: crosshair; width: var(--side); height: var(--side); border-radius: 12px; border: 1px solid var(--line); background: #0b1018; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); }
.k { display: inline-block; width: 9px; height: 9px; margin: 0 5px 0 10px; vertical-align: -1px; }
.k:first-child { margin-left: 0; }
.k.you { border-radius: 50%; border: 2px solid #fff; box-sizing: border-box; width: 11px; height: 11px; vertical-align: -2px; }
.k.tower { background: linear-gradient(#5dff9a, #5dff9a) center / 3px 100% no-repeat, linear-gradient(#5dff9a, #5dff9a) center / 100% 3px no-repeat; }
.k.base { background: #e8c27a; border: 2px solid rgba(0, 0, 0, 0.65); box-sizing: border-box; }
.k.shot { border-radius: 50%; background: #ff3b30; }
.k.mate { border-radius: 50%; background: #4be07c; }

#classRow { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin-bottom: 12px; }
#classRow .cls { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); }
#classRow .cls b { font: 800 16px var(--font); }
#classRow .cls span { font-size: 12px; font-weight: 600; color: var(--dim); }
#classRow .cls.picked { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
#classRow .cls.picked b { color: var(--gold); }
#shopGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.gun { padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.gun.owned { border-color: rgba(75, 224, 124, 0.45); }
.gun .top { display: flex; gap: 10px; align-items: center; }
.gun canvas { width: 112px; height: 80px; flex: none; border-radius: 8px; background: rgba(255, 255, 255, 0.16); }
.gun h3 { margin: 0; font: 800 16px var(--font); }
.gun p { margin: 2px 0 0; font-size: 12px; color: var(--dim); }
.stats { display: grid; grid-template-columns: 52px 1fr; gap: 3px 8px; align-items: center; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); }
.stats u { display: block; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.stats u i { display: block; height: 100%; background: var(--gold); border-radius: 3px; }
.gun .buy { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.gun .buy span { font-size: 12px; color: var(--green); font-weight: 700; }
.gun .buy button { color: var(--ink); background: var(--gold); border: 0; font-weight: 800; }
.gun .buy button:hover { background: #ffdd66; }

.rowform { display: flex; gap: 8px; margin: 12px 0; }
.rowform input { flex: 1; padding: 9px 12px; font-size: 14px; }
#myGroupBox { padding: 12px; border-radius: 12px; background: rgba(75, 224, 124, 0.08); border: 1px solid rgba(75, 224, 124, 0.3); font-size: 14px; }
#myGroupBox h3 { margin: 0 0 6px; font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
.gl { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.gl:last-child { border: 0; }
.gl b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gl span { color: var(--dim); font-size: 12px; }
.gl button { padding: 4px 10px; font-size: 12px; }
.testflag { display: inline-block; margin: 0 0 10px; padding: 4px 10px; border-radius: 6px; background: rgba(255, 210, 63, 0.16); color: var(--gold); font: 800 11px var(--font); letter-spacing: 0.06em; }
.payitem { font-size: 18px; font-weight: 700; margin: 6px 0 18px; }

@keyframes in { from { opacity: 0; transform: translateX(-8px); } }

#btns { bottom: 14px; }
#swap { bottom: calc(172px + var(--lift, 0px)); left: 50%; transform: translateX(-50%); color: var(--ink); background: var(--gold); border: 0; font-weight: 800; box-shadow: 0 3px 0 #b8901a; }
#kits { bottom: calc(128px + var(--lift, 0px)); left: 50%; transform: translateX(-50%); display: flex; gap: 6px; } /* above the row the corner buttons move up to */
#kits button { color: var(--text); background: rgba(18, 20, 28, 0.9); border: 1px solid #7fd6ff; font-weight: 700; white-space: nowrap; }
#kits b { color: #7fd6ff; font-size: 16px; }
#kits #kitBm { color: #d9a25e; font-weight: 600; }
#kits button.none { border-color: #5a6170; cursor: default; }
#kits button.none b { color: #8a909c; }
#onslaught { top: 52px; left: 50%; transform: translateX(-50%); padding: 5px 16px; border-radius: 8px; background: rgba(120, 12, 12, 0.9); border: 1px solid #ff5a52; color: #fff; font: 900 14px var(--font); letter-spacing: 0.2em; animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: 0.65; } to { opacity: 1; } }
#swap kbd { background: rgba(0, 0, 0, 0.18); border-color: rgba(0, 0, 0, 0.25); }
@media (max-width: 1000px) {
  h1 { font-size: 44px; }
}

/* Cooldown meters, one per mouse button, just above the gun bar. */
#cds { bottom: calc(84px + var(--lift, 0px)); left: 50%; transform: translateX(-50%); display: flex; gap: 8px; pointer-events: none; }
#cds .cd { display: flex; align-items: center; gap: 7px; padding: 5px 10px 5px 7px; border-radius: 9px; background: rgba(18, 20, 28, 0.86); border: 1px solid var(--line); }
#cds .mb { width: 15px; height: 21px; border-radius: 7px 7px 8px 8px; border: 1.5px solid #c9ced8; background: linear-gradient(#c9ced8, #c9ced8) no-repeat; background-size: 50% 46%; }
#cds .mb.l { background-position: left top; }
#cds .mb.r { background-position: right top; }
#cds .cd i { display: block; width: 92px; height: 9px; border-radius: 5px; background: rgba(0, 0, 0, 0.55); overflow: hidden; }
#cds .cd b { display: block; height: 100%; width: 100%; background: #4be07c; border-radius: 5px; }
#cds .cd em { font: 800 12px var(--font); font-style: normal; min-width: 40px; color: #9af5b5; text-transform: uppercase; letter-spacing: 0.04em; }
#cds .cd.wait b { background: #ffd23f; }
#cds .cd.wait em { color: #ffd23f; }
#cds #cdR.wait b { background: #6fb6ff; }
#cds #cdR.wait em { color: #6fb6ff; }

/* A gun still cooling down: its slot is shaded from the top by how much of the wait is left, with the seconds on it. */
.slot .cool { position: absolute; inset: 0; border-radius: 8px; overflow: hidden; display: none; pointer-events: none; }
.slot.cooling .cool { display: block; }
.slot .cool b { position: absolute; left: 0; right: 0; top: 0; background: rgba(6, 8, 14, 0.78); }
.slot .cool em { position: absolute; inset: 0; display: grid; place-items: center; font: 900 15px var(--font); font-style: normal; color: #ffd23f; text-shadow: 0 1px 3px #000, 0 0 6px #000; }
