:root {
  --bg: rgba(14, 17, 21, 0.86); --bg2: rgba(24, 28, 34, 0.92); --line: rgba(255, 255, 255, 0.09);
  --tx: #e7eaee; --mut: #8b95a1; --acc: #7cc4ff; --good: #5fd38d; --bad: #ff6b5e; --warn: #f2c14e;
  --P: #ff8a3d; --E: #3dd6ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0d10; color: var(--tx); font: 13px/1.35 "Segoe UI", Inter, system-ui, sans-serif; }
canvas#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.muted { color: var(--mut); }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; z-index: 50;
  background: radial-gradient(ellipse at 50% 120%, #26384a 0%, #0d1117 60%, #07090c 100%); }
.brand { font-size: 34px; font-weight: 800; letter-spacing: 0.22em; }
.brand span { color: var(--acc); font-weight: 300; }
.sub { color: var(--mut); letter-spacing: 0.04em; }
.bar { width: 340px; height: 3px; background: rgba(255,255,255,0.08); }
.bar div { height: 100%; width: 0; background: var(--acc); transition: width .2s; }
.login-card { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 36px 44px; background: var(--bg); border: 1px solid var(--line); }
.profiles { display: flex; gap: 14px; margin-top: 8px; }
.profile { width: 150px; height: 150px; border: 1px solid var(--line); background: var(--bg2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; transition: border-color .15s, transform .15s; }
.profile:hover { transform: translateY(-2px); }
.profile .pl { font-size: 64px; font-weight: 800; line-height: 1; }
.profile[data-who="P"] .pl { color: var(--P); } .profile[data-who="E"] .pl { color: var(--E); }
.profile.sel[data-who="P"] { border-color: var(--P); } .profile.sel[data-who="E"] { border-color: var(--E); }
.profile .pn { color: var(--mut); font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; }
#loginForm { display: flex; flex-direction: column; gap: 8px; width: 314px; }
#loginForm label { color: var(--mut); font-size: 12px; }
input { font: inherit; color: var(--tx); background: #0c0f13; border: 1px solid var(--line); padding: 9px 10px; outline: none; border-radius: 0; }
input:focus { border-color: var(--acc); }
.primary { background: var(--acc); color: #071018; font-weight: 700; padding: 10px; letter-spacing: 0.05em; }
.err { color: var(--bad); min-height: 18px; font-size: 12px; }

#top { position: fixed; top: 0; left: 0; right: 0; height: 52px; display: flex; align-items: center; gap: 18px; padding: 0 12px; background: var(--bg); border-bottom: 1px solid var(--line); z-index: 10; backdrop-filter: blur(6px); }
.cityname { width: 170px; font-weight: 700; font-size: 15px; background: transparent; border: 1px solid transparent; padding: 5px 6px; letter-spacing: 0.02em; }
.cityname:hover { border-color: var(--line); }
.stat, .grp { display: flex; flex-direction: column; justify-content: center; min-width: 56px; }
.stat label, .grp label, .ph { color: var(--mut); font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; }
.stat b { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat small { font-size: 10px; font-variant-numeric: tabular-nums; }
.rci .bars { display: flex; gap: 3px; height: 22px; align-items: center; }
.rci .bars i { display: block; width: 9px; height: 22px; background: rgba(255,255,255,0.06); position: relative; }
.rci .bars i::after { content: ""; position: absolute; left: 0; right: 0; bottom: 50%; height: var(--h, 0%); background: var(--c); }
.rci .bars i.neg::after { bottom: auto; top: 50%; }
#dR { --c: #2fbf5b; } #dC { --c: #2f8cff; } #dI { --c: #f2b01e; }
.seg { display: flex; align-items: center; border: 1px solid var(--line); }
.seg button, .seg span { padding: 3px 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
.seg button:hover { background: rgba(255,255,255,0.06); }
.seg button.on { background: var(--acc); color: #071018; font-weight: 700; }
.seg.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.chip { border: 1px solid var(--line); padding: 5px 10px; font-size: 12px; }
.chip:hover { background: rgba(255,255,255,0.06); }
.players { display: flex; gap: 6px; }
.pchip { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; font-weight: 800; border: 1px solid var(--line); opacity: 0.35; }
.pchip.on { opacity: 1; }
.pchip.me { outline: 1px solid currentColor; outline-offset: 2px; }

#tools { position: fixed; top: 64px; left: 10px; width: 172px; background: var(--bg); border: 1px solid var(--line); z-index: 10; padding: 4px 0; max-height: calc(100vh - 80px); overflow-y: auto; }
#tools .gh { color: var(--mut); font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; padding: 6px 10px 2px; }
#tools button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 3px 10px; text-align: left; font-size: 12.5px; border-left: 2px solid transparent; }
#tools button:hover { background: rgba(255,255,255,0.05); }
#tools button.on { background: rgba(124,196,255,0.12); border-left-color: var(--acc); }
#tools .sw { width: 10px; height: 10px; flex: none; }
#tools .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tools .k { color: var(--mut); font-size: 10px; border: 1px solid var(--line); padding: 0 4px; }
#tools .c { color: var(--mut); font-size: 10px; font-variant-numeric: tabular-nums; }

#side { position: fixed; top: 64px; right: 10px; width: 250px; display: flex; flex-direction: column; gap: 8px; z-index: 10; }
.panel { background: var(--bg); border: 1px solid var(--line); padding: 8px 10px; }
.panel .ph { margin-bottom: 6px; }
#infoBody table { width: 100%; border-collapse: collapse; }
#infoBody td { padding: 2px 0; } #infoBody td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
#infoBody .title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.meter { display: inline-block; width: 70px; height: 5px; background: rgba(255,255,255,0.08); vertical-align: middle; margin-left: 6px; }
.meter i { display: block; height: 100%; }

#chat { position: fixed; left: 192px; bottom: 10px; width: 360px; z-index: 10; display: flex; flex-direction: column; }
#msgs { height: 96px; overflow-y: auto; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
#msgs .sys { color: var(--mut); font-style: italic; }
#msgs b.P { color: var(--P); } #msgs b.E { color: var(--E); }
#chatIn { padding: 6px 8px; }

#help { position: fixed; right: 10px; bottom: 10px; z-index: 10; font-size: 11.5px; color: var(--mut); max-width: 440px; }
#help b { color: var(--tx); }
#tip { position: fixed; z-index: 20; pointer-events: none; background: var(--bg2); border: 1px solid var(--line); padding: 4px 8px; font-size: 12px; white-space: nowrap; }
#tip .bad { color: var(--bad); }
#toast { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 30; background: #3a1512; border: 1px solid #7a2a24; padding: 8px 14px; }
#conn { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 30; background: var(--bg2); border: 1px solid var(--warn); color: var(--warn); padding: 6px 12px; }
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.plabel { position: absolute; transform: translate(-50%, -130%); font-weight: 800; font-size: 12px; padding: 2px 7px; color: #071018; white-space: nowrap; }
