body{
    overflow-x: hidden;
    margin:0;
    background-color:#e5d7e5;
    font-family: "Special Gothic", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-variation-settings:
        "wdth" 100;
    font-size:16px;
}
.desktop{
    display:block;
}
label{
    cursor:pointer;
}
label:has(input[value="XX"]){
    display:none;
}
#mobile{
    display:none;
}
header{
    font-family: "Special Gothic", sans-serif;
    font-optical-sizing: auto;
    font-weight: 700;
    font-style: normal;
    font-variation-settings:
        "wdth" 100;
    padding:0.5rem 4rem;
    margin:0;
    display:flex;
    gap:10px;
    align-items:center;
}

header img{
    max-height:30px;
}
#count{
    margin-top:1rem;
    font-style:italic;
}
main{
    padding:0 4rem;
}
h1{
    color:#310732;
    margin:0.5rem 0;
}
h2{
    margin: 0 0 1rem 0;
}
hr{
    margin:5px;
}
#ytplayer{
    background-color:white;
    height:600px;
    width:calc(100vw - 449px - 8rem);
}
.ytp-pause-overlay{
    display:none;
}
#comment-overlay {
    /* Positionnement par-dessus la vidéo */
    position: absolute;
    z-index: 10; /* S'assure qu'il est au-dessus de la vidéo */

    /* Style de la boîte */
    background-color: rgba(0, 0, 0, 0.7); /* Fond noir semi-transparent */
    color: white;
    padding: 10px 20px;
    font-size: 1.2rem;
    text-align: center;
    max-width: 90%; /* Pour ne pas dépasser sur mobile */

    /* Comportement */
    display: none; /* Caché par défaut */
    pointer-events: none; /* Permet de cliquer sur la vidéo au travers */
    transition: opacity 0.3s ease;
}
#filters{
    padding:0 3rem;
    width:22rem;
    height:660px;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
}
#frame-and-filters{
    margin-top:1rem;
    display:flex;
    align-items:stretch;
}

#match-selector,
#timecode-button {
    /* --- Disposition Flexbox (Horizontal) --- */
    display: flex;
    flex-wrap: nowrap;

    /* --- Gestion du débordement (Scroll) --- */
    /* MODIFICATION : 'overlay' force la barre flottante */
    overflow-x: auto; 

    /* --- Style Barre de scroll (Firefox) --- */
    scrollbar-width: auto;
    scrollbar-color: #333 #FFF; /* Pouce #333, Piste #FFF */
}

/* --- Style commun du "pouce" (WebKit: Chrome, Edge, Safari) --- */
#match-selector::-webkit-scrollbar-thumb,
#timecode-button::-webkit-scrollbar-thumb {
    background-color: #333;
    border-radius: 4px;
}

#match-selector {
    margin: -2px 0 0 0;
    border: solid;
    border-width: 2px;
}

#match-selector::-webkit-scrollbar {
    height: 8px; /* Épaisseur du pouce flottant */
}

#match-selector::-webkit-scrollbar-thumb:hover {
    background-color: #555;
}

#timecode-button {
    padding: 0.5rem 0 0.5rem 10px;
    max-width:calc(100vw - 449px - 8rem - 524px);
}

#timecode-button::-webkit-scrollbar {
    height: 15px; /* Épaisseur du pouce flottant */
}

#timecode-button::-webkit-scrollbar-thumb:hover {
    background-color: #888;
}

/* --- Styles des enfants de #timecode-button --- */
#timecode-button .action.button {
    padding: 5px 8px;
    margin-right: 4px;
    border: solid;
    border-width: 2px;
    flex-shrink: 0;
}
#action_button{
    flex-grow: 1;
    min-width: 0;
}

.match{
    width:15rem;
    padding:0.5rem 2rem;
    border-right:solid;
    border-right-width:2px;
    border-color:black;
    flex-shrink: 0;
}
.match:hover, .button:hover{
    background-color:#cfb9cf;
    cursor:pointer;
}
.match-actif{
    background-color:#FFFFFF;
}
.bouton-actif{
    background-color:#FFFFFF !important;
}
.match p{
    margin:0;
}
.date{
    font-weight: 600;
}
.button-container{
    width:fit-content;
    border:solid;
    border-width:2px;
    display:flex;
    align-items:stretch;
    background-color:#e5d7e5;
}
.button{
    padding:1rem 3rem;
    border-right:solid;
    border-right-width:2px;
    border-color:black;
}
.last{
    border-right:none;
}
#bottom-bar{
    display:flex;
    align-items: stretch;
    gap:5px;
}
.timing-inputs input{
    border:none;
    padding:0.5rem;
    width:3rem;
}
.timing-inputs{
    display:flex;
    border:solid;
    align-items:center;
    border-width:2px;
    width:fit-content;
    padding:0.3rem;
    gap:0.8rem;
}
.timing-inputs div{
    height:100%;
    width:2px;
    background-color:black;
}
#read-all{
    border-left: solid;
    border-left-width: 2px;
}

