/* Leaderboard page (pages/leaderboard.js): board tabs, period buttons, one dark glass table per board.
   Ranks 1 to 3 carry the teal accent (never gold: gold is the store's). Figures are tabular. */

.lb-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }

/* Board tabs: one row that scrolls sideways on narrow screens rather than wrapping. */
.lb-tabs { display: flex; gap: 2px; min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.lb-tabs::-webkit-scrollbar { display: none; }
.lb-tabs button {
    flex: none; padding: 12px 16px; border: 0; border-bottom: 2px solid transparent; background: transparent; cursor: pointer;
    font-family: var(--font-display); font-stretch: var(--display-stretch); font-weight: 900; font-size: 13px; letter-spacing: 0.04em;
    text-transform: uppercase; white-space: nowrap; color: var(--text-3);
}
.lb-tabs button:hover { color: var(--text); background: var(--panel-hover); }
.lb-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); background: var(--accent-tint); }

/* Period: a small segmented control. */
.lb-periods { display: flex; flex-wrap: wrap; border: 1px solid var(--line-strong); }
.lb-periods[hidden] { display: none; }
.lb-periods button {
    padding: 8px 12px; border: 0; border-right: 1px solid var(--line-strong); background: color-mix(in srgb, var(--obsidian) 70%, transparent); cursor: pointer;
    font-family: var(--font-body); font-weight: 800; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3);
}
.lb-periods button:last-child { border-right: 0; }
.lb-periods button:hover { color: var(--text); }
.lb-periods button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* ---------------------------------------------------------------- the table */

.lb-panel[hidden] { display: none; }
.lb-panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; padding: 18px 22px; border-bottom: 1px solid var(--panel-line-top); }
.lb-title { margin: 0; font-family: var(--font-display); font-stretch: var(--display-stretch); font-weight: 900; font-size: 22px; letter-spacing: 0.02em; text-transform: uppercase; }
.lb-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
.lb-table th, .lb-table td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--panel-line); }
.lb-table th:first-child, .lb-table td:first-child { padding-left: 22px; }
.lb-table th:last-child, .lb-table td:last-child { padding-right: 22px; }
.lb-table thead th { font-weight: 800; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-4); vertical-align: bottom; overflow-wrap: anywhere; }
.lb-table tbody tr:last-child td { border-bottom: 0; }
.lb-table tbody tr:not(.lb-msg):hover { background-color: var(--panel-hover); }
.lb-table .lb-rank { width: 76px; }
.lb-table .num { width: 120px; text-align: right; }
.lb-table td.num { font-weight: 700; font-size: 15px; color: var(--text-2); }
.lb-table td.is-primary { font-family: var(--font-display); font-stretch: var(--display-stretch); font-weight: 900; font-size: 16px; color: var(--text); }
.lb-table td.lb-player { font-weight: 700; font-size: 15px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-table td.lb-rank { font-family: var(--font-display); font-stretch: var(--display-stretch); font-weight: 900; font-size: 14px; color: var(--text-4); }

/* Ranks 1 to 3: a teal bar on the left, a teal tint fading right, the rank in a teal square. */
.lb-table tr.is-top { background-image: linear-gradient(90deg, color-mix(in srgb, var(--peacock-teal) 16%, transparent) 0%, transparent 60%); }
.lb-table tr.is-top-1 { background-image: linear-gradient(90deg, color-mix(in srgb, var(--peacock-teal) 26%, transparent) 0%, transparent 70%); }
.lb-table tr.is-top td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.lb-badge {
    display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 6px;
    border: 1px solid var(--accent); background: var(--accent-tint); color: var(--text);
}
.lb-table tr.is-top-1 .lb-badge { background: var(--accent); color: var(--accent-ink); }
.lb-table tr.is-top td.lb-player { font-weight: 800; }

/* Loading, empty and error rows. */
.lb-table tr.lb-msg td { padding: 40px 22px; text-align: center; font-weight: 700; font-size: 14px; color: var(--text-3); }
.lb-table tr.lb-msg.is-error td { color: var(--text); }

@media (max-width: 820px) {
    .lb-controls { flex-direction: column; flex-wrap: nowrap; align-items: stretch; } /* one line, so the tab strip takes the column's width and scrolls */
    .lb-tabs { margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); max-width: none; }
    .lb-periods { align-self: flex-start; }
}
@media (max-width: 520px) {
    .lb-table .is-extra { display: none; }
    .lb-table th, .lb-table td { padding: 12px 10px; }
    .lb-table th:first-child, .lb-table td:first-child { padding-left: 16px; }
    .lb-table th:last-child, .lb-table td:last-child { padding-right: 16px; }
    .lb-table .lb-rank { width: 52px; }
    .lb-table .num { width: 112px; }
    .lb-table thead th { letter-spacing: 0.08em; }
    .lb-panel-head { padding: 16px; }
    .lb-title { font-size: 18px; }
    .lb-periods { align-self: stretch; }
    .lb-periods button { flex: 1 1 auto; padding: 9px 8px; }
}

/* Player names link to their stats page. */
.lb-table td.lb-player a { color: var(--text); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 4px; transition: text-decoration-color 0.15s; }
.lb-table td.lb-player a:hover, .lb-table td.lb-player a:focus-visible { text-decoration-color: var(--accent); }
