:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1c2330;
  --border: #2a3140;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #ff7a59;
  --green: #3fb950;
  --yellow: #d29922;
  --blue: #58a6ff;
  --red: #f85149;
  --purple: #bc8cff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header {
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--surface);
}

header h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.3px; }
header h1 .season-suffix { color: var(--text-muted); font-weight: 400; font-size: 14px; margin-left: 6px; }

nav { display: flex; gap: 12px; }
nav a {
  color: var(--blue);
  text-decoration: none;
  font-size: 13px;
}
nav a:hover { text-decoration: underline; }

.header-meta { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.header-meta .val { color: var(--text); }

.filter-bar {
  padding: 14px 32px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  align-items: center;
  background: var(--surface);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.seg {
  display: inline-flex;
}

.seg button {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}

.seg button:first-child { border-radius: 4px 0 0 4px; }
.seg button:last-child  { border-radius: 0 4px 4px 0; border-left: none; }
.seg button.active { background: var(--accent); color: white; border-color: var(--accent); }

/* The primary tab seg sits at the end of its flex container (filter-bar on
   home, detail-header on player page) and gets pushed to the right edge. */
.seg-primary { margin-left: auto; }

.filter-group input[type=number] {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 12px;
  width: 70px;
  font-family: inherit;
}

.filter-group .count {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.content { padding: 18px 32px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th:hover { color: var(--text); }
th.sorted { color: var(--text); }
th.no-sort { cursor: default; }
th.no-sort:hover { color: var(--text-muted); }
th .sort-arrow { font-size: 10px; margin-left: 4px; color: var(--accent); }

td { padding: 7px 12px; border-bottom: 1px solid var(--border); }
tr:hover { background: var(--surface); }

tr.summary-row {
  background: rgba(255, 122, 89, 0.08);
  position: sticky;
  top: 0;
  z-index: 2;
}
tr.summary-row td {
  border-bottom: 2px solid var(--accent);
  font-weight: 600;
  background: rgba(255, 122, 89, 0.10);
}
tr.summary-row:hover td { background: rgba(255, 122, 89, 0.16); }

.num { text-align: right; font-variant-numeric: tabular-nums; }
.dim { color: var(--text-muted); }
.player-link { color: var(--blue); text-decoration: none; cursor: pointer; }
.player-link:hover { text-decoration: underline; }

.video-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  opacity: 0.75;
}
.video-link:hover { opacity: 1; }

.shoots-L { color: var(--purple); }
.shoots-R { color: var(--text-muted); }

.height-diff-pos { color: var(--green); }
.height-diff-neg { color: var(--red); font-weight: 600; }
.height-diff-zero { color: var(--text-muted); }

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

.loading {
  display: flex;
  justify-content: center;
  padding: 60px 0;
}
.loading .spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.back-link {
  color: var(--blue);
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 14px;
  display: inline-block;
}
.back-link:hover { text-decoration: underline; }

.detail-header {
  margin-bottom: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: baseline;
}
.detail-header h2 { font-size: 22px; font-weight: 600; }
.detail-header .meta-line { color: var(--text-muted); font-size: 14px; }
.detail-header .meta-line .v { color: var(--text); }

.stat-cards { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  min-width: 120px;
}
.stat-card .card-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.stat-card .card-value { font-size: 20px; font-weight: 600; }
.stat-card .card-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.section-title {
  font-size: 15px;
  font-weight: 600;
  margin: 28px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.section-title .hint { font-size: 12px; color: var(--text-muted); font-weight: 400; margin-left: 8px; }

/* Histogram of height differentials */
.histogram { display: flex; align-items: flex-end; gap: 2px; height: 140px; padding: 8px 0; }
.histogram .bar {
  flex: 1;
  background: var(--accent);
  min-height: 1px;
  position: relative;
}
.histogram .bar.zero { background: var(--text-muted); opacity: 0.4; }
.histogram .bar .label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}
.histogram .bar .count {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text);
}
.histogram-wrap { padding-bottom: 28px; }
