:root {
  color-scheme: dark;
  --bg: #050709;
  --card: #0b1016;
  --card-2: #0f151d;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --ink: #eef1f4;
  --ink-2: #aab3bd;
  --mute: #737e8a;
  --grid: #18202a;
  --axis: #2a333e;
  --accent: #ee9035;
  --accent-ink: #ffb066;
  --accent-wash: rgba(238, 144, 53, 0.12);
  --battle: #d5751f;
  --queue: #3987e5;
  --menu: #199e70;
  --ru: #e66767;
  --us: #3987e5;
  --alpha: #9085e9;
  --bravo: #199e70;
  --draw: #4a5562;
  --other: #34404c;
  --low: #6d7f93;
  --good: #0ca30c;
  --warn: #fab219;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, select, input { font: inherit; color: inherit; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 20px 24px 48px; }
@media (max-width: 640px) { .wrap { padding: 12px 16px 40px; } }

/* header */
.top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.brand { display: flex; align-items: baseline; gap: 6px 10px; margin-right: auto; min-width: 0; flex-wrap: wrap; }
.brand b { font-size: 20px; letter-spacing: 0.14em; font-weight: 800; color: var(--accent); white-space: nowrap; }
.brand span { color: var(--ink-2); font-size: 14px; white-space: nowrap; }
.brand .chip { align-self: center; }
@media (max-width: 420px) { .brand b { font-size: 18px; letter-spacing: 0.1em; } }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--card-2);
  border: 1px solid var(--line); color: var(--ink-2); font-size: 12px; white-space: nowrap; }
.live { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgba(12, 163, 12, 0.18); }
.live.stale i { background: var(--warn); box-shadow: 0 0 0 3px rgba(250, 178, 25, 0.18); }
.nav { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.nav form { margin: 0; }
.nav button { background: none; border: 0; color: var(--mute); cursor: pointer; padding: 0; }
.nav button:hover { color: var(--ink); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 16px; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 7px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.04); }
.seg button[aria-pressed="true"] { background: var(--accent-wash); color: var(--accent-ink); font-weight: 600; }
.select { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; max-width: 100%; min-width: 0; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--ink-2); user-select: none; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }
.busy { color: var(--mute); font-size: 12px; }

