:root {
  --bg: #0f1117;
  --panel: #181b24;
  --panel-2: #1f2330;
  --line: #2a2f3d;
  --text: #e7e9ee;
  --muted: #8b91a3;
  --accent: #6c5ce7;
  --ok: #2ecc71;
  --warn: #f1c40f;
  --err: #e74c3c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: #0c0e14;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.logo {
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--accent);
  font-size: 20px;
}
.brand-sub { color: var(--muted); font-size: 14px; }

.conn { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.conn .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.conn.online .dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.conn.offline .dot { background: var(--err); }

.layout { display: flex; min-height: calc(100vh - 57px); }

.sidebar {
  width: 240px;
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  background: #0c0e14;
}
.side-title { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 0 0 12px 6px; }
.game-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.game-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel);
  transition: background .15s, border-color .15s, transform .05s;
}
.game-item:hover { background: var(--panel-2); }
.game-item.active { border-color: var(--accent); background: var(--panel-2); }
.game-item:active { transform: scale(.99); }
.game-item.disabled { opacity: .55; cursor: not-allowed; }
.game-swatch { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; }
.game-meta { display: flex; flex-direction: column; }
.game-name { font-weight: 600; font-size: 15px; }
.game-desc { font-size: 12px; color: var(--muted); }
.badge {
  margin-left: auto; font-size: 10px; padding: 2px 7px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .5px;
}
.badge.live { background: rgba(46,204,113,.15); color: var(--ok); }
.badge.soon { background: rgba(241,196,15,.13); color: var(--warn); }

.content { flex: 1; padding: 26px 30px; }
.content-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.content-head h1 { margin: 0; font-size: 24px; }
.status { font-size: 13px; color: var(--muted); }
.status .pill { padding: 3px 9px; border-radius: 999px; font-size: 12px; }
.status .pill.ok { background: rgba(46,204,113,.15); color: var(--ok); }
.status .pill.error { background: rgba(231,76,60,.15); color: var(--err); }
.status .pill.unavailable { background: rgba(241,196,15,.13); color: var(--warn); }

.hidden { display: none !important; }

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
}
.metric-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.metric-value { font-size: 34px; font-weight: 700; margin-top: 8px; font-variant-numeric: tabular-nums; }
.metric-value.flash { animation: flash .6s ease; }
@keyframes flash { 0% { color: var(--accent); } 100% { color: var(--text); } }

.live-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: .25; } 100% { opacity: 1; } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px 4px 4px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; }
.panel-head h3 { margin: 0; font-size: 16px; }
.updated { font-size: 12px; color: var(--muted); }

.top-table { width: 100%; border-collapse: collapse; }
.top-table th, .top-table td { text-align: left; padding: 11px 18px; font-size: 14px; }
.top-table thead th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--line); }
.top-table tbody tr { border-bottom: 1px solid rgba(42,47,61,.5); }
.top-table tbody tr:last-child { border-bottom: none; }
.top-table .rank { color: var(--muted); font-variant-numeric: tabular-nums; }
.top-table .player { font-weight: 600; }
.top-table .elo { font-variant-numeric: tabular-nums; }
.top-table .empty { text-align: center; color: var(--muted); padding: 26px; }

.placeholder { color: var(--muted); padding: 60px 0; text-align: center; }
