.youtube-extrait {
    position: relative;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
    border-radius: 4px;
    user-select: none;

    /* Permet d'adapter l'interface à la largeur réelle du lecteur */
    container-type: inline-size;
}

.youtube-extrait-video {
    position: absolute;
    inset: 0;
    background: #000;
}

.youtube-extrait iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}


/* =========================================================
   MINIATURE
   ========================================================= */

.yt-extrait-thumbnail {
    position: absolute;
    inset: 0;
    z-index: 5;

    background-position: center;
    background-size: cover;

    cursor: pointer;
}

.yt-extrait-thumbnail::after {
    content: "";
    position: absolute;
    inset: 0;

    background: rgba(0, 0, 0, 0.15);
}

.yt-extrait-play {
    position: absolute;
    z-index: 6;

    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%);

    width: 72px;
    height: 72px;

    border: 0;
    border-radius: 50%;

    background: rgba(0, 0, 0, 0.75);

    cursor: pointer;

    /* Le caractère ▶ du HTML n'est plus affiché */
    font-size: 0;
}

.yt-extrait-play::before {
    content: "";

    position: absolute;

    top: 50%;
    left: 50%;

    width: 0;
    height: 0;

    border-top: 16px solid transparent;
    border-bottom: 16px solid transparent;
    border-left: 25px solid white;

    transform: translate(-40%, -50%);
}

.yt-extrait-play:hover {
    background: rgba(0, 0, 0, 0.9);

    transform: translate(-50%, -50%) scale(1.08);
}


/* =========================================================
   INTERFACE
   ========================================================= */

.yt-extrait-ui {
    position: absolute;
    z-index: 10;

    left: 0;
    right: 0;
    bottom: 0;

    padding: 18px 7px 5px;

    background: linear-gradient(
        transparent,
        rgba(0, 0, 0, 0.85)
    );

    transition: opacity 0.3s ease;
}

.yt-extrait-ui.hidden {
    opacity: 0;
    pointer-events: none;
}


/* Barre de progression */

.yt-extrait-progress {
    display: block;

    width: 100%;
    height: 4px;

    margin: 0 0 5px;

    cursor: pointer;
}


/* Ligne des commandes */

.yt-extrait-controls {
    display: flex;
    align-items: center;

    gap: 2px;
    min-height: 26px;
}


/* Boutons */

.yt-extrait-controls button {
    flex: 0 0 auto;

    width: 35px;
    height: 34px;

    border: 0;
    background: transparent;
    color: white;

    padding: 0;

    font-size: 17px;
    line-height: 34px;
    text-align: center;

    cursor: pointer;
}

.yt-extrait-controls button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}


/* Volume */

.yt-extrait-volume {
    flex: 0 1 auto;

    width: 80px;
    height: 4px;

    cursor: pointer;
}

/* Sous titres */
.yt-captions {
    margin-left: 0;
    font-weight: 600;
    font-size: 13px !important;
}

.yt-captions.active {
   
    background: rgba(255, 255, 255, 0.25) !important;
    border-radius: 3px;
}

/* Compteur */

.yt-extrait-time {
    margin-left: auto;

    color: white;

    font-size: 20px;
    font-weight: 500;

    white-space: nowrap;
}


/* =========================================================
   ÉCRAN DE FIN
   ========================================================= */

.yt-extrait-ended {
    position: absolute;
    inset: 0;
    z-index: 20;

    display: none;

    align-items: center;
    justify-content: center;

    background: rgba(0, 0, 0, 0.65);
}

.yt-extrait-ended.visible {
    display: flex;
}

.yt-extrait-replay {
    padding: 12px 20px;

    border: 0;
    border-radius: 4px;

    background: white;
    color: #111;

    font-size: 16px;

    cursor: pointer;
}

.yt-extrait-replay:hover {
    background: #eee;
}


/* =========================================================
   DÉTECTEUR DE MOUVEMENT DE SOURIS
   ========================================================= */

.yt-extrait-mouse-detector {
    position: absolute;
    inset: 0;
    z-index: 8;

    display: none;
}

.yt-extrait-mouse-detector.visible {
    display: block;
}


/* =========================================================
   LECTEUR ÉTROIT
   =========================================================

   On regarde la largeur réelle du lecteur,
   pas la largeur de l'écran.
*/

@container (max-width: 600px) {

    .yt-extrait-ui {
        padding: 16px 5px 4px;
    }

    .yt-extrait-progress {
        height: 3px;
        margin-bottom: 4px;
    }

    .yt-extrait-controls {
        gap: 1px;
        min-height: 28px;
    }

    .yt-extrait-controls button {
        width: 29px;
        height: 28px;

        font-size: 14px;
        line-height: 28px;
    }

    .yt-extrait-volume {
        width: 60px;
        height: 3px;
    }

    .yt-extrait-time {
        font-size: 16px;
    }
}


/* =========================================================
   TRÈS PETIT LECTEUR
   ========================================================= */

@container (max-width: 400px) {

    .yt-extrait-ui {
        padding: 14px 4px 3px;
    }

    .yt-extrait-controls {
        min-height: 26px;
    }

    .yt-extrait-controls button {
        width: 27px;
        height: 26px;

        font-size: 13px;
        line-height: 26px;
    }

    .yt-extrait-volume {
        width: 50px;
    }

    .yt-extrait-time {
        font-size: 14px;
    }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

    .yt-extrait-play {
        width: 58px;
        height: 58px;
    }

    .yt-extrait-play::before {
        border-top-width: 11px;
        border-bottom-width: 11px;
        border-left-width: 17px;
    }
}