/* Steam 运营看板 · 样式。色值来自经校验的参考色板（浅色/深色各自取色，非自动反色）。 */
.viz-root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --surface-2: #f3f2ee;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --hover: rgba(11, 11, 11, 0.04);
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
  --pos: #2a78d6; --neg: #e34948;
  --ord-track: #cde2fb;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --delta-good: #006300; --delta-bad: #b42a2a;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .viz-root {
    color-scheme: dark;
    --page: #0d0d0d; --surface-1: #1a1a19; --surface-2: #232321;
    --text-primary: #ffffff; --text-secondary: #c3c2b7; --text-muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.1); --hover: rgba(255, 255, 255, 0.05);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --pos: #3987e5; --neg: #e66767; --ord-track: #184f95;
    --delta-good: #0ca30c; --delta-bad: #e66767; --shadow: none;
  }
}
:root[data-theme="dark"] .viz-root {
  color-scheme: dark;
  --page: #0d0d0d; --surface-1: #1a1a19; --surface-2: #232321;
  --text-primary: #ffffff; --text-secondary: #c3c2b7; --text-muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.1); --hover: rgba(255, 255, 255, 0.05);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --pos: #3987e5; --neg: #e66767; --ord-track: #184f95;
  --delta-good: #0ca30c; --delta-bad: #e66767; --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 13px; line-height: 1.45;
}
.viz-root { background: var(--page); color: var(--text-primary); min-height: 100vh; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }

/* ---------- 顶栏 & 筛选行 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 24px; background: var(--surface-1); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; margin-right: 8px; white-space: nowrap; }
.brand .logo { width: 22px; height: 22px; border-radius: 6px; background: var(--text-primary); display: grid; place-items: center; }
.brand .logo svg { width: 14px; height: 14px; fill: var(--surface-1); }
.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; padding: 2px; background: var(--surface-2); }
.seg button { border: 0; background: transparent; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--text-secondary); white-space: nowrap; }
.seg button:hover { background: var(--hover); }
.seg button[aria-pressed="true"] { background: var(--surface-1); color: var(--text-primary); font-weight: 600; box-shadow: 0 0 0 1px var(--border); }
.seg.sm button { padding: 2px 8px; font-size: 12px; }

.picker { position: relative; }
.picker > button {
  display: flex; align-items: center; gap: 8px; min-width: 220px; max-width: 320px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-1); padding: 5px 10px; cursor: pointer; text-align: left;
}
.picker > button .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.picker .menu {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 300px; z-index: 30;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.picker .menu[hidden] { display: none; }
.menu .item { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 7px 8px; border-radius: 6px; cursor: pointer; text-align: left; }
.menu .item:hover { background: var(--hover); }
.menu .item .check { width: 16px; font-weight: 700; }
.menu .item .tag { margin-left: auto; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.key.line { width: 14px; height: 2px; border-radius: 1px; }
.tag { font-size: 11px; color: var(--text-secondary); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; white-space: nowrap; }

.live { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); white-space: nowrap; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.live.on .dot { background: var(--good); box-shadow: 0 0 0 0 rgba(12,163,12,.5); animation: pulse 2s infinite; }
.live.off .dot { background: var(--critical); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(12,163,12,.45); } 70% { box-shadow: 0 0 0 6px rgba(12,163,12,0); } 100% { box-shadow: 0 0 0 0 rgba(12,163,12,0); } }
@media (prefers-reduced-motion: reduce) { .live.on .dot { animation: none; } }

.btn { border: 1px solid var(--border); background: var(--surface-1); border-radius: 8px; padding: 5px 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--text-primary); color: var(--surface-1); border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-secondary); padding: 3px 6px; }
.btn.ghost:hover { background: var(--hover); color: var(--text-primary); }
.btn .count { background: var(--critical); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 11px; font-weight: 600; }

.banner { padding: 8px 24px; background: var(--surface-2); border-bottom: 1px solid var(--border); color: var(--text-secondary); display: flex; gap: 8px; align-items: center; }
.banner strong { color: var(--text-primary); white-space: nowrap; }

/* ---------- 布局 ---------- */
main { padding: 20px 24px 40px; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; max-width: 1760px; margin: 0 auto; transition: opacity .2s; }
main.loading { opacity: .6; }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
@media (max-width: 1280px) { .span-3 { grid-column: span 6; } .span-4, .span-5, .span-7, .span-8 { grid-column: span 12; } .span-6 { grid-column: span 12; } }
@media (max-width: 720px) { main { padding: 12px; gap: 12px; } .span-3 { grid-column: span 12; } .topbar { padding: 10px 12px; } }

