/* Leaderboards. Uses the theme's colours when it defines them, Bootstrap's otherwise. */
.lb {
  --lb-surface: var(--surface, var(--bs-tertiary-bg));
  --lb-border: var(--border, var(--bs-border-color));
  --lb-text: var(--text, var(--bs-body-color));
  --lb-muted: var(--text-muted, var(--bs-secondary-color));
  --lb-accent: var(--accent, var(--bs-primary));
}
.lb { --lb-gold: #f0c04a; --lb-silver: #c9d1dc; --lb-bronze: #cd7f3b; }
.lb-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.lb-kicker {
  display: flex; align-items: center; gap: 12px; margin: 0 0 6px; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em; color: var(--lb-accent);
}
.lb-kicker::after { content: ""; width: 56px; height: 1px; background: var(--lb-border); }
.lb-header h1 { margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.02em; }
.lb-header p { margin: 0; color: var(--lb-muted); font-size: 0.9rem; }
.lb-header .lb-kicker { color: var(--lb-accent); font-size: 0.72rem; margin-bottom: 6px; }

.lb-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.lb-pill {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; white-space: nowrap;
  padding: 5px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 600;
  color: var(--lb-muted); border: 1px solid var(--lb-border); background: var(--lb-surface);
}
.lb-pill:hover { color: var(--lb-text); border-color: var(--lb-accent); }
.lb-pill.is-active { color: var(--lb-text); border-color: var(--lb-accent); background: color-mix(in srgb, var(--lb-accent) 18%, var(--lb-surface)); }
.lb-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 14px; }

/* Game switch: two-or-more segments in one frame */
.lb-switch { display: inline-flex; padding: 3px; border: 1px solid var(--lb-border); border-radius: 6px; background: var(--lb-surface); }
.lb-switch a {
  padding: 5px 14px; border-radius: 4px; text-decoration: none; color: var(--lb-muted);
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
}
.lb-switch a:hover { color: var(--lb-text); }
.lb-switch a.is-active { background: var(--lb-accent); color: var(--accent-contrast, #fff); }

.lb-search {
  display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; margin-bottom: 18px;
  border: 1px solid var(--lb-border); border-radius: 8px; background: var(--lb-surface); color: var(--lb-muted);
}
.lb-search:focus-within { border-color: var(--lb-accent); }
.lb-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--lb-text); font-size: 0.92rem; }
.lb-search input::placeholder { color: var(--lb-muted); }
.lb-search .btn { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.72rem; font-weight: 700; }

/* Category tabs */
.lb-cats { display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; margin-bottom: 22px; border-bottom: 1px solid var(--lb-border); }
.lb-cats::-webkit-scrollbar { display: none; }
.lb-cats a {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; white-space: nowrap;
  text-decoration: none; color: var(--lb-muted); border-bottom: 2px solid transparent;
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
}
.lb-cats a:hover { color: var(--lb-text); }
.lb-cats a.is-active { color: var(--lb-text); border-bottom-color: var(--lb-accent); }
.lb-cats a.is-active .bi { color: var(--lb-accent); }

.lb-label { display: block; font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--lb-muted); }

