/* Style repris du site Blazor de l'appli (AmongStat.Web/wwwroot/app.css, interface « moderne ») :
   fond #141414, accent #38FEDC, cartes #1C1C1C, bordures #2A2A2A, puces et boutons arrondis. */

:root {
    --app-background: #141414;
    --app-accent: #38FEDC;
    --app-accent-hover: #5CFFE4;
    --app-accent-ink: #08201C;
    --app-card-background: #1C1C1C;
    --app-border: #2A2A2A;
    --app-border-strong: #3A3A3A;
    --app-warning: #FFCB7D;
    --app-font: Aptos, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    color-scheme: dark;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    background: var(--app-background);
    color: white;
    font-family: var(--app-font);
    font-size: 14px;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: var(--app-accent);
}

/* ===================== Navigation ===================== */

/* Regroupe la nav et la barre de filtres (si l'écran en propose une) dans un seul bloc collant : les
   deux défilent comme une seule barre persistante plutôt que la nav seule. */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 10;
}

.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: rgba(20, 20, 20, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--app-border);
    padding: 10px 24px;
}

.top-nav__brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: white;
    text-decoration: none;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.top-nav__logo {
    width: 28px;
    height: 28px;
}

.top-nav__links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.top-nav__link {
    color: white;
    text-decoration: none;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    opacity: 0.75;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.top-nav__link:hover {
    opacity: 1;
    background: rgba(56, 254, 220, 0.08);
}

.top-nav__link--active {
    opacity: 1;
    background: var(--app-accent);
    color: var(--app-accent-ink);
}

.page-content {
    flex: 1;
    padding: 24px;
}

.footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 20px;
    border-top: 1px solid var(--app-border);
    padding: 16px 24px;
    font-size: 13px;
}

.footer__credit {
    margin-left: auto;
    opacity: 0.5;
}

.banner {
    padding: 10px 24px;
    font-weight: 600;
}

.banner--warning {
    background: rgba(229, 160, 58, 0.1);
    color: var(--app-warning);
    border-bottom: 1px solid #E5A03A;
}

/* ===================== Titres ===================== */

.page-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.page-header--section {
    align-items: center;
    margin: 24px 0 12px;
}

.page-header .page-title,
.page-header .section-title {
    margin: 0;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 20px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    margin: 20px 0 10px;
}

.hint {
    opacity: 0.75;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ===================== Boutons ===================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: white;
    border: 1px solid var(--app-border-strong);
    border-radius: 999px;
    padding: 7px 16px;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.btn:hover {
    border-color: var(--app-accent);
    background: rgba(56, 254, 220, 0.08);
}

.btn:active {
    transform: scale(0.97);
}

.btn--primary {
    background: var(--app-accent);
    color: var(--app-accent-ink);
    border-color: var(--app-accent);
}

.btn--primary:hover {
    background: var(--app-accent-hover);
}

/* ===================== Filtres ===================== */

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 20px;
    background: var(--app-card-background);
    border: 1px solid var(--app-border);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

/* Filtres déplacés dans la barre persistante (.top-bar) : se fond dans la nav plutôt que de garder
   l'aspect carte (pas de coins arrondis ni de marge), même fond translucide + flou. */
.filters--nav {
    margin: 0;
    border: none;
    border-radius: 0;
    border-bottom: 1px solid var(--app-border);
    background: rgba(20, 20, 20, 0.92);
    backdrop-filter: blur(8px);
    padding: 12px 24px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field__label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.6;
}

.field__input {
    background: var(--app-background);
    color: white;
    border: 1px solid var(--app-border-strong);
    border-radius: 10px;
    padding: 8px 12px;
    font: inherit;
    min-width: 180px;
}

.field__input:focus {
    outline: none;
    border-color: var(--app-accent);
}

.field__input option {
    background: var(--app-background);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--app-background);
    border: 1px solid var(--app-border-strong);
    border-radius: 999px;
    padding: 6px 14px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.chip:has(input:checked) {
    border-color: var(--app-accent);
    background: rgba(56, 254, 220, 0.1);
    color: var(--app-accent);
}

.chip input {
    accent-color: var(--app-accent);
    margin: 0;
}

/* Filtre lobbys : <details> fermé par défaut, même look que .field__input (le <select> Mod), s'ouvre sur
   un panneau de cases à cocher plutôt qu'un <select multiple> natif (toujours affiché en liste ouverte,
   jamais compact comme un select simple). */
.multiselect {
    position: relative;
}

.multiselect__toggle {
    display: inline-block;
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.multiselect__toggle::-webkit-details-marker {
    display: none;
}

.multiselect__toggle::after {
    content: '▾';
    margin-left: 8px;
    opacity: 0.7;
}

.multiselect__panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
    max-height: 260px;
    overflow-y: auto;
    background: var(--app-card-background);
    border: 1px solid var(--app-border-strong);
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.6);
}

