/* Extracted from library_content.html. Callers: webapp local gallery. */

    /* --- MÊME FOND QUE SETTINGS / AUTRES PAGES --- */
    body.library-page {
        overflow-x: clip;
        min-height: 100vh;
        background: #151020;
        background-image:
            radial-gradient(ellipse 150% 100% at 50% -20%, rgba(255,105,180,0.4) 0%, transparent 55%),
            radial-gradient(ellipse 120% 90% at 100% 30%, rgba(0,212,255,0.35) 0%, transparent 50%),
            radial-gradient(ellipse 100% 80% at 0% 70%, rgba(255,20,147,0.25) 0%, transparent 50%),
            radial-gradient(ellipse 80% 120% at 50% 100%, rgba(0,212,255,0.2) 0%, transparent 55%),
            linear-gradient(180deg, #1a1525 0%, #151020 30%, #120e1a 70%, #0f0d15 100%);
        background-attachment: fixed;
        background-repeat: no-repeat;
        background-size: 100% 100%;
    }
    body.library-page #main-swapper {
        background: transparent !important;
    }

    /* --- DESIGN ÉPURÉ DARK --- */

    /* Toolbar — verre dépoli aligné modales / batch bar */
    .compact-toolbar {
        position: sticky;
        top: 8px;
        z-index: 20;
        background: rgba(26, 21, 37, 0.45);
        padding: 10px 14px;
        margin: 0 0 20px 0;
        display: flex;
        align-items: center;
        gap: 12px;
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 16px;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 24px rgba(0, 0, 0, 0.18);
    }
    .toolbar-filters {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1 1 auto;
        min-width: 0;
    }
    .toolbar-line { display: contents; }
    .toolbar-divider {
        width: 1px;
        align-self: stretch;
        min-height: 28px;
        background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.12) 20%, rgba(255, 255, 255, 0.12) 80%, transparent);
        flex-shrink: 0;
    }
    /* --- CUSTOM SELECT STYLES (transparent comme player drawer) --- */
    .custom-select-container {
        position: relative;
        min-width: 140px;
    }

    .custom-select-trigger {
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: 0.72rem;
        font-weight: 700;
        color: rgba(255, 255, 255, 0.78);
        cursor: pointer;
        padding: 7px 12px;
        border-radius: 10px;
        background: transparent;
        border: 1px solid rgba(255, 255, 255, 0.14);
        transition: color 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        user-select: none;
    }

    .custom-select-trigger:hover {
        color: #00d4ff;
        background: rgba(0, 212, 255, 0.08);
        border-color: rgba(0, 212, 255, 0.35);
    }

    .custom-select-container.open .custom-select-trigger {
        color: #00d4ff;
        background: rgba(0, 212, 255, 0.1);
        border-color: rgba(0, 212, 255, 0.45);
        box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.12);
    }

    .custom-select-trigger::after {
        content: '';
        width: 0; height: 0;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        border-top: 4px solid rgba(255, 255, 255, 0.5);
        margin-left: 8px;
        transition: transform 0.2s, border-top-color 0.2s;
    }

    .custom-select-container.open .custom-select-trigger::after {
        transform: rotate(180deg);
        border-top-color: #00d4ff;
    }

    .custom-options {
        position: absolute;
        top: 100%;
        left: 0;
        min-width: 180px;
        background: rgba(26, 21, 37, 0.92);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border: 1px solid rgba(0, 212, 255, 0.2);
        border-radius: 12px;
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-6px);
        transition: all 0.2s ease;
        z-index: 120;
        padding: 6px;
        margin-top: 6px;
    }

    .custom-select-container.open .custom-options {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .custom-option {
        padding: 8px 12px;
        font-size: 0.8rem;
        color: rgba(255, 255, 255, 0.85);
        cursor: pointer;
        border-radius: 8px;
        transition: background 0.15s, color 0.15s;
    }

    .custom-option:hover {
        background: rgba(255, 255, 255, 0.08);
        color: #fff;
    }

    .custom-option.selected {
        color: #00d4ff;
        font-weight: 700;
        background: rgba(0, 212, 255, 0.12);
    }

    /* Coeur Favoris */
    .fav-toggle {
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        color: rgba(255, 255, 255, 0.72);
        width: 36px;
        height: 34px;
        border-radius: 10px;
        background: transparent;
        border: 1px solid rgba(255, 255, 255, 0.14);
        transition: color 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
    }
    .fav-toggle:hover {
        color: #fff;
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(255, 255, 255, 0.22);
    }
    .fav-toggle:has(input:checked) {
        color: #ff2da0;
        background: rgba(255, 45, 160, 0.1);
        border-color: rgba(255, 45, 160, 0.35);
        box-shadow: 0 0 12px rgba(255, 45, 160, 0.15);
    }
    .fav-toggle input:checked + .fav-toggle-icon {
        color: #ff2da0;
    }
    .fav-toggle input:checked + .fav-toggle-icon svg {
        fill: currentColor;
        filter: drop-shadow(0 0 6px rgba(255, 45, 160, 0.45));
    }

    /* Tags — pills verre (comme onglets player) */
    .tags-scroller {
        flex: 1;
        display: flex;
        gap: 6px;
        overflow-x: auto;
        scrollbar-width: none;
        mask-image: linear-gradient(to right, transparent 0, black 12px, black calc(100% - 24px), transparent 100%);
        -webkit-mask-image: linear-gradient(to right, transparent 0, black 12px, black calc(100% - 24px), transparent 100%);
        padding: 2px 4px;
        min-width: 0;
    }
    .tags-scroller::-webkit-scrollbar { display: none; }

    .tag-pill {
        background: transparent;
        color: rgba(255, 255, 255, 0.62);
        padding: 5px 12px;
        border-radius: 999px;
        font-size: 0.72rem;
        font-weight: 600;
        white-space: nowrap;
        cursor: pointer;
        transition: color 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
        border: 1px solid rgba(255, 255, 255, 0.12);
        letter-spacing: 0.02em;
    }
    .tag-pill:hover {
        color: #fff;
        background: rgba(0, 212, 255, 0.08);
        border-color: rgba(0, 212, 255, 0.3);
    }
    .tag-pill.active {
        color: #fff;
        background: rgba(0, 212, 255, 0.14);
        border-color: rgba(0, 212, 255, 0.45);
        box-shadow: 0 0 10px rgba(0, 212, 255, 0.12);
    }
    .toolbar-count {
        flex-shrink: 0;
        font-size: 0.72rem;
        font-weight: 700;
        white-space: nowrap;
        color: rgba(255, 255, 255, 0.45);
        letter-spacing: 0.04em;
        font-variant-numeric: tabular-nums;
    }
    .toolbar-count #visibleCount {
        color: #00d4ff;
    }

    /* --- GRILLE VIDEO --- */
    .video-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 16px;
        padding-bottom: 50px;
        overflow: visible;
    }

    /* Callers: gallery.html #folderReconnectBanner + local_gallery.js.
       API: none. Schema: FSA re-grant banner after Chrome close.
       User: « les gallerie peuvent se perdre… galleries doivent etre persistentes ». */
    .folder-reconnect-banner {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        flex-wrap: wrap;
        margin: 0 0 12px;
        padding: 12px 14px;
        border-radius: 12px;
        border: 1px solid rgba(0, 212, 255, 0.35);
        background: linear-gradient(135deg, rgba(0, 212, 255, 0.12), rgba(255, 20, 147, 0.08));
    }
    .folder-reconnect-banner[hidden] { display: none !important; }
    .folder-reconnect-msg {
        margin: 0;
        flex: 1;
        min-width: 12rem;
        font-size: 0.86rem;
        line-height: 1.4;
        color: rgba(232, 237, 247, 0.9);
    }
    .video-card.is-reconnect {
        opacity: 0.72;
        outline: 1px dashed rgba(0, 212, 255, 0.35);
    }

    .lib-empty-state[hidden] { display: none !important; }
    .gallery-load {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: min(62vh, 520px);
        padding: 24px 16px 48px;
        background: transparent;
    }
    .gallery-load[hidden] { display: none !important; }
    .gallery-load .web-splash-card { position: relative; }
    /* Galerie locale vide : uniquement sans dossier. */
    .lib-empty-state {
        display: none;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        min-height: min(52vh, 420px);
        padding: 48px 24px 64px;
        gap: 18px;
    }
    .lib-empty-state.is-on { display: flex; }
    .lib-empty-state__msg {
        margin: 0;
        max-width: 28rem;
        font-size: 1.05rem;
        line-height: 1.45;
        font-weight: 500;
        color: rgba(226, 232, 240, 0.78);
    }
    .lib-empty-state__cta {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        min-height: 42px;
        padding: 10px 20px;
        border-radius: 999px;
        border: 1px solid rgba(0, 212, 255, 0.45);
        background: linear-gradient(145deg, rgba(0, 212, 255, 0.18), rgba(0, 120, 160, 0.12));
        color: #e8f9ff;
        font-size: 0.88rem;
        font-weight: 650;
        letter-spacing: 0.02em;
        text-decoration: none;
        transition: border-color 0.15s, background 0.15s, transform 0.12s;
    }
    .lib-empty-state__cta:hover {
        border-color: rgba(0, 212, 255, 0.75);
        background: linear-gradient(145deg, rgba(0, 212, 255, 0.28), rgba(0, 140, 180, 0.18));
        color: #fff;
        transform: translateY(-1px);
    }

    /* Carte entière : scale au survol, sans trait blanc (glow soft seulement) */
    .video-card {
        background: transparent;
        border: none;
        border-radius: 16px;
        position: relative;
        overflow: visible;
        padding: 0;
        margin: 0;
        outline: none;
        transform-origin: center center;
        transition:
            transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
            box-shadow 0.3s ease,
            z-index 0s;
        box-shadow: none;
    }

    .video-card:hover {
        z-index: 10;
        transform: scale(1.06);
        /* Ombre derrière = profondeur / rapprochement — pas de halo blanc autour */
        box-shadow:
            0 22px 48px rgba(0, 0, 0, 0.55),
            0 10px 22px rgba(0, 0, 0, 0.4);
    }

    /* Brillance douce sur le tour (pas de trait, pas sur le GIF) */
    .video-card::after {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: 16px;
        pointer-events: none;
        z-index: 6;
        opacity: 0;
        box-shadow: inset 0 0 22px rgba(255, 255, 255, 0.14);
        transition: opacity 0.3s ease;
    }
    .video-card:hover::after {
        opacity: 1;
    }
    .video-card:hover .card-info {
        filter: brightness(1.1);
    }

    body.library-page .video-card:hover .batch-overlay,
    body.library-page .video-card.selected .batch-overlay { opacity: 1; }

    /* Vignette : pas de cadre ni scale propre (le cadre est la carte) */
    .thumbnail-box {
        aspect-ratio: 16/9;
        border-radius: 12px;
        overflow: hidden;
        position: relative;
        cursor: pointer;
        background: rgba(20, 18, 28, 0.6);
        border: none;
        box-shadow: none;
    }
    .thumbnail-box .static-thumb,
    .thumbnail-box .thumb-raster,
    .thumbnail-box .preview-vid {
        border-radius: 12px;
    }

    .static-thumb {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        border: none;
        outline: none;
        z-index: 1;
    }
    img.static-thumb.is-rasterized {
        opacity: 0;
        pointer-events: none;
    }
    .thumb-raster {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        pointer-events: none;
        border: none;
        z-index: 1;
    }
    .preview-vid {
        display: none;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        z-index: 2;
        opacity: 0;
        background: transparent;
        pointer-events: none;
    }
    .card-heatmap {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 3px;
        z-index: 4;
        background: linear-gradient(90deg, #333, #555);
        background-size: 100% 100%;
        background-repeat: no-repeat;
        pointer-events: none;
    }

    /* Actions Flottantes */
    .hover-actions {
        position: absolute;
        top: 6px; right: 6px;
        display: flex;
        flex-direction: column;
        gap: 4px;
        opacity: 0;
        transition: opacity 0.2s;
        z-index: 20;
    }
    .video-card:hover .hover-actions { opacity: 1; }

    /* Callers: gallery cards (button.action-btn — CSP forbids inline onclick).
       User: « favoris ne fonctionne pas » */
    .action-btn {
        width: 32px; height: 32px;
        padding: 0;
        margin: 0;
        appearance: none;
        -webkit-appearance: none;
        background: rgba(0, 0, 0, 0.35);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        border: 1px solid rgba(255, 255, 255, 0.08);
        color: rgba(255, 255, 255, 0.95);
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s;
    }
    button.fav-toggle {
        appearance: none;
        -webkit-appearance: none;
        font: inherit;
    }
    button.tag-pill {
        appearance: none;
        -webkit-appearance: none;
        font: inherit;
    }
    .action-btn:hover { background: rgba(0, 212, 255, 0.5); color: #000; border-color: rgba(0, 212, 255, 0.4); }
    .action-btn.delete:hover { background: rgba(255, 45, 160, 0.5); color: #fff; border-color: rgba(255, 45, 160, 0.4); }

    .action-btn.fav.active { color: #ff2da0; }
    .action-btn.fav.active svg { fill: #ff2da0; stroke: #ff2da0; }

    .card-info { padding: 10px 4px 4px; }
    .card-title {
        color: #eee;
        font-size: 0.95rem;
        font-weight: 600;
        line-height: 1.3;
        margin-bottom: 4px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        cursor: pointer;
    }
    .card-title .card-title-inner { display: inline; }
    .video-card:hover .card-title,
    .card-title.is-measuring {
        display: block;
        -webkit-line-clamp: unset;
        -webkit-box-orient: unset;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: clip;
    }
    .card-title.is-measuring .card-title-inner,
    .video-card:hover .card-title.is-overflow .card-title-inner {
        display: inline-block;
        white-space: nowrap;
        padding-right: 2em;
    }
    .video-card:hover .card-title.is-overflow .card-title-inner {
        animation: lib-card-title-marquee 9s linear infinite;
    }
    @keyframes lib-card-title-marquee {
        0%, 12% { transform: translateX(0); }
        88%, 100% { transform: translateX(calc(-100% + var(--marquee-view, 100%))); }
    }
    .meta-row { display: flex; justify-content: space-between; color: #666; font-size: 0.75rem; }

    /* Badges */
    .badges-overlay {
        position: absolute;
        left: 6px;
        right: 6px;
        bottom: 6px;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 4px;
        z-index: 12;
        pointer-events: none;
    }
    .badge-simple {
        background: rgba(0, 0, 0, 0.45);
        color: #fff;
        padding: 2px 7px;
        border-radius: 999px;
        font-size: 0.65rem;
        font-weight: 600;
        line-height: 1.2;
        white-space: nowrap;
    }
    .badge-script {
        max-width: 148px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-block;
        vertical-align: middle;
    }
    .badge-duration { margin-left: auto; }
    .bg-ai { background: rgba(0, 212, 255, 0.45); color: #fff; }
    .bg-human { background: rgba(0, 255, 157, 0.45); color: #fff; }
    .bg-multi { background: rgba(217, 70, 239, 0.5); color: #fff; }
    .bg-mhs { background: rgba(0, 212, 255, 0.5); color: #fff; }
    .bg-ch { background: rgba(255, 45, 160, 0.5); color: #fff; } /* CockHero - rose MAIA */
    .bg-mp3 { background: rgba(251, 191, 36, 0.55); color: #1a1200; }
    .thumbnail-box.has-raster:not(.is-previewing) > .badges-overlay { visibility: visible; }
    .thumbnail-box.has-hm:not(.is-previewing) > .card-heatmap { visibility: hidden; }

    /* --- Popups Library : verre transparent (même thème que Companion / galerie web) --- */
    body.library-page .modal-overlay {
        background: rgba(10, 8, 16, 0.22);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
    /* Callers: editModal. User: modal edit = thème ouverture galerie / PMV. */
    body.library-page .modal-overlay {
        background: rgba(8, 6, 12, 0.28) !important;
    }
    body.library-page .modal-box {
        background-color: transparent !important;
        background-image: linear-gradient(
          155deg,
          rgba(255, 255, 255, 0.05) 0%,
          rgba(255, 255, 255, 0.015) 45%,
          rgba(8, 6, 12, 0.32) 100%
        ) !important;
        backdrop-filter: blur(16px) saturate(1.1);
        -webkit-backdrop-filter: blur(16px) saturate(1.1);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 20px;
        width: min(640px, 94vw);
        max-width: 94vw;
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    }
    body.library-page .modal-header {
        color: #00d4ff;
        font-weight: 800;
        letter-spacing: 0.05em;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        padding-bottom: 12px;
    }
    body.library-page .modal-body {
        color: rgba(255, 255, 255, 0.9);
    }
    body.library-page .modal-body .add-url-input,
    body.library-page .modal-body input[type="text"],
    body.library-page .modal-body input[type="file"] {
        background: rgba(0, 0, 0, 0.35);
        border: 1px solid rgba(255, 255, 255, 0.12);
        color: #fff;
        border-radius: 8px;
    }
    body.library-page .modal-body input:focus {
        outline: none;
        border-color: rgba(0, 212, 255, 0.5);
    }
    body.library-page .modal-body label {
        color: rgba(255, 255, 255, 0.6);
        font-size: 0.8rem;
    }
    body.library-page .modal-body hr {
        border: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        margin: 15px 0;
    }
    body.library-page .modal-body #uploadStatus {
        color: rgba(255, 255, 255, 0.5);
        font-size: 0.8rem;
        margin-top: 5px;
    }
    body.library-page .btn-modal {
        border-radius: 10px;
        transition: box-shadow 0.2s, border-color 0.2s;
    }
    body.library-page .btn-modal.btn-confirm {
        background: transparent;
        color: #00d4ff;
        border: 1px solid rgba(0, 212, 255, 0.45);
        text-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
        box-shadow: 0 0 10px rgba(0, 212, 255, 0.2), inset 0 0 10px rgba(0, 212, 255, 0.04);
    }
    body.library-page .btn-modal.btn-confirm:hover {
        background: rgba(0, 212, 255, 0.08);
        color: #7fffff;
        box-shadow: 0 0 16px rgba(0, 212, 255, 0.35);
    }
    body.library-page .btn-modal.btn-cancel {
        background: transparent;
        color: rgba(255, 255, 255, 0.7);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    body.library-page .btn-modal.btn-cancel:hover {
        background: rgba(255, 255, 255, 0.06);
        color: #fff;
    }
    body.library-page .btn-modal.btn-danger {
        background: rgba(255, 45, 160, 0.85);
        color: #fff;
        border: 1px solid rgba(255, 45, 160, 0.5);
    }
    body.library-page .btn-modal.btn-danger:hover {
        box-shadow: 0 0 20px rgba(255, 45, 160, 0.4);
    }
    /* Modal confirm du layout (showModal) sur la page Library */
    body.library-page #masterModal {
        background: rgba(10, 8, 16, 0.22);
        backdrop-filter: blur(10px) saturate(1.08);
        -webkit-backdrop-filter: blur(10px) saturate(1.08);
    }
    body.library-page #masterModal > div {
        background-color: transparent;
        background-image: linear-gradient(155deg, rgba(34, 26, 42, 0.72) 0%, rgba(22, 16, 30, 0.76) 50%, rgba(14, 10, 20, 0.8) 100%);
        backdrop-filter: blur(14px) saturate(1.08);
        -webkit-backdrop-filter: blur(14px) saturate(1.08);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 18px;
        border-radius: 20px;
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    }
    body.library-page #masterModal #modalTitle {
        color: #00d4ff;
        font-weight: 800;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }
    body.library-page #masterModal #modalBody {
        color: rgba(255, 255, 255, 0.9);
    }

    /* --- Barre de sélection (batch) : thème verre dépoli --- */
    body.library-page .batch-bar {
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%) translateY(100px);
        z-index: 1000;
        transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    body.library-page .batch-bar.show {
        transform: translateX(-50%) translateY(0);
    }
    body.library-page .batch-content {
        display: flex;
        align-items: center;
        gap: 15px;
        background: rgba(26, 21, 37, 0.52);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 50px;
        padding: 10px 20px 10px 24px;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 16px 32px rgba(0, 0, 0, 0.3);
    }
    body.library-page #batchBar #batchCount {
        color: #00d4ff;
        font-weight: 800;
        font-size: 1rem;
        min-width: 1.5rem;
        text-align: center;
    }
    body.library-page .btn-batch-action {
        background: transparent;
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: rgba(255, 255, 255, 0.9);
        padding: 8px 14px;
        border-radius: 10px;
        font-weight: 700;
        font-size: 0.7rem;
        cursor: pointer;
        transition: all 0.2s;
    }
    body.library-page .btn-batch-action.btn-batch-play {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        color: #00d4ff;
        border-color: rgba(0, 212, 255, 0.4);
    }
    body.library-page .btn-batch-play-icon { flex: 0 0 auto; display: block; }
    body.library-page .btn-batch-action:hover {
        background: rgba(0, 212, 255, 0.15);
        color: #00d4ff;
        border-color: rgba(0, 212, 255, 0.4);
    }
    body.library-page .btn-batch-action.warning {
        color: #ffaa00;
        border-color: rgba(255, 170, 0, 0.35);
    }
    body.library-page .btn-batch-action.warning:hover {
        background: rgba(255, 170, 0, 0.12);
        border-color: rgba(255, 170, 0, 0.6);
    }
    body.library-page .btn-batch-action.danger {
        color: #ff2da0;
        border-color: rgba(255, 45, 160, 0.35);
    }
    body.library-page .btn-batch-action.danger:hover {
        background: rgba(255, 45, 160, 0.12);
        border-color: rgba(255, 45, 160, 0.6);
    }
    body.library-page .btn-batch-close {
        background: transparent;
        border: none;
        color: rgba(255, 255, 255, 0.5);
        font-weight: bold;
        cursor: pointer;
        padding: 6px 10px;
        margin-left: 4px;
        border-radius: 8px;
        transition: color 0.2s, background 0.2s;
    }
    body.library-page .btn-batch-close:hover {
        color: #fff;
        background: rgba(255, 255, 255, 0.08);
    }

    /* Callers: gallery.html webapp local gallery. API: none. Schema: .modal-overlay.show
       User: « association funscript auto, badge, modification du titre, ajout funscript manuel, gif, image de presentation, recherche par tag » */
    .modal-overlay {
        position: fixed;
        inset: 0;
        z-index: 2000;
        display: none;
        align-items: center;
        justify-content: center;
        opacity: 0;
        transition: opacity 0.2s;
    }
    .modal-overlay.show {
        display: flex;
        opacity: 1;
        height: 100dvh;
        max-height: 100dvh;
        padding: max(16px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
        box-sizing: border-box;
    }
    .modal-box {
        padding: 24px;
        display: flex;
        flex-direction: column;
        gap: 16px;
        max-height: min(90vh, 720px);
        overflow: auto;
    }
    .modal-header {
        font-size: 0.95rem;
        text-transform: uppercase;
    }
    .modal-actions {
        display: flex;
        gap: 12px;
        justify-content: flex-end;
    }
    .btn-modal {
        padding: 8px 16px;
        font-size: 0.8rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        cursor: pointer;
        background: transparent;
    }
    .fav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, 0.12);
        color: rgba(255, 255, 255, 0.55);
        cursor: pointer;
        flex-shrink: 0;
    }
    .fav-toggle.is-on {
        color: #ff2da0;
        border-color: rgba(255, 45, 160, 0.45);
        background: rgba(255, 45, 160, 0.1);
    }
    .toolbar-select {
        appearance: none;
        -webkit-appearance: none;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.12);
        color: rgba(255, 255, 255, 0.85);
        border-radius: 10px;
        padding: 7px 28px 7px 12px;
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        cursor: pointer;
        background-image: linear-gradient(45deg, transparent 50%, #9aa3b5 50%), linear-gradient(135deg, #9aa3b5 50%, transparent 50%);
        background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%;
        background-size: 5px 5px, 5px 5px;
        background-repeat: no-repeat;
    }
    .toolbar-select:focus {
        outline: none;
        border-color: rgba(0, 212, 255, 0.45);
    }
    .toolbar-select option {
        background: #1a1525;
        color: #fff;
    }
    .scan-status {
        font-size: 0.72rem;
        color: #9aa3b5;
        white-space: nowrap;
    }
    .star {
        cursor: pointer;
        color: #444;
        font-size: 0.85rem;
    }
    .star.active { color: #fbbf24; }

    /* Callers: local_gallery openWebSessionPlayer. User: « Make it Perfect » launch.
       Schema: #webSessionPlayer.is-open */
    #webSessionPlayer {
        position: fixed;
        inset: 0;
        z-index: 13000;
        display: none;
        align-items: center;
        justify-content: center;
        background: rgba(6, 4, 12, 0.88);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        padding: 20px;
    }
    #webSessionPlayer.is-open { display: flex; }
    .wsp-panel {
        width: min(1100px, 100%);
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    .wsp-top {
        display: flex;
        align-items: center;
        gap: 12px;
        color: #e8edf7;
        font-weight: 700;
    }
    #wspTitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    #wspMeta { color: #9aa3b5; font-size: 0.85rem; }
    #wspVideo {
        width: 100%;
        max-height: min(72vh, 720px);
        background: #000;
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.08);
    }
    .wsp-bar { display: flex; gap: 10px; justify-content: flex-end; }
    .wsp-btn {
        appearance: none;
        border: 1px solid rgba(0, 212, 255, 0.4);
        background: rgba(0, 212, 255, 0.1);
        color: #00d4ff;
        border-radius: 999px;
        padding: 8px 14px;
        font-size: 0.75rem;
        font-weight: 800;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        cursor: pointer;
    }
    .wsp-btn:hover { background: rgba(0, 212, 255, 0.2); }

    /* Callers: foldersModal / confirmModal. User: multi-dossiers + suppression DB only.
       Schema: .folders-list li */
    .folders-list {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 8px;
        max-height: min(40vh, 320px);
        overflow: auto;
    }
    .folders-list li {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        background: rgba(0, 0, 0, 0.22);
    }
    .folders-list .folder-name {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-weight: 600;
        color: #e8edf7;
    }
    .folders-list .folder-count {
        font-size: 0.72rem;
        color: #9aa3b5;
        white-space: nowrap;
    }
    .folders-empty {
        margin: 8px 0 0;
        font-size: 0.82rem;
        color: #9aa3b5;
    }

    /* --- Web gallery paste bar (Callers: web.html). User: paste URL + sites chips. --- */
    .web-paste-bar {
        margin: 0 0 16px;
        padding: 14px 16px;
        border-radius: 16px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(26, 21, 37, 0.45);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 24px rgba(0, 0, 0, 0.18);
    }
    .web-paste-row {
        display: flex;
        gap: 10px;
        align-items: stretch;
    }
    .web-paste-input {
        flex: 1;
        min-width: 0;
        padding: 11px 14px;
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.14);
        background: rgba(0, 0, 0, 0.28);
        color: #e8edf7;
        font-size: 0.9rem;
        outline: none;
    }
    .web-paste-input:focus {
        border-color: rgba(0, 212, 255, 0.55);
        box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.15);
    }
    .web-paste-btn { flex-shrink: 0; }
    /* Import progress (Callers: web.html). User: bulle bas-gauche type desktop. */
    .web-gallery-import-bubble {
        position: fixed;
        bottom: 24px;
        left: 24px;
        z-index: 30000;
        display: none;
        align-items: center;
        gap: 10px;
        padding: 10px 16px;
        border-radius: 14px;
        background: linear-gradient(155deg, rgba(255, 255, 255, 0.06) 0%, rgba(16, 12, 24, 0.38) 52%, rgba(10, 8, 16, 0.22) 100%);
        backdrop-filter: blur(14px) saturate(1.1);
        -webkit-backdrop-filter: blur(14px) saturate(1.1);
        border: 1px solid rgba(255, 255, 255, 0.08);
        color: #eee;
        font-size: 0.82rem;
        line-height: 1.35;
        max-width: min(420px, calc(100vw - 32px));
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    }
    .web-gallery-import-bubble.is-err { border-color: rgba(255, 107, 157, 0.35); color: #ffc0d4; }
    .web-gallery-import-bubble-spinner {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
        border: 2px solid rgba(255, 255, 255, 0.2);
        border-top-color: #fff;
        border-radius: 50%;
        animation: web-gallery-spin 0.7s linear infinite;
    }
    .web-gallery-import-bubble.is-done .web-gallery-import-bubble-spinner { display: none; }
    @keyframes web-gallery-spin { to { transform: rotate(360deg); } }
    .web-gallery-page .static-thumb.is-gif {
        object-fit: cover;
    }
    .web-gallery-page .thumbnail-box .static-thumb {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }
    @media (max-width: 720px) {
        .web-paste-row { flex-direction: row; align-items: center; }
        .web-paste-bar { margin: 0 0 10px; padding: 8px; }
        .web-paste-btn { flex: 0 0 auto; }
        .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
        .web-topbar { height: auto; flex-wrap: wrap; padding: 10px 12px; }
        .web-brand svg { width: min(210px, 58vw); height: auto; }
        .compact-toolbar {
            padding-left: 10px;
            padding-right: 10px;
            flex-wrap: wrap;
            align-items: stretch;
        }
        .toolbar-filters {
            flex-direction: column;
            align-items: stretch;
            width: 100%;
            gap: 8px;
        }
        .toolbar-line {
            display: flex;
            align-items: center;
            gap: 8px;
            width: 100%;
            min-width: 0;
        }
        .toolbar-line-sort .custom-select-container {
            min-width: 0;
            flex: 1 1 0;
        }
        .toolbar-line-sort .custom-select-trigger {
            min-width: 0;
            padding: 7px 8px;
        }
        .toolbar-count { margin-left: auto; }
        .toolbar-divider { display: none; }
        .tags-scroller { flex: 1 1 100%; min-width: 0; }
        .modal-overlay.show,
        #perfectSessionOverlay.is-open {
            position: fixed !important;
            inset: auto !important;
            top: 0 !important;
            left: 0 !important;
            width: 100% !important;
            height: 100dvh !important;
            max-height: 100dvh !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            padding: max(16px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom)) !important;
            box-sizing: border-box !important;
            overflow: auto !important;
        }
        .modal-overlay .modal-box,
        #perfectSessionOverlay .ps-modal {
            margin: auto !important;
            width: min(640px, calc(100vw - 24px)) !important;
            max-height: min(78dvh, 640px) !important;
        }
        .modal-actions { flex-wrap: wrap; justify-content: stretch; }
        .modal-actions .btn-modal { flex: 1 1 auto; }
    }
    @media (orientation: landscape) and (max-height: 520px) {
        .video-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
        .gallery-load { min-height: 40vh; }
    }

