:root {
  --bg: #0b0e14;
  --panel: rgba(14, 18, 27, 0.86);
  --panel-solid: #121722;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #e8ecf3;
  --muted: #8a93a6;
  --accent: #37f0c8;
  --accent-2: #ff7a3d;
  --danger: #ff4f6d;
  --warn: #ffd04a;
  --hud-font: 'Chakra Petch', 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(--text); font-family: var(--hud-font); font-size: 15px; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h2 { margin: 0; font-size: 26px; letter-spacing: .04em; text-transform: uppercase; }
h3 { margin: 26px 0 10px; font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 4px; background: rgba(255,255,255,.06); }

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#speedlines { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%); }

.screen { position: fixed; inset: 0; display: flex; z-index: 10; }

/* ---------- buttons & inputs ---------- */
.btn { background: rgba(255,255,255,.06); border: 1px solid var(--line-strong); padding: 8px 16px; border-radius: 6px; cursor: pointer; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; font-size: 13px; transition: background .12s, border-color .12s, transform .08s; white-space: nowrap; }
.btn:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #05221b; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { border-color: rgba(255,79,109,.5); color: #ffb3c0; }
.btn.big { padding: 12px 20px; font-size: 15px; width: 100%; }
.btn.small { padding: 4px 10px; font-size: 11px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; text-decoration: underline; padding: 0; font-size: 13px; }
input, select { background: rgba(0,0,0,.35); border: 1px solid var(--line-strong); border-radius: 6px; padding: 8px 10px; outline: none; min-width: 0; }
input:focus, select:focus { border-color: var(--accent); }
select option { background: var(--panel-solid); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; }

/* ---------- auth ---------- */
#scr-auth { align-items: center; justify-content: center; background: radial-gradient(ellipse at 30% 20%, rgba(55,240,200,.12), transparent 50%), linear-gradient(180deg, rgba(5,7,12,.3), rgba(5,7,12,.85)); padding: 16px; }
.auth-card { width: 400px; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 30px; backdrop-filter: blur(12px); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.logo { font-size: 44px; font-weight: 700; letter-spacing: .1em; font-style: italic; line-height: 1; }
.logo span { color: var(--accent); }
.logo.small { font-size: 26px; }
.tagline { color: var(--muted); margin-top: -6px; }
.tabs { display: flex; gap: 4px; background: rgba(0,0,0,.3); padding: 4px; border-radius: 8px; }
.tab { flex: 1; background: none; border: 0; padding: 8px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tab.active { background: rgba(255,255,255,.1); color: var(--text); }
#auth-form { display: flex; flex-direction: column; gap: 12px; }
.err { color: var(--danger); min-height: 18px; font-size: 13px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.guest-row { display: flex; gap: 8px; }
.guest-row input { flex: 1; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ---------- menu ---------- */
#scr-menu { background: linear-gradient(90deg, rgba(5,7,12,.92) 0%, rgba(5,7,12,.7) 45%, rgba(5,7,12,.25) 100%); }
.side { width: 260px; padding: 28px 22px; display: flex; flex-direction: column; gap: 26px; border-right: 1px solid var(--line); background: rgba(5,7,12,.55); backdrop-filter: blur(8px); }
#menu-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
#menu-nav button { text-align: left; background: none; border: 0; border-left: 3px solid transparent; padding: 11px 14px; font-size: 16px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); cursor: pointer; transition: all .12s; }
#menu-nav button:hover { color: var(--text); background: rgba(255,255,255,.04); }
#menu-nav button.active { color: var(--text); border-left-color: var(--accent); background: linear-gradient(90deg, rgba(55,240,200,.14), transparent); }
.whoami { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); }
.whoami #who-name { color: var(--text); font-weight: 600; }
.panels { flex: 1; overflow-y: auto; padding: 34px 40px; max-width: 1100px; }
.panel header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.row { display: flex; gap: 8px; }

.rooms { display: flex; flex-direction: column; gap: 6px; }
.room { display: grid; grid-template-columns: 1fr 160px 110px 70px 100px; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.room .name { font-weight: 600; font-size: 16px; }
.room .mode { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; background: rgba(255,122,61,.15); color: var(--accent-2); justify-self: start; }
.room .mode.race { background: rgba(55,240,200,.12); color: var(--accent); }
.empty { padding: 26px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 8px; }
.create-room { display: grid; grid-template-columns: 1fr 1fr 160px auto auto; gap: 12px; align-items: end; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }

.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.map-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.map-card .thumb { height: 120px; position: relative; display: block; width: 100%; }
.map-card .thumb .badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; }
.badge { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; background: rgba(0,0,0,.65); color: var(--text); }
.badge.ffa { color: var(--accent-2); } .badge.race { color: var(--accent); } .badge.draft { color: var(--warn); } .badge.official { color: #9fb4ff; }
.map-card .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.map-card .title { font-weight: 700; font-size: 17px; }
.map-card .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.map-card .desc { font-size: 13px; color: #b9c0cf; line-height: 1.4; flex: 1; }
.map-card .actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px 14px; }

.builds { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.build, .weapon { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; cursor: pointer; transition: border-color .12s, transform .1s; text-align: left; }
.build:hover, .weapon:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.build.sel, .weapon.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.build .bname { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.build .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.build .stats { display: flex; gap: 12px; margin: 8px 0; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.build p, .weapon p { margin: 0; font-size: 13px; color: #b9c0cf; line-height: 1.4; }
.weapons { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.weapon .wname { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.weapon .wstats { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.weapon .slot { float: right; font-size: 10px; letter-spacing: .1em; color: var(--accent); }

.howto { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.howto table { width: 100%; border-collapse: collapse; font-size: 14px; }
.howto td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.howto td:first-child { white-space: nowrap; color: var(--accent); font-family: var(--mono); font-size: 12px; }
.howto .card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.howto .card h3 { margin-top: 0; }
.howto p { color: #b9c0cf; line-height: 1.5; font-size: 14px; }

.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; max-width: 800px; }
.setting { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.setting .top { display: flex; justify-content: space-between; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.setting .top span:last-child { font-family: var(--mono); color: var(--accent); }
.setting input[type=range] { width: 100%; accent-color: var(--accent); padding: 0; border: 0; background: none; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.stat .v { font-size: 28px; font-weight: 700; font-family: var(--mono); }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; font-family: var(--hud-font); text-shadow: 0 1px 3px rgba(0,0,0,.6); }
#hud .pause-card, #hud #pause, #hud #end-screen, #hud #chat-input, #hud #click-to-play { pointer-events: auto; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
#crosshair i { position: absolute; background: rgba(255,255,255,.92); box-shadow: 0 0 2px rgba(0,0,0,.8); transition: transform .05s; }
#crosshair i:nth-child(1), #crosshair i:nth-child(2) { width: 2px; height: 8px; left: -1px; }
#crosshair i:nth-child(3), #crosshair i:nth-child(4) { width: 8px; height: 2px; top: -1px; }
#crosshair i:nth-child(1) { top: calc(-8px - var(--gap, 5px)); } #crosshair i:nth-child(2) { top: var(--gap, 5px); }
#crosshair i:nth-child(3) { left: calc(-8px - var(--gap, 5px)); } #crosshair i:nth-child(4) { left: var(--gap, 5px); }
#crosshair b { position: absolute; width: 2px; height: 2px; left: -1px; top: -1px; background: #fff; }
#hitmarker { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px; opacity: 0; background:
  linear-gradient(45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%) , linear-gradient(-45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%);
  -webkit-mask: radial-gradient(circle, transparent 5px, #000 6px); mask: radial-gradient(circle, transparent 5px, #000 6px); }
#hitmarker.show { animation: hm .25s ease-out; }
#hitmarker.hs { filter: drop-shadow(0 0 2px #ffd04a) sepia(1) saturate(6) hue-rotate(5deg); }
#hitmarker.kill { filter: sepia(1) saturate(8) hue-rotate(-30deg); width: 34px; height: 34px; margin: -17px; }
@keyframes hm { from { opacity: 1; transform: scale(1.3); } to { opacity: 0; transform: scale(1); } }
#dmg-dir { position: absolute; inset: 0; }
#dmg-dir .arc { position: absolute; left: 50%; top: 50%; width: 220px; height: 220px; margin: -110px; border-radius: 50%; border-top: 6px solid rgba(255,60,80,.85); animation: fade 1s forwards; }
@keyframes fade { to { opacity: 0; } }

#top-bar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 18px; align-items: center; background: rgba(5,7,12,.55); padding: 6px 18px; border-radius: 6px; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
#hud-timer { font-family: var(--mono); font-size: 18px; font-weight: 700; }
#race-timer { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); text-align: center; }
#race-time { font-family: var(--mono); font-size: 40px; font-weight: 700; letter-spacing: .02em; }
#race-time.pb { color: var(--accent); }
#race-sub { font-size: 14px; color: var(--muted); letter-spacing: .08em; }

#killfeed { position: absolute; top: 14px; right: 16px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.kf { background: rgba(5,7,12,.6); padding: 4px 10px; border-radius: 4px; font-size: 14px; animation: kfin .2s ease-out; }
.kf .w { color: var(--muted); margin: 0 6px; font-size: 12px; }
.kf .me { color: var(--accent); }
.kf .hs { color: var(--warn); }
@keyframes kfin { from { transform: translateX(20px); opacity: 0; } }

#trick-feed { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tf { font-size: 22px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-style: italic; animation: tfin 1.1s ease-out forwards; white-space: nowrap; }
.tf small { font-size: 14px; color: var(--accent); margin-left: 8px; font-style: normal; }
.tf.rep { opacity: .55; font-size: 17px; }
@keyframes tfin { 0% { transform: translateY(10px) scale(1.25); opacity: 0; } 12% { transform: translateY(0) scale(1); opacity: 1; } 75% { opacity: 1; } 100% { transform: translateY(-26px); opacity: 0; } }

#combo { position: absolute; left: 28px; top: 34%; min-width: 220px; transition: opacity .25s, transform .25s; }
#combo.hidden { opacity: 0; transform: translateX(-12px); }
#combo.banked #combo-score { color: var(--warn); }
#combo-score { font-family: var(--mono); font-size: 34px; font-weight: 700; line-height: 1; }
#combo-mult { font-size: 20px; font-weight: 700; color: var(--accent); font-style: italic; }
#combo-chain { font-size: 13px; color: #c9d0dd; max-width: 300px; line-height: 1.5; margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }
#combo-bar { height: 3px; background: rgba(255,255,255,.15); margin-top: 6px; width: 200px; }
#combo-bar i { display: block; height: 100%; background: var(--accent); width: 100%; }

#speedo { position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%); text-align: center; width: 260px; }
#speed-num { font-family: var(--mono); font-size: 52px; font-weight: 700; line-height: 1; display: inline-block; transition: color .2s; }
#speed-unit { display: inline-block; font-size: 14px; color: var(--muted); margin-left: 4px; }
#speed-kmh { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 2px; }
#speed-bar { position: relative; height: 6px; background: rgba(255,255,255,.12); margin-top: 8px; border-radius: 3px; overflow: hidden; }
#speed-fill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #37f0c8, #ffd04a 60%, #ff4f6d); width: 0; }
#speed-cap { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #fff; left: 20%; }
#flow-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 11px; letter-spacing: .12em; color: var(--muted); }
#flow-bar { flex: 1; height: 4px; background: rgba(255,255,255,.1); border-radius: 2px; }
#flow-bar i { display: block; height: 100%; width: 0; background: var(--accent-2); border-radius: 2px; }
#move-state { margin-top: 6px; font-size: 12px; letter-spacing: .2em; color: var(--accent); }

#vitals { position: absolute; left: 24px; bottom: 26px; width: 280px; }
#build-name { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
#hp-bar { position: relative; height: 22px; background: rgba(0,0,0,.45); border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden; }
#hp-fill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #e8ecf3, #ffffff); width: 100%; transition: width .15s; }
#hp-fill.low { background: var(--danger); }
#shield-fill { position: absolute; left: 0; top: 0; height: 5px; background: #6fb8ff; width: 0; }
#hp-num { position: absolute; right: 8px; top: 0; line-height: 22px; font-family: var(--mono); font-weight: 700; color: #111; text-shadow: none; mix-blend-mode: difference; filter: invert(1); }
#ability { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
#ability-cd { flex: 1; height: 4px; background: rgba(255,255,255,.12); border-radius: 2px; }
#ability-cd i { display: block; height: 100%; background: var(--accent); width: 100%; border-radius: 2px; }
#ability.ready #ability-name { color: var(--accent); }
#airjumps { display: flex; gap: 4px; margin-top: 8px; }
#airjumps i { width: 22px; height: 5px; background: var(--accent); border-radius: 2px; }
#airjumps i.used { background: rgba(255,255,255,.15); }

#weapon-box { position: absolute; right: 26px; bottom: 26px; text-align: right; }
#ammo { font-family: var(--mono); font-weight: 700; }
#ammo-cur { font-size: 46px; }
#ammo-max { font-size: 18px; color: var(--muted); }
#ammo.low #ammo-cur { color: var(--danger); }
#weapon-name { font-size: 15px; letter-spacing: .1em; text-transform: uppercase; }
#weapon-slots { display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px; }
#weapon-slots span { font-size: 11px; padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: 3px; color: var(--muted); }
#weapon-slots span.on { color: var(--text); border-color: var(--accent); }

#chat { position: absolute; left: 24px; bottom: 150px; width: 360px; }
#chat-log { display: flex; flex-direction: column; gap: 2px; font-size: 13px; max-height: 160px; overflow: hidden; justify-content: flex-end; }
#chat-log div { background: rgba(5,7,12,.45); padding: 2px 8px; border-radius: 3px; align-self: flex-start; animation: chatfade 10s forwards; }
#chat-log div.sys { color: var(--muted); font-style: italic; }
#chat-log b { color: var(--accent); }
#chat.open #chat-log div { animation: none; opacity: 1; }
@keyframes chatfade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
#chat-input { width: 100%; margin-top: 4px; }

#center-msg { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); font-size: 26px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; text-align: center; transition: opacity .3s; }

#scoreboard { position: absolute; left: 50%; top: 14%; transform: translateX(-50%); width: 640px; max-width: 94vw; background: rgba(8,11,18,.9); border: 1px solid var(--line); border-radius: 10px; padding: 18px 22px; }
#scoreboard table, #end-screen table { width: 100%; border-collapse: collapse; font-size: 15px; }
#scoreboard th, #end-screen th { text-align: left; font-size: 11px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; padding: 6px; border-bottom: 1px solid var(--line); }
#scoreboard td, #end-screen td { padding: 7px 6px; border-bottom: 1px solid var(--line); font-family: var(--mono); }
#scoreboard td:first-child, #end-screen td:first-child { font-family: var(--hud-font); font-weight: 600; }
#scoreboard tr.me td, #end-screen tr.me td { color: var(--accent); }
#scoreboard h3 { margin: 0 0 10px; }

#death { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); text-align: center; background: rgba(8,11,18,.75); padding: 22px 40px; border-radius: 10px; border: 1px solid rgba(255,79,109,.35); }
#death h2 { color: var(--danger); font-size: 34px; }
#death-by { margin: 8px 0; font-size: 17px; }
#death-timer { font-family: var(--mono); font-size: 18px; margin-bottom: 8px; }

#pause, #click-to-play { position: absolute; inset: 0; background: rgba(5,7,12,.6); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
#click-to-play { cursor: pointer; font-size: 26px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; background: rgba(5,7,12,.35); }
.pause-card { width: 320px; display: flex; flex-direction: column; gap: 10px; background: var(--panel); padding: 26px; border-radius: 12px; border: 1px solid var(--line); }
.pause-card h2 { margin-bottom: 8px; }
.pause-sub { font-size: 12px; color: var(--muted); text-align: center; }
#pause .panel-pop { width: min(900px, 94vw); max-height: 86vh; overflow-y: auto; background: var(--panel-solid); padding: 24px; border-radius: 12px; border: 1px solid var(--line); }
#end-screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(5,7,12,.7); }
#end-screen .card { width: 560px; max-width: 94vw; background: var(--panel-solid); padding: 26px; border-radius: 12px; border: 1px solid var(--line); text-align: center; }
#end-screen .card h2 { font-size: 34px; margin-bottom: 4px; }

/* ---------- editor ---------- */
#editor { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
#editor > * { pointer-events: auto; }
#ed-top { position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 8px; align-items: center; padding: 10px 14px; background: rgba(8,11,18,.88); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
#ed-top .spacer { flex: 1; }
#ed-name { width: 240px; font-weight: 600; }
#ed-palette { position: absolute; top: 62px; left: 12px; width: 200px; bottom: 54px; overflow-y: auto; background: rgba(8,11,18,.88); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
#ed-palette h4 { margin: 10px 4px 6px; font-size: 11px; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
#ed-palette h4:first-child { margin-top: 0; }
.pal-btn { display: flex; width: 100%; align-items: center; gap: 8px; padding: 7px 8px; background: none; border: 1px solid transparent; border-radius: 6px; cursor: pointer; text-align: left; font-size: 14px; }
.pal-btn:hover { background: rgba(255,255,255,.06); }
.pal-btn.sel { border-color: var(--accent); background: rgba(55,240,200,.1); }
.pal-btn .sw { width: 14px; height: 14px; border-radius: 3px; flex: none; }
.pal-btn kbd { margin-left: auto; }
.tools { display: flex; gap: 4px; }
.tools .pal-btn { justify-content: center; }
#ed-props { position: absolute; top: 62px; right: 12px; width: 230px; background: rgba(8,11,18,.88); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
#ed-props h4 { margin: 0; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.prop { display: grid; grid-template-columns: 1fr 70px; align-items: center; gap: 8px; font-size: 13px; }
.prop input { width: 70px; padding: 5px 8px; }
.colors { display: flex; flex-wrap: wrap; gap: 5px; }
.colors button { width: 22px; height: 22px; border-radius: 4px; border: 2px solid transparent; cursor: pointer; padding: 0; }
.colors button.sel { border-color: #fff; }
#ed-help { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background: rgba(8,11,18,.85); border: 1px solid var(--line); border-radius: 8px; padding: 7px 14px; font-size: 12px; color: var(--muted); white-space: nowrap; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; }
#ed-help b { color: var(--text); }
#ed-layer { position: absolute; bottom: 54px; right: 12px; background: rgba(8,11,18,.88); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; font-size: 14px; }
#ed-layer b { font-family: var(--mono); color: var(--accent); font-size: 18px; }
#ed-modal { position: absolute; inset: 0; background: rgba(5,7,12,.65); display: flex; align-items: center; justify-content: center; }
#ed-modal .card { width: 440px; max-width: 94vw; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 12px; padding: 22px; display: flex; flex-direction: column; gap: 12px; }
#ed-modal textarea { background: rgba(0,0,0,.35); border: 1px solid var(--line-strong); border-radius: 6px; padding: 8px 10px; color: var(--text); font: inherit; min-height: 70px; resize: vertical; }
#ed-modal .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#ed-modal .errs { color: var(--warn); font-size: 13px; }

/* ---------- misc ---------- */
#toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--panel-solid); border: 1px solid var(--line-strong); padding: 9px 16px; border-radius: 8px; font-size: 14px; animation: toast 3.2s forwards; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.toast.err { border-color: rgba(255,79,109,.6); }
.toast.ok { border-color: rgba(55,240,200,.6); }
@keyframes toast { 0% { opacity: 0; transform: translateY(-8px); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }
#loading { position: fixed; inset: 0; z-index: 60; background: rgba(5,7,12,.82); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.spinner { width: 38px; height: 38px; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  #scr-menu { flex-direction: column; }
  .side { width: 100%; flex-direction: row; flex-wrap: wrap; padding: 12px 16px; gap: 10px; align-items: center; }
  #menu-nav { flex-direction: row; flex-wrap: wrap; }
  #menu-nav button { padding: 6px 10px; font-size: 12px; border-left: 0; border-bottom: 2px solid transparent; }
  #menu-nav button.active { border-bottom-color: var(--accent); }
  .panels { padding: 16px; }
  .room { grid-template-columns: 1fr auto; }
  .room > :nth-child(2), .room > :nth-child(3) { display: none; }
  .create-room { grid-template-columns: 1fr; }
  .howto { grid-template-columns: 1fr; }
}
#weapon-name .wmult { font-family: var(--mono); color: var(--muted); letter-spacing: 0; margin-left: 6px; }
#weapon-name .wmult small { font-size: 10px; letter-spacing: .08em; }
#weapon-name .wmult.hot { color: var(--accent); }
#weapon-name .wmult.max { color: #fff; text-shadow: 0 0 8px var(--accent); }
/* spear: enemy within reach */
#crosshair.hot i, #crosshair.hot b { background: #fff27a; box-shadow: 0 0 6px #fff27a; }
/* Stormcoil lock rings + target marker */
#rings i { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 50%; border: 1px solid rgba(90,184,255,.28); box-shadow: 0 0 4px rgba(0,0,0,.5); transition: border-color .08s; }
#rings i.z0 { border-color: rgba(190,230,255,.4); }
#rings i.on { border: 2px solid #9fd8ff; box-shadow: 0 0 10px rgba(90,184,255,.8); }
#rings i.z0.on { border-color: #fff; box-shadow: 0 0 14px #5ab8ff; }
#lock-mark { position: absolute; left: 0; top: 0; width: 0; height: 0; --charge: 0; }
#lock-mark i { position: absolute; width: 18px; height: 18px; left: -11px; top: -11px; border: 2px solid #9fd8ff; transform: rotate(45deg) scale(calc(1.25 - var(--charge) * .45)); box-shadow: 0 0 calc(4px + var(--charge) * 14px) #5ab8ff; }
#lock-mark.z0 i { border-color: #fff; }
#lock-mark.z2 i { border-color: rgba(159,216,255,.55); }
#lock-mark span { position: absolute; left: 16px; top: 4px; font: 700 12px var(--mono); color: #9fd8ff; white-space: nowrap; opacity: calc(.45 + var(--charge) * .55); }
#lock-mark.max span { color: #fff; text-shadow: 0 0 6px #5ab8ff; }
/* grenade slot */
#nade-box { margin-top: 6px; display: flex; gap: 6px; align-items: center; justify-content: flex-end; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
#nade-box kbd { font: 700 10px var(--mono); border: 1px solid var(--line-strong); border-radius: 3px; padding: 0 4px; color: var(--muted); }
#nade-box i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(255,255,255,.5); background: linear-gradient(to top, rgba(255,255,255,.35) var(--fill, 0%), transparent var(--fill, 0%)); }
#nade-box i.full { background: #fff; box-shadow: 0 0 5px rgba(255,255,255,.6); }
/* stasis bullet time */
#slowmo { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 45%, rgba(110,90,255,.35) 100%); box-shadow: inset 0 0 120px rgba(143,123,255,.45); animation: slowpulse 1.4s ease-in-out infinite alternate; }
@keyframes slowpulse { from { opacity: .7; } to { opacity: 1; } }
/* Lancer Rail scope */
#scope { position: absolute; inset: 0; background: radial-gradient(circle at center, transparent 0 40vmin, rgba(0,0,0,.6) 40.3vmin, rgba(0,0,0,.94) 41vmin); }
#scope .lens { position: absolute; left: 50%; top: 50%; width: 80vmin; height: 80vmin; transform: translate(-50%, -50%); border-radius: 50%; box-shadow: inset 0 0 6vmin rgba(40,10,70,.55); }
#scope .lens i { position: absolute; background: rgba(0,0,0,.85); }
#scope .lens i.h { left: 0; right: 0; top: 50%; height: 1px; margin-top: -.5px; }
#scope .lens i.v { top: 0; bottom: 0; left: 50%; width: 1px; margin-left: -.5px; }
#scope .lens b { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: #ff3b6b; box-shadow: 0 0 4px #ff3b6b; }
/* ability charge (Skyburst) */
#ability.charging #ability-cd i { background: #9fe8ff; }
#ability.full #ability-name { color: #9fe8ff; text-shadow: 0 0 8px #9fe8ff; }
/* anchored / EMP / overdrive */
#fx-anchor { position: absolute; inset: 0; box-shadow: inset 0 0 0 6px rgba(208,228,255,.5), inset 0 0 160px rgba(208,228,255,.35); animation: slowpulse .5s ease-in-out infinite alternate; }
#fx-emp { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(102,224,255,.05) 0 2px, transparent 2px 5px); box-shadow: inset 0 0 120px rgba(102,224,255,.3); }
#weapon-box.od #weapon-name { color: #ffb13b; text-shadow: 0 0 8px #ff7a3d; }
/* sonar markers */
#sonar div { position: absolute; left: 0; top: 0; width: 0; height: 0; font: 700 11px var(--mono); color: #ff6b7f; }
#sonar div::before { content: ''; position: absolute; left: -9px; top: -9px; width: 14px; height: 14px; border: 2px solid #ff6b7f; border-radius: 50%; box-shadow: 0 0 8px #ff4f6d; }
#sonar div { text-indent: 12px; line-height: 24px; white-space: nowrap; }