.multiselect__option {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    cursor: pointer;
}

.multiselect__option input {
    accent-color: var(--app-accent);
    margin: 0;
}

.session-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    border: 1px solid rgba(56, 254, 220, 0.4);
    border-radius: 16px;
    padding: 12px 20px;
    margin-bottom: 16px;
    background: rgba(56, 254, 220, 0.06);
}

/* Sparkline de tendance par camp (Résumé joueur) : taux de victoire cumulé au fil des parties, une
   ligne par camp de DÉPART — mêmes couleurs que RoleAlignmentToBrushConverter côté desktop (nom du
   joueur dans GameFormControl.xaml) et que .player-name--impostor/--neutral (Détail de session) :
   rouge imposteur, jaune neutre, blanc crewmate. */
.sparkline-card {
    background: var(--app-card-background);
    border: 1px solid var(--app-border);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.sparkline-card__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 20px;
    margin-bottom: 8px;
}

.sparkline-card__label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.6;
}

.sparkline-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    font-size: 12px;
}

.sparkline-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    opacity: 0.85;
}

.sparkline-legend__swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.sparkline-legend__swatch--crewmate {
    background: white;
}

.sparkline-legend__swatch--neutral {
    background: #FFFF00;
}

.sparkline-legend__swatch--impostor {
    background: #FF0000;
}

/* .sparkline-chart encadre le SVG (position:relative) pour ancrer l'infobulle .sparkline-tooltip, qui
   suit le curseur via app.js. viewBox 300x78 : 0-60 le graphique, 60-78 la graduation de l'axe des
   abscisses (repères + numéros de partie, voir PlayerStatsController::sparklineAxisTicks()). */
.sparkline-chart {
    position: relative;
}

.sparkline {
    display: block;
    width: 100%;
    max-width: 500px;
    height: 78px;
}

.sparkline polyline {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sparkline__line--crewmate {
    stroke: white;
}

.sparkline__line--neutral {
    stroke: #FFFF00;
}

.sparkline__line--impostor {
    stroke: #FF0000;
}

.sparkline__axis,
.sparkline__tick {
    stroke: var(--app-border-strong);
    stroke-width: 1;
}

.sparkline__tick-label {
    fill: white;
    opacity: 0.5;
    font-size: 9px;
}

/* Cercle invisible (juste une zone de survol) sur chaque point de donnée ; visible seulement au survol,
   voir app.js pour l'infobulle qu'il déclenche. */
.sparkline__point {
    fill: transparent;
}

.sparkline__point:hover {
    fill: white;
    fill-opacity: 0.25;
}

.sparkline-tooltip {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    background: #000;
    border: 1px solid var(--app-border-strong);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    white-space: nowrap;
}

/* Variante grande de .player-color-dot (définie plus bas, réutilisée par sessions/detail.html.twig en
   petite taille inline) pour le titre du Résumé joueur -- même taille que .badge__icon, pour peser
   visuellement autant que les icônes de badge juste en dessous. Sélecteur composé (pas juste
   .player-color-dot--lg) : même spécificité que .player-color-dot, sinon son ordre dans le fichier
   (avant elle) la ferait perdre le cascade sur width/height. */
.player-color-dot.player-color-dot--lg {
    width: 48px;
    height: 48px;
    margin-left: 10px;
}

/* ===================== Badges (Résumé joueur) ===================== */
/* Même convention que PlayerSummaryWindow côté desktop : icône seule (pas de pastille de texte), détail
   en infobulle au survol/focus -- couleurs reprises telles quelles du ToolTip WPF (#1C1C1C / #38FEDC). */

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.badge {
    position: relative;
    width: 48px;
    height: 48px;
}

.badge__icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
}

