:root {
  color-scheme: dark;
  --bg: #0f0f11;
  --surface: #151519;
  --surface-2: #1a191f;
  --surface-3: #201d23;
  --line: #302b32;
  --line-strong: #443744;
  --text: #f1edf1;
  --muted: #918890;
  --accent: #ff91b9;
  --accent-soft: rgba(255, 145, 185, .12);
  --cyan: #7bddd9;
  --red: #ff667f;
  --amber: #eab467;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; background: var(--bg); color: var(--text); }
body { font-size: 14px; letter-spacing: 0; overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 750; }
.brand b { color: var(--accent); font-weight: 650; }
.brand-mark, .radar-mark { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: #281820; }
.brand-mark svg { width: 22px; height: 22px; stroke-width: 1.8; }
.radar-mark { position: relative; border: 0; }
.radar-mark::before, .radar-mark::after { content: ""; position: absolute; background: currentColor; opacity: .42; }
.radar-mark::before { width: 1px; height: 68%; }
.radar-mark::after { width: 68%; height: 1px; }
.radar-mark i { width: 8px; height: 8px; border: 2px solid currentColor; border-radius: 50%; }
.eyebrow { color: var(--accent); font: 10px ui-monospace, Consolas, monospace; letter-spacing: 1.8px; }
.eyebrow.muted { color: #8f7b88; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr); }
.login-visual { position: relative; min-height: 680px; overflow: hidden; padding: 42px 7%; border-right: 1px solid var(--line); background: #141316; }
.login-visual > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: grayscale(.45) contrast(1.12); opacity: .24; }
.visual-shade { position: absolute; inset: 0; background: linear-gradient(135deg, rgba(16, 15, 18, .38), rgba(30, 20, 28, .86)); }
.brand-on-map { position: relative; z-index: 1; }
.visual-copy { position: absolute; z-index: 1; left: 7%; top: 37%; }
.visual-copy h1 { margin-top: 18px; font-size: clamp(40px, 5vw, 70px); line-height: 1.08; font-weight: 650; }
.visual-copy p { color: #aa9fa8; margin-top: 20px; font-size: 14px; }
.visual-status { position: absolute; z-index: 1; left: 7%; bottom: 40px; display: flex; align-items: center; gap: 9px; color: #a18f9b; font: 10px ui-monospace, monospace; }
.visual-status i, .status-list i, .topbar-status i, .waiting-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 12px currentColor; }
.login-panel { position: relative; min-height: 680px; display: grid; place-items: center; padding: 64px 10%; background: #111113; }
.login-form { width: min(350px, 100%); }
.login-form h2 { margin-top: 20px; font-size: 30px; font-weight: 600; }
.login-form > p { color: var(--muted); margin-top: 12px; line-height: 1.75; }
.login-form label { display: block; margin: 36px 0 10px; color: #c0b8bd; font-size: 12px; }
.login-form input { width: 100%; height: 54px; border: 1px solid #3b333b; border-radius: 7px; background: #18171b; color: var(--text); padding: 0 15px; outline: none; }
.login-form input:focus { border-color: var(--accent); }
.primary { width: 100%; height: 50px; margin-top: 16px; border: 0; border-radius: 7px; background: var(--accent); color: #2b1922; font-weight: 750; transition: background .18s, transform .18s; }
.primary:hover { background: #ffacd0; transform: translateY(-1px); }
.form-error { margin-top: 14px; padding: 10px 12px; border-left: 2px solid var(--red); background: rgba(255, 102, 127, .08); color: #ffb5c1; font-size: 12px; }
.build-label { position: absolute; bottom: 28px; color: #685a64; font: 9px ui-monospace, monospace; letter-spacing: 2px; }

.radar-shell { position: fixed; inset: 0; overflow: hidden; background: var(--bg); }
.radar-stage { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; }
.stage-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.024) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.024) 1px, transparent 1px); background-size: 64px 64px; mask-image: radial-gradient(circle at center, #000 0, transparent 72%); }
.map-content { position: relative; z-index: 1; width: min(78vh, 76vw); aspect-ratio: 1; transform-origin: center; transition: transform .16s ease-out; }
.map-content > img, .map-content > canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-content > img { object-fit: fill; filter: saturate(.72) contrast(1.08) brightness(.83); opacity: .9; }
.map-content > canvas { z-index: 2; }
.map-empty { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(15, 15, 17, .7); }
.waiting-card { width: 320px; padding: 0 24px 22px; }
.waiting-card h1 { margin-bottom: 30px; color: var(--accent); font-size: 34px; font-weight: 750; letter-spacing: 0; text-align: center; }
.waiting-card > div { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #938a92; }
.waiting-card strong { color: #d8cfd5; font-size: 13px; font-weight: 500; }
.waiting-card > div:last-child strong { color: var(--accent); }
.waiting-state { display: flex; align-items: center; gap: 9px; }
.waiting-state i.online { background: var(--accent); }

.radar-header { position: absolute; top: 16px; left: 18px; right: 18px; z-index: 10; height: 54px; display: grid; grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr); align-items: center; gap: 16px; pointer-events: none; }
.radar-header > * { pointer-events: auto; }
.radar-header .brand { justify-self: start; }
.match-meta { justify-self: center; display: flex; align-items: center; gap: 12px; min-width: 0; padding: 9px 15px; border: 1px solid rgba(57, 50, 57, .72); border-radius: 7px; background: rgba(18, 17, 20, .82); backdrop-filter: blur(14px); }
.match-meta strong { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.match-meta span { color: var(--accent); font: 10px ui-monospace, monospace; }
.header-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.topbar-status { height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 13px; border: 1px solid rgba(57, 50, 57, .72); border-radius: 7px; background: rgba(18, 17, 20, .82); backdrop-filter: blur(14px); color: #a99fa6; font-size: 10px; white-space: nowrap; }
.topbar-status.live i { background: var(--accent); }
.hud-button { min-width: 36px; height: 36px; border: 1px solid rgba(57, 50, 57, .82); border-radius: 7px; background: rgba(22, 21, 24, .9); color: #b2a7ae; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 9px; }
.hud-button:hover, .hud-button[aria-expanded="true"] { color: var(--accent); border-color: #68485a; background: #241b22; }
.hud-button svg { width: 17px; height: 17px; }
.hud-button span { min-width: 14px; font: 10px ui-monospace, monospace; }

.room-hud { position: absolute; left: 18px; bottom: 18px; z-index: 9; width: 286px; padding: 18px; border: 1px solid rgba(57, 50, 57, .78); border-radius: 8px; background: rgba(20, 19, 22, .9); backdrop-filter: blur(16px); box-shadow: 0 18px 50px rgba(0,0,0,.24); }
.room-hud-head { display: flex; align-items: center; justify-content: space-between; color: #755f6e; font: 8px ui-monospace, monospace; letter-spacing: 1.8px; }
.bare-icon { width: 28px; height: 28px; border: 0; background: transparent; color: #9d8e98; display: grid; place-items: center; padding: 0; }
.bare-icon:hover { color: var(--accent); }
.bare-icon svg { width: 16px; height: 16px; }
.room-code { display: block; margin-top: 7px; color: #f1e7ed; font: 15px ui-monospace, Consolas, monospace; letter-spacing: .7px; }
.room-expiry { display: block; margin-top: 7px; color: #776d74; font-size: 9px; }
.status-list { display: grid; gap: 9px; margin-top: 18px; padding: 14px 0; border-top: 1px solid #2e292f; border-bottom: 1px solid #2e292f; }
.status-list > div { display: flex; align-items: center; gap: 8px; color: #b7adb4; font-size: 10px; }
.status-list i.online { background: var(--accent); }
.endpoint { display: block; min-height: 28px; margin-top: 12px; color: #786f75; font: 9px/1.5 ui-monospace, monospace; overflow-wrap: anywhere; }
.room-hud-foot { display: grid; gap: 5px; margin-top: 8px; color: #776b74; font: 8px/1.5 ui-monospace, monospace; }
.logout-button { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 0; border: 0; background: transparent; color: #9b8995; font-size: 10px; }
.logout-button:hover { color: var(--text); }
.logout-button svg { width: 14px; height: 14px; }

.side-drawer { position: fixed; top: 0; right: 0; z-index: 30; width: min(340px, 92vw); height: 100vh; display: grid; border-left: 1px solid var(--line); background: rgba(17, 17, 20, .98); box-shadow: -18px 0 60px rgba(0,0,0,.32); transform: translateX(100%); transition: transform .24s ease-out; }
.side-drawer.open { transform: translateX(0); }
.drawer-head { min-height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin-top: 7px; font-size: 18px; font-weight: 600; }
.roster-panel { grid-template-rows: auto auto minmax(0, 1fr) auto; }
.team-legend { display: flex; align-items: center; gap: 17px; padding: 14px 22px; color: #7f747c; font-size: 9px; }
.team-legend span { display: flex; align-items: center; gap: 6px; }
.team-legend i { width: 6px; height: 6px; border-radius: 50%; }
.team-legend strong { margin-left: auto; min-width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; color: #c6bbc2; font: 10px ui-monospace, monospace; }
.team-a { background: var(--cyan); }
.team-b { background: var(--red); }
.roster-list { min-height: 0; overflow-y: auto; border-top: 1px solid #272329; }
.player-row { min-height: 60px; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 20px; border-bottom: 1px solid #272329; }
.player-row.stale, .player-row.dead { opacity: .42; }
.player-dot { width: 24px; height: 24px; border: 1px solid currentColor; border-radius: 50%; display: grid; place-items: center; color: var(--cyan); font: 8px ui-monospace, monospace; }
.player-row.team-b .player-dot { color: var(--red); }
.player-main { min-width: 0; }
.player-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.player-main span { display: block; color: #716870; font: 8px ui-monospace, monospace; margin-top: 4px; }
.health { color: #a99fa6; font: 10px ui-monospace, monospace; }
.health.low { color: var(--red); }
.empty-list { padding: 24px 22px; color: #6e656c; font-size: 10px; }
.roster-panel > footer { padding: 16px 22px; border-top: 1px solid var(--line); display: grid; gap: 9px; }
.roster-panel > footer div { display: flex; justify-content: space-between; color: #796f76; font-size: 9px; }
.roster-panel > footer strong { color: #c4b8c0; font: 9px ui-monospace, monospace; font-weight: 500; }

.settings-panel { grid-template-rows: auto auto auto 1fr; align-content: start; }
.settings-panel .drawer-head h2 { margin: 0; }
.setting-group { padding: 24px 22px; border-bottom: 1px solid var(--line); }
.setting-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; color: #b9afb5; font-size: 11px; }
.setting-label output { color: var(--accent); font: 10px ui-monospace, monospace; }
.zoom-control { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; align-items: center; gap: 10px; }
.zoom-control input { width: 100%; accent-color: var(--accent); }
.small-button { width: 34px; height: 34px; border: 1px solid #38323a; border-radius: 6px; background: #1b191e; color: #c3b8bf; font-size: 18px; }
.small-button:hover { color: var(--accent); border-color: #644657; }
.secondary-button { width: 100%; height: 36px; margin-top: 14px; border: 1px solid #3b323a; border-radius: 6px; background: #1d191e; color: #bbaeb7; font-size: 10px; }
.secondary-button:hover { border-color: #67495a; color: var(--accent); }
.setting-row { min-height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid var(--line); color: #b9afb5; font-size: 11px; }
.toggle { position: relative; width: 36px; height: 20px; }
.toggle input { position: absolute; opacity: 0; }
.toggle > span { position: absolute; inset: 0; border-radius: 10px; background: #25222a; }
.toggle > span::after { content: ""; position: absolute; width: 11px; height: 11px; left: 5px; top: 4.5px; border-radius: 50%; background: #5d5660; transition: transform .16s, background .16s; }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(15px); background: #21151b; }

.toast { position: fixed; left: 50%; bottom: 22px; z-index: 50; max-width: 360px; transform: translateX(-50%); padding: 11px 16px; border: 1px solid #68485a; border-radius: 7px; background: rgba(39, 27, 36, .96); color: #f0dce8; box-shadow: 0 14px 36px rgba(0,0,0,.4); font-size: 11px; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { border-radius: 8px; background: #6c485d; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

@media (max-width: 800px) {
  .login-shell { grid-template-columns: 1fr; overflow-y: auto; }
  .login-visual { min-height: 300px; }
  .visual-copy { top: auto; bottom: 54px; left: 24px; }
  .visual-copy h1 { font-size: 36px; }
  .visual-status { display: none; }
  .login-panel { min-height: 500px; padding: 52px 24px; }
  .radar-header { top: 12px; left: 12px; right: 12px; grid-template-columns: 1fr auto; }
  .radar-header .brand { font-size: 0; gap: 0; }
  .radar-header .brand-mark { width: 34px; height: 34px; }
  .match-meta { position: absolute; top: 48px; left: 0; max-width: calc(100vw - 24px); }
  .topbar-status { padding: 0 10px; }
  .topbar-status span { display: none; }
  .map-content { width: min(92vw, 72vh); }
  .room-hud { left: 12px; right: 12px; bottom: 12px; width: auto; padding: 13px 15px; }
  .room-hud .room-expiry, .room-hud .endpoint, .room-hud .room-hud-foot { display: none; }
  .room-hud .status-list { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; padding: 10px 0 0; border-bottom: 0; }
  .room-hud .logout-button { position: absolute; top: 39px; right: 14px; width: 28px; height: 28px; margin: 0; display: grid; place-items: center; font-size: 0; }
  .room-hud .logout-button svg { width: 16px; height: 16px; }
  .waiting-card { width: min(320px, calc(100vw - 32px)); }
}

@media (max-width: 480px) {
  .header-actions { gap: 6px; }
  .hud-button { padding: 0 8px; }
  .match-meta { padding: 8px 11px; }
  .match-meta strong { max-width: 190px; }
  .waiting-card h1 { font-size: 30px; }
  .room-hud .status-list span { font-size: 9px; }
}
