/* ============ Stats / Leaderboards view ============ */

.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.9rem;
  margin-bottom: 2rem;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.1rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition:
    transform 0.2s var(--ease),
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}
.stat-tile:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.stat-tile__label {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.stat-tile__value {
  font-family: "EB Garamond", serif;
  font-size: 1.8rem;
  line-height: 1.1;
  color: var(--gold-bright);
}

/* Equal-width grid. Boards are kept to a uniform row count (top ~10) in
   stats.js so rows line up cleanly; the one inherently-short board (Top Parsers
   — only members with logged parses appear) is rendered LAST so its short
   height is harmless trailing space rather than a gap mid-grid. */
.stats-boards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  align-items: start;
  /* Backfill the gap a 2-column board (Maxed Jobs) can leave on a row. */
  grid-auto-flow: row dense;
}

.board {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.1rem 1.2rem 1.25rem;
}
.board > h3,
.board__head h3 {
  margin: 0 0 0.85rem;
  font-family: "EB Garamond", serif;
  font-size: 1.25rem;
  letter-spacing: 0.03em;
  color: var(--gold-bright);
}
.board__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}
.board__head h3 {
  margin: 0;
}
.board__select {
  background: var(--bg-1);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.35rem 0.5rem;
  font: inherit;
  font-size: 0.82rem;
  max-width: 55%;
}
.board__select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200, 170, 110, 0.15);
}

.board__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.board__row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-radius: 3px;
}
.board__row--plain {
  padding: 0.45rem 0.5rem;
}
.board__more {
  padding: 0.5rem 0.5rem 0.1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.board__rank {
  flex: 0 0 1.6rem;
  text-align: right;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Maxed Jobs board — a compact icon grid (icon + count) for every job at
   least one member has at level cap, instead of a truncated top-10 list. */
.maxed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 0.4rem;
}
.maxed-job {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  padding: 0.3rem 0.15rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.maxed-job__icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
}
.maxed-job__count {
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.1;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}
.maxed-job__abbr {
  font-size: 0.56rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* On desktop the Maxed Jobs board spans two columns so all ~30 jobs sit in a
   few wide rows at roughly the height of the single-column boards. On mobile
   (one column) it just stays full width. */
@media (min-width: 680px) {
  .board--maxed {
    grid-column: span 2;
  }
}

.board__link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.5rem;
  border-radius: 3px;
  color: inherit;
  text-decoration: none;
  transition:
    background 0.15s,
    transform 0.18s var(--ease);
}
.board__link:hover,
.board__link:focus-visible {
  background: rgba(200, 170, 110, 0.08);
  transform: translateX(3px);
  outline: none;
}

.board__avatar {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--border);
  transition:
    transform 0.18s var(--ease),
    border-color 0.18s var(--ease);
}
.board__link:hover .board__avatar,
.board__link:focus-visible .board__avatar {
  transform: scale(1.15);
  border-color: var(--gold);
}
.board__avatar--empty {
  display: inline-block;
  background: var(--bg-1);
}

.board__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.board__job {
  flex: 0 0 auto;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}
/* Fights-cleared badge shown in the Overall parser view, where a per-fight row
   shows the job. Tabular figures so the X/Y stays aligned down the column. */
.board__cover {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
}
.board__value {
  flex: 0 0 auto;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--gold);
}
/* When the value carries a parse-colour class, let that win over the gold. */
.board__value [class^="parse-"],
.board__value [class*=" parse-"] {
  font-weight: 600;
}

/* Touch: keep rows comfortably tappable. */
@media (pointer: coarse) {
  .board__link {
    min-height: 44px;
  }
  .board__select {
    min-height: 44px;
    font-size: 1rem;
  }
}
