:root {
  --bg: #0b0f1a;
  --panel: #131a2b;
  --panel-2: #1b2540;
  --border: #283655;
  --text: #e6ecff;
  --dim: #8a96b8;
  --accent: #4ea3ff;
  --good: #46d39a;
  --warn: #ffc234;
  --bad: #ff5c6c;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 70% -10%, #16203a 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 20px;
  background: rgba(11, 15, 26, 0.85);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10; backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 22px; color: var(--accent); letter-spacing: -2px; }
.title { font-weight: 700; letter-spacing: 0.5px; }
.subtitle { font-size: 12px; color: var(--dim); }
.controls { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 560px; }
#lookup {
  flex: 1; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  font-size: 14px;
}
#lookup:focus { outline: none; border-color: var(--accent); }
button {
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: #00122b; font-weight: 700; cursor: pointer;
  font-size: 13px;
}
button:hover { filter: brightness(1.08); }
button.ghost { background: transparent; color: var(--text); border-color: var(--border); }
button.ghost.active { border-color: var(--accent); color: var(--accent); }
.status { font-size: 12px; color: var(--dim); white-space: nowrap; }
.status.live { color: var(--good); }
.status.err { color: var(--bad); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; padding: 16px; flex: 1; }
@media (max-width: 820px) { .layout { grid-template-columns: 1fr; } }

.sidebar, .content > .dashboard, .empty, .match-header {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
}
.sidebar { padding: 14px; align-self: start; }
h2 { font-size: 13px; letter-spacing: 1px; color: var(--dim); margin: 0 0 10px; font-weight: 600; }
.dim { color: var(--dim); }
.hint { font-size: 12px; margin-top: 12px; }

.uni-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow: auto; }
.uni {
  padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--panel-2); cursor: pointer; transition: border-color .15s;
}
.uni:hover { border-color: var(--accent); }
.uni.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.uni .row1 { display: flex; justify-content: space-between; font-weight: 600; }
.uni .row2 { font-size: 12px; color: var(--dim); margin-top: 2px; }
.uni .lvl { color: var(--accent); }

.content { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.match-header { padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; }
.mh-id { font-weight: 700; font-size: 16px; }
.mh-winner { color: var(--warn); font-weight: 700; }
.empty { padding: 48px; text-align: center; color: var(--dim); }

.dashboard { padding: 16px; }
.metric-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.chart-wrap { background: var(--panel-2); border-radius: 10px; padding: 8px; }

.standings { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
.standings th, .standings td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.standings th:nth-child(2), .standings td:nth-child(2),
.standings th:nth-child(3), .standings td:nth-child(3) { text-align: left; }
.standings tbody tr:hover { background: var(--panel-2); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: middle; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--panel-2); color: var(--dim); }
.tag.ai { color: var(--warn); }
.tag.strategy { color: var(--accent); }
.tag.manual { color: var(--good); }

.hidden { display: none !important; }
.footer { padding: 10px 20px; font-size: 12px; border-top: 1px solid var(--border); }

/* uPlot dark tweaks */
.uplot, .u-wrap { width: 100% !important; }
.u-legend { font-size: 12px; color: var(--text); }
.u-legend .u-marker { width: 10px; height: 10px; }
