        /* =====================================================
           DASHBOARD LAYOUT
           Mobile-first leaderboard / capture layout
        ===================================================== */

        .dashboard-grid {
            display: grid;
            grid-template-columns:
                minmax(0, 1.65fr)
                minmax(330px, .75fr);
            gap: 20px;
            align-items: start;
            margin-bottom: 22px;
        }

        .dashboard-main {
            min-width: 0;
        }

        .dashboard-main .live-section {
            margin-bottom: 20px;
        }

        .dashboard-main .game-section {
            margin-bottom: 0;
        }

        .dashboard-leaderboards {
            display: grid;
            gap: 16px;
            min-width: 0;
        }

        .dashboard-leaderboards
        .session-leaderboard,
        .dashboard-leaderboards
        .overall-leaderboard {
            margin: 0;
            border: 1px solid var(--border);
            background: rgba(23,23,26,.88);
            backdrop-filter: blur(10px);
        }

        .dashboard-leaderboards
        .session-leaderboard-title,
        .dashboard-leaderboards
        .overall-leaderboard-title {
            margin-bottom: 14px;
        }

        .record-section {
            margin-top: 0;
        }


        /*
         * At narrower desktop/tablet widths, stop forcing the
         * sidebar. The order remains:
         *
         * Live
         * Game
         * Session leaderboard
         * Overall leaderboard
         * Replay capture
         */
        @media (max-width: 900px) {

            .dashboard-grid {
                grid-template-columns: 1fr;
                gap: 14px;
            }

            .dashboard-leaderboards {
                gap: 10px;
            }
        }


        /* =====================================================
           MOBILE
        ===================================================== */

        @media (max-width: 700px) {

            main {
                width: calc(100% - 16px);
                max-width: 520px;
                padding: 14px 0 44px;
            }

            .header {
                margin-bottom: 18px;
                padding: 0 4px;
            }

            .title {
                font-size: 1.75rem;
            }

            .subtitle {
                margin-top: 5px;
                font-size: .88rem;
                line-height: 1.4;
            }


            /* ---------------- LIVE ---------------- */

            .dashboard-grid {
                gap: 10px;
                margin-bottom: 12px;
            }

            .dashboard-main .live-section {
                margin-bottom: 10px;
            }

            .live-header {
                margin-bottom: 9px;
                padding: 0 3px;
            }

            .section-title {
                font-size: 1.05rem;
            }

            .live-status {
                font-size: 10px;
            }

            .live-player {
                border-radius: 14px;
                box-shadow:
                    0 8px 28px rgba(0,0,0,.32);
            }


            /* ---------------- GAME ---------------- */

            .game-section {
                margin-bottom: 0;
                padding: 14px;
                border-radius: 16px;
                background:
                    rgba(23,23,26,.94);
            }

            .game-header {
                gap: 10px;
                margin-bottom: 14px;
            }

            .game-empty {
                gap: 12px;
            }

            .game-button {
                min-height: 46px;
                border-radius: 11px;
            }

            .game-type-buttons {
                gap: 8px;
                margin-bottom: 14px;
            }

            .game-round-buttons {
                gap: 7px;
            }

            .game-player-input {
                height: 46px;
            }

            .game-score-button {
                border-radius: 14px;
            }

            .game-score-number {
                font-size: clamp(
                    2rem,
                    12vw,
                    3rem
                );
            }


            /* ---------------- LEADERBOARD CARDS ---------------- */

            .dashboard-leaderboards {
                gap: 8px;
            }

            .dashboard-leaderboards
            .session-leaderboard,
            .dashboard-leaderboards
            .overall-leaderboard {
                padding: 0;
                border-radius: 15px;
                overflow: hidden;
                background:
                    rgba(26,26,30,.96);
                box-shadow:
                    0 5px 20px rgba(0,0,0,.16);
            }

            .session-leaderboard-title,
            .overall-leaderboard-title {
                min-height: 52px;
                margin: 0 !important;
                padding: 12px 14px;
                cursor: pointer;
                user-select: none;
                -webkit-tap-highlight-color:
                    transparent;
            }

            .session-leaderboard-title:active,
            .overall-leaderboard-title:active {
                background:
                    rgba(255,255,255,.04);
            }

            .session-leaderboard-title h3,
            .overall-leaderboard-title h3 {
                display: flex;
                align-items: center;
                gap: 7px;
                font-size: .96rem;
            }

            .session-leaderboard-title h3::after,
            .overall-leaderboard-title h3::after {
                content: "⌄";
                display: inline-block;
                color: var(--muted);
                font-size: 1rem;
                transition:
                    transform .18s ease;
            }

            .session-leaderboard:not(.mobile-collapsed)
            .session-leaderboard-title h3::after,

            .overall-leaderboard:not(.mobile-collapsed)
            .overall-leaderboard-title h3::after {
                transform: rotate(180deg);
            }

            .session-leaderboard-session {
                font-size: 10px;
            }

            .session-end-button {
                min-height: 32px;
                padding: 5px 9px;
                border-radius: 8px;
                font-size: 10px;
            }


            /*
             * This is the important space saver:
             * collapsed leaderboard = basically one compact bar.
             */
            .session-leaderboard.mobile-collapsed
            #session-leaderboard-content,

            .overall-leaderboard.mobile-collapsed
            #overall-leaderboard-content {
                display: none;
            }


            #session-leaderboard-content,
            #overall-leaderboard-content {
                overflow-x: auto;
                padding: 0 10px 11px;
                -webkit-overflow-scrolling: touch;
            }

            .session-leaderboard-table,
            .overall-leaderboard-table {
                min-width: 600px;
                font-size: 12px;
            }

            .session-leaderboard-table th,
            .session-leaderboard-table td,
            .overall-leaderboard-table th,
            .overall-leaderboard-table td {
                padding: 8px 6px;
            }


            /*
             * Old mobile CSS hid leaderboard columns.
             * When expanded, we want the full information
             * available by horizontal scrolling.
             */
            .overall-leaderboard-table
            th:nth-child(4),
            .overall-leaderboard-table
            td:nth-child(4),

            .session-leaderboard-table
            th:nth-child(3),
            .session-leaderboard-table
            td:nth-child(3) {
                display: table-cell;
            }

            .overall-leaderboard-empty,
            .session-leaderboard-empty {
                padding: 8px 3px;
                font-size: .84rem;
            }


            /* ---------------- REPLAY CAPTURE ---------------- */

            .record-section {
                margin-top: 0;
                padding: 14px;
                border-radius: 16px;
            }

            .record-section .section-title {
                margin-bottom: 11px;
            }

            .record-buttons {
                grid-template-columns:
                    repeat(2, minmax(0, 1fr));
                gap: 8px;
                margin-top: 12px;
            }

            .record-button {
                min-height: 60px;
                padding: 10px 8px;
                border-radius: 12px;
                font-size: 1rem;
                font-weight: 750;
            }

            .record-button:last-child {
                grid-column: 1 / -1;
            }


            /* ---------------- LIBRARY ---------------- */

            .library {
                margin-top: 18px;
            }

            .library-header {
                gap: 3px;
            }

            .tools {
                gap: 8px;
            }

            .replay-grid {
                gap: 12px;
            }

            .replay-card {
                border-radius: 15px;
            }
        }


        /* =====================================================
           LEADERBOARD CLEANUP
        ===================================================== */

        .overall-leaderboard-title h3,
        .session-leaderboard-title h3 {
            text-align: center;
        }

        .overall-leaderboard-table th,
        .overall-leaderboard-table td,
        .session-leaderboard-table th,
        .session-leaderboard-table td {
            text-align: center !important;
        }

        .overall-leaderboard-rank,
        .session-leaderboard-rank {
            text-align: center !important;
        }

        .overall-leaderboard-player,
        .session-leaderboard-player {
            text-align: center !important;
        }

        .overall-leaderboard-record,
        .session-leaderboard-record,
        .overall-leaderboard-winrate,
        .session-leaderboard-winrate,
        .overall-leaderboard-streak,
        .session-leaderboard-streak {
            text-align: center !important;
        }


        /* =====================================================
           MOBILE LEADERBOARD BUTTON
        ===================================================== */

        .mobile-leaderboard-open {
            display: none;
        }

        .mobile-leaderboard-overlay {
            display: none;
        }


        @media (max-width: 700px) {

            /*
             * Header button sits level with "Pool Replay".
             */
            .header {
                position: relative;
                padding-right: 54px;
            }

            .mobile-leaderboard-open {
                position: absolute;
                top: -2px;
                right: 2px;

                display: flex;
                align-items: center;
                justify-content: center;

                width: 44px;
                height: 44px;
                padding: 0;

                border: 1px solid
                    rgba(255,255,255,.09);

                border-radius: 13px;

                background:
                    rgba(255,255,255,.055);

                color: white;
                cursor: pointer;

                -webkit-tap-highlight-color:
                    transparent;
            }

            .mobile-leaderboard-open:active {
                transform: scale(.96);
                background:
                    rgba(255,255,255,.10);
            }

            .mobile-leaderboard-open svg {
                width: 23px;
                height: 23px;
                fill: currentColor;
            }


            /*
             * The original leaderboard sidebar is unnecessary
             * on mobile now. This means Capture Replay follows
             * directly after Game.
             */
            .dashboard-leaderboards {
                display: none !important;
            }


            /* ---------------- OVERLAY ---------------- */

            .mobile-leaderboard-overlay {
                position: fixed;
                inset: 0;
                z-index: 12000;

                display: block;
                overflow-y: auto;

                background:
                    radial-gradient(
                        circle at top,
                        rgba(118,87,255,.14),
                        transparent 360px
                    ),
                    #0d0d0f;

                color: var(--text);

                overscroll-behavior:
                    contain;

                -webkit-overflow-scrolling:
                    touch;
            }

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


            /*
             * Sticky means the Session/Overall selector and
             * close button remain on screen while leaderboard
             * results scroll underneath them.
             */
            .mobile-leaderboard-toolbar {
                position: sticky;
                top: 0;
                z-index: 5;

                display: flex;
                align-items: center;
                justify-content: space-between;
                gap: 12px;

                min-height: 68px;
                padding:
                    calc(10px + env(safe-area-inset-top))
                    14px
                    10px;

                border-bottom:
                    1px solid rgba(255,255,255,.07);

                background:
                    rgba(13,13,15,.88);

                backdrop-filter:
                    blur(18px);

                -webkit-backdrop-filter:
                    blur(18px);
            }


            /* ---------------- TABS ---------------- */

            .mobile-leaderboard-tabs {
                display: flex;
                align-items: center;
                gap: 4px;

                padding: 4px;

                border-radius: 12px;

                background:
                    rgba(255,255,255,.06);
            }

            .mobile-leaderboard-tab {
                min-height: 36px;
                padding: 0 13px;

                border-radius: 9px;

                background: transparent;
                color: var(--muted);

                font-size: 13px;
                font-weight: 750;

                cursor: pointer;

                transition:
                    background .15s ease,
                    color .15s ease;
            }

            .mobile-leaderboard-tab.active {
                background:
                    var(--surface-3);

                color: white;

                box-shadow:
                    0 2px 8px rgba(0,0,0,.22);
            }


            /* ---------------- CLOSE ---------------- */

            .mobile-leaderboard-close {
                flex: 0 0 auto;

                display: flex;
                align-items: center;
                justify-content: center;

                width: 40px;
                height: 40px;
                min-height: 40px;
                padding: 0;

                border-radius: 12px;

                background:
                    rgba(255,255,255,.07);

                color: white;

                font-size: 27px;
                font-weight: 300;
                line-height: 1;

                cursor: pointer;
            }

            .mobile-leaderboard-close:active {
                transform: scale(.95);
            }


            /* ---------------- BODY ---------------- */

            .mobile-leaderboard-body {
                width: 100%;
                max-width: 560px;

                margin: 0 auto;

                padding:
                    24px
                    12px
                    calc(
                        36px +
                        env(safe-area-inset-bottom)
                    );
            }

            .mobile-leaderboard-heading {
                padding: 4px 5px 20px;
                text-align: center;
            }

            .mobile-leaderboard-kicker {
                margin-bottom: 6px;

                color: var(--accent-hover);

                font-size: 11px;
                font-weight: 800;

                text-transform: uppercase;
                letter-spacing: .09em;
            }

            .mobile-leaderboard-heading h2 {
                margin: 0;

                font-size: 1.6rem;
                letter-spacing: -.025em;
            }

            .mobile-leaderboard-subtitle {
                min-height: 19px;

                margin-top: 7px;

                color: var(--muted);
                font-size: 12px;
            }


            /* ---------------- TABLE CARD ---------------- */

            .mobile-leaderboard-content {
                overflow: hidden;

                border:
                    1px solid rgba(255,255,255,.07);

                border-radius: 17px;

                background:
                    rgba(23,23,26,.92);

                box-shadow:
                    0 14px 40px rgba(0,0,0,.22);
            }

            .mobile-leaderboard-content
            .session-leaderboard-empty,

            .mobile-leaderboard-content
            .overall-leaderboard-empty {
                padding: 28px 16px;
                text-align: center;
            }

            /*
             * Let the table scroll sideways only if it truly
             * needs to, while keeping the overlay itself
             * vertically scrollable.
             */
            .mobile-leaderboard-content {
                overflow-x: auto;

                -webkit-overflow-scrolling:
                    touch;
            }

            .mobile-leaderboard-content
            .session-leaderboard-table,

            .mobile-leaderboard-content
            .overall-leaderboard-table {
                width: 100%;
                min-width: 560px;

                border-collapse: collapse;

                font-size: 12px;
            }

            .mobile-leaderboard-content
            th {
                padding: 12px 8px;

                color: var(--muted);

                font-size: 10px;
                font-weight: 750;

                text-transform: uppercase;
                letter-spacing: .04em;

                white-space: nowrap;
            }

            .mobile-leaderboard-content
            td {
                padding: 13px 8px;

                border-top:
                    1px solid rgba(255,255,255,.06);

                white-space: nowrap;
            }

            .mobile-leaderboard-content
            th,

            .mobile-leaderboard-content
            td {
                text-align:
                    center !important;
            }

            .mobile-leaderboard-content
            .player-profile-player {
                color: #fff;
                font-weight: 750;
            }

            .mobile-leaderboard-content
            .player-profile-player:active {
                opacity: .65;
            }


            /*
             * Undo the old column-hiding mobile rules.
             * In the overlay we want every leaderboard stat.
             */
            .mobile-leaderboard-content
            .overall-leaderboard-table
            th:nth-child(4),

            .mobile-leaderboard-content
            .overall-leaderboard-table
            td:nth-child(4),

            .mobile-leaderboard-content
            .session-leaderboard-table
            th:nth-child(3),

            .mobile-leaderboard-content
            .session-leaderboard-table
            td:nth-child(3) {
                display: table-cell !important;
            }
        }


        @media (max-width: 700px) {

            .mobile-leaderboard-content {
                overflow: hidden;
            }

            .mobile-summary-table {
                width: 100%;
                min-width: 0;
                table-layout: fixed;
                border-collapse: collapse;
                font-size: 12px;
            }

            .mobile-summary-table th,
            .mobile-summary-table td {
                padding: 12px 4px;
                text-align: center;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            .mobile-summary-table th {
                color: var(--muted);
                font-size: 9px;
                font-weight: 800;
                text-transform: uppercase;
                letter-spacing: .035em;
            }

            .mobile-summary-table td {
                border-top:
                    1px solid rgba(255,255,255,.06);
            }

            .mobile-summary-table th:nth-child(1),
            .mobile-summary-table td:nth-child(1) {
                width: 9%;
            }

            .mobile-summary-table th:nth-child(2),
            .mobile-summary-table td:nth-child(2) {
                width: 31%;
            }

            .mobile-summary-table th:nth-child(3),
            .mobile-summary-table td:nth-child(3) {
                width: 20%;
            }

            .mobile-summary-table th:nth-child(4),
            .mobile-summary-table td:nth-child(4) {
                width: 19%;
            }

            .mobile-summary-table th:nth-child(5),
            .mobile-summary-table td:nth-child(5) {
                width: 21%;
            }

            .mobile-leaderboard-player {
                max-width: 100%;
                padding: 0;
                background: none;
                color: white;
                font-weight: 800;
                cursor: pointer;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }

            .mobile-leaderboard-player:active {
                opacity: .6;
            }

            .mobile-leaderboard-rank {
                color: var(--muted);
                font-weight: 700;
            }

            .mobile-leaderboard-empty {
                padding: 30px 16px;
                text-align: center;
                color: var(--muted);
                font-size: .9rem;
            }
        }



