.leaderboard-page {
    width: 100%;
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #fff;
    overflow-y: auto;
    overflow-x: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    -webkit-overflow-scrolling: touch;
}

.leaderboard-page h1 {
    font-size: 2.5rem;
    margin: 20px 0;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Top 3 Podium Styles */
.top-three {
    width: 100%;
    max-width: 800px;
    margin: 20px 0;
    padding: 20px;
}

.podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 10px;
    height: 300px;
}

.podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    width: 120px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px 10px 0 0;
    padding: 12px 8px;
    backdrop-filter: blur(5px);
}

.podium-item .rank {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    margin-bottom: 8px;
    text-align: center;
    width: 100%;
}

.podium-item .player-info {
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.podium-item .player-name {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0;
    padding: 0 4px;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.podium-item .player-score {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0;
    padding: 0;
    text-align: center;
}

.podium-item.first {
    height: 100%;
    background: linear-gradient(45deg, #ffd700, #ffa500);
    z-index: 3;
    padding: 15px 10px;
}

.podium-item.second {
    height: 80%;
    background: linear-gradient(45deg, #c0c0c0, #a9a9a9);
    z-index: 2;
    padding: 12px 8px;
}

.podium-item.third {
    height: 60%;
    background: linear-gradient(45deg, #cd7f32, #8b4513);
    z-index: 1;
    padding: 10px 8px;
}

.podium-item .rank-number {
    font-size: 2rem;
    font-weight: bold;
}

.podium-item .rank-emoji {
    font-size: 1.8rem;
    animation: floatEmoji 2s ease-in-out infinite;
}

.podium-item.first .rank-emoji {
    font-size: 2.2rem;
    animation-delay: 0s;
}

.podium-item.second .rank-emoji {
    font-size: 2rem;
    animation-delay: 0.3s;
}

.podium-item.third .rank-emoji {
    font-size: 1.8rem;
    animation-delay: 0.6s;
}

@keyframes floatEmoji {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* All Scores List Styles */
.all-scores {
    width: 100%;
    max-width: 800px;
    margin: 20px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(5px);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.all-scores h2 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.scores-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding-bottom: 80px; /* Space for home button */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    color: #333;
}

.score-item .rank {
    font-weight: bold;
    color: #6a11cb;
    width: 40px;
}

.score-item .player-name {
    flex: 1;
    margin: 0 15px;
}

.score-item .player-score {
    font-weight: bold;
    color: #2575fc;
}

/* Enhanced Home Button Styles */
.home-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(45deg, #6a11cb, #2575fc);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-size: 1.1rem;
    margin: 25px auto;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(106, 17, 203, 0.3);
    width: auto;
    min-width: 200px;
    text-align: center;
}

.home-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(106, 17, 203, 0.4);
}

.home-button:active {
    transform: translateY(1px);
}

.home-button i {
    font-size: 1.2rem;
}

/* Mobile Responsive Styles for Home Button */
@media (max-width: 768px) {
    .all-scores {
        width: 95%;
        margin: 15px auto;
        padding: 15px 10px;
        border-radius: 12px;
        max-height: calc(100vh - 400px);
        overflow-y: auto;
    }

    .scores-list {
        max-height: none;
        height: auto;
    }

    .score-item {
        padding: 10px 15px;
        margin: 6px 0;
        font-size: 0.95rem;
    }

    .home-button {
        padding: 12px 24px;
        font-size: 1rem;
        min-width: 180px;
        margin: 15px 0;
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 100;
    }

    .home-button:hover {
        transform: translateX(-50%) translateY(-2px);
    }

    .home-button:active {
        transform: translateX(-50%) translateY(1px);
    }

    /* Add padding at the bottom to account for fixed button */
    .leaderboard-page::after {
        content: '';
        display: block;
        height: 80px;
    }
}

@media (max-width: 480px) {
    .leaderboard-page {
        padding: 10px 5px;
    }

    .leaderboard-page h1 {
        font-size: 1.5rem;
    }

    .podium {
        height: 180px;
    }

    .podium-item {
        padding: 6px 4px;
        width: 65px;
    }

    .podium-item.first {
        padding: 8px 6px;
    }

    .podium-item.second,
    .podium-item.third {
        padding: 6px 4px;
    }

    .podium-item .player-info {
        gap: 1px;
    }

    .podium-item .rank {
        margin-bottom: 4px;
    }

    .podium-item .rank-number {
        font-size: 1.2rem;
    }
    
    .podium-item .rank-emoji {
        font-size: 1.2rem;
    }
    
    .podium-item.first .rank-emoji {
        font-size: 1.6rem;
    }
    
    .podium-item.second .rank-emoji {
        font-size: 1.4rem;
    }
    
    .podium-item.third .rank-emoji {
        font-size: 1.2rem;
    }

    .podium-item .player-name {
        font-size: 0.8rem;
    }

    .podium-item .player-score {
        font-size: 0.9rem;
    }

    .all-scores {
        width: 98%;
        padding: 12px 8px;
        margin: 10px auto;
        max-height: calc(100vh - 350px);
    }

    .score-item {
        padding: 8px 12px;
        margin: 4px 0;
        font-size: 0.9rem;
    }

    .score-item .rank {
        width: 25px;
        font-size: 0.9rem;
    }

    .score-item .player-name {
        margin: 0 10px;
        font-size: 0.9rem;
    }

    .score-item .player-score {
        font-size: 0.9rem;
    }

    .home-button {
        padding: 10px 20px;
        font-size: 0.95rem;
        min-width: 160px;
        bottom: 15px;
        border-radius: 20px;
    }

    /* Adjust spacing for very small screens */
    @media (max-height: 600px) {
        .scores-list {
            max-height: 30vh;
        }

        .home-button {
            padding: 8px 16px;
            font-size: 0.9rem;
            bottom: 10px;
        }
    }
}

/* Safe area insets for modern mobile devices */
@supports (padding: max(0px)) {
    .leaderboard-page {
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }

    .home-button {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        bottom: max(15px, env(safe-area-inset-bottom));
    }

    .leaderboard-page::after {
        height: max(80px, calc(env(safe-area-inset-bottom) + 60px));
    }
}

/* Touch-friendly improvements */
@media (hover: none) {
    .home-button {
        -webkit-tap-highlight-color: transparent;
    }

    .home-button:active {
        transform: translateX(-50%) scale(0.98);
    }
}

/* Touch-friendly scrolling */
.scores-list {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-right: 5px;
    overflow-y: auto;
    -ms-overflow-style: none;
}

.scores-list::-webkit-scrollbar {
    width: 4px;
}

.scores-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.scores-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

/* Touch-friendly interactions */
.score-item,
.home-button {
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

/* Smooth transitions */
.podium-item,
.score-item,
.home-button {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Better accessibility */
.home-button:focus,
.score-item:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

/* Prevent text selection */
.podium-item,
.score-item {
    user-select: none;
    -webkit-user-select: none;
}

/* Optimize performance */
.podium,
.scores-list {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Enhance scrollbar styling */
.scores-list::-webkit-scrollbar {
    width: 6px;
}

.scores-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

.scores-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    transition: background 0.3s ease;
}

.scores-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
} 