: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); }
@media (max-width: 560px) { .rng { grid-template-columns: 1fr 48px; gap: 4px 10px; } .rng > :is(input, select) { grid-column: 1; } }   /* narrow screens: the label above its control */
.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; animation: hmPop .14s ease-out; } #hitmark.show.kill { animation: hmKill .32s ease-out; }
@keyframes hmPop { from { transform: translate(-50%, -50%) rotate(45deg) scale(1.6); } }
@keyframes hmKill { 0% { transform: translate(-50%, -50%) rotate(45deg) scale(2.1); } 60% { transform: translate(-50%, -50%) rotate(45deg) scale(1.15); } }
/* the damage-direction arc: a red sliver on a ring round the crosshair, turned to point where the hit came from */
#hurtDir { position: fixed; left: 50%; top: 50%; width: min(52vh, 420px); height: min(52vh, 420px); pointer-events: none; z-index: 4; opacity: 0;
  background: conic-gradient(from -28deg, rgba(255,50,70,.9) 0deg 56deg, transparent 56deg);
  -webkit-mask: radial-gradient(circle, transparent 60%, #000 62%, #000 70%, transparent 73%); mask: radial-gradient(circle, transparent 60%, #000 62%, #000 70%, transparent 73%); }
#hurtDir.on { animation: hurtDir .7s ease-out; }
@keyframes hurtDir { 0% { opacity: 1; } 100% { opacity: 0; } } #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(--fg); font-weight: 600; letter-spacing: .05em; text-shadow: 0 1px 3px #000, 0 0 8px rgba(0,0,0,.8); }
/* the hub's credits changed (main.js credLine): a flash, green up, gold down */
#objective.crUp { animation: crUp .9s ease-out; } #objective.crDown { animation: crDown .9s ease-out; }
@keyframes crUp { 0% { color: #39ff88; text-shadow: 0 0 14px rgba(57,255,136,.9), 0 1px 3px #000; } 100% { color: var(--fg); } }
@keyframes crDown { 0% { color: #ffc23d; text-shadow: 0 0 14px rgba(255,194,61,.8), 0 1px 3px #000; } 100% { color: var(--fg); } }
@media (prefers-reduced-motion: reduce) { #objective.crUp, #objective.crDown { animation: none; } }
#minimap { position: absolute; top: 16px; left: 16px; width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 12px; }
/* (the hub shows its minimap too: where the gate, the bank and Kade are) */
#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: auto; bottom: 22%; 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: .75rem; }
.ab .ic { font-size: 1.35rem; line-height: 1.2; }
.ab small { font: 600 .75rem 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: .78rem; 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.party b { color: #c08cff; }
#chatlog .cl.wsp b { color: #ffb3f0; }
#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; }
#chatcount { position: absolute; left: 16px; bottom: 92px; font-size: .78rem; color: var(--fg-muted, #9fb8a8); pointer-events: none; }
#chatcount.hidden { display: none; }
#chatcount.near { color: #ffc23d; }
#chatcount.full { color: #ff5d7a; font-weight: 700; }
.namerow { justify-content: center; }
/* invite banners (party invites, friends' invites, trade requests): here, not in friends.js, which only signed-in runners
   load, so a guest's party invite was an unstyled div lost under the game view */
.friendInvite { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 95; background: #0b1410; color: #e7fff1; border: 1px solid #39ff88; border-radius: 10px; padding: 12px 16px; max-width: 92vw; font: 600 15px Rajdhani, system-ui, sans-serif; box-shadow: 0 8px 30px #0008; pointer-events: auto; }
.friendInvite .row { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.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; } }

/* ---------- UI polish layer: every panel, card, button, slot and toast (they all share these classes) ---------- */
/* panels open with a quick rise; a soft glass card with a lit top edge and a sticky header */
.overlay:not(.hidden) > .card, #panel:not(.hidden) > .card { animation: cardIn .18s cubic-bezier(.2,.8,.2,1); }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.card { position: relative; background: linear-gradient(180deg, rgba(10,30,20,.92), rgba(3,12,8,.94)); border-color: rgba(57,255,136,.28);
  box-shadow: 0 24px 80px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.03) inset, 0 1px 0 rgba(57,255,136,.35) inset; scrollbar-gutter: stable; }
.card::before { content: ""; position: absolute; left: 24px; right: 24px; top: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--nex), transparent); opacity: .7; pointer-events: none; }
.card > header:first-child { padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid rgba(57,255,136,.14); }
#panel > .card > header:first-child { position: sticky; top: -22px; z-index: 2; margin: -22px -24px 10px; padding: 16px 24px 12px; background: linear-gradient(180deg, rgba(8,24,16,.98), rgba(8,24,16,.92)); border-radius: 16px 16px 0 0; }
.card h2 { letter-spacing: .04em; text-shadow: 0 0 18px rgba(57,255,136,.35); }
.card h4 { display: flex; align-items: center; gap: 10px; }
.card h4::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(57,255,136,.25), transparent); }
.card .sub { line-height: 1.45; }
.card p { line-height: 1.5; }
/* themed scrollbars */
.card, .overlay, #panel * { scrollbar-width: thin; scrollbar-color: rgba(57,255,136,.35) transparent; }
.card::-webkit-scrollbar { width: 8px; } .card::-webkit-scrollbar-thumb { background: rgba(57,255,136,.3); border-radius: 8px; } .card::-webkit-scrollbar-track { background: transparent; }

/* buttons: a little lift and glow on hover, a clear pressed state; mini buttons get the same treatment */
.btn { transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.35), 0 0 0 1px rgba(57,255,136,.25); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.btn.primary:hover:not(:disabled) { box-shadow: 0 0 32px rgba(57,255,136,.55); }
.mini { transition: background .12s, border-color .12s; }
.mini:hover:not(:disabled) { background: rgba(57,255,136,.16); border-color: var(--nex); }
.btn[aria-pressed="true"]:not(.primary) { border-color: var(--nex); background: rgba(57,255,136,.14); }

/* item slots: tidy grid, hover lift, rarity shows as a coloured left edge when the chip inside has a rarity class */
.grid { gap: 8px; }
.slot { transition: border-color .12s, background .12s, transform .12s; position: relative; }
.slot:hover { border-color: rgba(57,255,136,.45); }
button.slot:hover:not(:disabled) { transform: translateY(-1px); }
.slot:has(.r-rare) { box-shadow: inset 3px 0 0 var(--rare); } .slot:has(.r-epic) { box-shadow: inset 3px 0 0 var(--epic); }
.slot:has(.r-legendary) { box-shadow: inset 3px 0 0 var(--legendary), 0 0 18px rgba(255,176,32,.08); }
.slot small { color: var(--muted); }
.slot .acts { margin-top: 2px; }

/* form controls match the theme */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], textarea, select {
  font: inherit; color: var(--fg); background: rgba(2,14,8,.85); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; transition: border-color .12s, box-shadow .12s; }
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus, input[type=number]:focus, input[type=search]:focus, textarea:focus, select:focus { border-color: var(--nex); box-shadow: 0 0 0 3px rgba(57,255,136,.15); outline: none; }
input::placeholder, textarea::placeholder { color: rgba(143,184,162,.6); }
input[type=range] { accent-color: var(--nex); }

/* toasts: glass, an accent bar and a glow for the big ones */
.toast { background: linear-gradient(90deg, rgba(8,26,17,.95), rgba(4,14,9,.88)); border: 1px solid rgba(57,255,136,.18); border-left-width: 3px; border-left-color: var(--nex);
  box-shadow: 0 8px 24px rgba(0,0,0,.4); backdrop-filter: blur(6px); line-height: 1.35; }
.toast.big { padding: 9px 14px; box-shadow: 0 8px 28px rgba(0,0,0,.45), 0 0 22px rgba(57,255,136,.12); }
.toast.warn { border-left-color: var(--gold); } .toast.legendary { border-left-color: var(--glitch); box-shadow: 0 8px 28px rgba(0,0,0,.45), 0 0 22px rgba(255,43,214,.18); }
#prompt { box-shadow: 0 8px 24px rgba(0,0,0,.45); border-color: rgba(57,255,136,.35); backdrop-filter: blur(6px); letter-spacing: .02em; }
kbd { box-shadow: 0 1px 0 rgba(57,255,136,.25); }

/* small screens: tighter cards; and no motion for people who asked for less */
@media (max-width: 640px) { .card { padding: 16px; border-radius: 14px; } #panel > .card > header:first-child { margin: -16px -16px 10px; padding: 12px 16px 10px; top: -16px; } .card::before { left: 16px; right: 16px; } }
body:not([data-mode=raid]) #quitRaid { display: none; }
body:not([data-mode=apt]):not([data-mode=lounge]) #toHub { display: none; }   /* (apartments and the Lounge: the Esc menu's way out) */
#sumBody .sumLevel { color: var(--nex); font-size: 1.15rem; margin: 4px 0; text-shadow: 0 0 14px rgba(57,255,136,.4); }   /* nothing to abandon outside a raid */
/* loot value on slots; the one-line description shows on touch screens (no tooltips there) */
.item .val { margin-left: auto; padding-left: 6px; font-size: .78em; color: #ffc23d; opacity: .85; font-family: "JetBrains Mono", monospace; }
.item .ds { display: none; }
body.touch .item .ds { display: block; flex-basis: 100%; font-size: .72em; color: #9fbfae; white-space: normal; line-height: 1.15; }
body.touch .item { flex-wrap: wrap; }
/* low health (under 35%): a red vignette that deepens and pulses faster the lower you are (static with Reduce motion) */
body.lowhp #hud::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; background: radial-gradient(ellipse at center, transparent 42%, rgba(255, 30, 60, calc(var(--lowhp, 0) * .55))); animation: lowPulse calc(1.1s - var(--lowhp, 0) * .5s) ease-in-out infinite; }
body.lowhp.nxCalm #hud::before { animation: none; }
@keyframes lowPulse { 0%, 100% { opacity: .65; } 50% { opacity: 1; } }
/* hit markers by kind: weak point gold-white, a shield hit small and grey (a wasted shot) */
#hitmark.weak::before, #hitmark.weak::after { background: #fff2a0; box-shadow: 0 0 6px #ffc23d; }
#hitmark.shield { transform: translate(-50%, -50%) rotate(45deg) scale(.6); } #hitmark.shield::before, #hitmark.shield::after { background: #9fd8ff; }
.touchOnly { display: none !important; } body.touch .touchOnly { display: grid !important; }
/* the Reduce motion setting does what the system preference does */
body.nxCalm *, body.nxCalm *::before, body.nxCalm *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
.settings .chk { display: flex; align-items: center; gap: 8px; }
#nxSetDlg { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(0,0,0,.6); }
#nxSetDlg .card { max-width: 520px; width: 92vw; text-align: left; }
@media (prefers-reduced-motion: reduce) { #timer.warn { animation: none; } .overlay > .card, #panel > .card, .toast { animation: none !important; } .btn, .slot, .mini { transition: none; } .btn:hover, button.slot:hover { transform: none; } }
/* an open panel owns the screen: the corner HUD widgets (account badge, contracts) step back instead of covering its title */
#acctBadge, #nexDaily { transition: opacity .15s; }
body:has(#panel:not(.hidden)) :is(#acctBadge, #nexDaily) { opacity: 0; pointer-events: none; }

#ammo b.empty { color: var(--danger, #ff5d5d); }
#bag .cr { color: var(--gold, #ffc23d); }
body.touch #extract { bottom: 30%; }

.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.item .rm{font-size:.85em}
#hitmark.kill.head { filter: drop-shadow(0 0 6px #ffc23d) drop-shadow(0 0 2px #fff2a0); }

/* ---------- game feel: sheets ease out, toasts stack, every button answers hover and press ---------- */
.overlay:not(.hidden), #panel:not(.hidden) { animation: nxSheetIn .14s ease-out; }
@keyframes nxSheetIn { from { opacity: 0; } }
/* the snapshot ui.js leaves behind when a panel or overlay closes: it fades while its card sinks a touch */
.nxSheetOut { position: fixed !important; inset: 0; display: grid; place-items: center; padding: 16px; pointer-events: none !important; animation: nxSheetOut .15s cubic-bezier(.4,0,1,1) forwards !important; }
.nxSheetOut:not(.overlay) { z-index: 15; background: rgba(0,0,0,.45); }
.nxSheetOut > .card { animation: nxCardSink .15s cubic-bezier(.4,0,1,1) forwards !important; }
@keyframes nxSheetOut { to { opacity: 0; } }
@keyframes nxCardSink { to { transform: translateY(8px) scale(.985); } }
/* toasts: a leaving one fades and its row closes up, so the rest glide instead of jumping; repeats count up */
#toasts > .toast { overflow: hidden; transition: opacity .3s ease, transform .3s cubic-bezier(.4,0,.2,1), max-height .3s cubic-bezier(.4,0,.2,1) .08s, padding .3s ease .08s, margin .3s ease .08s, border-width .3s ease .08s; }
#toasts > .toast.out { opacity: 0; transform: translateX(-14px); max-height: 0 !important; padding-top: 0; padding-bottom: 0; margin-bottom: -6px; border-top-width: 0; border-bottom-width: 0; }
.toast .tn { margin-left: 8px; padding: 0 6px; border-radius: 6px; background: rgba(57,255,136,.18); color: var(--nex); font: 700 .8em var(--mono); }
/* buttons without a style of their own inside menus still light on hover and dip on press */
:is(#panel, .overlay, [role=dialog]) :is(button, [role=button], [role=tab]):not(.btn):not(.mini):not(.slot):not(:disabled) { transition: filter .12s, transform .1s; }
:is(#panel, .overlay, [role=dialog]) :is(button, [role=button], [role=tab]):not(.btn):not(.mini):not(.slot):not(:disabled):hover { filter: brightness(1.2); }
:is(#panel, .overlay, [role=dialog]) :is(button, [role=button], [role=tab]):not(.btn):not(.mini):not(.slot):not(:disabled):active { transform: translateY(1px) scale(.98); }
button.slot:active:not(:disabled), .mini:active:not(:disabled) { transform: translateY(1px) scale(.985); }
/* a slot with nothing to press in it (a summary's loot, a read-only list) doesn't light on hover: no promise of a click */
div.slot:not(:has(button, a, input, select, [draggable=true], [role=button])):hover { border-color: var(--line); }
@media (prefers-reduced-motion: reduce) { .overlay:not(.hidden), #panel:not(.hidden), .nxSheetOut, .nxSheetOut > .card { animation: none !important; } #toasts > .toast { transition: none; } }

/* the loot pop (ui.js lootPop): each find rises over the crosshair with its name and value; the haul counter pulses */
#lootPop { position: fixed; left: 50%; top: 58%; transform: translateX(-50%); z-index: 35; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 4px; }
#lootPop .lp { font: 700 17px Rajdhani, system-ui, sans-serif; color: #e7fff1; background: rgba(2,10,6,.72); border: 1px solid rgba(57,255,136,.35); border-radius: 8px; padding: 3px 10px; text-shadow: 0 1px 2px #000; opacity: 0; animation: lootPop 2.5s ease-out forwards; white-space: nowrap; }
#lootPop .lp .cr, .slot .lpCap .cr { color: var(--gold, #ffc23d); }
/* a Lootblock's tiles (invgrid.js shows icons only): each with its name and value along the bottom */
#panelBody.nxTiles .grid.lootGrid > .slot > small.lpCap { display: block !important; position: absolute; left: 2px; right: 2px; bottom: 2px; font: 600 11px/1.15 Rajdhani, system-ui, sans-serif; text-align: center; color: #e7fff1; background: rgba(2,10,6,.78); border-radius: 4px; padding: 1px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
#panelBody.nxTiles .grid.lootGrid > .slot > small.lpCap .cr { display: block; }
#panelBody.nxTiles .grid.lootGrid > .slot[data-q]::after { bottom: 30px; }
@keyframes lootPop { 0% { opacity: 0; transform: translateY(12px) scale(.9); } 12% { opacity: 1; transform: translateY(0) scale(1.05); } 20% { transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-26px); } }
#bag.grow .cr { animation: haulGrow .6s ease-out; display: inline-block; }
@keyframes haulGrow { 0% { transform: scale(1.35); color: #fff; text-shadow: 0 0 10px #ffc23d; } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { #lootPop .lp { animation-duration: 2.5s; animation-name: lootFade; } #bag.grow .cr { animation: none; } }
@keyframes lootFade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }

/* the kill confirm (ui.js hitmarker): a ring round the X, and a word under the crosshair; a headshot hit gets a gold diamond */
html #hitmark.show.kill { border: 2px solid var(--hm); border-radius: 50%; box-sizing: border-box; }
html #hitmark.show.head:not(.kill) { outline: 2px solid var(--hm); outline-offset: 2px; }
#killTag { position: fixed; left: 50%; top: calc(50% + 34px); transform: translateX(-50%); pointer-events: none; z-index: 6; opacity: 0;
  font: 800 12px/1 var(--mono, monospace); letter-spacing: .22em; color: var(--danger, #ff3b5c); text-shadow: 0 0 6px rgba(0,0,0,.9); }
#killTag.head { color: #ffd25a; }
#killTag.on { animation: killTag .7s ease-out; }
@keyframes killTag { 0% { opacity: 0; transform: translateX(-50%) scale(1.5); } 15% { opacity: 1; transform: translateX(-50%) scale(1); } 70% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%) translateY(-6px); } }
body.nxSpecOn #killTag { display: none; }
@media (prefers-reduced-motion: reduce) { #killTag.on { animation-duration: 1s; animation-name: lootFade; } }
#bag { position: relative; }
#bag .hplus { position: absolute; left: 100%; margin-left: 8px; top: 0; white-space: nowrap; color: var(--gold, #ffc23d); font-weight: 800; pointer-events: none; animation: haulPlus 1.4s ease-out forwards; }
@keyframes haulPlus { 0% { opacity: 0; transform: translateY(4px) scale(1.4); } 15% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { #bag .hplus { animation-name: lootFade; } }
