/* Leaderboard — loaded in <head> to avoid FOUC/CLS */
/* Leaderboard Base Styles */
.leaderboard-page {
    max-width: 1100px;
    margin: 0 auto 48px;
    padding: 0 16px;
}
.leaderboard-hero {
    margin-bottom: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 38px 24px 34px !important;
    border-radius: 20px;
}
.leaderboard-hero-title {
    margin: 0 0 10px;
    font-size: 1.8rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.leaderboard-hero-title i {
    color: var(--accent, #ff0033);
    font-size: 2rem;
}
.leaderboard-hero-subtitle {
    margin: 0;
    color: var(--text-muted, #9aa0b4);
    font-size: 0.95rem;
    max-width: 540px;
    line-height: 1.5;
}
.leaderboard-utc-badge {
    margin-top: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 0.78rem;
    color: var(--text-muted, #9aa0b4);
}

.leaderboard-tabs-wrapper {
    margin-bottom: 24px;
}
.leaderboard-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.leaderboard-tabs a {
    height: 40px;
    padding: 0 18px;
    font-size: 0.9rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.active-tab {
    background: var(--accent, #ff0033) !important;
    border-color: var(--accent, #ff0033) !important;
    color: #fff !important;
}

/* Podium Cards */
.leaderboard-podium {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
    align-items: flex-end;
    min-height: 180px;
}
.podium-card {
    text-align: center;
    padding: 20px 12px 14px;
    position: relative;
    border: 1px solid var(--badge-color);
    border-radius: 18px;
    background: rgba(15, 15, 35, 0.95);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}
.podium-card.rank-1 {
    order: 2;
    transform: scale(1.04);
    border-color: rgba(255, 215, 0, 0.6);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.2);
}
.podium-card.rank-2 {
    order: 1;
    border-color: rgba(192, 192, 192, 0.4);
}
.podium-card.rank-3 {
    order: 3;
    border-color: rgba(205, 127, 50, 0.4);
}
.podium-rank-badge {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--badge-color);
    color: #000;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.podium-user-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
.podium-avatar {
    width: 64px;
    height: 64px;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid var(--badge-color);
    object-fit: cover;
    margin: 0 auto 8px;
    display: block;
    background: rgba(255, 255, 255, 0.06);
}
.podium-username {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}
.podium-level {
    font-size: 0.75rem;
    background: rgba(255,255,255,0.06);
    padding: 2px 8px;
    border-radius: 10px;
    color: var(--text-muted, #9aa0b4);
}
.podium-score {
    margin-top: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--badge-color);
}

/* Table */
.leaderboard-table-card {
    padding: 16px;
    border-radius: 18px;
    background: rgba(15, 15, 35, 0.92);
}
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.92rem;
}
.leaderboard-table thead tr {
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: var(--text-muted, #9aa0b4);
    font-size: 0.8rem;
    text-transform: uppercase;
}
.leaderboard-table th,
.leaderboard-table td {
    padding: 12px;
}
.leaderboard-table tr {
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.leaderboard-table tr.is-current-user {
    background: rgba(255,0,51,0.1);
}
.col-rank {
    font-weight: 700;
    color: var(--text-muted, #9aa0b4);
    width: 50px;
}
.col-level {
    text-align: center;
}
.col-score {
    text-align: right;
    font-weight: 700;
    color: #fff;
}
.leaderboard-user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
}
.leaderboard-user-avatar {
    width: 36px;
    height: 36px;
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
}
.leaderboard-username {
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff;
}
.leaderboard-username.highlight {
    color: var(--accent, #ff0033);
}
.leaderboard-level-badge {
    font-size: 0.8rem;
    background: rgba(255,255,255,0.06);
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
}
.leaderboard-my-foot {
    border-top: 2px solid var(--accent, #ff0033);
    background: rgba(255,0,51,0.12);
}
.leaderboard-my-foot .col-rank {
    color: var(--accent, #ff0033);
    font-weight: 800;
}
.leaderboard-level-badge.my-level {
    background: var(--accent, #ff0033);
    color: #fff;
    font-weight: 700;
}
.leaderboard-empty-cell {
    text-align: center;
    padding: 24px;
    color: var(--text-muted, #9aa0b4);
}

/* 📱 MOBILE RESPONSIVE OPTIMIZATION (< 640px) */
@media (max-width: 640px) {
    .leaderboard-page {
        padding: 0 8px;
    }
    .leaderboard-hero {
        padding: 32px 18px 28px !important;
        margin-bottom: 16px;
    }
    .leaderboard-hero-title {
        font-size: 1.45rem;
        gap: 8px;
        margin-bottom: 8px;
    }
    .leaderboard-hero-title i {
        font-size: 1.6rem;
    }
    .leaderboard-hero-subtitle {
        font-size: 0.88rem;
        line-height: 1.45;
    }
    .leaderboard-utc-badge {
        font-size: 0.74rem;
        padding: 5px 12px;
        margin-top: 12px;
        text-align: center;
    }

    /* Horizontal scrollable tab pill bar */
    .leaderboard-tabs-wrapper {
        margin-bottom: 18px;
    }
    .leaderboard-tabs {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 4px 2px 8px;
        gap: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .leaderboard-tabs::-webkit-scrollbar {
        display: none;
    }
    .leaderboard-tabs a {
        flex-shrink: 0;
        height: 38px;
        padding: 0 14px;
        font-size: 0.82rem;
    }

    /* Compact Podium Grid */
    .leaderboard-podium {
        gap: 6px;
        margin-bottom: 16px;
    }
    .podium-card {
        padding: 14px 4px 10px;
        border-radius: 14px;
    }
    .podium-card.rank-1 {
        transform: scale(1.01);
    }
    .podium-avatar {
        width: 44px;
        height: 44px;
    }
    .podium-rank-badge {
        width: 22px;
        height: 22px;
        font-size: 0.75rem;
        top: -11px;
    }
    .podium-username {
        font-size: 0.78rem;
    }
    .podium-level {
        font-size: 0.68rem;
        padding: 1px 5px;
    }
    .podium-score {
        font-size: 0.78rem;
        margin-top: 4px;
    }

    /* Compact Table */
    .leaderboard-table-card {
        padding: 10px 4px;
        border-radius: 14px;
    }
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px 4px;
    }
    .col-rank {
        width: 24px;
        font-size: 0.82rem;
    }
    .leaderboard-user-avatar {
        width: 28px;
        height: 28px;
    }
    .leaderboard-user-row {
        gap: 6px;
    }
    .leaderboard-username {
        font-size: 0.82rem;
        max-width: 95px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
    }
    .leaderboard-level-badge {
        font-size: 0.7rem;
        padding: 2px 5px;
    }
    .col-score {
        font-size: 0.82rem;
    }
}
