/* ==========================================
   BATLINGO - LEADERBOARD
========================================== */


.leaderboard-screen {
    position: fixed;
    inset: 0;
    z-index: 11000;

    width: 100%;
    height: 100dvh;

    overflow-x: hidden;
    overflow-y: auto;

    display: flex;
    justify-content: center;
    align-items: flex-start;

    padding: 50px 16px;

    background:
        linear-gradient(
            rgba(5, 10, 20, .84),
            rgba(5, 10, 20, .95)
        ),
        url("../assets/images/backgrounds/lobby-bg.png")
        center / cover no-repeat;

    color: #f8fafc;
}


.leaderboard-container {
    width: min(100%, 760px);

    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ==========================================
   HEADER
========================================== */

.leaderboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.leaderboard-header-title {
    display: flex;
    align-items: center;
    gap: 10px;

    min-width: 0;
}

.leaderboard-header-title h1 {
    margin: 0;

    font-size: clamp(18px, 4vw, 26px);
    letter-spacing: 1px;

    color: #fbbf24;
}

.leaderboard-back {
    width: 42px;
    height: 42px;

    flex-shrink: 0;

    border: 1px solid #334155;
    border-radius: 12px;

    background: #111827;
    color: white;

    font-size: 22px;
    cursor: pointer;
}

.leaderboard-back:hover {
    background: #1e293b;
}

.leaderboard-season {
    padding: 7px 12px;

    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;

    font-size: 11px;
    font-weight: 700;

    color: #fbbf24;
    white-space: nowrap;
}

/* ==========================================
   TABS
========================================== */

.leaderboard-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: 8px;

    padding: 6px;

    background: rgba(15, 23, 42, .95);
    border: 1px solid #334155;
    border-radius: 14px;
}

.leaderboard-tab {
    min-width: 0;

    padding: 12px 6px;

    border: none;
    border-radius: 10px;

    background: transparent;
    color: #94a3b8;

    font-size: 13px;
    font-weight: 700;

    cursor: pointer;
    transition: .2s;
}

.leaderboard-tab:hover {
    color: white;
    background: #1e293b;
}

.leaderboard-tab.active {
    color: #fbbf24;

    background: #263248;

    box-shadow:
        inset 0 0 0 1px #475569;
}

/* ==========================================
   TOP 3
========================================== */

.leaderboard-top {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: 12px;
}

.leaderboard-top-card {
    min-width: 0;

    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 9px;

    padding: 24px 10px 20px;

    border: 1px solid #334155;
    border-radius: 18px;

    background:
        linear-gradient(
            160deg,
            #1e293b,
            #111827
        );

    text-align: center;
}

.leaderboard-top-card.top-1 {
    border-color: #eab308;

    background:
        linear-gradient(
            160deg,
            #3d341c,
            #111827
        );
}

.leaderboard-top-card.top-2 {
    border-color: #94a3b8;
}

.leaderboard-top-card.top-3 {
    border-color: #b45309;
}

.leaderboard-top-card .leaderboard-position {
    font-size: 25px;
}

.leaderboard-top-card .leaderboard-avatar {
    width: 60px;
    height: 60px;

    display: flex;
    justify-content: center;
    align-items: center;

    border: 2px solid #475569;
    border-radius: 50%;

    background: #0f172a;

    font-size: 31px;
}

.leaderboard-top-card.top-1 .leaderboard-avatar {
    border-color: #fbbf24;
}

.leaderboard-top-card .leaderboard-player-info {
    min-width: 0;
    width: 100%;
}

.leaderboard-top-card .leaderboard-player-score {
    color: #fbbf24;
    font-size: 16px;
}

/* ==========================================
   LIST HEADER
========================================== */

.leaderboard-list-header {
    display: flex;
    justify-content: space-between;

    padding: 0 14px;

    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;

    color: #94a3b8;
}

/* ==========================================
   PLAYER LIST
========================================== */

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-player-row {
    display: flex;
    align-items: center;

    gap: 12px;

    min-width: 0;

    padding: 13px 16px;

    background: #111827;
    border: 1px solid #334155;
    border-radius: 13px;
}

.leaderboard-position {
    width: 34px;
    flex-shrink: 0;

    font-size: 15px;
    font-weight: 800;
    text-align: center;

    color: #cbd5e1;
}

.leaderboard-avatar {
    width: 40px;
    height: 40px;

    flex-shrink: 0;

    display: flex;
    justify-content: center;
    align-items: center;

    border-radius: 50%;

    background: #1e293b;

    font-size: 22px;
}

.leaderboard-player-info {
    min-width: 0;
    flex: 1;
}

.leaderboard-player-name {
    font-size: 13px;
    font-weight: 700;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-player-description {
    margin-top: 4px;

    font-size: 11px;
    color: #94a3b8;
}

.leaderboard-player-score {
    flex-shrink: 0;

    font-size: 13px;
    font-weight: 800;

    color: #e2e8f0;
}

.leaderboard-you {
    font-size: 10px;
    color: #38bdf8;
}

.leaderboard-player-row.is-me,
.leaderboard-top-card.is-me {
    border-color: #38bdf8;
}

/* ==========================================
   MY RANK
========================================== */

.leaderboard-my-rank {
    position: sticky;
    bottom: 12px;

    padding: 12px;

    background: #172339;
    border: 1px solid #38bdf8;
    border-radius: 15px;

    box-shadow:
        0 12px 30px rgba(0, 0, 0, .4);

    font-size: 12px;
    text-align: center;
}

.leaderboard-my-label {
    margin-bottom: 8px;

    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;

    color: #38bdf8;
}

.leaderboard-my-rank .leaderboard-player-row {
    background: #0f172a;
}

.leaderboard-empty {
    padding: 32px 12px;

    text-align: center;
    color: #94a3b8;
}

/* ==========================================
   MOBILE
========================================== */

@media (max-width: 600px) {

    .leaderboard-screen {
        padding:
            max(18px, env(safe-area-inset-top))
            12px
            max(20px, env(safe-area-inset-bottom));
    }

    .leaderboard-container {
        gap: 16px;
    }

    .leaderboard-header-title h1 {
        font-size: 18px;
    }

    .leaderboard-header-title > span {
        font-size: 20px;
    }

    .leaderboard-season {
        font-size: 9px;
        padding: 6px 8px;
    }

    .leaderboard-tab {
        padding: 11px 3px;
        font-size: 11px;
    }

    .leaderboard-top {
        gap: 6px;
    }

    .leaderboard-top-card {
        padding: 17px 5px;
        gap: 7px;
    }

    .leaderboard-top-card .leaderboard-avatar {
        width: 46px;
        height: 46px;
        font-size: 25px;
    }

    .leaderboard-top-card .leaderboard-position {
        font-size: 21px;
    }

    .leaderboard-top-card .leaderboard-player-name {
        font-size: 11px;
    }

    .leaderboard-top-card .leaderboard-player-score {
        font-size: 12px;
    }

    .leaderboard-player-row {
        gap: 8px;
        padding: 11px 9px;
    }

    .leaderboard-position {
        width: 29px;
        font-size: 12px;
    }

    .leaderboard-avatar {
        width: 34px;
        height: 34px;
        font-size: 19px;
    }

    .leaderboard-player-name,
    .leaderboard-player-score {
        font-size: 12px;
    }

    .leaderboard-player-description {
        font-size: 10px;
    }
}

@media (max-width: 360px) {

    .leaderboard-top-card .leaderboard-player-description {
        font-size: 9px;
    }

    .leaderboard-season {
        display: none;
    }
}
