/* ==========================================================================
   INTERFACES COMPORTEMENTALES : REPRODUCTION DU RENDU CANVAS DE L'IMAGE 2
   ========================================================================== */

.results-hero {
    text-align: center;
    margin-bottom: 3rem;
    padding: 0 1rem;
}

.charts-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 4rem;
    padding: 0 1rem;
}

/* Section de la Poule (Agencée en Flex-row pour isoler le titre latéral) */
.pool-chart-section {
    background-color: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 0.75rem;
    padding: 4rem;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 2rem;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    box-shadow: 0 25px 30px -5px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

/* Conteneur dédié qui sécurise l'espace du titre et s'élargit horizontalement si besoin */
.chart-vertical-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    width: auto;
    max-width: 320px;
    /* Sécurité pour éviter qu'un titre-roman ne mange tout le graphique */
    flex-shrink: 0;
    height: 520px;
    /* Parfaitement aligné sur la hauteur minimale de la grille de vautre */
}

/* Titre vertical natif avec gestion intelligente du multi-lignes et de la taille */
.chart-vertical-title {
    /* Utilisation de clamp : la police diminue fluidement sur les petits écrans d'ordinateur */
    font-size: 2.5rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
    white-space: normal;
    /* Autorise le retour à la ligne vertical */
    letter-spacing: -0.02em;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-align: center;
    max-height: 100%;
    /* Interdiction stricte de dépasser les 420px du wrapper */
    line-height: 1.15;
}

.chart-title-emoji {
    margin-bottom: 0.75rem;
    display: inline-block;
    writing-mode: sideways-rl;

}

/* Grille d'alignement par le bas (Centrée sur ordinateur) */
.chart-graphic-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 1.25rem;
    min-height: 420px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
    flex: 1;
}

/* Colonne interactive */
.chart-bar-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 85px;
    max-width: 150px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.chart-bar-column:hover {
    transform: translateY(-4px);
}

/* Élément de remplissage basé sur un ratio et des unités de viewport dynamiques (dvh) */
.bar-fill-element {
    width: 100%;
    height: calc(var(--bar-ratio) * 38dvh);
    position: relative;
    border-radius: 0;
    overflow: visible;
}

/* Label des votes (Blanc, calé en bas de la barre, juste au-dessus de la pochette) */
.bar-score-label {
    position: absolute;
    bottom: 8px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 1), 0 1px 3px rgba(0, 0, 0, 1);
    white-space: nowrap;
    z-index: 5;
}

/* Cadre de pochette carré et franc */
.bar-artwork-frame {
    width: 100%;
    aspect-ratio: 1 / 1;
    margin-top: 0;
    border-radius: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: 3px solid #ffffff;
    background-color: var(--gray-900);
}

.bar-artwork-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bar-artwork-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

/* Modulations mobiles - Inversion ordonnée et création de pistes (tracks) horizontales */
@media (max-width: 1200px) {
    .pool-chart-section {
        padding: 1.5rem 0.75rem;
        flex-direction: column-reverse;
        gap: 1.5rem;
        position: relative;
        /* Requis pour confiner le filtre de fond */
        z-index: 1;
        /* Crée un nouveau contexte d'empilement */
    }

    /* Voile d'assombrissement et de flou exclusif au mobile */
    .pool-chart-section::before {
        content: "";
        position: absolute;
        inset: 0;
        background-color: rgba(0, 0, 0, 0.35);
        /* Léger assombrissement (35% d'opacité) */
        backdrop-filter: blur(3px);
        /* Tout petit peu de flou */
        -webkit-backdrop-filter: blur(3px);
        /* Compatibilité iPhone/Safari */
        z-index: -1;
        /* Se place exactement entre l'image de fond et le graphique */
        border-radius: inherit;
        /* Respecte les arrondis de la carte */
    }

    .chart-vertical-title-wrapper {
        width: 100%;
        justify-content: flex-start;
        height: 80px;
    }

    .chart-vertical-title {
        writing-mode: horizontal-tb;
        transform: none;
        font-size: 1.35rem;
        /* Taille réduite pour les petits écrans */
        text-align: left;
        white-space: normal;
        /* Permet le retour à la ligne */
        word-wrap: break-word;
        /* Force la coupure si un mot est trop long */
        line-height: 1.3;
        /* Ajuste l'espacement si ça passe sur 2 lignes */
    }

    .chart-title-emoji {
        margin-bottom: 0;
        margin-right: 0.5rem;
        writing-mode: horizontal-tb;
    }

    .chart-graphic-container {
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 0.75rem;
        min-height: auto;
        border-bottom: none;
        border-left: none;
        padding-bottom: 0;
        padding-left: 0;
        width: 100%;
    }

    /* La "Piste" complète translucide pour combler le vide */
    .chart-bar-column {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 0;
        width: 100%;
        max-width: 100%;
        background-color: rgba(255, 255, 255, 0.08);
        /* Effet piste / track */
    }

    /* Jauge interne colorée */
    .bar-fill-element {
        /* Le maximum (ratio 1) prend désormais 100% de la piste */
        width: calc(var(--bar-ratio) * 100%);
        height: 3.25rem;
        /* Exactement la même hauteur que la pochette */
        order: 2;
        min-width: 0.1rem;
        /* Garantit que la jauge est visible même à zéro */
    }

    /* Le texte de score, par défaut à l'extérieur de la jauge */
    .bar-score-label {
        position: absolute;
        left: 100%;
        top: 50%;
        transform: translateY(-50%);
        bottom: auto;
        right: auto;
        text-align: left;
        margin-left: 0.75rem;
        font-size: 0.9rem;
    }

    /* Bascule intelligente gérée par Jinja : ramène le texte dans la barre */
    .bar-fill-element.label-inside .bar-score-label {
        left: auto;
        right: 0.75rem;
        margin-left: 0;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    }

    /* Pochette carré fusionnée avec la piste */
    .bar-artwork-frame {
        width: 3.25rem;
        height: 3.25rem;
        min-width: 3.25rem;
        order: 1;
        border: none;
        margin-top: 0;
    }
}

/* ==========================================================================
   ASCENSEUR PERSONNALISÉ POUR LA MODALE (SCROLLBAR)
   ========================================================================== */
.modal-custom-scroll::-webkit-scrollbar {
    width: 6px;
    /* Largeur toute fine */
}

.modal-custom-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    /* Piste à peine visible */
    border-radius: 10px;
}

.modal-custom-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    /* Curseur gris translucide */
    border-radius: 10px;
}

.modal-custom-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
    /* Curseur un peu plus clair au survol */
}

/* Firefox */
.modal-custom-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.05);
}