.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 16px; min-width: 0; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.card-head h2 { font-size: 14px; font-weight: 600; margin: 0; }
.card-head .sub { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.card-head .actions { margin-left: auto; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.card-body { position: relative; min-width: 0; flex: 1; }
.empty { color: var(--text-muted); padding: 28px 0; text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 8px; color: var(--text-secondary); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend button { border: 0; background: none; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: inherit; }
.legend button[aria-pressed="false"] { opacity: .4; }

/* ---------- 核心指标 ---------- */
.hero { grid-column: span 4; }
.hero .game { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.hero .game img { width: 120px; height: 45px; object-fit: cover; border-radius: 6px; background: var(--surface-2); flex: none; }
.hero .game .ph { width: 120px; height: 45px; border-radius: 6px; background: var(--surface-2); flex: none; }
.hero .game .nm { font-weight: 600; font-size: 15px; }
.hero .game .meta { color: var(--text-muted); font-size: 12px; }
.hero .label { color: var(--text-secondary); }
.hero .value { font-size: 52px; font-weight: 600; line-height: 1.05; letter-spacing: -0.02em; margin: 4px 0 6px; }
.hero .deltas { display: flex; gap: 16px; flex-wrap: wrap; color: var(--text-secondary); }
.hero .spark { margin-top: 12px; }
.tiles { grid-column: span 8; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1280px) { .hero, .tiles { grid-column: span 12; } }
@media (max-width: 720px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 14px; min-width: 0; box-shadow: var(--shadow); }
.tile .label { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .value { font-size: 24px; font-weight: 600; margin: 4px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .note { color: var(--text-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.delta { font-weight: 600; white-space: nowrap; }
.delta.up-good, .delta.down-good { color: var(--delta-good); }
.delta.up-bad, .delta.down-bad { color: var(--delta-bad); }
.delta.flat { color: var(--text-muted); font-weight: 500; }

/* ---------- 告警 ---------- */
.alerts { display: flex; flex-direction: column; gap: 2px; max-height: 360px; overflow: auto; margin: 0 -6px; }
.alert { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 8px 6px; border-radius: 8px; }
.alert:hover { background: var(--hover); }
.alert.acked { opacity: .55; }
.alert .t { font-weight: 600; }
.alert .d { color: var(--text-secondary); font-size: 12px; grid-column: 2; white-space: pre-line; word-break: break-word; }
.alert .m { color: var(--text-muted); font-size: 12px; grid-column: 2; display: flex; gap: 8px; align-items: center; }
.sev { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; white-space: nowrap; height: 20px; padding: 0 6px 0 2px; border-radius: 10px; background: var(--surface-2); color: var(--text-primary); }
.sev i { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 11px; color: #fff; }
.sev.critical i { background: var(--critical); } .sev.serious i { background: var(--serious); color: #0b0b0b; }
.sev.warning i { background: var(--warning); color: #0b0b0b; } .sev.good i { background: var(--good); }
.sev.info i { background: var(--text-muted); }

/* ---------- 评级档位 ---------- */
.tier .big { font-size: 28px; font-weight: 600; }
.tier .row { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--grid); }
.tier .row:first-of-type { border-top: 0; }
.tier .row .k { color: var(--text-secondary); }
.tier .row .v { font-weight: 600; text-align: right; }
.meter { position: relative; height: 10px; border-radius: 5px; background: var(--ord-track); margin: 10px 0 4px; overflow: hidden; }
.meter > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--s1); }
.meter > i { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--surface-1); }
.meter-scale { position: relative; height: 16px; color: var(--text-muted); font-size: 11px; }
.meter-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 8px; text-align: left; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { color: var(--text-muted); font-weight: 500; font-size: 12px; position: sticky; top: 0; background: var(--surface-1); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.me td { font-weight: 600; }
tr:hover td { background: var(--hover); }
td .cell { display: flex; align-items: center; gap: 8px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
td .cell span.n { overflow: hidden; text-overflow: ellipsis; }
.inbar { display: inline-block; height: 8px; border-radius: 0 4px 4px 0; background: var(--s1); vertical-align: middle; margin-right: 6px; }

/* ---------- 评测流 ---------- */
.feed-tools { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; align-items: center; }
.feed { max-height: 520px; overflow: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -6px; }
.rv { padding: 10px 6px; border-radius: 8px; display: grid; grid-template-columns: 28px 1fr; gap: 4px 10px; }
.rv:hover { background: var(--hover); }
.rv .thumb { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; background: var(--surface-2); }
.rv .thumb svg { width: 16px; height: 16px; }
.rv.up .thumb svg { fill: var(--pos); } .rv.down .thumb svg { fill: var(--neg); transform: rotate(180deg); }
.rv .meta { color: var(--text-muted); font-size: 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rv .meta b { color: var(--text-primary); font-weight: 600; }
.rv .txt { grid-column: 2; color: var(--text-primary); word-break: break-word; white-space: pre-line; }
.rv .txt.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }

/* ---------- 新闻 ---------- */
.news { display: flex; flex-direction: column; max-height: 420px; overflow: auto; }
.news a { display: block; padding: 9px 0; border-bottom: 1px solid var(--grid); text-decoration: none; }
.news a:hover .tt { text-decoration: underline; }
.news .tt { font-weight: 600; }
.news .mt { color: var(--text-muted); font-size: 12px; }
.news .ct { color: var(--text-secondary); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 健康 ---------- */
.health { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; }
.health > div { padding: 6px 0; border-bottom: 1px solid var(--grid); }
.health .st { display: inline-flex; gap: 6px; align-items: center; }
.health .st i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.health .ok i { background: var(--good); } .health .bad i { background: var(--critical); } .health .wait i { background: var(--text-muted); }
.health .r { text-align: right; color: var(--text-muted); font-size: 12px; }
.health .err { grid-column: 1 / -1; color: var(--delta-bad); font-size: 12px; padding-top: 0; word-break: break-all; }

/* ---------- 图表 ---------- */
svg.chart { display: block; width: 100%; overflow: visible; }
svg.chart text { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
svg.chart text.lbl { fill: var(--text-secondary); font-size: 12px; font-variant-numeric: normal; }
svg.chart text.lbl.strong { fill: var(--text-primary); font-weight: 600; }
svg.chart .grid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
svg.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
svg.chart .xhair { stroke: var(--text-muted); stroke-width: 1; pointer-events: none; }
svg.chart .hit { fill: transparent; cursor: crosshair; }
svg.chart:focus { outline: none; }
svg.chart:focus-visible { outline: 2px solid var(--s1); outline-offset: 2px; border-radius: 4px; }
svg.chart .mark-hover { opacity: .78; }
svg.chart .evt { fill: var(--text-secondary); stroke: var(--surface-1); stroke-width: 2; }
svg.chart .evt-line { stroke: var(--axis); stroke-width: 1; }

.tooltip {
  position: fixed; z-index: 100; pointer-events: none; min-width: 140px; max-width: 320px;
  background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; box-shadow: 0 6px 20px rgba(0,0,0,.14); font-size: 12px;
}
.tooltip[hidden] { display: none; }
.tooltip .tt-h { color: var(--text-secondary); margin-bottom: 4px; }
.tooltip .tt-r { display: grid; grid-template-columns: 14px auto 1fr; gap: 8px; align-items: center; padding: 1px 0; }
.tooltip .tt-r b { font-weight: 600; font-variant-numeric: tabular-nums; }
.tooltip .tt-r span:last-child { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tooltip .tt-n { color: var(--text-muted); margin-top: 4px; }

/* ---------- 弹窗 ---------- */
dialog { border: 1px solid var(--border); border-radius: 14px; padding: 0; background: var(--surface-1); color: var(--text-primary); width: min(640px, 94vw); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog .dh { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
dialog .dh h3 { margin: 0; font-size: 15px; }
dialog .db { padding: 14px 16px; max-height: 70vh; overflow: auto; }
dialog input[type="search"] { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); }
.mlist { display: flex; flex-direction: column; margin-top: 8px; }
.mlist .row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--grid); }
.mlist .row img { width: 64px; height: 24px; object-fit: cover; border-radius: 4px; background: var(--surface-2); }
.mlist .row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hint { color: var(--text-muted); font-size: 12px; margin: 6px 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.banner.offline { border-left: 4px solid var(--critical); color: var(--text-primary); }
.banner.offline strong::before { content: "!"; display: inline-grid; place-items: center; width: 16px; height: 16px; margin-right: 6px; border-radius: 50%; background: var(--critical); color: #fff; font-size: 11px; }
.banner code { background: var(--surface-1); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; }
