.leaderboard-overlay {
    align-items: center;
    background: #000000a3;
    bottom: 0;
    display: flex;
    justify-content: center;
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
    overflow: hidden; /* Prevent scrolling */
}

/* Prevent body scroll when leaderboard is open */
body.leaderboard-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInScale {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.leaderboard-modal {
    align-items: center;
    display: flex;
    flex-direction: column;
    /* height: 580px; */
    padding: 24px;
    position: relative;
    width: 600px;
    overflow: hidden;
    border-radius: 24px;
    background: var(--bg-secondary);
    box-shadow: 1px 0 4px 0 rgba(0, 0, 0, 0.25);
    animation: slideInScale 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.leaderboard-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    /* color: #666; */
    cursor: pointer;
    width: 24px;
    height: 24px;
    z-index: 12;
}

.leaderboard-title {
    color: var(--txt-primary);
    text-align: center;
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 8px;
    width: 100%;
}

.leaderboard-loader {
    width: 50px;
    height: 50px;
    margin: 0 auto;
}

.leaderboard-loading {
    color: var(--txt-primary);
    font-family: Outfit;
    font-size: 20px;
    font-weight: 500;
    text-align: center;
}

.loader-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    width: 100%;
}

/* Table wrapper for scrolling */
.leaderboard-table-wrapper {
    display: flex;
    flex-direction: column;
    max-height: 500px;
    border-radius: 12px;
    background: var(--bg-primary);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 21px;
    border: 0.5px solid #636363a6;
    overflow: hidden;
}

.leaderboard-content {
    width: 100%;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    border-radius: 21px;
    /* background: #FFF; */
    min-width: 500px;
}

/* Webkit scrollbar styles */
.leaderboard-content::-webkit-scrollbar {
    width: 6px;
}

.leaderboard-content::-webkit-scrollbar-track {
    background: #F5F5F5;
    border-radius: 3px;
}

.leaderboard-content::-webkit-scrollbar-thumb {
    background-color: #48B825;
    border-radius: 3px;
}

.leaderboard-table {
    width: 100%;
    margin: 0 auto;
    border-collapse: separate;
    border-spacing: 0 4px;
    font-size: 1rem;
    position: relative;
    /* border: 2px solid #E0E0E0; */
    border-radius: 12px;
    /* overflow: hidden; */
    padding: 0px 10px 0px 10px;
}

.leaderboard-table thead {
    position: sticky;
    top: 0;
    /* background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%); */
    z-index: 2;
    /* border-bottom: 1px solid #E0E0E0; */
    border-radius: 20px 20px 0 0;
    background-color:var(--bg-primary);
}

.leaderboard-table th {
    padding: 12px 8px;
    height: 40px;
    text-align: center;
    font-weight: 700;
     color: var(--txt-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: transparent;
    position: relative;
}

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

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

.leaderboard-table td {
    padding: 12px 8px;
    height: 50px;
    text-align: center;
    /* font-weight: 500; */
    /* color: #2D2D2D; */
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    color: var(--txt-primary);
    text-align: center;

    font-size: 14px;

    font-weight: 400;

}

.leaderboard-table tbody tr {
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
}

.leaderboard-table tbody tr:first-child td:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.leaderboard-table tbody tr:first-child td:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* Row styling for different ranks */
.gold-row {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%) !important;
}

.gold-row td {
    color: #000;
    font-weight: 600 !important;
}

.silver-row {
    background: linear-gradient(135deg, #E6E6E6 0%, #C0C0C0 100%) !important;
}

.silver-row td {
   color: #000;
    font-weight: 600 !important;
}

.bronze-row {
    background: linear-gradient(135deg, #CD7F32 0%, #B8860B 100%) !important;
}

.bronze-row td {
    color: #000;
    font-weight: 600 !important;
}

.normal-row {
    background: #F8F9FA !important;
}

.normal-row td {
  color: #000;
}

/* Fix for proper row border radius */
.leaderboard-table tbody tr td:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.leaderboard-table tbody tr td:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* User highlight row - for current logged-in user */
.user-highlight-row {
    border: 2px solid #007bff !important;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.2) !important;
    transform: scale(1.02);
}

.user-highlight-row td {
    font-weight: 700 !important;
}

/* Star header styling */
.star-header {
    display: flex;
    align-items: center;
    justify-content: center;
}

.star-header img {
    width: 68px;
    height: 20.4px;
    flex-shrink: 0;
}

/* Special styling for current user row (like Strategy_Shadow in screenshot) */
.user-highlight-row {
    background: linear-gradient(135deg, #48B825 0%, #3A9B1F 100%) !important;
    border: 2px solid #48B825 !important;
    transform: scale(1.02);
    z-index: 1;
    position: relative;
}

/* Add shadow to the bottom of header */
/* .leaderboard-table thead::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: #eee;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
} */

.star-header {
    /* color: #ffc107; */
    font-size: 1.2rem;
}

.flag-img {
    width: 32px;
    height: 22px;
    border-radius: 3px;
    object-fit: cover;
    border: 1px solid var(--txt-primary);
}

.gold-row {
    background: #FFE082;
    color: #222;
}

.silver-row {
    background: #E0E0E0;
    color: #222;
}

.bronze-row {
    background: #FFD59A;
    color: #222;
}

.my-rank-row {
    background: #D4F8D4;
    color: #222;
    font-weight: 700;
    font-size: 1.1rem;
    border-radius: 0 0 16px 16px;
}

.normal-row {
    background: var(--bg-primary);
    color: #2D2D2D;
}

/* Current user highlight when their rank is visible in the list */
/* Current user row border highlight when visible in viewport */
.current-user-highlight {
  border: 2px solid #4CAF50 !important;
  box-shadow: 0 0 0 1px #4CAF50 !important;
}

.dark-mode .current-user-highlight {
  border: 2px solid #66BB6A !important;
  box-shadow: 0 0 0 1px #66BB6A !important;
}

@keyframes highlight-pulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4); 
    }
    50% { 
        box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.2); 
    }
}

