:root {
  --bg: #0f1114;
  --panel: rgba(18, 21, 26, 0.86);
  --panel-2: rgba(32, 37, 44, 0.9);
  --line: rgba(255, 255, 255, 0.08);
  --text: #e9ecef;
  --dim: #8d96a0;
  --accent: #ff7a1a;
  --accent-2: #ffb35c;
  --ok: #3dd68c;
  --warn: #f2c21e;
  --bad: #ff4d4d;
  --cyan: #59d2ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: 'Rajdhani', system-ui, sans-serif; font-size: 15px; user-select: none; }
canvas#c { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }
button { font: inherit; font-weight: 600; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 6px 12px; cursor: pointer; letter-spacing: .03em; transition: background .12s, border-color .12s; }
button:hover { background: #2d343d; border-color: rgba(255, 122, 26, .5); }
input { font: inherit; color: var(--text); background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 4px; padding: 5px 8px; }
input:focus { outline: none; border-color: var(--accent); }
h3 { font-family: 'Chakra Petch', sans-serif; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin: 0 0 10px; }

.logo { font-family: 'Chakra Petch', sans-serif; font-weight: 700; font-size: 22px; letter-spacing: .08em; color: #fff; }
.logo span { color: var(--accent); margin-left: 6px; text-shadow: 0 0 14px rgba(255,122,26,.6); }
.logo.big { font-size: 64px; }

#loading { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: radial-gradient(circle at 50% 40%, #1d2229, #0b0c0e); z-index: 50; }
#loading .sub { color: var(--dim); letter-spacing: .1em; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; backdrop-filter: blur(8px); box-shadow: 0 10px 40px rgba(0,0,0,.35); }

#topbar { position: fixed; top: 0; left: 0; right: 0; height: 54px; display: flex; align-items: center; gap: 18px; padding: 0 16px; background: linear-gradient(180deg, rgba(10,12,15,.95), rgba(10,12,15,.75)); border-bottom: 1px solid var(--line); z-index: 10; }
.modes { display: flex; gap: 4px; }
.mode { background: transparent; border-color: transparent; font-family: 'Chakra Petch'; text-transform: uppercase; font-size: 14px; letter-spacing: .1em; color: var(--dim); }
.mode.active { color: #fff; border-bottom: 2px solid var(--accent); border-radius: 0; }
.mode.drive { color: #111; background: var(--accent); border-radius: 4px; }
.mode.drive:hover { background: var(--accent-2); }
.tools { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.tools input { width: 180px; font-weight: 600; }
.sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.toggle.on { border-color: var(--accent); color: var(--accent); }
.icon { font-size: 18px; padding: 4px 10px; }
body.range #btnSettings { margin-left: auto; }

#left { position: fixed; top: 66px; left: 12px; bottom: 12px; width: 300px; display: flex; flex-direction: column; overflow: hidden; z-index: 5; }
#tabs { display: flex; border-bottom: 1px solid var(--line); }
#tabs button { flex: 1; border: none; border-radius: 0; background: transparent; padding: 11px 4px; font-family: 'Chakra Petch'; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
#tabs button.active { color: #fff; box-shadow: inset 0 -2px var(--accent); }
#cards { flex: 1; overflow-y: auto; padding: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; }
#cards::-webkit-scrollbar { width: 6px; } #cards::-webkit-scrollbar-thumb { background: #333a42; border-radius: 3px; }
.card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px; cursor: pointer; transition: transform .1s, border-color .1s; position: relative; }
.card:hover { border-color: rgba(255,122,26,.6); transform: translateY(-1px); }
.card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 18px rgba(255,122,26,.25); }
.card img { width: 100%; aspect-ratio: 4/3; display: block; border-radius: 4px; background: radial-gradient(circle at 50% 40%, #39414b, #1a1e23); }
.card .nm { font-weight: 700; font-size: 13.5px; line-height: 1.15; margin-top: 5px; }
.card .st { font-size: 12px; color: var(--dim); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1px 6px; margin-top: 2px; }
.card .tag { position: absolute; top: 9px; right: 9px; font-size: 10px; font-weight: 700; letter-spacing: .08em; background: rgba(0,0,0,.6); padding: 1px 5px; border-radius: 3px; color: var(--accent-2); }

#right { position: fixed; top: 66px; right: 12px; width: 280px; padding: 14px; z-index: 5; max-height: calc(100vh - 78px); overflow-y: auto; overflow-x: hidden; }
.massbar { position: relative; height: 14px; background: rgba(255,255,255,.06); border-radius: 3px; overflow: visible; margin-top: 18px; }
.massbar .fill { height: 100%; border-radius: 3px; background: var(--ok); transition: width .25s, background .25s; }
.massbar .mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: #fff; transition: left .25s; }
.massbar .mark span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--dim); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.mblegend { display: flex; justify-content: space-between; font-size: 12px; color: var(--dim); margin: 5px 0 10px; }
.row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.row span { color: var(--dim); }
.row b { font-family: 'Chakra Petch'; font-weight: 500; text-align: right; margin-left: 12px; }
.row span { flex: none; }
.row b.warn { color: var(--warn); } .row b.bad { color: var(--bad); } .row b.good { color: var(--ok); }
#warnings { list-style: none; padding: 0; margin: 10px 0 0; font-size: 13px; }
#warnings li { padding: 5px 8px; border-left: 3px solid var(--warn); background: rgba(242,194,30,.07); margin-bottom: 4px; border-radius: 2px; }
#warnings li.err { border-color: var(--bad); background: rgba(255,77,77,.08); }
.info { margin-top: 12px; padding: 10px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; }
.info .t { font-weight: 700; font-size: 15px; color: #fff; }
.info .d { color: var(--dim); margin: 3px 0 7px; }
.info .kv { display: grid; grid-template-columns: 1fr auto; gap: 1px 10px; }
.info .kv span:nth-child(odd) { color: var(--dim); }

#hint { position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%); padding: 8px 16px; border-radius: 20px; background: rgba(10,12,15,.85); border: 1px solid var(--line); font-size: 14px; z-index: 6; white-space: nowrap; }
#hint.err { border-color: var(--bad); color: #ffb3b3; }

#toast { position: fixed; top: 70px; left: 50%; transform: translateX(-50%) translateY(-10px); padding: 9px 18px; border-radius: 6px; background: var(--accent); color: #111; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 40; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--bad); color: #fff; }

/* modal */
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 30; }
.modal-box { width: min(560px, calc(100vw - 32px)); max-height: 80vh; overflow-y: auto; padding: 18px; }
.modal-actions { display: flex; justify-content: flex-end; margin-top: 14px; gap: 8px; }
.modal-box textarea { width: 100%; height: 110px; font-family: monospace; font-size: 12px; color: var(--text); background: rgba(0,0,0,.4); border: 1px solid var(--line); border-radius: 4px; padding: 8px; resize: vertical; }
.savelist { display: flex; flex-direction: column; gap: 6px; }
.savelist .it { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--panel-2); border-radius: 5px; }
.savelist .it .n { flex: 1; font-weight: 700; } .savelist .it .b { color: var(--dim); font-size: 13px; }
.binds { display: grid; grid-template-columns: 1fr 120px 120px; gap: 6px 10px; align-items: center; }
.binds .h { color: var(--dim); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.binds button.listening { border-color: var(--accent); color: var(--accent); }
.modal-box label { display: flex; align-items: center; gap: 10px; margin-top: 14px; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud .panel, #hud button, #hud input { pointer-events: auto; }
.hud-tl { position: absolute; top: 66px; left: 12px; width: 240px; padding: 12px 14px; }
.hud-name { font-family: 'Chakra Petch'; font-weight: 700; font-size: 16px; margin-bottom: 6px; color: var(--accent); }
.hud-row { display: flex; justify-content: space-between; font-size: 14px; padding: 2px 0; }
.hud-row span { color: var(--dim); }
#hudWarn { color: var(--warn); font-weight: 700; margin-top: 6px; font-size: 13px; }
.speedo { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); text-align: center; text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.spd { font-family: 'Chakra Petch'; font-weight: 700; font-size: 64px; line-height: 1; color: #fff; }
.unit { font-size: 13px; letter-spacing: .2em; color: #dde; }
.spdbar { width: 220px; height: 5px; background: rgba(0,0,0,.4); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.spdbar div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.hud-br { position: absolute; right: 12px; bottom: 12px; padding: 10px 12px; font-size: 13px; display: grid; grid-template-columns: auto auto; gap: 3px 12px; }
.hud-br kbd { font-family: 'Chakra Petch'; font-size: 11px; background: rgba(255,255,255,.1); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; padding: 0 6px; color: #fff; }
.hud-br span { color: var(--dim); }
.hud-tc { position: absolute; top: 66px; left: 50%; transform: translateX(-50%); font-size: 14px; color: #fff; background: rgba(10,12,15,.6); padding: 6px 14px; border-radius: 16px; text-shadow: none; }
#tune { position: absolute; top: 66px; right: 12px; width: 280px; padding: 14px; }
#tune label { display: grid; grid-template-columns: 1fr 44px; font-size: 13px; color: var(--dim); margin-bottom: 8px; }
#tune input { grid-column: 1 / 3; accent-color: var(--accent); padding: 0; }
#tune output { grid-column: 2; grid-row: 1; text-align: right; color: #fff; font-family: 'Chakra Petch'; }

/* v2 additions */
#factionFilter { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 10px 0; }
#factionFilter button { font-size: 11px; padding: 2px 7px; border-radius: 10px; color: var(--dim); display: inline-flex; align-items: center; gap: 4px; }
#factionFilter button.on { color: #fff; border-color: var(--accent); }
#factionFilter i, .bp .b i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.card .fac { position: absolute; top: 10px; left: 10px; width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(0,0,0,.5); }
#cards .sub { grid-column: 1 / -1; }
.sub { font-family: 'Chakra Petch'; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin: 10px 0 4px; }
.dim { color: var(--dim); }
.info .facname { font-size: 12px; font-weight: 700; margin-top: 2px; }
#warnings li button { font-size: 11px; padding: 1px 8px; margin-left: 6px; }
#modal.wide .modal-box { width: min(920px, calc(100vw - 32px)); }
.card .st .buff { color: #3dd68c; }
.card .st .buff, .card .st .debuff { flex-basis: 100%; font-size: 11px; line-height: 1.3; }
.card .st .debuff { color: #ff6b6b; }
#crosshair { --p: 1; --c: #fff; position: fixed; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; pointer-events: none; z-index: 5; filter: drop-shadow(0 0 2px rgba(0,0,0,.85)); transition: transform .12s; }
#crosshair .ring { position: absolute; inset: 9px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 360deg), rgba(255,255,255,.18) 0); -webkit-mask: radial-gradient(circle, transparent 11.5px, #000 12px); mask: radial-gradient(circle, transparent 11.5px, #000 12px); }
#crosshair .t { position: absolute; background: var(--c); border-radius: 1px; transition: all .12s; }
#crosshair .t.n, #crosshair .t.s { left: 21px; width: 2px; height: 8px; }
#crosshair .t.e, #crosshair .t.w { top: 21px; height: 2px; width: 8px; }
#crosshair .t.n { top: 0; } #crosshair .t.s { bottom: 0; } #crosshair .t.w { left: 0; } #crosshair .t.e { right: 0; }
#crosshair i { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; background: #ff7a1a; border-radius: 50%; box-shadow: 0 0 4px #ff7a1a; }
#crosshair .x { position: absolute; left: 50%; top: 50%; width: 26px; height: 3px; margin: -1.5px 0 0 -13px; background: #ff3b3b; border-radius: 2px; opacity: 0; transition: opacity .1s; }
#crosshair .x.a { transform: rotate(45deg); } #crosshair .x.b { transform: rotate(-45deg); }
#crosshair.cool { --c: rgba(200,200,200,.8); }
#crosshair.cool i { background: #999; box-shadow: none; }
#crosshair.hooked { --c: #ffb347; }
/* boomerang charge: ring grows, fills amber, ticks spread; label under it; pulses at max */
#crosshair.charging { --c: #ffb020; transform: scale(1.35); }
#crosshair.charging .ring { inset: 6px; }
#crosshair.charging .t.n { top: calc(-6px * var(--p)); } #crosshair.charging .t.s { bottom: calc(-6px * var(--p)); }
#crosshair.charging .t.w { left: calc(-6px * var(--p)); } #crosshair.charging .t.e { right: calc(-6px * var(--p)); }
#crosshair.full { animation: chgPulse .5s ease-in-out infinite alternate; --c: #ff6a1a; }
@keyframes chgPulse { from { transform: scale(1.35); } to { transform: scale(1.5); } }
#crosshair .chg { position: absolute; top: 50px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-style: normal; font-family: 'Chakra Petch'; font-weight: 700; font-size: 12px; color: #ffcf80; text-shadow: 0 1px 3px #000; letter-spacing: .05em; }
#crosshair.charging .chg { font-size: 11px; top: 44px; }
#crosshair.blocked { --c: rgba(255,80,80,.55); transform: scale(.9); }
#crosshair.blocked .x { opacity: 1; }
#crosshair.blocked i { opacity: 0; }
#crosshair.blocked .t.n { top: 4px; } #crosshair.blocked .t.s { bottom: 4px; } #crosshair.blocked .t.w { left: 4px; } #crosshair.blocked .t.e { right: 4px; }
#crosshair.off { opacity: .25; }
#hudWeapon { position: fixed; left: 50%; bottom: 128px; transform: translateX(-50%); color: #fff; font-size: 13px; text-shadow: 0 1px 3px #000; pointer-events: none; white-space: nowrap; }
#dmgLayer { position: fixed; inset: 0; pointer-events: none; z-index: 6; overflow: hidden; }
.dmgnum { position: absolute; left: 0; top: 0; font-weight: 900; letter-spacing: .5px; white-space: nowrap; text-shadow: 0 2px 0 #000, 0 0 6px rgba(0,0,0,.8); will-change: transform, opacity; }
.dmgnum.part { color: #d9dde2; }
.dmgnum.base { color: #ffa133; }
.dmgnum.dummy { color: #ff3b3b; }
.dmgnum.own { font-style: italic; opacity: .9; }
.bp-top { display: flex; gap: 8px; margin-bottom: 6px; }
.bpgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; }
.bp { display: flex; gap: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px; }
.bp img { width: 150px; height: 112px; border-radius: 4px; background: radial-gradient(circle at 50% 40%, #39414b, #1a1e23); }
.bp .bpi { flex: 1; min-width: 0; }
.bp .n { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp .b { color: var(--dim); font-size: 12px; display: flex; align-items: center; gap: 5px; }
.bp .acts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.bp .acts button { font-size: 12px; padding: 3px 8px; }
.bp .acts button.primary { background: var(--accent, #ff7a1a); color: #111; font-weight: 700; border-color: transparent; }
.pill { font-size: 9px; letter-spacing: .1em; background: rgba(255,122,26,.2); color: var(--accent-2); padding: 1px 5px; border-radius: 3px; vertical-align: middle; }
.hbar { display: grid; grid-template-columns: 52px 1fr 64px; align-items: center; gap: 8px; font-size: 13px; margin: 3px 0; }
.hbar span { color: var(--dim); }
.hbar div { height: 7px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; }
.hbar i { display: block; height: 100%; width: 100%; background: var(--ok); transition: width .2s; }
.hbar em { font-style: normal; font-family: 'Chakra Petch'; font-size: 12px; text-align: right; }
#hudFeed { position: fixed; left: 50%; bottom: 152px; transform: translateX(-50%); width: 420px; max-width: 90vw; display: flex; flex-direction: column-reverse; align-items: center; gap: 3px; font-size: 13px; font-weight: 700; text-shadow: 0 1px 3px #000; pointer-events: none; }
#hudFeed div { padding: 2px 10px; border-left: 3px solid var(--accent); border-radius: 3px; background: rgba(10,12,15,.45); white-space: nowrap; transition: opacity .3s; }
#hudFeed .bad { border-color: var(--bad); color: #ffc2c2; } #hudFeed .warn { border-color: var(--warn); } #hudFeed .info { border-color: var(--cyan); }
#overlay { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); text-align: center; text-shadow: 0 3px 18px rgba(0,0,0,.8); }
#overlay .big { font-family: 'Chakra Petch'; font-weight: 700; font-size: 58px; letter-spacing: .06em; }
#overlay.eject .big { color: var(--warn); } #overlay.dead .big { color: var(--bad); }
#overlay .k { font-size: 18px; margin-top: 6px; }
/* garage tabs: labelled groups in a 2-column grid (chassis · body / weapons · dummy / modules full width); every
   option is its own framed tile, two per row */
#tabs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; padding: 6px; border-bottom: 1px solid var(--line); }
#tabs .tgroup { min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 4px 5px 5px; background: rgba(255,255,255,.02); }
#tabs .tgroup.wide { grid-column: 1 / -1; }
#tabs .tgroup.active { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
#tabs .tg-name { font-family: 'Chakra Petch'; font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim); padding: 1px 2px 4px; }
#tabs .tgroup.active .tg-name { color: var(--accent); }
#tabs .tg-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
#tabs .tgroup.wide .tg-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#tabs button { min-width: 0; padding: 6px 3px; font-size: 10px; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid var(--line); border-radius: 4px; background: rgba(255,255,255,.035); color: var(--dim); }
#tabs button:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: #fff; }
#tabs button.soon { opacity: .55; border-style: dashed; }
#tabs .tgroup[data-group="body"] button:first-child { grid-column: 1 / -1; }   /* Structure: full row, Armor + Bumpers under it */
#tabs button small { display: block; font-size: 8px; letter-spacing: .14em; opacity: .8; }
#tabs button.active { background: color-mix(in srgb, var(--accent) 20%, transparent); border-color: var(--accent); color: #fff; box-shadow: none; }

#rotbar.flat [data-r="x"], #rotbar.flat [data-r="z"] { display: none; }
#rotbar { position: fixed; bottom: 58px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 6; }
#rotbar button { background: rgba(10,12,15,.88); border-radius: 18px; padding: 6px 14px; }
#rotbar kbd { font-family: 'Chakra Petch'; font-size: 11px; background: rgba(255,255,255,.1); border-radius: 3px; padding: 0 5px; margin-left: 4px; }

#overlay.dead { position: fixed; inset: 0; transform: none; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(circle, rgba(60,0,0,.35), rgba(0,0,0,.75)); pointer-events: none; }
#overlay.dead .big { font-size: 96px; color: #ff4d4d; letter-spacing: .12em; }
#overlay .why { font-size: 20px; color: #e9ecef; margin-top: 4px; text-transform: uppercase; letter-spacing: .1em; }
#overlay .dstats { display: grid; grid-template-columns: auto auto; gap: 4px 24px; margin: 18px 0 10px; font-size: 18px; text-align: left; }
#overlay .dstats span { color: #aab; } #overlay .dstats b { font-family: 'Chakra Petch'; }
#overlay.eject .big { color: var(--accent); }

#mirrorChip { position: fixed; top: 66px; left: 16px; z-index: 6; border-radius: 18px; background: rgba(10,12,15,.88); padding: 7px 14px; }
body:not(.range) #mirrorChip { left: 324px; }
#mirrorChip.on { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 12px rgba(89,210,255,.35); }
#mirrorChip kbd { font-family: 'Chakra Petch'; font-size: 11px; background: rgba(255,255,255,.1); border-radius: 3px; padding: 0 5px; margin-left: 4px; }

/* ---------- main menu ---------- */
#menu { position: fixed; inset: 0; z-index: 12; display: flex; flex-direction: column; align-items: center; padding-top: 5vh; background: radial-gradient(ellipse at 50% 110%, rgba(8,9,12,.15), rgba(8,9,12,.72) 70%); }
.menu-head { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.menu-tabs { display: flex; gap: 4px; background: rgba(10,12,15,.8); border: 1px solid var(--line); border-radius: 30px; padding: 5px; }
.menu-tabs button { border-radius: 24px; background: transparent; border-color: transparent; font-family: 'Chakra Petch'; text-transform: uppercase; letter-spacing: .12em; padding: 9px 26px; color: var(--dim); }
.menu-tabs button.on { background: var(--accent); color: #111; }
#menuBody { margin-top: 28px; width: min(980px, 92vw); max-height: 70vh; overflow: auto; }
.mcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.mcard { background: rgba(14,16,20,.88); border: 1px solid var(--line); border-radius: 10px; padding: 18px; cursor: pointer; position: relative; transition: border-color .12s, transform .12s; }
.mcard:hover { border-color: rgba(255,122,26,.6); transform: translateY(-2px); }
.mcard.on { border-color: var(--accent); box-shadow: 0 0 22px rgba(255,122,26,.25); }
.mcard.locked { opacity: .45; cursor: default; }
.mcard h4 { margin: 0 0 6px; font-family: 'Chakra Petch'; font-size: 22px; letter-spacing: .06em; }
.mcard .tag { position: absolute; top: 14px; right: 14px; font-size: 11px; letter-spacing: .12em; background: var(--accent); color: #111; padding: 2px 8px; border-radius: 3px; font-weight: 700; }
.mcard p { margin: 0; color: #c4cad1; font-size: 15px; line-height: 1.35; }
.mcard ul { margin: 10px 0 0; padding-left: 18px; color: #c4cad1; font-size: 14px; }
.mpick { margin-top: 18px; background: rgba(14,16,20,.9); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.mpick h3 { margin-bottom: 12px; }
.bps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.bp { display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 8px; padding: 8px; cursor: pointer; }
.bp img { width: 58px; height: 58px; object-fit: contain; background: rgba(0,0,0,.3); border-radius: 6px; }
.bp .n { font-weight: 700; font-size: 15px; } .bp .d { font-size: 13px; color: var(--dim); }
.bp.locked { opacity: .35; cursor: default; filter: grayscale(1); }
.bp.on { border-color: var(--accent); background: rgba(255,122,26,.12); }
.mstart { margin-top: 14px; display: flex; justify-content: flex-end; }
button.primary, .mstart button { background: var(--accent); color: #111; font-family: 'Chakra Petch'; text-transform: uppercase; letter-spacing: .12em; padding: 10px 30px; font-size: 16px; }
button.primary:hover, .mstart button:hover { background: var(--accent-2); }

/* ---------- intro cut scene: letterbox, HUD hidden ---------- */
#cineBars i { position: fixed; left: 0; right: 0; height: 0; background: #000; transition: height .45s ease; z-index: 7; }
#cineBars i:first-child { top: 0; } #cineBars i:last-child { bottom: 0; }
body.cinema #cineBars i { height: 12vh; }
body.cinema #hud > :not(#arenaBanner):not(#cineBars) { visibility: hidden; }
body.cinema #arenaBanner { top: 50%; }
body.cinema #arenaBanner .b { font-size: 120px; }

/* ---------- Hex Rumble HUD ---------- */
#arenaHud { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
body.arena .hud-tc { display: none; }
#arClock { font-family: 'Chakra Petch'; font-weight: 700; font-size: 34px; color: #fff; background: rgba(10,12,15,.75); padding: 2px 22px; border-radius: 8px; border-bottom: 3px solid var(--accent); text-shadow: 0 2px 6px #000; }
#arClock.low { color: var(--bad); border-color: var(--bad); }
#arChips { display: flex; gap: 6px; }
#arChips .chip { display: flex; align-items: center; gap: 7px; background: rgba(10,12,15,.75); padding: 3px 10px; border-radius: 16px; font-weight: 700; font-size: 14px; }
#arChips .chip i { width: 10px; height: 10px; border-radius: 50%; }
#arChips .chip b { font-family: 'Chakra Petch'; color: #ffd23d; font-size: 16px; }
#arChips .chip .crown { width: 16px; height: 11px; margin-right: -2px; filter: drop-shadow(0 0 3px rgba(255,210,60,.7)); }
#arChips .chip.lead { box-shadow: 0 0 0 1px rgba(255,210,60,.55); }
#arChips .chip.me { border: 1px solid rgba(255,210,61,.6); }
#arChips .chip.out { opacity: .4; text-decoration: line-through; }
#arChips .chip.off span::after { content: ' ↓'; color: var(--bad); }
#arenaBanner { position: fixed; top: 17%; left: 50%; transform: translate(-50%, -50%) scale(.8); text-align: center; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; text-shadow: 0 3px 18px rgba(0,0,0,.85); }
#arenaBanner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#arenaBanner .b { font-family: 'Chakra Petch'; font-weight: 700; font-size: 42px; letter-spacing: .06em; color: #fff; }
#arenaBanner .s { font-size: 14px; text-transform: uppercase; letter-spacing: .12em; color: #e9ecef; }
#arenaBanner.big .b { font-size: 72px; }
#arenaBanner.good .b { color: #ffd23d; } #arenaBanner.bad .b { color: var(--bad); }
#arenaEnd { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); min-width: 380px; padding: 22px 28px; text-align: center; z-index: 8; }
#arenaDeath { position: fixed; left: 50%; bottom: 7vh; transform: translateX(-50%); width: min(760px, 92vw); padding: 14px 18px; z-index: 8; }
#arenaDeath .bps { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
#arenaEnd h2 { font-family: 'Chakra Petch'; font-size: 40px; margin: 0; letter-spacing: .06em; }
#arenaEnd .why { color: var(--dim); text-transform: uppercase; letter-spacing: .12em; margin-bottom: 14px; }
#arenaEnd table { width: 100%; border-collapse: collapse; font-size: 17px; text-align: left; }
#arenaEnd td { padding: 5px 8px; border-top: 1px solid var(--line); }
#arenaEnd td i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; }
#arenaEnd tr.me td { color: #ffd23d; }
#arenaEnd .acts { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }

/* ---------- garage hub (main menu) ---------- */
#menu { position: fixed; inset: 0; z-index: 12; display: block; padding: 0; background: linear-gradient(180deg, rgba(8,9,12,.55), transparent 22%, transparent 70%, rgba(8,9,12,.55)); pointer-events: none; }
#menu > * { pointer-events: auto; }
.hub-top { position: absolute; top: 0; left: 0; right: 0; height: 58px; display: flex; align-items: center; gap: 24px; padding: 0 18px; background: linear-gradient(180deg, rgba(10,12,15,.92), rgba(10,12,15,.55)); border-bottom: 1px solid var(--line); }
.hub-me { display: flex; align-items: center; gap: 10px; min-width: 250px; }
.hub-me img { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; background: rgba(0,0,0,.4); border: 1px solid var(--line); }
.hub-me b { font-family: 'Chakra Petch'; font-size: 22px; color: var(--accent); }
.hub-me i { display: inline-block; width: 110px; height: 4px; background: rgba(255,255,255,.12); vertical-align: middle; margin: 0 6px; }
.hub-me i em { display: block; height: 100%; background: var(--accent); }
.hub-me small { color: var(--dim); } .hub-me .nm { font-weight: 700; font-size: 16px; }
.hub-nav { display: flex; gap: 4px; margin: 0 auto; }
.hub-nav button { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; font-family: 'Chakra Petch'; font-size: 16px; color: #d6dbe0; padding: 16px 14px 14px; }
.hub-nav button.on { color: var(--accent); border-bottom-color: var(--accent); }
.hub-nav button:disabled { opacity: .35; cursor: default; }
.hub-tr { display: flex; align-items: center; gap: 8px; }
.hub-prof { display: flex; align-items: center; gap: 10px; text-align: left; padding: 4px 12px 4px 4px; background: rgba(20,24,30,.8); }
.hub-prof img { width: 54px; height: 42px; object-fit: contain; background: rgba(0,0,0,.35); border-radius: 4px; }
.hub-prof .nm { font-weight: 700; } .hub-prof small { color: var(--dim); }
.hub-play { position: absolute; top: 76px; left: 50%; transform: translateX(-50%); display: flex; align-items: flex-start; gap: 0; filter: drop-shadow(0 6px 18px rgba(0,0,0,.5)); }
.hp-side, .hp-battle { font-family: 'Chakra Petch'; font-weight: 700; letter-spacing: .1em; color: #fff; border: 0; border-radius: 0; background: linear-gradient(180deg, #ff8a2a, #c8561a); }
.hp-side { padding: 12px 34px; font-size: 16px; white-space: nowrap; clip-path: polygon(8% 0, 100% 0, 92% 100%, 0 100%); margin-top: 8px; }
.hp-side:hover, .hp-battle:hover { background: linear-gradient(180deg, #ffa24a, #d9661f); }
.hp-side kbd { font-size: 12px; background: rgba(0,0,0,.35); border-radius: 3px; padding: 1px 6px; margin: 0 4px; }
.hp-mid { display: flex; flex-direction: column; align-items: center; margin: 0 -10px; z-index: 1; }
.hp-battle { font-size: 30px; padding: 14px 70px; clip-path: polygon(6% 0, 94% 0, 100% 100%, 0 100%); }
.hp-mode { margin-top: -1px; min-width: 190px; font-size: 15px; background: rgba(20,40,60,.9); border: 1px solid rgba(89,210,255,.35); border-top: 0; border-radius: 0 0 8px 8px; color: #dff4ff; }
.hub-modes { position: absolute; top: 162px; left: 50%; transform: translateX(-50%); width: min(720px, calc(100vw - 580px), 92vw); min-width: 420px; padding: 10px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-height: none; overflow: visible; z-index: 30; }
/* compact mode cards: all fit without a scroll bar (live modes first, the planned ones smaller and dimmed) */
.hub-modes .mcard { padding: 10px 12px; border-radius: 8px; }
.hub-modes .mcard h4 { font-size: 15px; margin-bottom: 3px; }
.hub-modes .mcard p { font-size: 12px; line-height: 1.3; }
.hub-modes .mcard.locked { padding: 7px 10px; } .hub-modes .mcard.locked h4 { font-size: 12.5px; } .hub-modes .mcard.locked p { font-size: 11px; }
.hub-social { position: absolute; left: 16px; top: 84px; width: 250px; max-height: calc(100vh - 170px); overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.hwin { padding: 0; overflow: hidden; }
.hwin-h { display: flex; align-items: center; gap: 10px; width: 100%; background: transparent; border: 0; border-radius: 0; padding: 10px 12px; font-size: 16px; text-align: left; color: #e9ecef; }
.hwin-h:hover { background: rgba(255,255,255,.05); }
.hwin-h span { width: 20px; text-align: center; } .hwin-h small { color: var(--dim); font-size: 13px; } .hwin-h em { margin-left: auto; font-style: normal; color: var(--dim); }
.hwin.open .hwin-h { color: var(--accent-2); border-bottom: 1px solid var(--line); }
.hwin-b { padding: 6px 8px 8px; } .hwin-b p { margin: 4px 6px; font-size: 13px; }
.hub-social h3 { margin: 12px 0 6px; }
.sp-tabs { display: flex; gap: 4px; } .sp-tabs button { flex: 1; font-size: 13px; } .sp-tabs button.on { border-color: var(--accent); color: #fff; }
.sp { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 4px; cursor: context-menu; font-weight: 600; }
.sp:hover { background: rgba(255,255,255,.06); } .sp.me span { color: var(--accent-2); }
.sp i { width: 9px; height: 9px; border-radius: 50%; } .sp b { color: #ffd23d; font-size: 12px; } .sp small { margin-left: auto; color: var(--dim); font-size: 12px; }
.hub-side { position: absolute; right: 16px; bottom: 70px; width: 340px; max-height: calc(100vh - 230px); overflow: auto; padding: 0; }
.hs-tabs { display: flex; border-bottom: 1px solid var(--line); } .hs-tabs button { flex: 1; background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px; color: var(--dim); }
.hs-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.hs-body { padding: 10px 12px; } .hs-body h3 { margin: 4px 0 8px; } .hs-body h4 { margin: 10px 0 4px; font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; }
.hw { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: context-menu; }
.hw img { width: 40px; height: 40px; object-fit: contain; border-radius: 50%; background: rgba(0,0,0,.35); border: 1px solid var(--line); }
.hw b { display: block; } .hw small { color: var(--dim); } .hw kbd { margin-left: auto; font-family: 'Chakra Petch'; background: rgba(255,255,255,.1); border-radius: 4px; padding: 3px 8px; }
.hw.cap kbd { background: var(--accent); color: #111; } .hw.dimrow { opacity: .5; }
.sws { display: flex; flex-wrap: wrap; gap: 5px; }
.sw { width: 44px; height: 44px; padding: 2px; border-radius: 6px; } .sw img { width: 100%; height: 100%; object-fit: contain; }
.sw.col { width: 26px; height: 26px; border-radius: 50%; } .sw.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.hub-icons { position: absolute; right: 16px; bottom: 20px; width: 340px; display: flex; gap: 4px; }
.hub-icons button { width: 46px; height: 40px; font-size: 18px; } .hub-icons button.wide { flex: 1; font-size: 16px; font-family: 'Chakra Petch'; }
.hub-icons button.on { border-color: var(--accent); color: var(--accent); }
.hub-fav { position: absolute; left: 16px; bottom: 20px; font-family: 'Chakra Petch'; font-size: 16px; color: #fff; border: 0; padding: 10px 30px; background: linear-gradient(180deg, #ff8a2a, #c8561a); clip-path: polygon(6% 0, 94% 0, 100% 100%, 0 100%); }
.hub-chair { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); font-family: 'Chakra Petch'; color: #dfe4ea; background: rgba(10,12,15,.6); padding: 4px 16px; border-radius: 14px; }
#ctxMenu { position: fixed; z-index: 45; min-width: 170px; background: rgba(16,18,22,.97); border: 1px solid var(--line); border-radius: 6px; padding: 4px; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
#ctxMenu .ttl { padding: 5px 10px; color: var(--accent-2); font-weight: 700; border-bottom: 1px solid var(--line); margin-bottom: 3px; }
#ctxMenu button { display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: 7px 10px; }
#ctxMenu button:hover { background: rgba(255,122,26,.18); }
.prof { display: flex; gap: 18px; } .prof-l { width: 240px; text-align: center; } .prof-l img { width: 100%; background: rgba(0,0,0,.3); border-radius: 8px; }
.prof-r { flex: 1; } .prof-r h2 { margin: 0 0 10px; font-family: 'Chakra Petch'; } .prof-r h2 small { color: var(--accent); font-size: 16px; }
.prof-r h2 input { font: inherit; width: 220px; }
.prof-st { display: grid; grid-template-columns: auto auto auto auto; gap: 4px 14px; margin-bottom: 10px; } .prof-st span { color: var(--dim); } .prof-st b { font-family: 'Chakra Petch'; }
.hs-body .prof-st { grid-template-columns: auto auto; }
.prof-bps { display: flex; flex-wrap: wrap; gap: 8px; } .prof-bps div { width: 96px; text-align: center; } .prof-bps img { width: 96px; height: 72px; object-fit: contain; background: rgba(0,0,0,.3); border-radius: 6px; } .prof-bps small { color: var(--dim); }
/* chat: Enter opens, Tab switches channel */
#chat { position: fixed; left: 16px; bottom: 76px; z-index: 20; width: 420px; }
#chat.closed .ch-box { display: none; } #chat.open .ch-hint { display: none; }
body:not(.range) #chat { bottom: 76px; } body.range #chat { bottom: 200px; }
#menu.hidden ~ #chat, body:not(.range) #menu.hidden ~ #chat { }
.ch-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #cfd5db; background: rgba(10,12,15,.6); padding: 3px 10px; border-radius: 4px; cursor: pointer; }
.ch-hint kbd { font-family: 'Chakra Petch'; font-size: 11px; background: rgba(255,255,255,.12); border-radius: 3px; padding: 0 5px; }
.ch-box { padding: 0; overflow: hidden; background: rgba(12,16,22,.42) !important; backdrop-filter: blur(3px); }
.ch-list { text-shadow: 0 1px 2px rgba(0,0,0,.8); }
#chat.battle .ch-tabs { display: none; }
.ch-glob { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; font-size: 11px; color: var(--dim); cursor: pointer; }
#keyLegend { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 6; display: flex; gap: 12px; padding: 4px 12px; font-size: 11px; color: var(--dim); background: rgba(10,12,15,.55); border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; white-space: nowrap; }
#keyLegend kbd { font-family: 'Chakra Petch'; font-size: 10px; color: #fff; background: rgba(255,255,255,.1); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; margin-right: 4px; }
#keyLegend.hidden { display: none; }
.ch-tabs { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--line); padding: 4px; }
.ch-tabs button { background: transparent; border: 0; padding: 5px 10px; color: var(--dim); } .ch-tabs button.on { color: var(--accent); }
.ch-tabs small { margin-left: auto; color: var(--dim); font-size: 11px; padding-right: 6px; }
.ch-list { height: 190px; overflow: auto; padding: 6px 10px; font-size: 14px; }
.ch-list div { margin: 2px 0; color: #9be38f; } .ch-list div b { color: #b6f0a8; } .ch-list .mine { color: #ffd9a8; } .ch-list .mine b { color: #ffb35c; } .ch-list .sys { color: var(--dim); font-style: italic; }
.ch-dms { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; } .ch-dms button { font-size: 12px; padding: 2px 8px; } .ch-dms button.on { border-color: var(--accent); }
.ch-in { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--line); padding: 6px 8px; } .ch-in span { color: var(--accent-2); font-weight: 700; } .ch-in input { flex: 1; }

/* weapon slots */
.slots { margin-left: auto; display: flex; gap: 3px; }
.slot { width: 26px; height: 26px; padding: 0; font-family: 'Chakra Petch'; font-size: 13px; }
.slot.on { background: var(--accent); color: #111; border-color: var(--accent); }
.sks { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin-bottom: 8px; }
.sk { display: flex; align-items: center; justify-content: space-between; font-size: 13px; padding: 3px 4px; border-radius: 4px; cursor: context-menu; }
.sk:hover { background: rgba(255,255,255,.05); } .sk kbd { font-family: 'Chakra Petch'; background: rgba(255,255,255,.1); border-radius: 4px; padding: 1px 7px; }
.sk.cap kbd { background: var(--accent); color: #111; }
.hub-ready { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(660px, 92vw); max-height: 90vh; overflow-y: auto; padding: 18px 20px; z-index: 3; }
.hub-ready h2 { margin: 0 0 12px; font-family: 'Chakra Petch'; } .hub-ready h3 { margin: 14px 0 2px; }
.hub-ready .hs-body { padding: 8px 0; }
.hub-ready .mode-picks { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.hub-ready .mode-picks .bp { display: block; width: 100%; min-width: 0; text-align: left; font: inherit; color: var(--text); }
.hub-ready .mode-picks img { display: block; width: 100%; height: 88px; margin-bottom: 6px; object-fit: contain; }
.hub-ready .mode-picks .n, .hub-ready .mode-picks .d { display: block; white-space: normal; }
.hub-side .bp.static { cursor: default; }
.hub-side .bps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.hub-side .bp { display: block; width: 100%; min-width: 0; padding: 5px; text-align: left; font: inherit; color: var(--text); }
.hub-side .bp img { display: block; width: 100%; height: 70px; margin-bottom: 4px; object-fit: contain; }
.hub-side .bp .n, .hub-side .bp .d { display: block; font-size: 12px; }
.hub-side .bp .d { color: var(--dim); font-size: 11px; }
.hub-side .bp:not(.static):hover { border-color: #4db6e8; }
.hub-side .bp.on { border-color: #4db6e8; box-shadow: 0 0 0 1px #4db6e8 inset; }
.hub-side .bp-new { display: flex !important; flex-direction: column; align-items: center; justify-content: center; min-height: 100px; border-style: dashed; }
.hub-side .bp-new .plus { font-size: 34px; line-height: 1; color: #4db6e8; margin-bottom: 4px; }
.svName { display: flex; gap: 8px; align-items: center; margin: 10px 0; } .svName input { flex: 1; }
@media (max-width: 700px) { .hub-ready .mode-picks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .hub-ready .mode-picks { grid-template-columns: 1fr; } .hub-ready .mode-picks .bp { display: flex; } .hub-ready .mode-picks img { width: 58px; height: 58px; margin: 0; } }
.hub-ready .acts { display: flex; justify-content: flex-end; gap: 8px; }

/* softer hub look (older style, same layout) */
.hub-top { background: linear-gradient(180deg, rgba(10,12,15,.7), transparent); border-bottom: 0; }
.hub-play { gap: 10px; align-items: center; filter: none; }
.hp-mid { margin: 0; }
.hp-side, .hp-battle, .hub-fav { clip-path: none; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.hp-side { margin-top: 0; padding: 10px 22px; font-size: 15px; color: var(--text); background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(8px); }
.hp-side:hover { background: var(--panel-2); border-color: rgba(255,122,26,.5); }
.hp-battle { padding: 12px 56px; font-size: 26px; background: linear-gradient(180deg, #ff8a2a, #e0651c); }
.hp-mode { margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); }
.hub-fav { background: var(--panel); border: 1px solid var(--line); color: var(--accent-2); padding: 9px 20px; backdrop-filter: blur(8px); }
.hub-fav:hover { background: var(--panel-2); }
.hub-prof { border-radius: 8px; background: var(--panel); }
.hub-icons button { border-radius: 8px; }
.hs-tabs button.on, .hwin.open .hwin-h { border-bottom-color: rgba(255,122,26,.6); }

/* hub layout: grid so panels never overlap at any size */
#menu:not(.hidden) { display: grid; gap: 10px 16px; padding: 0 16px 16px; align-items: stretch; justify-items: stretch;
  grid-template-columns: clamp(190px, 18vw, 260px) minmax(0, 1fr) clamp(250px, 24vw, 340px);
  grid-template-rows: auto minmax(0, 1fr) 28px auto;
  grid-template-areas: "top top top" "soc mid side" "chat mid side" "fav chr ico"; }
#menu > .hub-top, #menu > .hub-play, #menu > .hub-social, #menu > .hub-side, #menu > .hub-icons, #menu > .hub-fav, #menu > .hub-chair { position: relative; inset: auto; transform: none; width: auto; max-height: none; }
.hub-top { grid-area: top; margin: 0 -16px; height: 58px; }
.hub-play { grid-area: mid; align-self: start; justify-self: center; flex-wrap: nowrap; justify-content: center; margin-top: 8px; }
.hub-social { grid-area: soc; align-self: start; min-height: 0; max-height: 100% !important; overflow: auto; }
.hub-side { grid-area: side; align-self: end; min-height: 0; max-height: 100% !important; overflow: auto; }
.hub-icons { grid-area: ico; }
.hub-fav { grid-area: fav; justify-self: start; align-self: center; }
.hub-chair { grid-area: chr; justify-self: center; align-self: center; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-modes { top: 150px; z-index: 5; }
.hub-me { min-width: 0; }
body:not(.range) #chat { bottom: 66px; width: min(420px, calc(100vw - 32px)); }
@media (max-width: 1100px) { .hp-battle { padding: 10px 34px; font-size: 22px; } .hp-side { padding: 8px 14px; } .hub-me i { width: 60px; } }
@media (max-width: 820px) { .hp-side kbd, .hub-prof div, .hub-me small { display: none; } .hub-chair { font-size: 12px; } }
@media (max-height: 620px) { .ch-list { height: 120px; } }

/* hub colour scheme: cool steel-blue, orange kept only for BATTLE */
#menu, #chat, #ctxMenu, #hubReady { --accent: #4db6e8; --accent-2: #9ad7f2; --panel: rgba(14,20,28,.84); --panel-2: rgba(28,38,50,.92); --line: rgba(150,200,255,.12); }
#menu button:hover, #chat button:hover { background: #22303e; border-color: rgba(77,182,232,.5); }
#ctxMenu button:hover { background: rgba(77,182,232,.18); }
#menu { background: linear-gradient(180deg, rgba(6,10,16,.5), transparent 22%, transparent 70%, rgba(6,10,16,.55)); }
.hub-top { background: linear-gradient(180deg, rgba(8,12,18,.75), transparent); }
.hp-battle { color: #fff; }
.hub-me img, .hub-prof img { border-color: var(--line); }
.hp-side, .hub-fav, .hp-mode, .hub-icons button.wide { white-space: nowrap; }
.hub-icons { justify-self: stretch; }
@media (max-width: 1000px) { .hub-fav { font-size: 13px; padding: 8px 12px; } .hp-side { font-size: 13px; padding: 7px 10px; } .hp-battle { padding: 9px 22px; font-size: 20px; } .hub-play { gap: 6px; } }
@media (max-width: 1000px) { .hub-play { flex-wrap: wrap; max-width: 100%; } .hp-mid { order: -1; flex-basis: 100%; } }
.hp-battle { background: linear-gradient(180deg, #3aa8dc, #1f6f9e); border: 1px solid rgba(154,215,242,.35); }
.hp-battle:hover { background: linear-gradient(180deg, #52b9e8, #2780b3); }
.logo span { color: #4db6e8; text-shadow: 0 0 14px rgba(77,182,232,.55); }
#overlay.eject .big { color: #4db6e8; }
.hw .hw-n { flex: 1; min-width: 0; } .hw .hw-n b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slotSel { font: inherit; font-size: 13px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; cursor: pointer; }
.hw kbd.sk { margin-left: 0; min-width: 62px; text-align: center; cursor: context-menu; }
.hw kbd.sk.cap { background: var(--accent); color: #111; }
.slotFoot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.hs-body .hw { gap: 8px; } .hs-body .hw img { width: 32px; height: 32px; }
.hw .hw-n b { font-size: 14px; } .hw .hw-n small { font-size: 11px; }
.slotSel { max-width: 108px; padding: 3px 4px; } .hw kbd.sk { min-width: 46px; padding: 3px 6px; }
.hw .hw-n b { white-space: normal; line-height: 1.1; }
.nameEd { display: inline-flex; align-items: center; gap: 6px; color: var(--dim); font-size: 18px; } .nameEd input { border-color: rgba(150,200,255,.25); }
.hs-body .hw { flex-wrap: wrap; } .hs-body .hw .hw-n { min-width: 90px; }
body:has(#menu:not(.hidden)) #modal, body:has(#menu:not(.hidden)) #toast { --accent: #4db6e8; --accent-2: #9ad7f2; --line: rgba(150,200,255,.12); }

/* start screen */
#loading { overflow: hidden; background: radial-gradient(ellipse at 50% 42%, #14243a 0%, #0a111c 45%, #05080d 100%); transition: opacity .7s; }
#loading.out { opacity: 0; pointer-events: none; }
.ld-grid { position: absolute; left: -50%; right: -50%; bottom: 0; height: 75%; transform: perspective(500px) rotateX(58deg); transform-origin: 50% 100%;
  background-image: linear-gradient(rgba(77,182,232,.3) 1px, transparent 1px), linear-gradient(90deg, rgba(77,182,232,.3) 1px, transparent 1px); background-size: 60px 60px;
  animation: ldGrid 3s linear infinite; mask-image: linear-gradient(to top, #000 10%, transparent 90%); -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 90%); }
@keyframes ldGrid { to { background-position: 0 60px; } }
.ld-wheel { position: absolute; top: 50%; left: 50%; width: min(62vh, 80vw); height: min(62vh, 80vw); margin: calc(min(62vh, 80vw) / -2) 0 0 calc(min(62vh, 80vw) / -2); color: #4db6e8; opacity: .07; animation: ldSpin 14s linear infinite; filter: drop-shadow(0 0 20px rgba(77,182,232,.8)); }
#loading.ready .ld-wheel { opacity: .12; animation-duration: 6s; }
@keyframes ldSpin { to { transform: rotate(360deg); } }
.ld-main { position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px; }
#loading .logo.big { font-size: clamp(44px, 9vw, 92px); text-shadow: 0 6px 30px rgba(0,0,0,.6); animation: ldIn .9s ease-out both; }
.ld-tag { font-family: 'Chakra Petch'; letter-spacing: .35em; text-transform: uppercase; color: #9ad7f2; font-size: clamp(11px, 1.6vw, 15px); opacity: .8; animation: ldIn .9s .2s ease-out both; }
@keyframes ldIn { from { opacity: 0; transform: translateY(12px); } }
.ld-bar { width: min(340px, 70vw); height: 3px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; margin-top: 18px; }
.ld-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #1f6f9e, #4db6e8); box-shadow: 0 0 10px #4db6e8; transition: width .4s ease-out; }
#loading .sub { font-size: 12px; letter-spacing: .15em; text-transform: uppercase; }
#loading.ready .ld-bar, #loading.ready .sub { display: none; }
#ldStart { margin-top: 22px; font-family: 'Chakra Petch'; font-size: 18px; letter-spacing: .3em; padding: 12px 34px; color: #dff4ff; background: rgba(14,20,28,.6); border: 1px solid rgba(77,182,232,.45); border-radius: 8px; animation: ldPulse 1.6s ease-in-out infinite; }
#ldStart:hover { background: rgba(31,111,158,.5); border-color: #4db6e8; }
@keyframes ldPulse { 50% { box-shadow: 0 0 24px rgba(77,182,232,.45); color: #fff; } }
.ld-foot { position: absolute; bottom: 14px; right: 18px; font-size: 12px; color: rgba(154,215,242,.35); letter-spacing: .1em; }

/* cinematic intro (1960s newsreel) */
body.intro > :not(canvas):not(#intro) { visibility: hidden !important; }
#intro { position: fixed; inset: 0; z-index: 60; pointer-events: none; transition: opacity .7s; font-family: Georgia, 'Times New Roman', serif; color: #f3e6c8; }
#intro.out { opacity: 0; }
.in-bars i { position: absolute; left: 0; right: 0; height: 11vh; background: #000; } .in-bars i:first-child { top: 0; } .in-bars i:last-child { bottom: 0; }
.in-leader { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle, #8a7a60 0%, #3d3325 70%, #15110b 100%); }
.in-leader::before, .in-leader::after { content: ''; position: absolute; width: 46vh; height: 46vh; border-radius: 50%; border: 3px solid rgba(20,15,10,.7); }
.in-leader::after { width: 38vh; height: 38vh; border-width: 2px; }
.in-leader i { position: absolute; width: 46vh; height: 46vh; border-radius: 50%; }
.in-leader b { position: relative; font-size: 30vh; font-weight: 400; color: #1a140c; line-height: 1; }
.in-cap { position: absolute; left: 0; right: 0; bottom: 14vh; text-align: center; font-style: italic; font-size: clamp(18px, 2.6vw, 32px); letter-spacing: .04em; text-shadow: 0 2px 8px #000, 0 0 2px #000; opacity: 0; }
.in-card { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; opacity: 0; background: radial-gradient(circle, rgba(40,32,22,.2), #0b0906 75%); }
.in-card .logo.big { font-size: clamp(48px, 10vw, 110px); color: #f3e6c8; filter: sepia(.6) blur(.4px); text-shadow: 0 0 18px rgba(243,230,200,.35); }
.in-card .logo span { color: #d9c9a2; text-shadow: none; }
.in-sub { font-style: italic; font-size: clamp(16px, 2vw, 24px); letter-spacing: .12em; opacity: .85; }
.in-skip { position: absolute; right: 22px; bottom: calc(11vh + 12px); font-family: 'Rajdhani', sans-serif; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: rgba(243,230,200,.5); }
/* intro: modern steel-blue look (overrides the old newsreel styles) */
#intro { font-family: 'Chakra Petch', sans-serif; color: #dff4ff; }
.in-bars i { height: 10vh; }
.in-count { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22vh; font-weight: 700; color: #4db6e8; text-shadow: 0 0 40px rgba(77,182,232,.5); background: radial-gradient(ellipse at 50% 45%, #14243a 0%, #0a111c 45%, #05080d 100%); }
.in-card { background: radial-gradient(ellipse at 50% 45%, #14243a 0%, #0a111c 45%, #05080d 100%); }
.in-card .logo.big { color: #fff; filter: none; text-shadow: 0 6px 30px rgba(0,0,0,.6); }
.in-card .logo span { color: #4db6e8; text-shadow: 0 0 14px rgba(77,182,232,.55); }
.in-skip { font-family: 'Rajdhani', sans-serif; color: rgba(154,215,242,.5); bottom: calc(10vh + 12px); }
.in-count { background: #0b1320; }
#introVid { position: fixed; inset: 0; z-index: 60; background: #000; }
#introVid video { width: 100%; height: 100%; object-fit: contain; display: block; }
#introVid .in-skip { position: absolute; right: 22px; bottom: calc(10vh + 12px); font-family: 'Rajdhani', sans-serif; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: rgba(154,215,242,.5); }
#introVid { opacity: 0; transition: opacity .6s ease; background: transparent; pointer-events: none; }
#introVid.on { opacity: 1; background: #000; }
/* while the intro is up the start screen only shows the logo (no loading text) */
body:has(#introVid) #loading .ld-bar, body:has(#introVid) #loading .sub { visibility: hidden; }
/* grid floor scrolls with a transform (runs smoothly even while the engine loads) */
.ld-grid { animation: ldGrid2 3s linear infinite; }
@keyframes ldGrid2 { from { transform: perspective(500px) rotateX(58deg) translateY(0); } to { transform: perspective(500px) rotateX(58deg) translateY(60px); } }
.ld-wheel { filter: none; will-change: transform; }

/* online: login card, online badge, invites, admin */
.login { width: min(420px, 86vw); display: flex; flex-direction: column; gap: 10px; }
.login h2 { margin: 0; font-family: 'Chakra Petch'; } .login p { margin: 0; }
.login label { display: flex; flex-direction: column; gap: 4px; color: var(--dim); font-size: 13px; }
.login input { font-size: 16px; padding: 8px 10px; }
.login .bad { color: var(--bad); } .login .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.hub-net { font-size: 13px; color: var(--dim); letter-spacing: .05em; } .hub-net.on { color: #6fe3a4; } .hub-net small { color: var(--dim); margin-left: 4px; }
.invCard { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 46; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; --accent: #4db6e8; }
.invCard .acts { display: flex; gap: 8px; justify-content: flex-end; }
.adm { width: min(640px, 90vw); } .adm table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.adm td { padding: 4px 6px; border-bottom: 1px solid var(--line); } .adm td:last-child { text-align: right; white-space: nowrap; } .adm td button { margin-left: 4px; padding: 3px 8px; }
.adm label { display: flex; align-items: center; gap: 8px; margin: 6px 0; } .adm label input:not([type=checkbox]) { flex: 1; }
.prof-net { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 10px; }
.rdBots { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; } .rdBots small { color: var(--dim); }
.rdRound { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; } .rdRound span { margin-right: 6px; } .rdRound button { padding: 4px 12px; border-radius: 6px; border: 1px solid rgba(120,160,200,.3); background: rgba(20,30,44,.8); color: var(--dim); cursor: pointer; } .rdRound button.on { background: #2f6fa8; color: #fff; border-color: #4db6e8; }
.login { text-align: left; } .hub-net { cursor: pointer; }

/* weapon bar (bottom edge, Crossout-style): groups by key, ring = reload / charge, part HP; chair HP below */
#hudWeapon { display: none; }
.speedo { left: auto; right: 250px; transform: none; bottom: 16px; }
#wbar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.wb-row { display: flex; gap: 22px; align-items: flex-end; }
.wb-grp { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.wb-key { height: 24px; display: flex; align-items: center; gap: 2px; color: #fff; }
.wb-key .wb-cap { font-family: 'Chakra Petch'; font-size: 13px; font-weight: 700; min-width: 22px; height: 22px; padding: 0 5px; display: grid; place-items: center; background: rgba(240,244,248,.92); color: #0b1016; border-radius: 4px; }
.wb-mouse { width: 22px; height: 22px; fill: rgba(240,244,248,.92); stroke: #0b1016; stroke-width: 1.2; }
.wb-mouse .lit { fill: #4db6e8; stroke: none; }
.wb-key small { font: 700 10px 'Chakra Petch'; }
.wb-icons { display: flex; gap: 8px; }
.wb-w { --p: 1; --c: #4db6e8; width: 54px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.wb-ic { width: 50px; height: 50px; border-radius: 50%; padding: 3px; background: conic-gradient(var(--c) calc(var(--p) * 1turn), rgba(255,255,255,.14) 0); box-shadow: 0 2px 10px rgba(0,0,0,.5); }
.wb-ic > div { width: 100%; height: 100%; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #1b2430, #0c1118); display: grid; place-items: center; }
.wb-ic svg { width: 27px; height: 27px; fill: none; stroke: #f2f5f8; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.wb-ic { position: relative; }
.wb-n { position: absolute; right: -4px; top: -4px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: #3a9fd0; color: #fff; font: 700 11px/16px 'Chakra Petch'; font-style: normal; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.6); }
.wb-n:empty { display: none; }
.wb-w.reload { --c: #8d96a0; } .wb-w.reload svg { opacity: .55; }
.wb-w.charging { --c: #ffb020; } .wb-w.active { --c: #6fe3a4; }
.wb-w.blocked { --c: #ff4040; } .wb-w.blocked svg { stroke: #ff8080; }
.wb-w.dead { filter: grayscale(1); opacity: .35; }
.wb-hp { font: 700 13px 'Chakra Petch'; color: #fff; text-shadow: 0 1px 3px #000; min-height: 16px; }
.wb-life { display: flex; align-items: center; gap: 10px; padding: 5px 14px; background: rgba(10,14,20,.78); border-radius: 6px; }
.wb-life svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 1.8; }
.wb-life b { font: 700 16px 'Chakra Petch'; color: #fff; min-width: 44px; }
.wb-life i { display: block; width: 180px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; }
.wb-life em { display: block; height: 100%; width: 100%; background: #f2f5f8; transition: width .2s; }
.speedo { left: auto; right: 18px; bottom: 14px; text-align: right; }   /* bottom right – the chat is bottom left */
#hudKeys { display: none; }   /* no controls box in the game (Settings has them) */
.speedo .spdbar { margin-left: auto; }
@media (max-width: 1150px) { .hud-br { display: none; } }
/* chair / blueprint cards: the text column may shrink, long names wrap onto a second line inside the card */
.bp > div, .bp > span, .bp .bpi { flex: 1 1 auto; min-width: 0; }
.bp .n, .bp .d { white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }
/* seat + dummy HP above the total (weapon bar) */
.wb-sub { display: flex; align-items: center; gap: 6px; padding: 3px 12px; margin-bottom: 4px; background: rgba(10,14,20,.6); border-radius: 6px; font: 600 11px 'Chakra Petch'; color: #aeb8c4; letter-spacing: .04em; text-transform: uppercase; }
.wb-sub i { display: block; width: 80px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; }
.wb-sub em { display: block; height: 100%; width: 100%; transition: width .2s; }
.wb-sub .wb-base { background: #ff9a3d; } .wb-sub .wb-dummy { background: #ff5a5a; }
.wb-sub b { color: #fff; font-weight: 700; min-width: 26px; margin-right: 8px; }

#arenaEnd .endPickH { margin: 14px 0 6px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
#arenaEnd .bps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; max-height: none; }

/* pause menu (Esc in a level) */
#pauseMenu { position: fixed; inset: 0; z-index: 25; display: flex; align-items: center; justify-content: center; background: rgba(4,8,14,.45); backdrop-filter: blur(3px); }
#pauseMenu .pm { display: flex; flex-direction: column; gap: 8px; width: 260px; padding: 18px; text-align: center; }
#pauseMenu h2 { margin: 0 0 6px; }
#pauseMenu button { padding: 10px; font-size: 15px; }
#pauseMenu button.primary { background: #2f9bd6; border-color: #4db6e8; color: #fff; font-weight: 700; }

/* group lobby: who is ready */
.sp .rdy { font-style: normal; font-size: 12px; color: var(--dim); margin-left: 4px; } .sp .rdy.on { color: #3dd68c; font-weight: 700; }
.hp-battle .hp-rdy { display: block; font-size: 12px; letter-spacing: .04em; opacity: .85; margin-top: -2px; }

.hp-mode:disabled { opacity: .6; cursor: default; }