.badge__icon--placeholder {
    background: var(--app-card-background);
    border: 1px solid var(--app-border);
    border-radius: 8px;
}

.badge__tooltip {
    position: absolute;
    z-index: 5;
    /* Ancrée par le bord GAUCHE de l'icône plutôt que centrée : centrée, l'infobulle du badge le plus à
       gauche de la ligne débordait hors de l'écran (coupée), rien ne la recentrait. Un léger décalage
       négatif (-8px) compense visuellement le padding de l'infobulle pour garder son texte aligné sous
       l'icône plutôt que décalé vers la droite. */
    left: -8px;
    top: calc(100% + 8px);
    transform: translateY(-4px);
    width: max-content;
    max-width: 260px;
    background: #1C1C1C;
    border: 1px solid var(--app-accent);
    border-radius: 8px;
    padding: 10px 12px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease, transform 0.12s ease;
}

.badge:hover .badge__tooltip,
.badge:focus .badge__tooltip,
.badge:focus-visible .badge__tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.badge__tooltip-title {
    color: var(--app-accent);
    font-weight: 700;
    font-size: 13px;
}

.badge__tooltip-condition {
    color: white;
    font-size: 12px;
    margin-top: 4px;
}

.badge__tooltip-progress {
    color: #AAAAAA;
    font-size: 11px;
    font-style: italic;
    margin-top: 4px;
}

.columns-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--app-card-background);
    border: 1px solid var(--app-border);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.columns-panel[hidden] {
    display: none;
}

/* ===================== Cartes (vignettes) ===================== */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.card {
    background: linear-gradient(155deg, #1C1C1C 0%, #171717 100%);
    border: 1px solid var(--app-border);
    border-radius: 16px;
    padding: 16px 18px;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
    transform: translateY(-3px);
    border-color: rgba(56, 254, 220, 0.4);
    box-shadow: 0 10px 30px -10px rgba(56, 254, 220, 0.25);
}

.card__title {
    color: var(--app-accent);
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 8px;
}

.card__description {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    opacity: 0.92;
}

/* Diaporama de l'accueil : une vignette .card à la fois, défilement automatique en ordre mélangé
   (voir StatsController::index et partials/_highlights_carousel.html.twig). Piste en pleine largeur,
   une seule .carousel__slide visible (is-active) à la fois, transition en fondu plutôt qu'un slide en
   translation pour éviter de dépendre de la hauteur exacte de chaque carte (les descriptions varient
   beaucoup en longueur d'une vignette à l'autre). */
.carousel {
    max-width: 560px;
    margin: 0 auto 24px;
    outline: none;
}

.carousel__track {
    position: relative;
    min-height: 140px;
}

.carousel__slide {
    display: none;
}

/* opacity:1 posé en dur (pas seulement via la keyframe) : si l'animation ne peut pas tourner
   (onglet en arrière-plan, prefers-reduced-motion, navigateur qui la saute), la vignette reste
   quand même visible plutôt que bloquée à son état de départ opacity:0. */
.carousel__slide.is-active {
    display: block;
    opacity: 1;
    animation: carousel-fade 0.4s ease;
}

@keyframes carousel-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.carousel .card {
    min-height: 140px;
    padding: 24px 28px;
}

.carousel .card__title {
    font-size: 17px;
}

.carousel__controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 14px;
}

.carousel__arrow {
    background: transparent;
    border: 1px solid var(--app-border-strong);
    color: white;
    border-radius: 999px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.carousel__arrow:hover {
    border-color: var(--app-accent);
    color: var(--app-accent);
}

.carousel__dots {
    display: flex;
    gap: 8px;
}

.carousel__dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--app-border-strong);
    cursor: pointer;
}

