.leaderboard {
    width: 50%;
    margin: 40px auto;
    padding: 12px;
    background: rgba(42, 53, 67, 0.9);
    border-radius: 14px;
    backdrop-filter: blur(10px);
    box-shadow:
        0 0 0 1px rgba(56, 189, 248, 0.15),
        0 20px 40px rgba(0, 0, 0, 0.6);
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    color: #e5e7eb;
    font-size: 0.95rem;
}

.leaderboard-table thead {
    background: linear-gradient(
        90deg,
        rgba(0, 242, 254, 0.15),
        rgba(129, 1, 255, 0.15)
    );
}

.leaderboard-table thead th {
    padding: 14px 16px;
    text-align: center;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #7dd3fc;
}

.leaderboard-table thead th:first-child {
    border-top-left-radius: 10px;
}

.leaderboard-table thead th:last-child {
    border-top-right-radius: 10px;
}

.leaderboard-table tbody tr {
    transition: background 0.2s ease, transform 0.15s ease;
}

.leaderboard-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

.leaderboard-table tbody tr:hover {
    background: rgba(0, 242, 254, 0.12);
    transform: scale(1.01);
}

.leaderboard-table th {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-right: 1px solid rgba(255, 255, 255, 0.15);
}
.leaderboard-table th:last-child {
    border-right: none;
}


.rank {
    font-weight: 800;
    color: #777777;

}
.rank[data-rank="1"] {
    color: #fbe300;
    text-shadow: 0 0 15px rgba(236, 255, 0, 0.53);
}

.rank[data-rank="2"] {
    color: #a3b7bd;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.53);
}

.rank[data-rank="3"] {
    color: #cd7f32;
    text-shadow: 0 0 15px rgba(255, 77, 0, 0.53);
}

.username {
    font-weight: 600;
}

.elo {
    text-align: center;
    font-weight: 700;
    color: #00f2fe;

}

    .filter-group {
        display: flex;
        gap: 8px;
        justify-content: center;
        flex-wrap: wrap;
    }

    .filter-btn {
        padding: 7px 18px;
        border: 1px solid rgba(56, 189, 248, 0.3);
        border-radius: 8px;
        background: rgba(255,255,255,0.05);
        color: #94a3b8;
        font-size: 0.85rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        cursor: pointer;
        transition: background 0.15s, color 0.15s, border-color 0.15s;
    }

    .filter-btn:hover {
        background: rgba(0, 242, 254, 0.12);
        color: #e2e8f0;
    }

    .filter-btn.active {
        background: rgba(0, 242, 254, 0.18);
        border-color: rgba(0, 242, 254, 0.6);
        color: #00f2fe;
    }

    .filter-btn.disabled, .filter-btn:disabled {
        opacity: 0.35;
        cursor: not-allowed;
        pointer-events: none;
    }

    #my-rank-tfoot {
        position: sticky;
        bottom: 0;
        z-index: 2;
    }

    #my-rank-tfoot tr {
        cursor: pointer;
        transition: background 0.2s ease;
    }

    #my-rank-tfoot tr th {
        background-color: #2a3543;
        border-top: none;
        border-bottom: none;
        border-left: none;
        border-right: 1px solid rgba(255, 255, 255, 0.15);
        position: relative;
        z-index: 1;
        transition: background-color 0.2s ease;
    }

    /* ::before extends 1px past the right edge to paint cyan over the border-right corners */
    #my-rank-tfoot tr th::before {
        content: '';
        position: absolute;
        top: 0; bottom: 0; left: 0;
        right: -1px;
        pointer-events: none;
        box-shadow: inset 0 2px 0 0 #00f2fe, inset 0 -2px 0 0 #00f2fe;
        z-index: 1;
    }

    /* Stacking order: earlier cells sit above their right neighbour so ::before is visible */
    #my-rank-tfoot tr th:first-child {
        border-radius: 8px 0 0 8px;
        z-index: 3;
    }

    #my-rank-tfoot tr th:nth-child(2) {
        z-index: 2;
    }

    #my-rank-tfoot tr th:first-child::before {
        border-radius: 8px 0 0 8px;
        box-shadow: inset 2px 2px 0 0 #00f2fe, inset 2px -2px 0 0 #00f2fe;
    }

    #my-rank-tfoot tr th:last-child {
        border-radius: 0 8px 8px 0;
        border-right: none;
    }

    #my-rank-tfoot tr th:last-child::before {
        right: 0;
        border-radius: 0 8px 8px 0;
        box-shadow: inset -2px 2px 0 0 #00f2fe, inset -2px -2px 0 0 #00f2fe;
    }

    #my-rank-tfoot tr:hover th {
        background-color: #264856;
    }

    @keyframes row-flash {
        0%   { box-shadow: inset 0 0 0 9999px rgba(0, 242, 254, 0.25); outline: 1px solid rgba(0, 242, 254, 0.7); }
        100% { box-shadow: inset 0 0 0 9999px rgba(0, 242, 254, 0); outline: 1px solid rgba(0, 242, 254, 0); }
    }

    tr.my-row-flash {
        animation: row-flash 2s ease-out forwards;
    }

    .search-wrapper {
        position: relative;
        width: 100%;
        max-width: 300px;
    }

    #search-input {
        width: 100%;
        padding: 8px 14px;
        background: rgba(255,255,255,0.05);
        border: 1px solid rgba(56, 189, 248, 0.3);
        border-radius: 8px;
        color: #e5e7eb;
        font-size: 0.9rem;
        outline: none;
        transition: border-color 0.15s;
        box-sizing: border-box;
    }

    #search-input:focus {
        border-color: rgba(0, 242, 254, 0.6);
    }

    #search-input::placeholder {
        color: #64748b;
    }

    #search-dropdown {
        position: absolute;
        top: calc(100% + 4px);
        left: 0; right: 0;
        background: rgba(30, 40, 54, 0.97);
        border: 1px solid rgba(56, 189, 248, 0.25);
        border-radius: 8px;
        overflow: hidden;
        z-index: 100;
        box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    }

    .search-result-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 14px;
        cursor: pointer;
        transition: background 0.15s;
        color: #e5e7eb;
        font-size: 0.9rem;
    }

    .search-result-item:hover {
        background: rgba(0, 242, 254, 0.12);
    }

    .search-result-rank {
        color: #64748b;
        font-size: 0.8rem;
    }

    .search-result-elo {
        color: #00f2fe;
        font-weight: 700;
        font-size: 0.85rem;
    }