#filter-form{
    display:flex;
    flex-wrap:wrap;
    gap:0.7rem;
}
.filter-group, .checkbox-group, .radio-group{
    display:flex;
    flex-direction:column;
    flex-wrap:nowrap;
}
}
#filter-timing{
    width:100%;
}
#filter-players{
    width:50%;
}
#filter-position, #filter-poste{
    width:20%;
}
#filter-toggle-btn,
#filter-close-btn,
#overlay {
    display: none;
}
#filter-toggle-btn .filter-text {
    display: none;
}

#play-pause-btn .pause-icon {
    display: none; /* Cache l'icône Pause par défaut */
}
#play-pause-btn.is-playing .pause-icon {
    display: inline-block; /* Affiche Pause quand .is-playing est là */
}
#play-pause-btn.is-playing .play-icon {
    display: none; /* Cache Play quand .is-playing est là */
}
#play-pause-btn {
    display: none;
}
#nav_button{
    flex-shrink: 0;
}
.burger-icon img {
    height: 1.2em;
    width: auto;
    vertical-align: middle;
}

/* S'applique à tous les écrans de 1373px de largeur ou moins */
@media (max-width: 1373px) {

    header img{
        max-height:20px;
    }
    #read-all, #stop-reading{
        padding:1rem 0.7rem;
    }
    body{
        font-size:16px;
    }

    /* --- Styles Généraux --- */
    h1 {
        font-size: 16px;
    }

    header {
        padding: 0 0 0 1rem;
    }

    main {
        padding: 0 3rem 0 1rem;
    }

    .button {
        padding: 0.7rem; /* Règle prioritaire */
    }

    .desktop {
        display: none;
    }

    #mobile {
        display: block;
    }

    /* --- Sélecteur de Match --- */
    .match {
        width: fit-content;
    }

    /* --- Conteneur Vidéo et Filtres --- */
    #frame-and-filters {
        flex-direction: column;
    }

    /* --- Lecteur Vidéo --- */
    #ytplayer {
        width: 100%;
        height: auto; /* CORRECTION : 'auto' pour permettre l'aspect-ratio */
        aspect-ratio: 16 / 9; /* CORRECTION : Appliqué ici */
        max-height:82vh;
    }

    /* --- Barre de Boutons Vidéo --- */
    #bottom-bar {
        gap:5px;
    }

    #nav_button {
        order: 1;
    }

    #action_button {
        order: 2;
    }

    #nav_button .button {
        padding: 0.5rem 1rem;
    }
    #timecode-button{
        max-width:fit-content;
    }
    #timecode-button .action.button {
        padding: 8px 14px;
    }


    /* * ======================================
    * STYLES DU TIROIR FILTRES RESPONSIVE
    * ======================================
    */

    /* --- Le Tiroir (Conteneur) --- */
    #filters {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        width: 25rem; /* Règle prioritaire */

        background-color: #e5d7e5;
        border-left: solid;
        border-left-width: 2px;
        border-color: black;
        z-index: 1000;

        /* Layout interne */
        justify-content: flex-start;
        gap: 10px;
        overflow-y: auto;
        padding: 0rem 1rem 1rem 1rem;

        /* Animation (état fermé) */
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
    }

    /* État ouvert (ajouté par JS) */
    #filters.filters-open {
        transform: translateX(0);
    }

    /* --- Bouton "Ouvrir" (Côté) --- */
    #filter-toggle-btn {
        display: block;
        position: fixed;
        height: 110vh;
        top: -5vh;
        right: -2px;
        z-index: 998;

        border: solid;
        border-width: 2px;
        border-color: black;
        background-color: #e5d7e5;

        font-weight: 700;
        font-size: 20px;
        padding: 0.5rem;
    }

    /* --- Bouton "Fermer" (Dans le tiroir) --- */
    #filter-close-btn {
        display: block;
        position: sticky; /* Reste en haut lors du scroll */
        top: 0rem;
        right: 0rem;
        z-index: 1001;
        order:-10;
        background-color: #e5d7e5;
        border: none;
        font-size: 2.5rem;
    }

    /* --- Overlay (Fond sombre) --- */
    #overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }

    #overlay.overlay-open {
        display: block;
    }

    /* --- Styles des Éléments de Filtre (agrandis) --- */
    .filter-group {
        width: 40%;
    }

    #filter-timing {
        width: 100%;
    }

    #filter-players, #filter-position, #filter-poste, #filter-action, #filter-resultat {
        width: fit-content;
    }
    #filter-players p{
        font-size:10px;
    }

    #filters label {
        font-size: 1.1rem;
        padding: 0.2rem 0.1rem;
        display: flex;
        gap:5px;
        align-items: center;
    }

    #filters input[type="checkbox"],
    #filters input[type="radio"] {
        transform: scale(1.5);
        vertical-align: middle;
    }

    #filters .checkbox-group,
    #filters .radio-group {
        margin-top: 0.5rem;
    }

    #filters input[type="number"]::-webkit-inner-spin-button,
    #filters input[type="number"]::-webkit-outer-spin-button {
        transform: scale(1.4);
        margin-left: 0.5rem;
    }
    
    #filter-buttons{
        flex-direction:column;
        gap:5px;
        border:none;
        order:-9;
        position: sticky;
        top:69px;
        right:0;
        z-index:1100;
        background-color:#e5d7e5;
        width:100%;
        padding:0.5rem 0;
    }
    #count{
        order:-8;
        position: sticky;
        top:80px;
        right:0;
    }
    #filter-buttons .button{
        padding:0.3rem 0.6rem;
        border-width:2px;
        border:solid;
        border-color:black;
    }
    #play-pause-btn {
        display: block; /* Devient visible */

        /* Assure qu'il a le même padding que ses voisins */
        padding: 0.3rem; 
    }

}
@media (max-width: 740px) {
    /* --- Styles du tiroir (ancré en bas) --- */
    #filters {
        /* 1. ANCRAGE EN BAS */
        top: auto; /* Annule le 'top: 0' hérité */
        bottom: 0; /* Ancré en bas */
        left: 0;
        right: 0;
        
        width: 100%; /* Prend toute la largeur */
        height: auto; /* La hauteur s'adapte au contenu */
        max-height: 70vh; /* Max 70% de la hauteur de l'écran */

        /* Animation (état fermé) */
        transform: translateY(100%); /* Caché en bas */
        
        /* (Le reste de vos styles est conservé) */
        padding: 0 0.5rem 0.5rem 0.5rem;
        font-size: 16px;
        border-left: none; /* Plus de bordure gauche */
        border-top: 2px solid black; /* Nouvelle bordure en haut */
        
        /* (Styles hérités de 1373px) */
        position: fixed;
        background-color: #e5d7e5;
        z-index: 1000;
        justify-content: flex-start;
        gap: 10px;
        overflow-y: auto;
        transition: transform 0.3s ease-in-out;
    }

    /* État ouvert (vient du bas) */
    #filters.filters-open {
        transform: translateY(0);
    }

    /* --- Contenu du formulaire (Horizontal) --- */
    #filter-form {
        /* 2. DIRECTION HORIZONTALE */
        display: flex;
        flex-direction: row;
        margin-right:30px;
        
        /* Et on le rend scrollable */
        overflow-x: auto;
        flex-wrap: nowrap;
        
        /* Espace pour la barre de scroll en bas */
        padding-bottom: 1rem; 
    }
    
    /* On donne une largeur fixe aux groupes pour le scroll */
    .filter-group {
        flex-shrink: 0;
        width: fit-content;
    }

    /* (Le reste de vos styles 740px) */

    #frame-and-filters {
        margin: 0;
    }

    main {
        padding: 0;
    }

    /* Les boutons sticky s'adaptent au nouveau tiroir */
    #filter-buttons {
        flex-direction:row;
        justify-content:center;
        top: 10px; /* Reste collé 44px sous le haut DU TIROIR */
        padding:0;
        background-color:rgba(0,0,0,0);
    }
    #count{
        display:flex;
        justify-content:center;
        margin:0;
        font-size:0.7rem;
        top:50px;
    }

    #filter-close-btn {
        width:fit-content;
        position: absolute;
        top: 3px;
        left: 0rem;
        z-index: 1101;
        }

    /* Le bouton "Ouvrir" reste en haut de la page */
    #filter-toggle-btn {
        position: absolute;
        bottom: 0;
        top:calc(100svh - 46px);
        right:0;
        width:100%;
        height: 44px;
        border:none;
        border-top:solid;
    }
    #filters h2{
        display:none;
    }
    #filters label{
        font-size: 1rem;
        padding: 0;
    }
    #filters input[type="checkbox"], #filters input[type="radio"] {
        transform: scale(1.2);
        }
    #match-selector {
        margin: -2px 0 0 -2px;
        width: 100%;
    }

    #bottom-bar {
        width: 100%;
        margin-left: -2px;
        flex-direction:column;
    }

    .button {
        padding: 0 0.4rem 0 0.4rem;
    }

      #filter-timing {
    width: 33%;
  }
    #action_button{
        width:100%;
    }
    #filters p {
        font-size: 12px;
    }

    .filter-buttons .button {
        padding: 1rem 1rem;
        font-size: 14px;
    }


    .timing-inputs {
        flex-direction: column;
        gap: 0;
        align-items: flex-start;
    }
    /* 1. On CACHE l'icône burger ☰ */
    #filter-toggle-btn .burger-icon {
        display: none;
    }

    /* 2. On AFFICHE le texte "Filtres" */
    #filter-toggle-btn .filter-text {
        display: inline-block; /* (ou 'block') */
    }
}