/* Top page (/top): the ranking list. The page frame, the filter panel, the buttons and the
   paginator are the Checklist's (garam_checklist.css); Onix / Ash come from its --check-* tokens. */
.garam-top-page .top-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* The order select looks like the two fields next to it. */
.garam-top-page .top-filters select {
    display: block; width: 100%; min-width: 0; height: 45px; margin: 0; padding: 10px 12px;
    border: 1px solid var(--garam-c-b7d8ed, #b7d8ed); border-radius: 13px; background-color: var(--check-soft);
    color: var(--check-ink); font: inherit; font-weight: 500; font-size: 14px; box-shadow: none; outline: none; cursor: pointer;
}
.garam-top-page .top-filters select:focus-visible { outline: 2px solid var(--garam-c-51a8e8, #51a8e8); outline-offset: 1px; }

/* Leaderboard / My leaderboards. */
.top-views { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.top-view {
    display: inline-flex; align-items: center; min-height: 42px; padding: 8px 16px; border-radius: 13px;
    border: 1px solid var(--garam-c-a9cfea, #a9cfea); background: #fff; color: var(--garam-c-155a8d, #155a8d);
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.top-view:hover { background: var(--garam-c-e5f5ff, #e5f5ff); }
.top-view[aria-pressed="true"] { border-color: var(--garam-c-0764a6, #0764a6); background: var(--garam-c-087cce, #087cce); color: #fff; }
.top-view:focus-visible, .top-board-open:focus-visible, .top-person:focus-visible { outline: 3px solid var(--check-accent); outline-offset: 2px; }

.garam-top-page .checklist-results-heading { flex-wrap: wrap; gap: 4px 16px; align-items: baseline; margin-bottom: 10px; }
.top-heading { margin: 0; color: var(--check-ink); font-size: clamp(20px, 2.6vw, 28px); font-weight: 700; letter-spacing: -.03em; line-height: 1.2; overflow-wrap: anywhere; }
.top-count { margin: 0; color: var(--garam-c-096dae, #096dae); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

.top-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; transition: opacity .2s ease; }
.top-row, .top-board-open {
    display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 12px;
}
.top-row {
    min-height: 64px; padding: 10px 18px 10px 10px; background: #fff; border: 1px solid var(--check-border); border-radius: 18px;
    box-shadow: 0 8px 20px rgba(21, 99, 153, .07);
}
.top-row.is-you { border-color: var(--check-accent); box-shadow: 0 0 0 2px var(--check-accent), 0 8px 20px rgba(21, 99, 153, .1); }
/* A board row is one big button. */
.top-board-row { display: block; padding: 0; }
.top-board-open {
    width: 100%; min-height: 62px; padding: 10px 18px 10px 10px; border: 0; border-radius: 17px; background: transparent;
    color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.top-board-open:hover { background: var(--check-soft); }

.top-rank { justify-self: center; color: var(--check-muted); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.top-rank.is-medal { font-size: 28px; line-height: 1; }
.top-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.top-person { display: inline-flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%; color: var(--check-ink); text-decoration: none; border-radius: 10px; }
a.top-person:hover .top-name { text-decoration: underline; }
.top-avatar { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; object-fit: cover; background: var(--garam-c-caeaff, #caeaff); }
.top-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--check-ink); font-size: 15px; font-weight: 600; }
.top-name.is-private { color: var(--check-muted); font-style: italic; font-weight: 500; }
.top-you-tag { flex-shrink: 0; padding: 2px 8px; border-radius: 99px; background: var(--check-accent); color: #fff; font-size: 12px; font-weight: 600; }
.top-sub { color: var(--check-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.top-person + .top-sub { padding-left: 50px; }

.top-stats { display: flex; align-items: center; justify-content: flex-end; gap: 6px 18px; flex-wrap: wrap; }
.top-stat { display: inline-flex; align-items: baseline; gap: 5px; color: var(--check-muted); white-space: nowrap; }
.top-stat strong { color: var(--check-ink); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.top-stat.is-main strong { font-size: 17px; font-weight: 700; }
.top-stat small { font-size: 12px; }
/* The Garamies coin after a value. */
.top-coin { width: 18px; height: 18px; flex: 0 0 18px; object-fit: contain; align-self: center; }
.top-stat.is-main .top-coin { width: 20px; height: 20px; flex-basis: 20px; }
.top-progress { min-width: 62px; padding: 4px 10px; border-radius: 99px; background: var(--check-soft); color: var(--check-ink);
    font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; }
.top-progress.is-all { background: #fff3d1; color: #6d4b00; }

/* Your place, above the list. */
.top-you { display: flex; align-items: center; gap: 14px; margin-top: 17px; }
.top-you-label { flex-shrink: 0; color: var(--check-ink); font-size: 14px; font-weight: 600; }
.top-you-row { flex: 1; min-width: 0; }
.top-you-none { margin: 0; padding: 12px 16px; border-radius: 14px; background: #fff; border: 1px dashed var(--check-border); color: var(--check-muted); font-size: 14px; width: 100%; }

.top-empty { display: flex; flex-direction: column; gap: 6px; padding: 55px 15px; border: 1px dashed var(--check-border); border-radius: 17px;
    text-align: center; color: var(--check-muted); font-size: 14px; }
.top-empty strong { color: var(--check-ink); font-size: 16px; font-weight: 600; }
.top-empty + .top-row { margin-top: 0; }

html[data-garam-mode="dark"] .top-row,
html[data-garam-mode="dark"] .top-you-none { background: var(--garam-dark-panel, #23242a); border-color: var(--garam-dark-border, #45464d); }
html[data-garam-mode="dark"] .top-row.is-you { border-color: var(--check-accent); }
html[data-garam-mode="dark"] .top-view:not([aria-pressed="true"]) { background: var(--garam-dark-raised, #34353c); color: var(--garam-dark-text, #f3f4f7);
    border-color: var(--garam-dark-border, #45464d); }
html[data-garam-mode="dark"] .garam-top-page .top-filters select { background-color: var(--garam-dark-raised, #34353c); color: var(--garam-dark-text, #f3f4f7);
    border-color: var(--garam-dark-border, #45464d); }
/* Filled with the accent in the light themes; the dark accent is close to white, so these get dark-theme surfaces. */
html[data-garam-mode="dark"] .top-view[aria-pressed="true"] { background: var(--garam-dark-hover, #3d3e46); border-color: var(--garam-theme-ui-accent, #c8cad2);
    color: var(--garam-dark-text, #f3f4f7); }
html[data-garam-mode="dark"] .top-you-tag { background: var(--garam-dark-text, #f3f4f7); color: var(--garam-dark-panel, #23242a); }
html[data-garam-mode="dark"] .top-progress.is-all { background: rgb(227 160 8 / 16%); color: #f1c76a; }
html[data-garam-mode="dark"] .top-empty strong { color: var(--garam-dark-text, #f3f4f7); }

@media (max-width: 740px) {
    .garam-top-page .top-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .garam-top-page .top-filters .checklist-filter-field:last-child { grid-column: 1 / -1; }
    .top-row, .top-board-open { grid-template-columns: 44px minmax(0, 1fr); gap: 4px 10px; padding: 10px 12px 10px 6px; }
    .top-row.top-board-row { padding: 0; }
    /* The figures go under the name. */
    .top-stats { grid-column: 2; justify-content: flex-start; gap: 4px 14px; }
    .top-rank.is-medal { font-size: 24px; }
    .top-avatar { width: 34px; height: 34px; flex-basis: 34px; }
    .top-person + .top-sub { padding-left: 44px; }
    .top-you { flex-direction: column; align-items: stretch; gap: 6px; }
    .top-views .top-view { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .top-list { transition: none; } }
