:root {
  --bg: #020604; --surface: rgba(4, 16, 10, .88); --line: rgba(57, 255, 136, .22); --fg: #e6fff1; --muted: #8fb8a2;
  --nex: #39ff88; --nex-deep: #16a36a; --cyan: #37e8ff; --glitch: #ff2bd6; --danger: #ff3b5c; --gold: #ffc23d;
  --common: #c9d6cf; --rare: #3da5ff; --epic: #b56cff; --legendary: #ffb020;
  --r: 10px; --font: "Rajdhani", "Segoe UI", system-ui, sans-serif; --mono: "JetBrains Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 17px; -webkit-font-smoothing: antialiased; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.hidden { display: none !important; }
.nex-data, kbd { font-family: var(--mono); font-variant-numeric: tabular-nums; }
kbd { font-size: .78em; padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; background: rgba(57,255,136,.06); }
h1, h2, h3, h4 { margin: 0; letter-spacing: .04em; }
h4 { margin: 16px 0 8px; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .14em; }
.sub { color: var(--muted); margin: 6px 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }

/* buttons */
.btn { font: 600 1rem var(--font); letter-spacing: .05em; color: var(--fg); background: rgba(57,255,136,.06); border: 1px solid var(--line); border-radius: var(--r); padding: 9px 16px; cursor: pointer; transition: background .15s, border-color .15s, transform .08s; }
.btn:hover { background: rgba(57,255,136,.14); border-color: var(--nex); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .slot:focus-visible, .mini:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--nex); outline-offset: 2px; }
.btn.primary { background: var(--nex); color: #021208; border-color: var(--nex); box-shadow: 0 0 24px rgba(57,255,136,.35); }
.btn.primary:hover { background: #6dffa8; }
.btn.big { font-size: 1.2rem; padding: 13px 26px; }
.btn.mini, .mini { font: 600 .8rem var(--font); padding: 4px 9px; border-radius: 7px; color: var(--fg); background: rgba(57,255,136,.06); border: 1px solid var(--line); cursor: pointer; }
.btn:disabled, .mini:disabled, .slot:disabled { opacity: .4; cursor: not-allowed; }

/* overlays and cards */
.overlay, #panel { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; z-index: 20; background: radial-gradient(ellipse at center, rgba(2,10,6,.55), rgba(0,0,0,.85)); }
#panel { z-index: 15; background: rgba(0,0,0,.45); }
.card { width: min(760px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; backdrop-filter: blur(10px); box-shadow: 0 0 60px rgba(57,255,136,.08), inset 0 0 0 1px rgba(255,255,255,.02); }
.card header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.card h2 { font-size: 1.5rem; color: var(--nex); }

/* menu */
#menu { background: radial-gradient(ellipse at 50% 30%, rgba(22,163,106,.25), transparent 60%), linear-gradient(#020604ee, #000000f5); }
.hero { text-align: center; }
.kicker { color: var(--muted); letter-spacing: .3em; font-size: .78rem; margin: 0; }
.logo { font-size: clamp(3rem, 12vw, 6.5rem); line-height: 1; color: var(--nex); letter-spacing: .12em; text-shadow: 0 0 30px rgba(57,255,136,.6), 0 0 80px rgba(57,255,136,.25); margin: 8px 0; }
.tag { font-size: 1.25rem; margin: 0 0 8px; }
.hero .row { justify-content: center; }
.loops { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; text-align: left; }
.loops div { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; background: rgba(57,255,136,.03); }
.loops b { display: block; color: var(--nex); }
.loops span { color: var(--muted); font-size: .92rem; }
.controls { text-align: left; margin: 8px 0 14px; }
.controls summary { cursor: pointer; color: var(--nex); font-weight: 600; }
.controls table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .92rem; }
.controls td { padding: 4px 6px; color: var(--muted); }
.controls td:nth-child(odd) { white-space: nowrap; color: var(--fg); }
@media (max-width: 640px) { .loops { grid-template-columns: 1fr; } .controls td { display: block; } }

/* summary */
#sumTitle { font-size: 2.4rem; text-align: center; }
#sumTitle.ok { color: var(--nex); text-shadow: 0 0 24px rgba(57,255,136,.5); }
#sumTitle.bad { color: var(--danger); text-shadow: 0 0 24px rgba(255,59,92,.45); }
#summary .row { justify-content: center; }

/* settings */
.settings { margin-top: 16px; display: grid; gap: 8px; }
.rng { display: grid; grid-template-columns: 170px 1fr 48px; gap: 10px; align-items: center; color: var(--muted); }
.rng input[type=range] { accent-color: var(--nex); width: 100%; }
.rng select { font: inherit; background: #04140c; color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
.rng b { color: var(--fg); font-family: var(--mono); font-size: .9rem; }

/* items */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.slot { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; font: inherit; color: inherit; background: rgba(255,255,255,.02); border: 1px solid var(--line); border-radius: var(--r); padding: 9px 10px; min-height: 48px; }
button.slot { cursor: pointer; }
button.slot:hover:not(:disabled) { border-color: var(--nex); background: rgba(57,255,136,.08); }
.slot.sel { border-color: var(--nex); box-shadow: 0 0 0 1px var(--nex) inset; }
.slot.lost { opacity: .55; text-decoration: line-through; border-color: rgba(255,59,92,.4); }
.slot .acts { display: flex; gap: 4px; flex-wrap: wrap; }
.item { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.item .ic { font-size: 1.15em; }
.r-common { color: var(--common); } .r-rare { color: var(--rare); } .r-epic { color: var(--epic); }
.r-legendary { color: var(--legendary); text-shadow: 0 0 12px rgba(255,176,32,.5); }
.price { font-family: var(--mono); color: var(--gold); font-size: .85rem; }
.cr { color: var(--gold); font-family: var(--mono); }
.skill { margin: 12px 0; }
.skill .row { margin: 0 0 4px; justify-content: space-between; }
.bar { height: 8px; background: rgba(255,255,255,.07); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--nex); border-radius: inherit; transition: width .12s; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; transform: translate(-50%, -50%); }
#crosshair i { position: absolute; background: var(--nex); box-shadow: 0 0 6px var(--nex); }
#crosshair i:nth-child(1), #crosshair i:nth-child(2) { width: 2px; height: 6px; left: 10px; }
#crosshair i:nth-child(1) { top: 0; } #crosshair i:nth-child(2) { bottom: 0; }
#crosshair i:nth-child(3), #crosshair i:nth-child(4) { height: 2px; width: 6px; top: 10px; }
#crosshair i:nth-child(3) { left: 0; } #crosshair i:nth-child(4) { right: 0; }
body[data-mode=hub] #crosshair { opacity: .35; }
#hitmark { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; transform: translate(-50%, -50%) rotate(45deg); opacity: 0; }
#hitmark::before, #hitmark::after { content: ""; position: absolute; background: #fff; }
#hitmark::before { left: 14px; top: 0; width: 2px; height: 100%; } #hitmark::after { top: 14px; left: 0; height: 2px; width: 100%; }
#hitmark.show { opacity: 1; } #hitmark.head::before, #hitmark.head::after { background: var(--gold); }
#hitmark.kill::before, #hitmark.kill::after { background: var(--danger); }
#hurt { position: absolute; inset: 0; opacity: 0; transition: opacity .2s; background: radial-gradient(ellipse at center, transparent 45%, rgba(255,40,70,.6)); }
#prompt { position: absolute; left: 50%; top: 60%; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 7px 14px; font-weight: 600; font-size: 1.05rem; }
#toasts { position: absolute; left: 16px; top: 210px; display: flex; flex-direction: column; gap: 6px; max-width: min(420px, 70vw); }
body[data-mode=hub] #toasts { top: 16px; }
.toast { background: var(--surface); border-left: 3px solid var(--nex); padding: 7px 12px; border-radius: 8px; font-weight: 500; animation: tin .2s ease-out; transition: opacity .4s, transform .4s; }
.toast.big { font-size: 1.15rem; } .toast.warn { border-color: var(--gold); } .toast.legendary { border-color: var(--glitch); }
.toast.out { opacity: 0; transform: translateX(-12px); }
.toast .xp { color: var(--nex); font-size: .88em; margin-left: 6px; }
@keyframes tin { from { opacity: 0; transform: translateX(-12px); } }
#dmgNums { position: absolute; inset: 0; overflow: hidden; }
.dmg { position: absolute; font: 700 1.1rem var(--mono); color: #fff; text-shadow: 0 0 6px #000; transform: translate(-50%, -50%); white-space: nowrap; }
.dmg.head { color: var(--gold); font-size: 1.35rem; }
#topbar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); text-align: center; }
#timer { font-size: 1.7rem; color: var(--fg); text-shadow: 0 0 12px rgba(57,255,136,.4); }
#timer.warn { color: var(--danger); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .5; } }
#objective { color: var(--muted); font-weight: 600; letter-spacing: .05em; }
#minimap { position: absolute; top: 16px; left: 16px; width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 12px; }
body[data-mode=hub] #minimap { display: none; }
#bossbar { position: absolute; top: 84px; left: 50%; transform: translateX(-50%); width: min(560px, 80vw); text-align: center; }
#bossName { color: var(--glitch); font-weight: 700; letter-spacing: .2em; text-shadow: 0 0 12px rgba(255,43,214,.6); }
#bossbar .bar { height: 10px; margin-top: 4px; } #bossbar .bar i { background: var(--glitch); }
#vitals { position: absolute; left: 16px; bottom: 16px; width: min(320px, 46vw); display: grid; gap: 6px; }
.vrow { display: grid; grid-template-columns: 64px 1fr 34px; align-items: center; gap: 8px; font-size: .75rem; letter-spacing: .14em; color: var(--muted); }
.vrow .bar.sh i { background: var(--cyan); } .vrow .bar.hp i { background: var(--nex); } .vrow .bar.st i { background: var(--gold); }
.vrow b { color: var(--fg); font-size: .95rem; letter-spacing: 0; }
#weapon { position: absolute; right: 18px; bottom: 16px; text-align: right; }
#wname { color: var(--muted); letter-spacing: .14em; font-weight: 600; }
#ammo b { font-size: 2.6rem; color: var(--fg); } #ammo span { color: var(--muted); margin-left: 6px; }
#reload { color: var(--gold); font-weight: 700; letter-spacing: .2em; }
#bag { color: var(--muted); }
#extract { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); text-align: center; color: var(--cyan); font-weight: 700; letter-spacing: .25em; }
#extract .ring { width: 74px; height: 74px; margin: 8px auto 0; border-radius: 50%; background: conic-gradient(var(--cyan) var(--p, 0%), rgba(55,232,255,.12) 0); -webkit-mask: radial-gradient(circle, transparent 28px, #000 29px); mask: radial-gradient(circle, transparent 28px, #000 29px); }
@media (max-width: 640px) { #minimap { width: 120px; height: 120px; } #toasts { top: 150px; } #ammo b { font-size: 2rem; } }
#VRButton { z-index: 25 !important; top: 16px !important; bottom: auto !important; left: auto !important; right: 16px !important; }

/* Data Stick ability bar */
#abilities { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 8px; }
.ab { position: relative; width: 92px; padding: 6px 6px 5px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); text-align: center; display: grid; gap: 1px; justify-items: center; }
.ab kbd { position: absolute; top: 3px; left: 4px; font-size: .66rem; }
.ab .ic { font-size: 1.35rem; line-height: 1.2; }
.ab small { font: 600 .68rem var(--mono); color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ab.empty { opacity: .45; } .ab.empty small { color: var(--muted); font-family: var(--font); }
.ab.cool .ic, .ab.cool small { opacity: .35; }
.ab .cdn { position: absolute; inset: 0; display: grid; place-items: center; font: 700 1.3rem var(--mono); color: var(--fg); text-shadow: 0 0 8px #000; }
.ab.on { border-color: var(--gold); box-shadow: 0 0 16px rgba(255,194,61,.45); }
.ab.r-rare { border-color: rgba(61,165,255,.5); } .ab.r-epic { border-color: rgba(181,108,255,.55); } .ab.r-legendary { border-color: rgba(255,176,32,.6); }
.pips { font-size: .62rem; letter-spacing: 1px; color: var(--gold); }
body.cloak #game { filter: saturate(.35) hue-rotate(80deg) brightness(.9); }
body.oc #hud::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 90px rgba(255,93,93,.35); pointer-events: none; }
@media (max-width: 640px) { .ab { width: 64px; } .ab small { display: none; } #abilities { bottom: 92px; } }

/* ---------- online: presence, chat, trade ---------- */
#online { position: absolute; right: 16px; top: 66px; font-size: .8rem; color: var(--fg-muted, #9fb8a8); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 3px 9px; }
#online:empty { display: none; }
#chatlog { position: absolute; left: 16px; bottom: 150px; width: min(420px, 60vw); display: flex; flex-direction: column; gap: 3px; pointer-events: none; }
#chatlog .cl { background: rgba(2,8,5,.72); border-radius: 6px; padding: 3px 8px; font-size: .92rem; transition: opacity 1.5s; overflow-wrap: anywhere; }
#chatlog .cl b { color: var(--nex); font-weight: 600; }
#chatlog .cl.me b { color: #c9ffe0; }
#chatlog .cl.sys { color: var(--fg-muted, #9fb8a8); font-style: italic; }
#chatlog .cl.old { opacity: 0; }
body.chatting #chatlog .cl.old { opacity: 1; }
#chatin { position: absolute; left: 16px; bottom: 112px; width: min(420px, 80vw); font: 500 1rem var(--font); color: var(--fg); background: var(--surface); border: 1px solid var(--nex); border-radius: var(--r); padding: 8px 12px; pointer-events: auto; }
.namerow { justify-content: center; }
.namerow label { font-weight: 600; }
.namerow #runnerName { font: 600 1rem var(--font); color: var(--fg); background: rgba(57,255,136,.06); border: 1px solid var(--line); border-radius: var(--r); padding: 7px 12px; width: 13em; }
.namerow .off { font-weight: 500; opacity: .8; display: flex; gap: 6px; align-items: center; }
.trade { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.trade > div { border: 1px solid var(--line); border-radius: var(--r); padding: 10px; min-width: 0; }
.trade .ok { color: var(--nex); font-weight: 700; }
@media (max-width: 640px) { .trade { grid-template-columns: 1fr; } #chatlog { bottom: 190px; } }