.carousel__dot.is-active {
    background: var(--app-accent);
}

/* ===================== Sessions ===================== */

.session-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.session-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: linear-gradient(155deg, #1C1C1C 0%, #171717 100%);
    border: 1px solid var(--app-border);
    border-radius: 16px;
    padding: 18px 20px;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.session-card:hover {
    transform: translateY(-3px);
    border-color: rgba(56, 254, 220, 0.4);
    box-shadow: 0 10px 30px -10px rgba(56, 254, 220, 0.25);
}

.session-card__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.session-card__lobby {
    font-size: 18px;
    font-weight: 700;
}

.session-card__date {
    font-size: 13px;
    opacity: 0.6;
}

.session-card__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.session-card__actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 4px;
}

.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--app-background);
    border: 1px solid #2F2F2F;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 13px;
}

.stat-chip--warn {
    border-color: #E5A03A;
    color: var(--app-warning);
    background: rgba(229, 160, 58, 0.1);
}

.game-block {
    background: var(--app-card-background);
    border: 1px solid var(--app-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.game-block__title {
    font-size: 18px;
    margin: 0 0 12px;
}

.game-block__tables {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
}

/* Détail de session : une partie = un <details> (accordéon natif, pas de JS). */
.game-accordion {
    background: var(--app-card-background);
    border: 1px solid var(--app-border);
    border-radius: 16px;
    margin-bottom: 12px;
    overflow: hidden;
}

.game-accordion__summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 20px;
    cursor: pointer;
    list-style: none;
    font-size: 15px;
    font-weight: 600;
}

.game-accordion__summary::-webkit-details-marker {
    display: none;
}

.game-accordion__summary::before {
    content: '▸';
    color: var(--app-accent);
    transition: transform 0.15s ease;
    flex: none;
}

.game-accordion[open] .game-accordion__summary::before {
    transform: rotate(90deg);
}

.game-accordion__summary:hover {
    background: rgba(56, 254, 220, 0.06);
}

.game-accordion__meta {
    font-size: 13px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
}

.game-accordion__body {
    padding: 0 20px 20px;
    border-top: 1px solid var(--app-border);
}

/* Badges de camp (rôle de départ/final d'un joueur, ou camp vainqueur d'une partie). */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid transparent;
    white-space: nowrap;
}

.role-badge--crewmate {
    background: rgba(91, 155, 255, 0.12);
    border-color: rgba(91, 155, 255, 0.4);
    color: #8FB8FF;
}

.role-badge--impostor {
    background: rgba(255, 92, 92, 0.12);
    border-color: rgba(255, 92, 92, 0.4);
    color: #FF8F8F;
}

.role-badge--neutral {
    background: rgba(185, 140, 224, 0.12);
    border-color: rgba(185, 140, 224, 0.4);
    color: #C9A6E8;
}

/* Camp "Special" (victoire mixte/transverse, ex: Lovers) — pas un rôle, uniquement une issue de partie. */
.role-badge--special {
    background: rgba(255, 203, 125, 0.12);
    border-color: rgba(255, 203, 125, 0.4);
    color: var(--app-warning);
}

/* Nom du joueur coloré par son camp effectif (rôle final si renseigné, sinon rôle de départ) —
   mêmes couleurs que RoleAlignmentToBrushConverter côté desktop (GameFormControl.xaml) : rouge
   imposteur, jaune neutre, blanc (par défaut, pas de classe) pour crewmate ou rôle non résolu. */
.player-name--impostor {
    color: #FF0000;
}

.player-name--neutral {
    color: #FFFF00;
}

/* Pastille de couleur préférée d'un joueur (aussi utilisée par admin/players.html.twig). */
.player-color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    vertical-align: middle;
}

/* ===================== Tableaux ===================== */

.table-wrap {
    border: 1px solid var(--app-border);
    border-radius: 16px;
    overflow: auto;
    max-width: 100%;
    margin-bottom: 16px;
}

.table {
    border-collapse: collapse;
    white-space: nowrap;
    width: 100%;
}

.table--wrap {
    white-space: normal;
}

