:root {
    --bg: #0b0e14;
    --panel: #111726;
    --line: #1a2236;
    --text: #e8eefc;
    --muted: #9aa3b2;
    --gold: #ffd166;
    --silver: #d1d5db;
    --bronze: #d3956b;
}

/* Reset & base */
* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    background: linear-gradient(180deg, #0b0e14, #0d111d);
    color: var(--text);
    font: 16px/1.45 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* ================= Header (même look que Top10) ================= */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    /* au-dessus de tout */
    background: #0b0e14;
    /* OPAQUE -> plus d’ombre qui transperce */
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    /* backdrop-filter: blur(8px);  // tu peux enlever pour être 100% clean */
}

.header-bar {
    max-width: 1100px;
    margin: 0 auto;
    height: 58px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 16px;
}

.brand {
    font-weight: 700;
    color: #fff;
    text-decoration: none
}

.header-tabs {
    display: flex;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0
}

.tab-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .04);
    color: #e8eefc;
    text-decoration: none;
    font-size: 14px;
}

.tab-link:hover {
    border-color: rgba(255, 255, 255, .22)
}

/* ================= Container ================= */
.top10-container {
    max-width: 1100px;
    margin: 28px auto 40px;
    padding: 0 16px
}

h1 {
    margin: 0 0 12px;
    font-weight: 700
}

h1 .sub {
    font-weight: 400;
    color: var(--muted);
    margin-left: 8px;
    font-size: .9em
}

/* ================= Table ================= */
.top10-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

.top10-table thead th {
    text-align: left;
    font-weight: 600;
    color: #cdd6f4;
    background: #0f1629;
    border-bottom: 1px solid var(--line);
    padding: 14px 16px;
    font-size: 14px;
}

.top10-table thead th:nth-child(1) {
    width: 65%
}

.top10-table thead th:nth-child(2) {
    width: 20%;
    text-align: center
}

.top10-table thead th:nth-child(3) {
    width: 15%
}

/* lignes */
.top10-table tbody td {
    padding: 16px 16px 22px;
    /* un peu d’air sous chaque ligne */
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.top10-table tbody tr:last-child td {
    border-bottom: 0;
    padding-bottom: 26px;
}

/* évite tout clip */

/* ================= Joueur : médaille + cover + avatar + nom + chanson ================= */
td.player {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-weight: 600;
}

td.player .medal {
    font-size: 20px;
    width: 24px;
    text-align: center
}

/* Cover à gauche du nom */
td.player .cover {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, .10);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
}

/* Lien utilisateur : avatar + pseudo */
td.player .user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none
}

td.player .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, .12);
}

td.player .username {
    font-weight: 600
}

td.player .song {
    margin-left: 6px;
    color: var(--muted);
    font-size: 14px
}

/* ================= Temps (badge) ================= */
td.time {
    text-align: center
}

td.time {
    font-size: 0 !important;
}

/* -> les enfants repartent de zéro */
.time-badge {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    padding: 5px 12px;
    background: var(--gold);
    color: #000;
    font-weight: 800;
    border-radius: 10px;
    font-size: 15px;
    border: 1px solid rgba(0, 0, 0, .15);
    /* bord net */
    width: 70px !important;
    /* même largeur pour tous */
    height: 32px !important;
    /* même hauteur */
    padding: 0 !important;
    /* plus besoin de padding */
    font-size: 16px !important;
    /* taille fixe */
    line-height: 1 !important;
    /* pas de variation de hauteur de ligne */
}

.medal-2 .time-badge {
    background: var(--silver)
}

.medal-3 .time-badge {
    background: var(--bronze)
}

/* ================= Date ================= */
td.date {
    color: var(--muted);
    font-size: 14px
}

/* Highlight 1er */
.medal-1 td.player {
    color: var(--gold)
}

.medal-1 .username {
    font-weight: 700
}

.medal-1 .time-badge {
    box-shadow: 0 0 8px rgba(255, 209, 102, .45), inset 0 -2px 0 rgba(0, 0, 0, .12)
}