/* Top three */
.lb-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; margin-bottom: 26px; }
.lb-top {
  --lb-medal: var(--lb-silver);
  padding: 18px; border-radius: 8px; background: var(--lb-surface);
  border: 1px solid color-mix(in srgb, var(--lb-medal) 55%, var(--lb-border));
}
.lb-top { grid-row: 1; }
.lb-top-1 { --lb-medal: var(--lb-gold); grid-column: 2; padding-top: 24px; padding-bottom: 24px; background: linear-gradient(180deg, color-mix(in srgb, var(--lb-gold) 9%, var(--lb-surface)), var(--lb-surface) 55%); }
.lb-top-2 { grid-column: 1; }
.lb-top-3 { --lb-medal: var(--lb-bronze); grid-column: 3; }
.lb-top header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.lb-top-rank { font-size: 1.7rem; font-weight: 800; line-height: 1; color: var(--lb-medal); font-variant-numeric: tabular-nums; }
.lb-top-1 .lb-top-rank { font-size: 2rem; }
.lb-top-go { color: var(--lb-muted); text-decoration: none; font-size: 1.1rem; }
.lb-top-go:hover { color: var(--lb-text); }
.lb-top-who { display: flex; align-items: center; gap: 12px; min-width: 0; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--lb-border); }
.lb-top-who img, .lb-top-who .lb-initial { width: 44px; height: 44px; border-radius: 6px; flex-shrink: 0; object-fit: cover; }
.lb-top-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--lb-text); text-decoration: none; }
a.lb-top-name:hover { color: var(--lb-accent); }
.lb-top-score { display: block; font-size: 2.4rem; font-weight: 800; line-height: 1.1; color: var(--lb-medal); font-variant-numeric: tabular-nums; }
.lb-top-1 .lb-top-score { font-size: 2.8rem; }
.lb-top-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.lb-top-stats > div { padding: 8px 10px; border: 1px solid var(--lb-border); border-radius: 5px; min-width: 0; }
.lb-top-value { display: block; margin-top: 3px; font-weight: 700; color: var(--lb-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb-top-stats .lb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lb-board { background: var(--lb-surface); border: 1px solid var(--lb-border); border-radius: 10px; overflow: hidden; }
.lb-scroll { overflow-x: auto; }
.lb-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.lb-table th, .lb-table td { padding: 11px 9px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--lb-border); }
.lb-table th:last-child, .lb-table td:last-child { padding-right: 16px; }
.lb-table tbody tr:last-child td { border-bottom: none; }
.lb-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; color: var(--lb-muted); }
.lb-table th a { color: inherit; text-decoration: none; }
.lb-table th a:hover { color: var(--lb-text); }
.lb-table th.is-sorted, .lb-table th.is-sorted a { color: var(--lb-accent); }
.lb-table td.is-sorted { color: var(--lb-accent); font-weight: 700; }
.lb-table td { color: var(--lb-muted); }
.lb-table .lb-rank { text-align: left; width: 64px; padding-left: 18px; font-weight: 600; color: var(--lb-muted); }
.lb-table .lb-player { text-align: left; }
.lb-table tbody tr:hover td { background: color-mix(in srgb, var(--lb-text) 4%, transparent); }
.lb-rank-1 .lb-rank { color: #f5c542; }
.lb-rank-2 .lb-rank { color: #c8d0da; }
.lb-rank-3 .lb-rank { color: #d08b4f; }
.lb-who { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--lb-text); font-weight: 600; text-decoration: none; }
a.lb-who:hover { color: var(--lb-accent); }
.lb-who img, .lb-initial { width: 28px; height: 28px; border-radius: 5px; flex-shrink: 0; object-fit: cover; }
.lb-initial {
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700;
  color: var(--lb-muted); background: color-mix(in srgb, var(--lb-text) 10%, transparent);
}
.lb-who span.lb-name { overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.lb-note { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin: 10px 2px 18px; font-size: 0.85rem; color: var(--lb-muted); }
.lb-empty { padding: 34px 20px; text-align: center; color: var(--lb-muted); }

/* Stat tiles on a member's profile */
.lb-profile-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin: 0 0 12px; }
.lb-profile-title h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.08em; margin: 0; }
.lb-profile-title span { font-size: 0.8rem; color: var(--lb-muted); }
.lb-profile-game + .lb-profile-game { margin-top: 22px; }
.lb-profile-cat { margin: 14px 0 8px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--lb-muted); }
.lb-profile-cat .bi { color: var(--lb-accent); }
.lb-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.lb-tile {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px;
  border: 1px solid var(--lb-border); border-radius: 8px; background: color-mix(in srgb, var(--lb-text) 3%, transparent);
}
.lb-tile > div { min-width: 0; }
.lb-tile-value { font-size: 1.25rem; font-weight: 700; line-height: 1.15; white-space: nowrap; color: var(--lb-text); font-variant-numeric: tabular-nums; }
.lb-tile-label { font-size: 0.8rem; color: var(--lb-muted); }
.lb-tile-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 6px; flex-shrink: 0;
  color: var(--lb-accent); background: color-mix(in srgb, var(--lb-accent) 14%, transparent); font-size: 1.1rem;
}

@media (max-width: 860px) {
  .lb-podium { grid-template-columns: minmax(0, 1fr); }
  .lb-top, .lb-top-1, .lb-top-2, .lb-top-3 { grid-column: 1; grid-row: auto; }
  .lb-top-score, .lb-top-1 .lb-top-score { font-size: 2rem; }
}
@media (max-width: 575px) {
  .lb-table th, .lb-table td { padding: 9px 10px; }
  .lb-who span.lb-name { max-width: 130px; }
}

