:root {
  --bg: #1a1c20;
  --panel: #23262d;
  --border: #2f343d;
  --text: #e6e8eb;
  --muted: #8b919b;
  --accent: #ff5b3c;       /* MARS-y red-orange */
  --good: #51cf66;
  --warn: #ffd43b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  height: 100%;
}

body { display: flex; flex-direction: column; min-height: 100vh; }

header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.5px;
  color: var(--accent);
}
h1 .muted { color: var(--muted); font-weight: 400; }

.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 0 rgba(81, 207, 102, 0.7);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0   rgba(81, 207, 102, 0.7); }
  70%  { box-shadow: 0 0 0 10px rgba(81, 207, 102, 0); }
  100% { box-shadow: 0 0 0 0   rgba(81, 207, 102, 0); }
}
.pulse.stale { background: var(--warn); }
.pulse.stale { animation: none; }
.pulse.error { background: #ff4444; animation: none; }

main { flex: 1; padding: 16px 20px; }

.meta-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px 16px;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
.meta-row .label { color: var(--muted); margin-right: 6px; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

th, td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: #1d1f24;
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255, 255, 255, 0.02); }

.rank { width: 48px; color: var(--muted); }
.num  { width: 70px; text-align: right; font-variant-numeric: tabular-nums; }
.when { width: 120px; color: var(--muted); font-size: 12px; }
.player { font-weight: 500; }

tbody tr:nth-child(1) .rank { color: var(--accent); font-weight: 600; }
tbody tr:nth-child(2) .rank,
tbody tr:nth-child(3) .rank { color: var(--text); font-weight: 600; }

.loading, .empty {
  text-align: center;
  color: var(--muted);
  padding: 24px 0;
  font-style: italic;
}

footer {
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