/* grid */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.c12 { grid-column: span 12; } .c8 { grid-column: span 8; } .c6 { grid-column: span 6; } .c4 { grid-column: span 4; }
@media (max-width: 1000px) { .c8, .c4 { grid-column: span 12; } }
@media (max-width: 760px) { .c6 { grid-column: span 12; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card h2 { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 0 2px; letter-spacing: 0.02em; }
.card .sub { color: var(--mute); font-size: 12px; margin: 0 0 12px; }
.card h3 { font-size: 12px; font-weight: 600; color: var(--mute); margin: 14px 0 8px; text-transform: uppercase; letter-spacing: 0.06em; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpis.k5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1000px) { .kpis, .kpis.k5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpis, .kpis.k5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.kpi .l { color: var(--ink-2); font-size: 12px; }
.kpi .v { font-size: 28px; font-weight: 650; margin: 2px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v small { font-size: 14px; font-weight: 500; color: var(--ink-2); margin-left: 4px; }
.kpi .s { color: var(--mute); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.hero { grid-row: span 1; border-color: rgba(238, 144, 53, 0.35); background: linear-gradient(180deg, rgba(238, 144, 53, 0.09), var(--card) 70%); }
.kpi.hero .v { font-size: 48px; line-height: 1.05; color: var(--accent); }
@media (max-width: 560px) { .kpi.hero { grid-column: span 2; } .kpi.wide { grid-column: span 2; } .kpi .v { font-size: 24px; } .kpi.hero .v { font-size: 44px; } }
.states { display: flex; gap: 10px; flex-wrap: wrap; color: var(--ink-2); font-size: 12px; margin-top: 4px; }
.states span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--ink-2); font-size: 12px; margin: 0 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sw.ln { height: 2px; border-radius: 1px; width: 14px; }
.sw.dash { height: 0; width: 14px; border-top: 2px dashed var(--mute); border-radius: 0; }

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--mute); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .base { stroke: var(--axis); stroke-width: 1; }
.chart .cross { stroke: var(--line-2); stroke-width: 1; }
.empty { color: var(--mute); font-size: 13px; padding: 24px 0; text-align: center; }
.note { color: var(--mute); font-size: 12px; margin-top: 8px; }

/* tall segmented bar */
.segbar { display: flex; gap: 2px; height: 28px; margin: 4px 0 8px; }
.segbar div { border-radius: 4px; display: flex; align-items: center; padding: 0 8px; color: #fff; font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden; min-width: 0; font-variant-numeric: tabular-nums; }
.big2 { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 2px; }
.big2 div { display: flex; flex-direction: column; min-width: 0; }
.big2 div:last-child { text-align: right; }
.big2 b { font-size: 26px; font-weight: 650; }
.big2 span { color: var(--ink-2); font-size: 12px; }

/* horizontal bars */
.hb { display: grid; grid-template-columns: minmax(0, 38%) minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; }
.hb .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-size: 13px; }
.hb .bar { position: relative; height: 18px; display: flex; flex-direction: column; justify-content: center; gap: 2px; cursor: default; }
.hb .bar i { display: block; height: 12px; border-radius: 0 4px 4px 0; background: var(--accent); min-width: 2px; }
.hb .bar i.thin { height: 4px; border-radius: 2px; display: flex; gap: 2px; background: none; }
.hb .bar i.thin u { display: block; height: 4px; border-radius: 2px; }
.hb .val { color: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.hb .val b { color: var(--ink); font-weight: 600; }
.hb.div .bar { display: block; }
.hb.div .bar .mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--axis); }
.hb.div .bar i { position: absolute; top: 3px; height: 12px; }
@media (max-width: 560px) { .hb { grid-template-columns: minmax(0, 44%) minmax(0, 1fr) auto; } }

/* tables */
.tbl { width: 100%; overflow-x: auto; }
.tbl table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { color: var(--mute); font-weight: 500; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12px; }
.tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tr:last-child td { border-bottom: 0; }
.tag { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* tooltip */
.tip { position: fixed; z-index: 10; pointer-events: none; background: #141b24; border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px;
  font-size: 12px; color: var(--ink); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); max-width: 280px; opacity: 0; transition: opacity 0.08s; }
.tip.on { opacity: 1; }
.tip .t { color: var(--ink-2); margin-bottom: 4px; }
.tip .row { display: flex; align-items: center; gap: 8px; justify-content: space-between; white-space: nowrap; }
.tip .row span { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tip .row b { font-weight: 600; font-variant-numeric: tabular-nums; }

.foot { color: var(--mute); font-size: 12px; margin-top: 20px; line-height: 1.7; }
.err { background: rgba(208, 59, 59, 0.12); border: 1px solid rgba(208, 59, 59, 0.4); color: #ffb4b4; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login form { width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; }
.login h1 { margin: 0 0 4px; font-size: 18px; letter-spacing: 0.14em; color: var(--accent); }
.login p { color: var(--ink-2); margin: 0 0 18px; font-size: 13px; }
.login label { display: block; color: var(--ink-2); font-size: 12px; margin-bottom: 6px; }
.login input[type="password"] { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); outline: none; }
.login input[type="password"]:focus { border-color: var(--accent); }
.login button { margin-top: 14px; width: 100%; padding: 10px; border: 0; border-radius: 10px; background: var(--accent); color: #1a0f04; font-weight: 700; cursor: pointer; }
.login .login-msg { color: #ffb4b4; margin: 0 0 12px; }
.login .hint { color: var(--mute); font-size: 12px; margin: 14px 0 0; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.nav a.on { color: var(--ink); font-weight: 600; }
.lang { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.lang button { background: none; border: 0; padding: 4px 9px; font-size: 12px; font-weight: 600; color: var(--mute); cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--accent-wash); color: var(--accent-ink); }

.loader { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; pointer-events: none;
  opacity: 0; visibility: hidden; transition: opacity 0.15s, visibility 0.15s; }
.loader.on { opacity: 1; visibility: visible; }
.loader-box { display: flex; align-items: center; gap: 12px; background: #111821; border: 1px solid var(--line-2); border-radius: 14px;
  padding: 16px 22px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55); color: var(--ink); font-size: 14px; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(238, 144, 53, 0.25); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }
body.is-loading .wrap { opacity: 0.45; transition: opacity 0.2s; }

.btn { background: var(--card); border: 1px solid var(--line-2); border-radius: 10px; padding: 6px 12px; cursor: pointer; color: var(--ink); }
.btn:hover:not([disabled]) { border-color: var(--accent); }
.btn[disabled] { opacity: 0.4; cursor: default; }
.linkish { background: none; border: 0; color: var(--accent-ink); cursor: pointer; padding: 0; text-decoration: underline; }
.searchform { display: inline-flex; gap: 6px; min-width: 0; }
.search { width: 180px; max-width: 46vw; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; color: var(--ink-2); }
.tbl tr.link { cursor: pointer; }
.tbl tr.link:hover td, .tbl tr.link:focus td { background: rgba(255, 255, 255, 0.03); }
.tbl tr.link:focus { outline: none; }
.names { white-space: normal; font-size: 12px; }

.back { margin: 0 0 12px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 18px; margin: 4px 0 0; }
.facts dt { color: var(--mute); font-size: 12px; }
.facts dd { margin: 2px 0 0; font-weight: 600; }
.side-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.side-head b { font-size: 16px; }
.side-head .sum { margin-left: auto; color: var(--ink-2); font-size: 12px; }
.res { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); color: var(--ink-2); }
.res.won { background: rgba(12, 163, 12, 0.16); color: #7fd97f; }
.badge { margin-left: 6px; font-size: 11px; padding: 1px 6px; border-radius: 6px; background: rgba(250, 178, 25, 0.16); color: #f5c76a; }
.pname { display: inline-flex; align-items: center; }
details.units summary { cursor: pointer; color: var(--ink-2); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.units[open] summary { margin-bottom: 6px; }
details.units .tbl table { font-size: 12px; }
.deck { color: var(--ink-2); font-size: 12px; margin: 8px 0; white-space: normal; line-height: 1.5; }
.deck b { color: var(--ink); }
.deck .cards { margin-top: 2px; }
.side .card h2:empty, .card h2:empty { display: none; }