/* View picker (current / past wipes or seasons / all time) */
.lb-view { min-width: 230px; }
.lb-view .lb-label { margin-bottom: 5px; }
.lb-view-row { display: flex; gap: 6px; }
.lb-view-hint { display: block; margin-top: 5px; font-size: 0.78rem; color: var(--lb-muted); }

/* "Your rank" line */
.lb-you {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px; margin-bottom: 16px;
  border-radius: 8px; border: 1px solid color-mix(in srgb, var(--lb-accent) 55%, var(--lb-border));
  background: color-mix(in srgb, var(--lb-accent) 9%, var(--lb-surface));
}
.lb-you-tag {
  padding: 2px 8px; border-radius: 4px; background: var(--lb-accent); color: var(--accent-contrast, #fff);
  font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em;
}
.lb-you-rank { font-size: 1.15rem; font-weight: 800; color: var(--lb-text); font-variant-numeric: tabular-nums; }
.lb-you-text { flex: 1; min-width: 200px; color: var(--lb-text); font-size: 0.92rem; }
.lb-you-stats { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-left: auto; font-variant-numeric: tabular-nums; color: var(--lb-muted); }
.lb-you-stats > span { text-align: right; }
.lb-you-stats .is-sorted { color: var(--lb-accent); font-weight: 700; }

/* A player's own page */
.lb-playerpage { max-width: 1100px; margin: 0 auto; }
.lb-player-head { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.lb-player-head .lb-initial { width: 84px; height: 84px; border-radius: 8px; font-size: 2rem; flex-shrink: 0; }
.lb-player-head h1 { margin: 0 0 6px; overflow-wrap: anywhere; }
.lb-player-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; color: var(--lb-muted); font-size: 0.9rem; }
.lb-player-meta a { color: var(--lb-muted); text-decoration: none; }
.lb-player-meta a:hover { color: var(--lb-accent); }
.lb-claim {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; padding: 18px 20px; margin-bottom: 20px;
  border-radius: 8px; border: 1px solid color-mix(in srgb, var(--lb-accent) 55%, var(--lb-border));
  background: color-mix(in srgb, var(--lb-accent) 9%, var(--lb-surface));
}
.lb-claim > div { flex: 1; min-width: 240px; }
.lb-claim strong { display: block; font-size: 1.05rem; color: var(--lb-text); margin-bottom: 4px; }
.lb-claim p { margin: 0; color: var(--lb-muted); font-size: 0.92rem; }
.lb-player-stats { padding: 20px 22px; margin-bottom: 20px; overflow: visible; }
@media (max-width: 575px) {
  .lb-you-stats { margin-left: 0; }
  .lb-view { width: 100%; }
}
img.lb-initial { object-fit: cover; }
.lb-profile-visibility { display: flex; align-items: center; gap: 10px; margin: -4px 0 10px; font-size: 0.82rem; color: var(--lb-muted); }
.lb-profile-visibility .btn { padding: 1px 10px; font-size: 0.78rem; }

/* Groups (clans…) on the board */
.lb-members { margin-left: 8px; color: var(--lb-muted); font-size: 0.8rem; white-space: nowrap; }
.lb-top-members { margin: -6px 0 12px; color: var(--lb-muted); font-size: 0.85rem; }
.lb-table tr.lb-mine td { background: color-mix(in srgb, var(--lb-accent) 10%, transparent); }
.lb-table tr.lb-mine td:first-child { box-shadow: inset 3px 0 0 var(--lb-accent); }

/* Wipe / season trophies */
.lb-trophies { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.lb-trophy { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--lb-border); border-radius: 6px; min-width: 0; }
.lb-trophy > .bi { font-size: 1.4rem; flex-shrink: 0; color: var(--lb-muted); }
.lb-trophy-1 > .bi { color: var(--lb-gold); }
.lb-trophy-3 > .bi { color: var(--lb-bronze); }
.lb-trophy strong { display: block; color: var(--lb-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-trophy span { display: block; color: var(--lb-muted); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-trophy > div { min-width: 0; }

/* Members who keep their stats off the public board (shown to them and to staff only) */
.lb-private { margin-left: 8px; padding: 1px 7px; border: 1px dashed var(--lb-border); border-radius: 999px; color: var(--lb-muted); font-size: 0.72rem; white-space: nowrap; }
.lb-private-note { margin: 0 0 12px; color: var(--lb-muted); font-size: 0.88rem; }

/* Links under the board */
.lb-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 14px 2px 4px; font-size: 0.88rem; }
.lb-links a { color: var(--lb-muted); text-decoration: none; }
.lb-links a:hover { color: var(--lb-accent); }

/* Head to head */
.lb-compare-pick { display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: end; gap: 12px; margin-bottom: 18px; }
.lb-compare-pick .lb-label { display: block; margin-bottom: 5px; }
.lb-compare-vs { align-self: center; font-weight: 800; letter-spacing: 0.08em; color: var(--lb-muted); }
.lb-compare-pick .lb-compare-vs { padding-bottom: 8px; align-self: end; }
.lb-compare { padding: 0 0 8px; }
.lb-compare-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 20px; border-bottom: 1px solid var(--lb-border); }
.lb-compare-side { display: flex; align-items: center; gap: 14px; min-width: 0; }
.lb-compare-b { flex-direction: row-reverse; text-align: right; }
.lb-compare-side > div { min-width: 0; }
.lb-compare-side .lb-initial { width: 64px; height: 64px; border-radius: 8px; font-size: 1.5rem; flex-shrink: 0; }
.lb-compare-name { font-size: 1.15rem; font-weight: 800; color: var(--lb-text); text-decoration: none; overflow-wrap: anywhere; }
a.lb-compare-name:hover { color: var(--lb-accent); }
.lb-compare-sub, .lb-compare-wins { display: block; color: var(--lb-muted); font-size: 0.82rem; }
.lb-compare-side.is-ahead .lb-compare-wins { color: var(--lb-gold); font-weight: 700; }
.lb-compare-cat { margin: 16px 20px 6px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--lb-muted); }
.lb-compare-cat .bi { color: var(--lb-accent); }
.lb-compare-row { display: grid; grid-template-columns: 1fr minmax(110px, auto) 1fr; align-items: center; gap: 12px; padding: 9px 20px; border-top: 1px solid color-mix(in srgb, var(--lb-border) 60%, transparent); font-variant-numeric: tabular-nums; }
.lb-compare-stat { text-align: center; color: var(--lb-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }
.lb-compare-value { font-size: 1.05rem; font-weight: 700; color: var(--lb-muted); }
.lb-compare-value:last-child { text-align: right; }
.lb-compare-value.is-better { color: var(--lb-accent); }
.lb-compare-with { max-width: 460px; margin: 18px 0; }
.lb-compare-with .lb-label { display: block; margin-bottom: 6px; }

/* Wipe / season recaps */
.lb-recaps { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-bottom: 18px; }
.lb-recap-card { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border: 1px solid var(--lb-border); border-radius: 10px; background: var(--lb-surface); color: var(--lb-text); text-decoration: none; }
.lb-recap-card:hover { border-color: var(--lb-accent); color: var(--lb-text); }
.lb-recap-card strong { font-size: 1.3rem; }
.lb-recap-dates { color: var(--lb-muted); font-size: 0.85rem; }
.lb-recap-champion { margin-top: 6px; font-weight: 600; }
.lb-recap-champion .bi { color: var(--lb-gold); }
.lb-recap-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.lb-recap-totals { margin-bottom: 18px; }
.lb-recap-cat { padding: 18px 20px; margin-bottom: 16px; }
.lb-recap-cat h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 14px; }
.lb-recap-cat h2 .bi { color: var(--lb-accent); }
.lb-recap-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px 28px; }
.lb-recap-cols .lb-label { margin-bottom: 8px; }
.lb-recap-place { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid color-mix(in srgb, var(--lb-border) 60%, transparent); min-width: 0; }
.lb-recap-place > .bi { font-size: 1.1rem; color: var(--lb-muted); flex-shrink: 0; }
.lb-recap-place.lb-trophy-1 > .bi { color: var(--lb-gold); }
.lb-recap-place.lb-trophy-3 > .bi { color: var(--lb-bronze); }
.lb-recap-place .lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--lb-text); text-decoration: none; font-weight: 600; }
.lb-recap-place a.lb-name:hover { color: var(--lb-accent); }
.lb-recap-score { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--lb-text); }
a.lb-trophy { text-decoration: none; }
a.lb-trophy:hover { border-color: var(--lb-accent); }
@media (max-width: 720px) {
  .lb-compare-pick { grid-template-columns: 1fr; }
  .lb-compare-pick .lb-compare-vs { display: none; }
  .lb-compare-head { grid-template-columns: 1fr; }
  .lb-compare-head .lb-compare-vs { justify-self: center; }
  .lb-compare-b { flex-direction: row; text-align: left; }
}