.leaderboard-table tr {
    /* background: #FDFDFD; */
    transition: background 0.15s;
}

/* .leaderboard-table tr:not(.gold-row):not(.silver-row):not(.bronze-row):not(.my-rank-row):hover {
    background: #f0f0f0;
} */

.leaderboard-table th.table-col-head {
    /* font-size: 12px; */
    font-family: 'Outfit';
    font-weight: 500;
    letter-spacing: 1.6px;
    color: var(--txt-primary);
    text-align: center;
    font-size: 16px;
    font-weight: 400;

}

@media (max-width: 700px) {
    .leaderboard-modal {
        height: 73vh;
        width: 98vw;
        min-width: 0;
        min-height: 0;
        max-width: 99vw;
        /* max-height: 99vw; */
        padding: 0 10px 12px;

    }

    .leaderboard-title {
        font-size: 20px;
        font-weight: 600;
        font-family: 'Outfit';
        letter-spacing: 1.6px;
    }

    .close-btn img {
        width: 14px;
        height: 14px;
    }

    .flag-img {
        width: 24px;
        height: 16px;
    }

    .leaderboard-table-wrapper {
        max-height: 70vh;
    }

    .leaderboard-table th .star-header img {
        width: 37.4px;
        height: 11.22px;
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    .leaderboard-table tr {
        color: var(--txt-primary);
        text-overflow: ellipsis;
        white-space: nowrap;
        /* font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; */
        font-family: Poppins;
        font-size: 14px;
        font-weight: 500;
        line-height: normal;
        text-transform: capitalize;
        border-radius: 10px;
    }
}

/* Child row layout for table rows */
.leaderboard-table td,
.leaderboard-table th {
    width: 250px;
    height: 34px;
    flex-shrink: 0;
}

.leaderboard-content {
    width: 100%;
    overflow-y: auto;
    max-height: 450px;
    /* padding: 0 16px; */
    /* scrollbar-width: thin; */
    /* scrollbar-color: #48B825 #F5F5F5; */
    min-width: 350px;
}

.scrollable-content {
    flex: 1;
    overflow-y: auto;
    padding: 0px 10px;
    margin-bottom: 10px;
    position: relative;
}

.user-rank-footer {
    position: sticky;
    bottom: 0;
    width: 100%;
    background: #EBEBEB;
    padding: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.user-rank-row {
    background: #48B825 !important;
    /* color: white !important; */
    font-weight: 500;
    border-radius: 8px;
}

.leaderboard-login-block {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 24px;
    overflow: hidden;
}

.leaderboard-login-blur {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1;
}

.leaderboard-login-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.leaderboard-login-text {
    color: #FDFDFD;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 32px;
    text-align: center;
    letter-spacing: 1px;
}

.leaderboard-login-btn {
    /* Normal mode colors */
    background: linear-gradient(180deg, #7be65a 0%, #4ebd2a 100%);
    box-shadow: 0 4px 0 #3fa11e;
    border: none;
    border-radius: 18px;
    color: #FDFDFD;
    font-size: 2rem;
    font-weight: 700;
    padding: 18px 64px;
    cursor: pointer;
    transition: filter 0.2s;
}

/* Contrast mode colors for login button */
body.high-contrast .leaderboard-login-btn {
    background: linear-gradient(to bottom, #FCC344, #FF9000);
    box-shadow: 0 4px 8px #FF7300;
}

.leaderboard-login-btn:hover {
    filter: brightness(1.08);
}

@media (max-width: 700px) {
    leaderboard-close img {
        width: 20px;
        height: 20px;
    }
}

/* Current User Rank Section Styles */
/* Sticky Current User Rank Section */
.current-user-rank-sticky {
    position: absolute;
    bottom: 1%;
    /* background: var(--bg-primary); */
    /* border-top: 2px solid #4caf50; */
    padding: 15px 20px;
    z-index: 10;
    border-radius: 0 0 21px 21px;
}

.current-user-rank-row {
    display: flex;
    align-items: center;
    background: #4CAF50;
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 16px;
    min-height: 60px;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.current-user-rank-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.current-user-rank-cell:first-child {
    flex: 0 0 80px;
    font-weight: 400;
    font-size: 14px;
    justify-content: flex-start;
}

.current-user-rank-cell:nth-child(2) {
    flex: 1;
    text-align: left;
    padding-left: 20px;
    font-weight: 400;
    font-size: 14px;
}

.current-user-rank-cell:nth-child(3) {
    flex: 0 0 100px;
    font-weight: 400;
    font-size: 14px;
}

.current-user-rank-cell:nth-child(4) {
     font-weight: 400;
    font-size: 14px;
}

.current-user-rank-cell:last-child {
    flex: 0 0 80px;
     font-weight: 400;
    font-size: 14px;
}



/* Mobile responsive styles for current user rank */
@media (max-width: 700px) {
    .current-user-rank-section {
        padding: 0 15px 15px 15px;
    }
    
    .current-user-rank-row {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .current-user-rank-cell:first-child {
        flex: 0 0 60px;
        font-size: 18px;
    }
    
    .current-user-rank-cell:nth-child(2) {
        font-size: 16px;
        padding-left: 15px;
    }
    
    .current-user-rank-cell:nth-child(3) {
        flex: 0 0 80px;
    }
    
    .current-user-rank-cell:last-child {
        font-size: 16px;
    }
}