:root {
  --bg: #0f1218;
  --panel: #171b23;
  --panel-2: #1d222c;
  --line: #262c38;
  --line-soft: #1f2530;
  --text: #e9edf3;
  --muted: #8a93a3;
  --faint: #5d6575;
  --accent: #4ea8ff;
  --accent-soft: rgba(78, 168, 255, 0.14);
  --ready: #34d399;
  --monitor: #fbbf24;
  --recover: #f87171;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 32px;
  height: 60px; padding: 0 28px;
  background: rgba(15, 18, 24, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark { width: 24px; height: 24px; color: var(--accent); }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand-sub {
  font-size: 11px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); padding: 2px 7px; border-radius: 999px;
}
.tabs { display: flex; gap: 4px; }
.tab {
  padding: 7px 12px; border-radius: 8px; color: var(--muted);
  font-weight: 500; cursor: default;
}
.tab.active { color: var(--text); background: var(--panel-2); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.team-select {
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  padding: 7px 12px; font-weight: 500;
}
.caret { color: var(--muted); margin-left: 6px; }

/* ---------- Avatars ---------- */
.avatar {
  --c: var(--accent);
  flex: none; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  font-weight: 600; font-size: 13px; letter-spacing: 0.02em;
  color: var(--text); background: var(--panel-2);
  box-shadow: inset 0 0 0 2px var(--c);
}
.avatar.staff { width: 32px; height: 32px; font-size: 12px; box-shadow: none; background: #2a3140; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; box-shadow: inset 0 0 0 3px var(--c); }

/* ---------- Page ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 32px 28px 48px; }
.intro {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  margin-bottom: 24px;
}
.eyebrow {
  margin: 0 0 6px; color: var(--accent); font-size: 12px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
}
h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
h1 em { font-style: normal; color: var(--ready); }
.sub { margin: 8px 0 0; color: var(--muted); font-size: 15px; }
.legend-inline { display: flex; gap: 16px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.legend-inline span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot.ready { background: var(--ready); }
.dot.monitor { background: var(--monitor); }
.dot.recover { background: var(--recover); }

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid.hero { grid-template-columns: 1.15fr 1fr; }
.grid.charts { grid-template-columns: 1.6fr 1fr; }

.card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.card + .card, section.card { margin-bottom: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px;
}
h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- Segmented control ---------- */
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg button {
  border: 0; background: transparent; color: var(--muted);
  padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 500;
}
.seg button.active { background: var(--panel-2); color: var(--text); }

/* ---------- Team score ---------- */
.team-score { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.ring { position: relative; width: 168px; height: 168px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-value { font-size: 48px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.ring-caption { margin-top: 6px; color: var(--muted); font-size: 12px; }
.team-meta h2 { margin-bottom: 4px; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 13px; }
.delta.down { color: var(--recover); }
.delta.up { color: var(--ready); }
.status-split { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.split {
  background: var(--panel-2); border-radius: 10px; padding: 12px 14px;
  border-left: 3px solid var(--c);
}
.split b { display: block; font-size: 24px; font-weight: 700; line-height: 1.1; }
.split span { color: var(--muted); font-size: 12px; }
.split-bar { display: flex; height: 6px; border-radius: 999px; overflow: hidden; margin-top: 16px; gap: 2px; }
.split-bar i { display: block; height: 100%; }

/* ---------- Attention list ---------- */
.attention-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.attention-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px; background: var(--panel-2);
  cursor: pointer; transition: background 0.15s;
}
.attention-list li:hover { background: #232a36; }
.att-main { flex: 1; min-width: 0; }
.att-name { font-weight: 600; }
.att-name small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.att-reason { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-score { font-size: 20px; font-weight: 700; }

/* ---------- Leaderboard ---------- */
.leader-strip {
  display: grid; grid-template-columns: repeat(13, minmax(64px, 1fr)); gap: 6px;
  overflow-x: auto; padding-bottom: 2px;
}
.leader {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 4px 10px; border-radius: 10px; cursor: pointer;
  transition: background 0.15s;
}
.leader:hover { background: var(--panel-2); }
.leader .rank { font-size: 11px; color: var(--faint); font-weight: 600; }
.leader .name { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.leader .score { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }

/* ---------- Charts ---------- */
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.axis text { fill: var(--faint); font-size: 11px; }
.grid-line { stroke: var(--line-soft); stroke-width: 1; }
.band { opacity: 0.06; }
.game-tag { fill: var(--muted); font-size: 10.5px; }
.tooltip-dot { fill: var(--panel); stroke: var(--accent); stroke-width: 2; }

.unit-bars { display: grid; gap: 18px; padding-top: 4px; }
.unit-row .unit-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.unit-row .unit-name { font-weight: 500; }
.unit-row .unit-val { font-size: 20px; font-weight: 700; }
.unit-row .unit-val small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.track { height: 10px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.fill { height: 100%; border-radius: 999px; transition: width 0.8s cubic-bezier(.2,.8,.2,1); }
.unit-note { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11px; font-weight: 600; color: var(--faint);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0 10px 10px; border-bottom: 1px solid var(--line);
}
.table td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr { cursor: pointer; transition: background 0.15s; }
.table tbody tr:hover { background: var(--panel-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.who { display: flex; align-items: center; gap: 10px; }
.who .avatar { width: 32px; height: 32px; font-size: 12px; }
.who b { display: block; font-weight: 600; }
.who span { color: var(--muted); font-size: 12px; }
.big-score { font-size: 20px; font-weight: 700; }
.mini { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.mini .track { flex: 1; height: 6px; max-width: 70px; }
.mini b { font-weight: 600; width: 26px; text-align: right; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }

.foot { margin-top: 24px; color: var(--faint); font-size: 12px; text-align: center; }

/* ---------- Drawer ---------- */
.scrim {
  position: fixed; inset: 0; background: rgba(5, 7, 10, 0.55);
  opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 20;
}
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 30;
  width: min(560px, 100vw); overflow-y: auto;
  background: var(--bg); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform 0.28s cubic-bezier(.2,.8,.2,1);
  padding: 24px 26px 40px;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.drawer-head h3 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.drawer-head p { margin: 2px 0 0; color: var(--muted); }
.close {
  margin-left: auto; width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel); font-size: 18px; line-height: 1;
}
.d-score {
  display: flex; align-items: center; gap: 20px;
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 14px;
}
.d-score .ring { width: 108px; height: 108px; }
.d-score .ring-value { font-size: 34px; }
.d-score .ring-caption { margin-top: 3px; font-size: 11px; }
.d-summary { flex: 1; }
.d-summary .pill { margin-bottom: 8px; }
.d-summary p { margin: 0; color: var(--text); font-size: 14px; }
.d-summary .muted { margin-top: 6px; font-size: 12.5px; }

.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.metric {
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: 12px;
  padding: 14px 16px;
}
.metric .m-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.metric .m-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.metric .m-score { font-size: 12px; font-weight: 700; color: var(--c); }
.metric .m-value { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.metric .m-value small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.metric .m-detail { font-size: 12px; color: var(--muted); margin-top: 2px; }
.metric .track { height: 4px; margin-top: 12px; }

.panel {
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 14px;
}
.panel h4 { margin: 0 0 12px; font-size: 13px; font-weight: 600; }
.panel h4 span { color: var(--muted); font-weight: 500; margin-left: 6px; }
.lanes { display: grid; grid-template-columns: 118px 1fr; row-gap: 10px; column-gap: 10px; align-items: center; }
.lane-label { font-size: 12px; color: var(--muted); }
.lane { position: relative; height: 18px; border-radius: 5px; background: var(--panel-2); overflow: hidden; }
.lane i { position: absolute; top: 0; bottom: 0; }
.lane-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); grid-column: 2; }
.lane-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 11.5px; color: var(--muted); }
.lane-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lane-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

@media (max-width: 1000px) {
  .grid.hero, .grid.charts { grid-template-columns: 1fr; }
  .intro { flex-direction: column; align-items: flex-start; }
}
