.leaderboard-results { display: block; position: relative; }
.leaderboard-loading-status, .leaderboard-skeleton { display: none; }
.leaderboard-results[aria-busy="true"] .leaderboard-loading-status { display: block; }
.leaderboard-results[aria-busy="true"] .leaderboard-track { pointer-events: none; }
.leaderboard-results[aria-busy="true"] .leaderboard-skeleton {
  display: grid;
  grid-template-columns: inherit;
  gap: inherit;
  position: absolute;
  inset: 0;
  z-index: 2;
  background: var(--surface);
  opacity: 0;
  animation: leaderboard-skeleton-show 0s .15s forwards;
}
/* The skeleton is the tile grid, drawn empty. */
.leaderboard-skeleton-tile { display: block; height: 170px; border-radius: 3px; background: var(--surface-2); }
@keyframes leaderboard-skeleton-show { to { opacity: 1; } }
.leaderboard-pagination { display: flex; flex-direction: column; gap: .75rem; }
.leaderboard-pagination-controls, .leaderboard-page-numbers { display: flex; align-items: center; gap: .375rem; }
.leaderboard-pages-mobile { display: none; }
.leaderboard-page-gap { width: 12px; text-align: center; color: var(--ink-faint); }
.leaderboard-page-direction { gap: .5rem; padding: 0 .75rem; }
.leaderboard-page-direction.is-disabled { opacity: .3; }
.leaderboard-page-number { flex-shrink: 0; }
.leaderboard-page-number { display: inline-flex; justify-content: center; align-items: center; min-width: 44px; min-height: 44px; border: 1px solid var(--edge-strong); border-radius: 3px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.leaderboard-page-number:hover { background: var(--surface-2); color: var(--ink); }
.leaderboard-page-number.is-current { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.leaderboard-page-number:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 767px) {
  .leaderboard-pagination-controls, .leaderboard-page-numbers { gap: 4px; }
  .leaderboard-pages-desktop { display: none; }
  .leaderboard-pages-mobile { display: flex; }
  .leaderboard-page-direction { padding: 0; }
  .leaderboard-page-direction span { display: none; }
}

/* The index: one photo tile per track. The picture fills the tile, a dark
   gradient rises from the bottom, and the name sits on it in condensed
   italic. Three across on a desktop, two on a tablet, one on a phone. */
.leaderboard-track-list {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.leaderboard-track {
  position: relative;
  display: block;
  height: 170px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--surface-2);
}
.leaderboard-track > img { transition: transform 200ms ease; }
.leaderboard-track:hover > img { transform: scale(1.03); }
.leaderboard-track::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(8, 9, 11, .95) 10%, rgba(8, 9, 11, .1) 70%);
}
.leaderboard-track:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.leaderboard-track-tag { position: absolute; top: 10px; left: 0; z-index: 1; border-radius: 0 2px 2px 0; }
.leaderboard-track-title { position: absolute; z-index: 1; left: 14px; right: 14px; bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.leaderboard-track-name {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1;
  color: #fff;
}
.leaderboard-track:hover .leaderboard-track-name { color: var(--accent); }
.leaderboard-track-meta { font-size: .875rem; color: #c3c8cf; }
@media (max-width: 1023px) {
  .leaderboard-track-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .leaderboard-track-list { grid-template-columns: minmax(0, 1fr); }
  .leaderboard-track { height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  .leaderboard-track > img { transition: none; }
}

/* A class search hit on the Tracks tab: the tile plus a tag link over its
   top right corner. The cell is the grid item; the tag sits above the
   tile's link, never inside it. */
.leaderboard-track-cell { position: relative; min-width: 0; }
.leaderboard-track-classes {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  max-width: calc(100% - 20px);
}
.index-car-matches { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* The Cars tab: one row per car. */
.index-car-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  transition: background-color 100ms ease;
}
.index-car-row:hover { background: rgba(255, 255, 255, 0.02); }
.index-car-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.index-car-best { flex-shrink: 0; text-align: right; }
@media (max-width: 640px) {
  .index-car-row { flex-wrap: wrap; gap: 6px 12px; padding: 12px 14px; }
  .index-car-best { text-align: left; }
}

/* The foot of the track board: the most-driven cars as one-tap chips. */
.car-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.car-strip-chip { gap: 6px; max-width: 100%; }
.car-strip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.car-strip-count { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.car-strip-chip[aria-current] .car-strip-count { color: inherit; opacity: 0.75; }
.car-strip-more { margin-left: 4px; font-size: 0.875rem; font-weight: 500; }

/* The car page's hero: the catalog photo beside the name, on the plain
   dark hero (a car has no track photo to stretch behind it). */
.car-hero { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 24px; }
.car-hero-photo {
  position: relative;
  flex: 0 0 auto;
  width: 12rem;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--edge-strong);
  border-radius: 3px;
  background: var(--surface);
}
.car-hero .photo-hero-sub .chip { margin-left: 0; margin-right: 6px; }
@media (max-width: 640px) {
  .car-hero-photo { width: 100%; max-width: 20rem; }
}

/* The track board's Cars control, first in the filter row:
   All cars | Pick a class | Pick a car. Wraps as a group on a phone. */
.cars-control { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.cars-all {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 6px 12px;
  border: 1px solid var(--edge-strong);
  border-radius: 3px;
  font-size: 0.9rem;
  color: var(--ink-muted);
  white-space: nowrap;
}
.cars-all:hover { color: var(--ink); border-color: var(--ink-faint); }
.cars-all[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* A searchable pick-one menu (leaderboards/_combo_menu): the button names
   the choice, an (x) joined to its right edge clears it, and the panel is a
   search box over a scrolling list of links. */
.combo-menu { display: inline-flex; align-items: stretch; min-width: 0; max-width: 100%; }
.combo-menu-details { min-width: 0; }
.combo-menu-details > summary { max-width: 18rem; }
.combo-menu-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-menu.is-chosen .combo-menu-details > summary { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.combo-menu-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  border: 1px solid var(--accent-edge);
  border-left: 0;
  border-radius: 0 3px 3px 0;
  background: var(--surface);
  color: var(--ink-muted);
}
.combo-menu-clear:hover { color: #fff; background: var(--surface-2); }
.combo-menu-clear:focus-visible { outline-offset: 2px; }
.combo-menu-panel { width: min(24rem, calc(100vw - 2.5rem)); max-width: none; gap: 6px; }
.combo-menu-search { width: 100%; max-width: none; }
.combo-menu-list { display: grid; gap: 2px; max-height: min(22rem, 60vh); overflow-y: auto; overscroll-behavior: contain; }
.combo-menu-list > li[hidden] { display: none; }
.combo-menu-list .menu-item { justify-content: space-between; gap: 12px; }
.combo-menu-list > li.is-active .menu-item { background: var(--accent-soft); color: var(--ink); }
.combo-menu-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-menu-hint { flex-shrink: 0; font-size: 0.8rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .cars-control { flex: 1 1 100%; }
  .combo-menu-details > summary { max-width: calc(100vw - 6rem); }
  .combo-menu-panel { width: auto; }
}