/* Tableau Stats joueurs : sa propre zone de défilement, pour que la barre horizontale reste visible en bas
   de la zone et que l'en-tête et la colonne des noms, déjà « sticky », restent figés dans les deux sens.
   Repli (fenêtre très basse) : hauteur limitée, la page défile normalement. */
.table-wrap--viewport {
    max-height: max(300px, calc(100dvh - 250px));
}

/* Écran « plein cadre » : la page occupe exactement la fenêtre (pas de barre de défilement de page) ; l'en-tête,
   le titre et le pied de page gardent leur hauteur, le tableau prend tout l'espace restant et défile seul. */
@media (min-height: 560px) {
    body.page--fit {
        height: 100dvh;
        overflow: hidden;
    }

    body.page--fit .page-content {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    body.page--fit .table-wrap--viewport {
        flex: 1;
        min-height: 0;
        max-height: none;
        margin-bottom: 0;
    }
}

.table th,
.table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--app-border);
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #1C1C1C;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.75);
}

.table tbody tr:hover {
    background: rgba(56, 254, 220, 0.06);
}

.table tr.table__row--selected {
    background: rgba(56, 254, 220, 0.15);
}

.table tr.table__group td {
    background: #202020;
    color: var(--app-accent);
    font-weight: 700;
}

.table a {
    color: var(--app-accent);
    text-decoration: none;
    font-weight: 600;
}

.table a:hover {
    text-decoration: underline;
}

/* Première colonne figée sur le tableau Stats joueurs (26 colonnes). */
.table--frozen th:first-child,
.table--frozen td:first-child {
    position: sticky;
    left: 0;
    background: var(--app-background);
}

.table--frozen thead th:first-child {
    z-index: 2;
    background: #1C1C1C;
}

.table--frozen tr.table__row--selected td:first-child {
    background: #1E3A36;
}

.is-hidden-column {
    display: none;
}

/* En-têtes de colonnes triables (tableau Stats joueurs) : cliquables, avec une flèche pour la colonne
   et le sens de tri actifs. */
.js-sortable-header {
    cursor: pointer;
    user-select: none;
}

.js-sortable-header:hover {
    color: var(--app-accent);
}

.js-sortable-header::after {
    content: '';
    display: inline-block;
    width: 0.7em;
}

.js-sortable-header.is-sort-asc::after {
    content: '▲';
    color: var(--app-accent);
}

.js-sortable-header.is-sort-desc::after {
    content: '▼';
    color: var(--app-accent);
}

/* ===================== Page d'erreur ===================== */

.error-page__content {
    max-width: 480px;
    margin: 80px auto;
    padding: 0 16px;
    text-align: center;
}

.error-page__code {
    font-size: 72px;
    font-weight: 700;
    color: var(--app-accent);
    margin: 0;
}

/* ===================== Classement (accueil) ===================== */

.leaderboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.leaderboard-card {
    background: var(--app-card-background);
    border: 1px solid var(--app-border);
    border-radius: 16px;
    padding: 16px 20px;
}

.leaderboard-card__title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
    margin: 0 0 12px;
}

