/* ---- Filter controls ---- */
#leaderboard-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

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

.filter-label {
  font-size: 0.85rem;
  color: #666;
  font-weight: 600;
}

.filter-buttons {
  display: flex;
  gap: 4px;
}

.filter-btn {
  background: #f0f2f5;
  border: 1px solid #ccc;
  color: #555;
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  width: auto;
  height: auto;
  display: inline-flex;
}

.filter-btn:hover { background: #e4e6ea; color: #333; }
.filter-btn.active { background: #2563b1; color: #fff; border-color: #2563b1; }

/* ---- Table wrapper ---- */
#leaderboard-table-wrap {
  overflow-x: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
}

/* ---- Table ---- */
#leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  white-space: nowrap;
}

#leaderboard-table th,
#leaderboard-table td {
  padding: 8px 12px;
  text-align: center;
  border-bottom: 1px solid #eee;
}

/* Game group header row */
#leaderboard-table thead tr.game-header th {
  background: #f5f6f8;
  color: #333;
  font-size: 0.82rem;
  font-weight: 700;
  border-bottom: 2px solid #ddd;
  border-left: 1px solid #ddd;
}

#leaderboard-table thead tr.game-header th:first-child {
  border-left: none;
}

/* Sub-header row (modalities) */
#leaderboard-table thead tr.mod-header th {
  background: #fafbfc;
  color: #666;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  border-left: 1px solid #eee;
}

#leaderboard-table thead tr.mod-header th:hover {
  color: #222;
  background: #f0f1f3;
}

.sort-arrow {
  font-size: 0.7rem;
  margin-left: 3px;
  color: #bbb;
}

.sort-arrow.active { color: #2563b1; }

/* Model name column */
#leaderboard-table thead tr.mod-header th:first-child {
  text-align: left;
  cursor: default;
  border-left: none;
}

#leaderboard-table td.model-cell {
  text-align: left;
  font-weight: 600;
  color: #1a1a1a;
  background: #fafbfc;
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: 1px solid #ddd;
}

/* Tier label within model cell */
.tier-tag {
  font-size: 0.72rem;
  color: #999;
  font-weight: 400;
  margin-left: 6px;
}

/* Heatmap cell */
#leaderboard-table td.score-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  border-left: 1px solid #f0f0f0;
}

#leaderboard-table td.score-cell.null-cell {
  color: #ccc;
  background: #fafafa;
}

/* Average column */
#leaderboard-table th.avg-col,
#leaderboard-table td.avg-col {
  border-right: 2px solid #ccc;
  font-weight: 700;
}

/* Tier group separator row */
#leaderboard-table tbody tr.tier-separator td {
  background: #e8edf3;
  color: #2563b1;
  font-weight: 700;
  font-size: 0.82rem;
  text-align: left;
  padding: 6px 12px;
  border-bottom: 2px solid #c0cfe0;
  border-top: 1px solid #c0cfe0;
  letter-spacing: 0.02em;
}

#leaderboard-table tbody tr.tier-separator:first-child td {
  border-top: none;
}

/* Row hover */
#leaderboard-table tbody tr:hover:not(.tier-separator) td {
  filter: brightness(0.96);
}

/* ---- Responsive ---- */
@media (max-width: 700px) {
  #leaderboard-filters { gap: 10px; }
  .filter-buttons { flex-wrap: wrap; }
}