/* ================= Mobile ================= */
@media (max-width: 720px) {
    .top10-table thead {
        display: none
    }

    .top10-table,
    .top10-table tbody,
    .top10-table tr,
    .top10-table td {
        display: block;
        width: 100%
    }

    .top10-table tr {
        border: 1px solid var(--line);
        border-radius: 12px;
        overflow: hidden;
        margin: 12px 0;
        background: var(--panel);
        box-shadow: 0 6px 16px rgba(0, 0, 0, .25);
    }

    .top10-table td {
        padding: 12px 16px;
        border-bottom: 1px solid var(--line)
    }

    .top10-table td:last-child {
        border-bottom: 0
    }

    /* Libellés responsives */
    .top10-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        color: var(--muted);
        font-size: 12px;
        margin-bottom: 4px;
    }

    /* bloc joueur compact mais lisible */
    td.player {
        gap: 10px
    }

    td.player .cover {
        width: 44px;
        height: 44px
    }

    td.player .avatar {
        width: 34px;
        height: 34px
    }

    td.player .song {
        margin-left: 0;
        margin-top: 2px
    }

    /* badge temps plus visible en mobile */
    .time-badge {
        font-size: 16px;
        padding: 6px 14px;
        min-width: 64px
    }

    td.time {
        text-align: left
    }
}


/* ================= Joueur : avatar + pseudo + chanson + cover ================= */
td.player {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-weight: 600;
}

td.player .medal {
    font-size: 26px;
    /* agrandi (avant ~20px) */
    width: 32px;
    text-align: center;
}

td.player .user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none
}

td.player .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, .12);
}

td.player .song {
    margin-left: 6px;
    color: var(--muted);
    font-size: 14px
}

/* Cover déplacée à droite du nom */
td.player .cover {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    margin-left: auto;
    /* pousse la cover à droite */
    border: 1px solid rgba(255, 255, 255, .10);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
}

/* Numéro de rang pour >3 : petit cercle gris */
td.player .medal {
    font-size: 26px;
    width: 32px;
    text-align: center;
    font-weight: 700;
}

tr:not(.medal-1):not(.medal-2):not(.medal-3) td.player .medal {
    font-size: 15px;
    width: 24px;
    height: 24px;
    line-height: 24px;
    display: inline-block;
    background: #1e293b;
    border-radius: 50%;
    color: #fff;
    font-weight: 600;
}

/* ===== Mobile ===== */
@media (max-width: 480px) {
    .header-bar {
        height: 52px;
        padding: 0 10px;
        gap: 8px;
    }

    .brand {
        font-size: 16px;
    }

    .tab-link {
        font-size: 12px;
        padding: 5px 8px;
        border-radius: 10px;
        gap: 5px;
    }

    /* icônes devant le texte pour gagner de la place */
    .tab-link--classement::before {
        content: "🏆";
    }

    .tab-link--top10::before {
        content: "🥇";
    }

    /* très petits écrans : afficher surtout l’icône */
    @media (max-width: 360px) {
        .tab-link span {
            display: none;
        }

        /* cache le libellé mais le title reste */
        .tab-link {
            padding: 6px;
        }
    }
}


/* === TOP10 — MOBILE: one compact card per player =================== */
@media (max-width: 720px) {
    .top10-container {
        padding: 0 12px;
    }

    /* table -> cards */
    .top10-table {
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .top10-table thead {
        display: none;
    }

    .top10-table,
    .top10-table tbody {
        display: block;
        width: 100%;
    }

    .top10-table tr {
        display: grid;
        grid-template-columns: 1fr auto;
        /* 2 cols: content + right */
        grid-template-areas:
            "player player"
            "time   date";
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 14px;
        overflow: hidden;
        margin: 12px 0;
        box-shadow: 0 6px 16px rgba(0, 0, 0, .25);
    }

    .top10-table td {
        padding: 12px 16px;
        border: 0;
        width: auto;
    }

    /* hide auto labels */
    .top10-table td[data-label]::before {
        display: none;
    }

    /* ===== player block (top row) */
    td.player {
        grid-area: player;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--line);
        display: grid;
        grid-template-columns: 34px 1fr 56px;
        /* medal | text | cover */
        grid-template-areas:
            "medal text  cover"
            "medal song  cover";
        column-gap: 10px;
        row-gap: 2px;
        align-items: center;
    }

    td.player .medal {
        grid-area: medal;
        font-size: 26px;
        width: auto;
        text-align: center;
    }

    /* rank badge for >3 */
    tr:not(.medal-1):not(.medal-2):not(.medal-3) td.player .medal {
        font-size: 14px;
        width: 22px;
        height: 22px;
        line-height: 22px;
        display: inline-block;
        background: #1e293b;
        border-radius: 50%;
        color: #fff;
        font-weight: 700;
    }

    td.player .user {
        grid-area: text;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: #fff;
        text-decoration: none;
    }

    td.player .avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        object-fit: cover;
        border: 1px solid rgba(255, 255, 255, .12);
    }

    td.player .username {
        font-weight: 600;
    }

    td.player .song {
        grid-area: song;
        color: #cbd5e1;
        font-size: 13px;
        margin-left: 0;
    }

    /* cover to the right */
    td.player .cover {
        grid-area: cover;
        width: 52px;
        height: 52px;
        border-radius: 10px;
        object-fit: cover;
        border: 1px solid rgba(255, 255, 255, .10);
        box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
        margin-left: 0;
    }

    /* ===== bottom row: time (left) / date (right) */
    td.time {
        grid-area: time;
        padding-top: 10px;
    }

    td.date {
        grid-area: date;
        padding-top: 10px;
        text-align: right;
        font-size: 14px;
        color: var(--muted);
    }

    .time-badge {
        font-size: 16px;
        padding: 7px 14px;
        min-width: 72px;
    }

    /* little spacing after last card */
    .top10-table tbody tr:last-child {
        margin-bottom: 16px;
    }
}