.leaderboard {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard__row {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    grid-template-areas: "rank name value" ". detail detail";
    align-items: center;
    column-gap: 10px;
    row-gap: 2px;
}

.leaderboard__rank {
    grid-area: rank;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    background: var(--app-border-strong);
}

.leaderboard__rank--1 {
    background: var(--app-accent);
    color: var(--app-accent-ink);
}

.leaderboard__name {
    grid-area: name;
    font-weight: 600;
}

.leaderboard__value {
    grid-area: value;
    color: var(--app-accent);
    font-weight: 700;
    white-space: nowrap;
}

.leaderboard__detail {
    grid-area: detail;
    font-size: 12px;
    opacity: 0.6;
}

/* Boucle vidéo protégée de l'accueil (banque de médias, voir MediaBank). Le calque .media-frame__shield
   recouvre la vidéo pour absorber clic droit et glisser-déposer. */
.media-frame {
    position: relative;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 16px;
    border-radius: 12px;
    overflow: hidden;
    line-height: 0;
    user-select: none;
    -webkit-user-select: none;
}

.media-frame__video {
    display: block;
    /* Même hauteur pour toutes les boucles (celle de Animation_0026, 1000x1200 affichée en 240 px de large) ;
       la largeur suit le ratio de chaque vidéo, plafonnée à l'écran (contain : jamais déformée). */
    height: 288px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    pointer-events: none;
}

.media-frame__shield {
    position: absolute;
    inset: 0;
    background: transparent;
}
/* Badge spécial (premier joueur à atteindre le palier maximal de la saison) : anneau doré autour de l'icône,
   comme dans le Résumé joueur de l'appli bureau. */
.badge--special .badge__icon {
    border-radius: 50%;
    box-shadow: 0 0 0 2px #ffd700, 0 0 10px rgba(255, 215, 0, 0.55);
}

/* Intitulé d'une ligne de badges (une saison) sur le Résumé joueur avec « Toutes saisons ». */
.badge-group__label {
    font-size: 15px;
    font-weight: 700;
    color: #38fedc;
    margin: 14px 0 8px;
}

/* Collection de badges (page /joueurs/badges) : une carte par famille, tous les paliers en ligne (acquis en
   couleur, les autres en silhouette), barre de progression vers le palier suivant, rareté sous chaque icône. */
.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.collection-card {
    background: var(--app-card-background);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    padding: 14px 16px;
}

.collection-card--complete {
    border-color: #38fedc;
}

.collection-card__header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 12px;
}

.collection-card__title {
    font-weight: 700;
    font-size: 16px;
}

.collection-card__stat {
    font-size: 12px;
    opacity: 0.65;
}

.collection-tiers {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.collection-tier {
    position: relative;
    width: 52px;
    text-align: center;
}

.collection-tier__icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
    margin: 0 auto 2px;
}

.collection-tier--locked .collection-tier__icon {
    /* Silhouette : l'icône d'origine passée au noir puis éclaircie, sans image supplémentaire. */
    filter: brightness(0) invert(0.28);
}

.collection-tier--special .collection-tier__icon {
    border-radius: 50%;
}

.collection-tier--special:not(.collection-tier--locked) .collection-tier__icon {
    box-shadow: 0 0 0 2px #ffd700, 0 0 10px rgba(255, 215, 0, 0.55);
}

.collection-tier__rarity {
    font-size: 11px;
    opacity: 0.7;
}

.collection-tier:hover .badge__tooltip,
.collection-tier:focus .badge__tooltip,
.collection-tier:focus-visible .badge__tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.progress {
    height: 8px;
    border-radius: 4px;
    background: var(--app-border);
    overflow: hidden;
}

.progress__bar {
    height: 100%;
    background: #38fedc;
    border-radius: 4px;
}

.collection-card__progress {
    margin-top: 6px;
    font-size: 12px;
    opacity: 0.8;
}

/* Collection de badges : une saison = un <details> natif (accordéon sans JS), même esprit que .game-accordion. */
.season-accordion {
    margin-bottom: 14px;
}

.season-accordion__summary {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 4px;
    border-bottom: 1px solid var(--app-border);
    cursor: pointer;
    list-style: none;
}

.season-accordion__summary::-webkit-details-marker {
    display: none;
}

.season-accordion__summary::before {
    content: '▸';
    color: var(--app-accent);
    transition: transform 0.15s ease;
}

.season-accordion[open] > .season-accordion__summary::before {
    transform: rotate(90deg);
}

.season-accordion__summary:hover {
    background: rgba(56, 254, 220, 0.06);
}

.season-accordion__title {
    font-size: 18px;
    font-weight: 700;
}

.season-accordion__meta {
    font-size: 13px;
    opacity: 0.75;
}

.season-accordion[open] > .season-accordion__summary {
    margin-bottom: 12px;
}

/* Collection de badges : un lobby = un <details> imbriqué dans la saison (le joueur en a plusieurs). */
.season-accordion--lobby {
    margin-left: 12px;
}

.season-accordion--lobby > .season-accordion__summary .season-accordion__title {
    font-size: 16px;
    color: var(--app-accent);
}
