/* =========================================================
   V13 — DESKTOP LEADERBOARD OVERLAY
   Mobile rules below 700px remain unchanged.
========================================================= */
@media (min-width: 701px) {
    /* Leaderboards no longer occupy the permanent desktop sidebar. */
    .dashboard-grid {
        grid-template-columns: minmax(0, 1fr);
        max-width: 1180px;
        margin-left: auto;
        margin-right: auto;
    }

    .dashboard-leaderboards {
        display: none !important;
    }

    /* Reuse the existing leaderboard trigger, but make it a proper desktop button. */
    .header {
        position: relative;
        padding-right: 170px;
    }

    .mobile-leaderboard-open {
        position: absolute;
        top: 0;
        right: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 9px;
        width: auto;
        min-width: 148px;
        height: 42px;
        padding: 0 15px;
        border: 1px solid rgba(255,255,255,.10);
        border-radius: 12px;
        background: rgba(255,255,255,.055);
        color: var(--text);
        font: inherit;
        font-weight: 800;
        cursor: pointer;
        transition: background .16s ease, border-color .16s ease, transform .16s ease;
    }

    .mobile-leaderboard-open:hover {
        background: rgba(255,255,255,.09);
        border-color: rgba(255,255,255,.16);
        transform: translateY(-1px);
    }

    .mobile-leaderboard-open svg {
        width: 19px;
        height: 19px;
        fill: currentColor;
        flex: 0 0 auto;
    }

    .leaderboard-open-label {
        display: inline;
    }

    /*
     * Same DOM + same JS as mobile, but presented as a centered
     * desktop modal rather than a full-screen phone sheet.
     */
    .mobile-leaderboard-overlay {
        position: fixed;
        inset: 0;
        z-index: 1600;
        display: flex;
        flex-direction: column;
        width: min(960px, calc(100vw - 64px));
        height: min(760px, calc(100vh - 64px));
        margin: auto;
        overflow: hidden;
        border: 1px solid rgba(255,255,255,.12);
        border-radius: 20px;
        background: rgba(18,18,21,.985);
        box-shadow: 0 30px 90px rgba(0,0,0,.58);
        backdrop-filter: blur(18px);
    }

    .mobile-leaderboard-overlay.hidden {
        display: none !important;
    }

    /* Dim the page around the desktop modal. */
    .mobile-leaderboard-overlay::before {
        content: "";
        position: fixed;
        inset: 0;
        z-index: -1;
        background: rgba(0,0,0,.58);
        backdrop-filter: blur(3px);
    }

    .mobile-leaderboard-toolbar {
        display: flex;
        align-items: center;
        gap: 16px;
        flex: 0 0 auto;
        padding: 16px 18px;
        border-bottom: 1px solid rgba(255,255,255,.08);
        background: rgba(255,255,255,.025);
    }

    .mobile-leaderboard-tabs {
        display: flex;
        gap: 8px;
        flex: 1;
        min-width: 0;
    }

    .mobile-leaderboard-tab {
        min-width: 128px;
        height: 40px;
        padding: 0 18px;
        border: 1px solid rgba(255,255,255,.08);
        border-radius: 10px;
        background: transparent;
        color: var(--muted);
        font: inherit;
        font-weight: 800;
        cursor: pointer;
    }

    .mobile-leaderboard-tab.active {
        background: rgba(255,255,255,.09);
        border-color: rgba(255,255,255,.15);
        color: var(--text);
    }

    .mobile-leaderboard-close {
        display: grid;
        place-items: center;
        width: 40px;
        height: 40px;
        padding: 0;
        border: 1px solid rgba(255,255,255,.09);
        border-radius: 10px;
        background: rgba(255,255,255,.04);
        color: var(--text);
        font-size: 26px;
        line-height: 1;
        cursor: pointer;
    }

    .mobile-leaderboard-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
        padding: 24px 28px 30px;
    }

    .mobile-leaderboard-heading {
        display: grid;
        grid-template-columns: minmax(0,1fr) auto;
        column-gap: 20px;
        align-items: end;
        margin-bottom: 20px;
    }

    .mobile-leaderboard-kicker,
    .mobile-leaderboard-heading h2,
    .mobile-leaderboard-subtitle {
        grid-column: 1;
    }

    .mobile-session-history-button {
        grid-column: 2;
        grid-row: 1 / span 3;
        align-self: center;
        min-height: 38px;
        padding: 0 14px;
    }

    .mobile-leaderboard-content {
        width: 100%;
    }

    .mobile-summary-table {
        width: 100%;
        border-collapse: collapse;
    }

    .mobile-summary-table th,
    .mobile-summary-table td {
        padding: 11px 12px;
        border-bottom: 1px solid rgba(255,255,255,.065);
    }

    .mobile-summary-table th {
        position: sticky;
        top: 0;
        z-index: 1;
        background: rgba(18,18,21,.98);
    }
}

/* Mobile stays visually identical: icon-only header control. */
@media (max-width: 700px) {
    .leaderboard-open-label {
        display: none;
    }
}




