body {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
    padding-top: 60px; /* Accommodate navbar */
    overflow-y: auto; /* Enable scrolling */
    overflow-x: hidden;
}

#gameNavbar {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    display: flex !important;
    visibility: visible !important;
}

.navbar-title-link {
    color: #fff;
    text-decoration: none;
    font-size: 20px;
    font-weight: bold;
    margin-left: 10px;
    transition: opacity 0.2s;
}

.navbar-title-link:hover {
    opacity: 0.8;
}

.navbar-tab.active {
    background-color: rgba(255, 255, 255, 0.2);
    border-bottom: 2px solid #fff;
}

.leaderboard-container {
    display: flex;
    max-width: 1400px;
    margin: 20px auto;
    padding: 50px 20px;
    gap: 30px;
}

.leaderboard-main {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.leaderboard-main h1 {
    margin: 0 0 20px 0;
    color: #1e3c72;
    font-size: 32px;
    text-align: center;
}

.time-filter-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 600;
    border: 2px solid #2a5298;
    background: #fff;
    color: #2a5298;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: #e8f0fe;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(42, 82, 152, 0.2);
}

.filter-btn.active {
    background: #2a5298;
    color: #fff;
    box-shadow: 0 4px 12px rgba(42, 82, 152, 0.4);
}

.leaderboard-sidebar {
    width: 350px;
    flex-shrink: 0;
}

.info-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 20px;
}

.info-panel h2 {
    margin: 0 0 20px 0;
    color: #1e3c72;
    font-size: 24px;
}

.info-panel h3 {
    margin: 20px 0 10px 0;
    color: #2a5298;
    font-size: 18px;
}

.info-content p {
    margin: 12px 0;
    line-height: 1.6;
    color: #333;
}

.info-content hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 20px 0;
}

.country-row {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.country-row:hover {
    border-color: #2a5298;
    box-shadow: 0 4px 12px rgba(42, 82, 152, 0.2);
    transform: translateY(-2px);
}

.country-row.expanded {
    border-color: #1e3c72;
    box-shadow: 0 6px 20px rgba(30, 60, 114, 0.3);
}

.country-row-header {
    display: flex;
    align-items: center;
    padding: 20px;
    gap: 20px;
}

.country-rank {
    font-size: 28px;
    font-weight: bold;
    color: #1e3c72;
    min-width: 50px;
    text-align: center;
}

.country-rank.rank-1 {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.country-rank.rank-2 {
    color: #c0c0c0;
    text-shadow: 0 0 10px rgba(192, 192, 192, 0.5);
}

.country-rank.rank-3 {
    color: #cd7f32;
    text-shadow: 0 0 10px rgba(205, 127, 50, 0.5);
}

.country-flag {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e0e0e0;
    flex-shrink: 0;
}

.country-flag.rank-1-flag {
    border-color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.country-flag.rank-2-flag {
    border-color: #c0c0c0;
    box-shadow: 0 0 10px rgba(192, 192, 192, 0.5);
}

.country-flag.rank-3-flag {
    border-color: #cd7f32;
    box-shadow: 0 0 10px rgba(205, 127, 50, 0.5);
}

.country-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.country-name {
    font-size: 22px;
    font-weight: bold;
    color: #1e3c72;
    margin: 0;
}

.country-points {
    font-size: 24px;
    font-weight: bold;
    color: #2a5298;
    background: #e8f0fe;
    padding: 8px 16px;
    border-radius: 20px;
}

.country-expand-icon {
    font-size: 24px;
    color: #666;
    transition: transform 0.3s ease;
    margin-left: 10px;
}

.country-row.expanded .country-expand-icon {
    transform: rotate(180deg);
}

.country-contributors {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.country-row.expanded .country-contributors {
    max-height: 500px;
}

.contributors-list {
    padding: 20px;
}

.contributors-title {
    font-size: 16px;
    font-weight: bold;
    color: #2a5298;
    margin: 0 0 15px 0;
}

.contributor-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #fff;
    border-radius: 6px;
    margin-bottom: 8px;
    border-left: 4px solid #2a5298;
}

.contributor-name {
    font-weight: 600;
    color: #333;
}

.contributor-score {
    color: #2a5298;
    font-weight: bold;
}

.loading, .error {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #666;
}

.error {
    color: #d32f2f;
}

.empty-leaderboard {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-leaderboard h2 {
    color: #999;
    margin-bottom: 10px;
}

/* Ensure navbar is always visible on leaderboard page */
body:has(.leaderboard-container) #gameNavbar {
    display: flex !important;
    visibility: visible !important;
}

@media (max-width: 1024px) {
    .leaderboard-container {
        flex-direction: column;
    }
    
    .leaderboard-sidebar {
        width: 100%;
    }
    
    .info-panel {
        position: static;
    }
    
    /* Keep navbar visible on mobile for leaderboard */
    body:has(.leaderboard-container) #gameNavbar {
        display: flex !important;
        visibility: visible !important;
    }
}

@media (max-width: 768px) {
    /* Keep navbar visible on mobile for leaderboard */
    body:has(.leaderboard-container) #gameNavbar {
        display: flex !important;
        visibility: visible !important;
        height: 50px;
    }
    
    body {
        padding-top: 60px; /* Accommodate fixed navbar on mobile */
    }
    
    .leaderboard-main {
        padding: 15px;
    }
    
    .leaderboard-main h1 {
        font-size: 24px;
        margin: 0 0 15px 0;
    }
    
    .time-filter-buttons {
        margin-bottom: 15px;
        gap: 8px;
    }
    
    .filter-btn {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    .country-row {
        margin-bottom: 6px;
        border-width: 1px;
    }
    
    .country-row-header {
        padding: 8px 12px;
        gap: 8px;
        flex-wrap: nowrap;
    }
    
    .country-info {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex: 1;
        min-width: 0;
    }
    
    .country-rank {
        min-width: 30px;
        font-size: 18px;
    }
    
    .country-flag {
        width: 35px;
        height: 35px;
        border-width: 2px;
    }
    
    .country-name {
        font-size: 14px;
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .country-points {
        font-size: 14px;
        padding: 4px 10px;
        border-radius: 12px;
        flex-shrink: 0;
    }
    
    .country-expand-icon {
        font-size: 18px;
        margin-left: 5px;
    }
    
    .contributors-list {
        padding: 10px 12px;
    }
    
    .contributors-title {
        font-size: 13px;
        margin: 0 0 8px 0;
    }
    
    .contributor-item {
        padding: 6px 10px;
        margin-bottom: 4px;
        border-left-width: 3px;
    }
    
    .contributor-name {
        font-size: 13px;
    }
    
    .contributor-score {
        font-size: 13px;
    }
    
    .info-panel {
        padding: 15px;
        margin-top: 10px;
    }
    
    .info-panel h2 {
        font-size: 20px;
        margin: 0 0 15px 0;
    }
    
    .info-panel h3 {
        font-size: 16px;
        margin: 15px 0 8px 0;
    }
    
    .info-content p {
        margin: 8px 0;
        font-size: 14px;
        line-height: 1.4;
    }
}