h1 {
    font-size: clamp(20px, 3.5vw, 28px) !important;
    line-height: 1.1 !important;
}

h1 .sub {
    font-size: .8em !important;
}

@media (max-width: 480px) {

    .header-bar {
        height: 48px !important;
        padding: 0 8px !important;
        gap: 6px !important;
    }

    .brand {
        font-size: 15px !important;
    }

    .tab-link {
        font-size: 11px !important;
        padding: 4px 6px !important;
    }

    .top10-container {
        margin: 18px auto 28px !important;
        padding: 0 10px !important;
    }

    .top10-table {
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .top10-table tr {
        margin: 8px 0 !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, .22) !important;
    }

    .top10-table td {
        padding: 10px 12px !important;
    }

    td.player {
        grid-template-columns: 28px 1fr 44px !important;
        column-gap: 8px !important;
        row-gap: 1px !important;
        padding-bottom: 8px !important;
    }

    td.player .medal {
        font-size: 20px !important;
    }

    tr:not(.medal-1):not(.medal-2):not(.medal-3) td.player .medal {
        font-size: 12px !important;
        width: 20px !important;
        height: 20px !important;
        line-height: 20px !important;
    }

    td.player .avatar {
        width: 28px !important;
        height: 28px !important;
    }

    td.player .username {
        font-size: 14px !important;
    }

    td.player .song {
        font-size: 12px !important;
    }

    td.player .cover {
        width: 44px !important;
        height: 44px !important;
        border-radius: 8px !important;
    }

    .time-badge {
        font-size: 14px !important;
        padding: 5px 10px !important;
        min-width: 60px !important;
    }

    td.date {
        font-size: 12px !important;
        padding-top: 8px !important;
    }
}

@media (max-width: 360px) {
    h1 {
        font-size: 18px !important;
    }

    .time-badge {
        font-size: 13px !important;
        padding: 4px 8px !important;
        min-width: 54px !important;
    }

    td.player {
        grid-template-columns: 24px 1fr 40px !important;
    }

    td.player .avatar {
        width: 26px !important;
        height: 26px !important;
    }

    td.player .cover {
        width: 40px !important;
        height: 40px !important;
    }
}


/* Médaille/rang : même boîte partout -> alignement nickel */
td.player .medal {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 28px;
    /* largeur fixe */
    height: 28px;
    /* hauteur fixe */
    line-height: 1;
    /* évite l'effet "baseline" */
    font-size: 18px;
    /* taille commune */
}

/* Top 1–3 : un poil plus grand mais dans la même boîte */
.medal-1 td.player .medal,
.medal-2 td.player .medal,
.medal-3 td.player .medal {
    font-size: 22px;
    /* emoji un peu plus gros mais centrés */
}

/* Rangs >3 : badge rond identique (desktop aussi, pas seulement mobile) */
tr:not(.medal-1):not(.medal-2):not(.medal-3) td.player .medal {
    background: #1e293b;
    color: #fff;
    border-radius: 50%;
    font-weight: 700;
}