/* ============================================================
 * video-exporter.css — v1.0
 * Style de la modale d'export vidéo MP4.
 * Palette : monochrome bleu #006699 cohérente avec le reste
 * de free-scores.com / opus.php.
 * ============================================================ */

/* ─── BACKDROP + CARD ──────────────────────────────────────── */

.vexp-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #2c3e50;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.vexp-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 30, 45, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: vexp-fade-in 180ms ease-out;
}

.vexp-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(640px, 92vw);
    max-height: 90vh;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 24px 60px rgba(0, 30, 60, 0.25), 0 4px 12px rgba(0, 30, 60, 0.10);
    animation: vexp-slide-in 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes vexp-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes vexp-slide-in {
    from { opacity: 0; transform: translate(-50%, -46%) scale(0.96); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ─── HEADER ───────────────────────────────────────────────── */

.vexp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e6edf2;
}

.vexp-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #006699;
    letter-spacing: -0.01em;
}

.vexp-close {
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: #8a9aac;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    transition: background 120ms, color 120ms;
}
@media (hover: hover) {
    .vexp-close:hover {
        background: #f0f4f7;
        color: #006699;
    }
}

/* ─── BODY ─────────────────────────────────────────────────── */

.vexp-body {
    padding: 20px 24px 24px;
}

.vexp-field {
    margin-bottom: 18px;
}

.vexp-field > label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #4a5b6e;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.vexp-field-row {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
}

.vexp-field-half {
    flex: 1;
    margin-bottom: 0;
}

/* ─── FORMAT GRID ──────────────────────────────────────────── */

.vexp-format-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.vexp-format-opt {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 8px 10px;
    background: #f7faff;
    border: 1px solid #d6e2ed;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 120ms, background 120ms, transform 120ms;
}

.vexp-format-opt input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.vexp-format-opt:has(input:checked) {
    background: #e8f2fa;
    border-color: #006699;
    border-width: 2px;
    padding: 13px 7px 9px;
}

@media (hover: hover) {
    .vexp-format-opt:hover {
        border-color: #4a90c2;
        background: #eef5fa;
    }
}

/* Preview rectangles (proportional) */
.vexp-format-preview {
    position: relative;
    background: #ffffff;
    border: 1px solid #c8d4e0;
    border-radius: 3px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.vexp-preview-9-16 { width: 38px;  height: 68px; }
.vexp-preview-16-9 { width: 80px;  height: 45px; }
.vexp-preview-1-1  { width: 56px;  height: 56px; }

.vexp-preview-head,
.vexp-preview-foot {
    background: #2c3e50;
    flex-shrink: 0;
}
.vexp-preview-ribbon {
    background: #d5e6f2;
    position: relative;
    flex-grow: 1;
}
.vexp-preview-ribbon::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1.5px;
    background: #E8422F;
    transform: translateX(-50%);
}

/* Per-format header/footer ratios */
.vexp-preview-9-16 .vexp-preview-head { height: 18%; }
.vexp-preview-9-16 .vexp-preview-foot { height: 22%; }
.vexp-preview-16-9 .vexp-preview-head { height: 12%; }
.vexp-preview-16-9 .vexp-preview-foot { height: 13%; }
.vexp-preview-1-1  .vexp-preview-head { height: 15%; }
.vexp-preview-1-1  .vexp-preview-foot { height: 25%; }

.vexp-format-label {
    text-align: center;
}
.vexp-format-label strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #006699;
    line-height: 1.1;
}
.vexp-format-label em {
    display: block;
    font-size: 11px;
    color: #6c7d8f;
    font-style: normal;
    margin-top: 2px;
}
.vexp-format-label small {
    display: block;
    font-size: 10px;
    color: #8a9aac;
    margin-top: 3px;
}

/* ─── SELECTS ──────────────────────────────────────────────── */

.vexp-body select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    color: #2c3e50;
    background: #ffffff;
    border: 1px solid #d6e2ed;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 120ms, box-shadow 120ms;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path fill='%23006699' d='M1 1.5L6 6.5L11 1.5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px;
    padding-right: 32px;
}
.vexp-body select:focus {
    outline: none;
    border-color: #006699;
    box-shadow: 0 0 0 3px rgba(0, 102, 153, 0.15);
}

/* ─── AUDIO SOURCE INFO ────────────────────────────────────── */

.vexp-audio-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f0f7fb;
    border: 1px solid #d3e4f0;
    border-radius: 6px;
    font-size: 13px;
    color: #4a5b6e;
}

.vexp-audio-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    border-radius: 4px;
    letter-spacing: 0.04em;
}
.vexp-audio-mp3   { background: #2d8659; }
.vexp-audio-midi  { background: #b8860b; }
.vexp-audio-none  { background: #c0392b; }

.vexp-audio-text em {
    color: #8a9aac;
    font-style: italic;
}

/* ─── SECTION "APPARENCE" (surbrillances + playhead) ───────── */

.vexp-vis-section {
    margin-top: 18px;
    padding: 14px 14px 10px;
    background: #f7faff;
    border: 1px solid #e0eaf2;
    border-radius: 8px;
}

.vexp-vis-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #006699;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}

.vexp-vis-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vexp-vis-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 8px;
    background: #ffffff;
    border: 1px solid #e6edf2;
    border-radius: 6px;
    transition: border-color 120ms;
}

.vexp-vis-row:has(input[type="checkbox"]:checked) {
    border-color: #b8d4e6;
}

.vexp-vis-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: #2c3e50;
}

.vexp-vis-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #006699;
    cursor: pointer;
    flex-shrink: 0;
}

.vexp-vis-toggle span {
    line-height: 1.3;
}

/* Hint texte (ex. lib manquante pour le QR) */
.vexp-vis-hint {
    font-size: 12px;
    color: #8a9aac;
    font-style: italic;
    flex-shrink: 0;
}

/* ─── Sous-bloc d'inputs nichés sous une checkbox (titre/compositeur) ─ */
.vexp-vis-children {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: -2px 0 4px 0;
    padding: 10px 12px 10px 38px;     /* indenté pour signaler la hiérarchie */
    background: #ffffff;
    border: 1px solid #e6edf2;
    border-top: none;
    border-radius: 0 0 6px 6px;
    transition: max-height 220ms ease, opacity 180ms ease, padding 180ms ease;
    overflow: hidden;
    /* Borne supérieure pour la transition open/close. La hauteur réelle est
       définie par le contenu. 1000px laisse de la marge pour ajouts futurs
       sans clipper. La modale parent (90vh + overflow-y:auto) gère le scroll. */
    max-height: 1000px;
}
.vexp-vis-children-hidden {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
    border: none;
    pointer-events: none;
}
.vexp-vis-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.vexp-vis-input-row > label {
    font-size: 12px;
    color: #6c7d8f;
    min-width: 90px;
    flex-shrink: 0;
    text-align: right;
}
.vexp-vis-input-row > input[type="text"] {
    flex: 1;
    padding: 7px 10px;
    font-size: 13px;
    color: #2c3e50;
    background: #f7faff;
    border: 1px solid #d6e2ed;
    border-radius: 4px;
    transition: border-color 120ms, background 120ms;
    min-width: 0;
}
.vexp-vis-input-row > input[type="text"]:focus {
    outline: none;
    border-color: #006699;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(0,102,153,0.12);
}
/* Extension pour inputs numériques (nouvelles tailles texte header) */
.vexp-vis-input-row > input[type="number"] {
    width: 70px;
    padding: 7px 10px;
    font-size: 13px;
    color: #2c3e50;
    background: #f7faff;
    border: 1px solid #d6e2ed;
    border-radius: 4px;
    font-variant-numeric: tabular-nums;
    text-align: right;
    flex: 0 0 auto;
    transition: border-color 120ms, background 120ms;
    min-width: 0;
}
.vexp-vis-input-row > input[type="number"]:focus {
    outline: none;
    border-color: #006699;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(0, 102, 153, 0.12);
}
.vexp-vis-suffix {
    font-size: 12px;
    color: #8a9aac;
    flex-shrink: 0;
    margin-left: -4px;
}
.vexp-vis-hint-warn {
    color: #b8860b;
    font-style: normal;
}
/* Variante "block" : hint placé seul sur une ligne sous un input row,
   pour les avertissements détaillés (ex: QR size trop petit). */
.vexp-vis-hint-block {
    display: block;
    margin: 4px 0 0 0;
    line-height: 1.35;
    font-size: 12px;
}

/* ─── Hint sous le select "Plage" : affiche les bornes du loop ─── */
.vexp-range-hint {
    font-size: 12px;
    line-height: 1.3;
    margin-top: 6px;
    min-height: 16px;     /* évite que le layout saute quand le hint est vide */
    color: #5a6e80;
}
.vexp-range-hint-ok {
    color: #006699;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}
.vexp-range-hint-warn {
    color: #b8860b;
    font-style: italic;
}

/* ─── Piano virtuel : <select> taille clavier ─── */
.vexp-vis-input-row > select {
    flex: 1;
    padding: 7px 28px 7px 10px;
    font-size: 13px;
    color: #2c3e50;
    background: #f7faff;
    border: 1px solid #d6e2ed;
    border-radius: 4px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path fill='%23006699' d='M1 1.5L6 6.5L11 1.5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 9px;
    min-width: 0;
    transition: border-color 120ms, background 120ms;
}
.vexp-vis-input-row > select:focus {
    outline: none;
    border-color: #006699;
    background-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(0, 102, 153, 0.12);
}

/* ─── Toggle inline (checkbox doigtés dans le sous-bloc piano) ─── */
.vexp-vis-input-row-check {
    justify-content: flex-start;
}
.vexp-vis-toggle-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: #4a5b6e;
}
.vexp-vis-toggle-inline input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #006699;
    cursor: pointer;
    flex-shrink: 0;
}

/* Checkbox désactivée → toute la ligne grisée */
.vexp-vis-toggle input[type="checkbox"]:disabled + span {
    color: #b8c2cc;
    cursor: not-allowed;
}
.vexp-vis-row:has(input[type="checkbox"]:disabled) {
    background: #f4f6f8;
    border-color: #e6e9ed;
}

/* Color picker compact */
.vexp-color-input {
    width: 38px;
    height: 28px;
    padding: 0;
    border: 1px solid #d6e2ed;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 120ms, transform 120ms;
}

.vexp-color-input::-webkit-color-swatch-wrapper { padding: 2px; }
.vexp-color-input::-webkit-color-swatch         { border: none; border-radius: 3px; }
.vexp-color-input::-moz-color-swatch            { border: none; border-radius: 3px; }

@media (hover: hover) {
    .vexp-color-input:hover {
        border-color: #006699;
        transform: scale(1.04);
    }
}

/* Désactivation visuelle quand la case est décochée */
.vexp-vis-row:has(input[type="checkbox"]:not(:checked)) .vexp-color-input {
    opacity: 0.45;
    pointer-events: none;
}

/* ─── WARNING BANNER (style discret amber/blue-grey) ───────── */

.vexp-warn {
    margin: 14px 0 0;
    padding: 10px 14px;
    background: #fef7e6;
    border: 1px solid #f0d896;
    border-left: 3px solid #b8860b;
    border-radius: 4px;
    font-size: 13px;
    color: #6b5520;
    line-height: 1.5;
}

/* ─── ACTIONS ─────────────────────────────────────────────── */

.vexp-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #e6edf2;
}

.vexp-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: background 120ms, color 120ms, border-color 120ms, transform 80ms;
    background: #f0f4f7;
    color: #4a5b6e;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}
.vexp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
@media (hover: hover) {
    .vexp-btn:not(:disabled):hover {
        background: #e3e9ee;
        color: #2c3e50;
    }
}
.vexp-btn:not(:disabled):active {
    transform: scale(0.98);
}

.vexp-btn-primary {
    background: #006699;
    color: #ffffff;
    border-color: #006699;
}
@media (hover: hover) {
    .vexp-btn-primary:not(:disabled):hover {
        background: #00557f;
        color: #ffffff;
    }
}

/* ─── Bouton secondaire (Aperçu) ──────────────────────────── */
.vexp-btn-secondary {
    background: #ffffff;
    color: #006699;
    border-color: #006699;
}
@media (hover: hover) {
    .vexp-btn-secondary:not(:disabled):hover {
        background: #e8f2fa;
        color: #00557f;
        border-color: #00557f;
    }
}

/* ─── Zone d'aperçu (1 frame statique) ────────────────────── */
.vexp-preview {
    margin-top: 14px;
    padding: 12px 14px 14px;
    background: #f7faff;
    border: 1px solid #d6e2ed;
    border-radius: 8px;
}
.vexp-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.vexp-preview-label {
    font-size: 12px;
    font-weight: 600;
    color: #4a5b6e;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.vexp-preview-overlay-ctrl {
    display: flex;
    align-items: center;
    gap: 6px;
}
.vexp-preview-overlay-ctrl label {
    font-size: 12px;
    font-weight: 500;
    color: #4a5b6e;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.vexp-preview-overlay-ctrl select {
    font-size: 13px;
    padding: 4px 8px;
    border: 1px solid #c5d2e0;
    border-radius: 5px;
    background: #ffffff;
    color: #2c3e50;
    cursor: pointer;
}
.vexp-preview-overlay-ctrl select:focus {
    outline: 2px solid #006699;
    outline-offset: 1px;
}
.vexp-preview-stage {
    position: relative;
    background: #0a0a0a;
    border-radius: 6px;
    overflow: hidden;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.vexp-preview-frame {
    position: relative;
    display: inline-block;
    line-height: 0;
    max-width: 100%;
    max-height: 60vh;
}
.vexp-preview-frame img {
    display: block;
    max-width: 100%;
    max-height: 60vh;
    height: auto;
    width: auto;
    object-fit: contain;
}
.vexp-preview-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    line-height: 0;
}
.vexp-preview-overlay svg {
    width: 100%;
    height: 100%;
    display: block;
}
/* Fallback rétro-compatible si du contenu utilise encore l'ancien sélecteur */
.vexp-preview-stage img {
    display: block;
    max-width: 100%;
    max-height: 60vh;
    height: auto;
    width: auto;
    object-fit: contain;
}
.vexp-preview-error {
    color: #c0392b;
    font-size: 13px;
    padding: 18px;
    text-align: center;
}

/* Spinner 3 points */
.vexp-preview-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 30px;
}
.vexp-preview-spinner-dot {
    width: 8px;
    height: 8px;
    background: #4a90c2;
    border-radius: 50%;
    animation: vexp-spin-bounce 1.2s ease-in-out infinite;
}
.vexp-preview-spinner-dot:nth-child(2) { animation-delay: 0.15s; }
.vexp-preview-spinner-dot:nth-child(3) { animation-delay: 0.30s; }
@keyframes vexp-spin-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40%           { transform: scale(1.0); opacity: 1; }
}

.vexp-btn-cancel {
    background: transparent;
    color: #8a9aac;
}
@media (hover: hover) {
    .vexp-btn-cancel:not(:disabled):hover {
        background: #f6f1f1;
        color: #c0392b;
    }
}

/* ─── PROGRESS ────────────────────────────────────────────── */

.vexp-progress {
    padding: 32px 24px 28px;
    text-align: center;
}

.vexp-progress-label {
    font-size: 14px;
    color: #4a5b6e;
    margin-bottom: 14px;
    min-height: 22px;
    font-variant-numeric: tabular-nums;
}

.vexp-progress-bar {
    height: 8px;
    background: #e6edf2;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.vexp-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #006699 0%, #4a90c2 100%);
    border-radius: 4px;
    transition: width 200ms ease-out;
}

.vexp-progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #8a9aac;
    margin-bottom: 22px;
    font-variant-numeric: tabular-nums;
}

.vexp-progress-pct {
    font-weight: 600;
    color: #006699;
}

.vexp-progress-actions {
    display: flex;
    justify-content: center;
}

/* ─── SUCCESS / RESULT ────────────────────────────────────── */

.vexp-result {
    padding: 24px;
}

.vexp-success {
    text-align: center;
}

.vexp-success-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: #e8f5ee;
    color: #2d8659;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
}

.vexp-success h3 {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.vexp-success-meta {
    margin: 0 0 18px;
    font-size: 13px;
    color: #8a9aac;
}

.vexp-preview-video {
    width: 100%;
    max-height: 50vh;
    background: #1a1a1a;
    border-radius: 8px;
    margin-bottom: 20px;
    display: block;
}

.vexp-success-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ─── ERROR ──────────────────────────────────────────────── */

.vexp-error {
    padding: 8px 0;
    text-align: center;
}

.vexp-error-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: #fdecec;
    color: #c0392b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 700;
}

.vexp-error h3 {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 600;
    color: #c0392b;
}

.vexp-error-msg {
    margin: 0 0 20px;
    font-size: 13px;
    color: #6c7d8f;
    line-height: 1.5;
    word-break: break-word;
}

/* ─── FALLBACK NOTICE (browser non supporté) ──────────────── */

.vexp-fallback-notice {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(20, 30, 45, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.vexp-fallback-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 28px 28px 22px;
    max-width: 480px;
    box-shadow: 0 24px 60px rgba(0, 30, 60, 0.25);
    text-align: center;
}

.vexp-fallback-card h3 {
    margin: 0 0 12px;
    color: #006699;
    font-size: 18px;
}

.vexp-fallback-card p {
    margin: 0 0 14px;
    font-size: 14px;
    color: #4a5b6e;
    line-height: 1.55;
}

.vexp-fallback-card button {
    margin-top: 10px;
    padding: 10px 24px;
    background: #006699;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

/* ─── DARK MODE (optionnel, suit le system) ───────────────── */

@media (prefers-color-scheme: dark) {
    .vexp-card,
    .vexp-fallback-card {
        background: #1f2933;
        color: #d8dde2;
    }
    .vexp-header {
        border-bottom-color: #2d3a47;
    }
    .vexp-header h3 {
        color: #5fa8d1;
    }
    .vexp-field > label {
        color: #a3b1bf;
    }
    .vexp-format-opt {
        background: #29333d;
        border-color: #3a4651;
    }
    .vexp-format-opt:has(input:checked) {
        background: #1f3a52;
        border-color: #5fa8d1;
    }
    .vexp-format-preview {
        background: #1a2128;
        border-color: #3a4651;
    }
    .vexp-preview-ribbon {
        background: #2a4356;
    }
    .vexp-format-label strong { color: #5fa8d1; }
    .vexp-format-label em     { color: #9aa8b6; }
    .vexp-format-label small  { color: #6e7d8e; }
    .vexp-body select {
        background-color: #29333d;
        border-color: #3a4651;
        color: #d8dde2;
    }
    .vexp-audio-info {
        background: #243240;
        border-color: #344554;
        color: #c0cbd6;
    }
    .vexp-warn {
        background: #3d3424;
        border-color: #6b5520;
        border-left-color: #b8860b;
        color: #e8c97c;
    }
    .vexp-actions {
        border-top-color: #2d3a47;
    }
    .vexp-btn {
        background: #2d3a47;
        color: #c0cbd6;
    }
    @media (hover: hover) {
        .vexp-btn:not(:disabled):hover {
            background: #364553;
            color: #e8edf2;
        }
    }
    .vexp-progress-bar {
        background: #2d3a47;
    }
    .vexp-progress-meta { color: #7a8a9a; }
    .vexp-success-icon {
        background: #1f3d2c;
        color: #6abf8f;
    }
    .vexp-error-icon {
        background: #3d2424;
        color: #e87575;
    }
    .vexp-success h3 { color: #e8edf2; }
    .vexp-success-meta { color: #7a8a9a; }
    .vexp-error h3 { color: #e87575; }
    .vexp-error-msg { color: #9aa8b6; }
}

/* ─── MOBILE TWEAKS ───────────────────────────────────────── */

@media (max-width: 480px) {
    .vexp-card {
        width: 96vw;
        max-height: 94vh;
    }
    .vexp-header { padding: 16px 18px 12px; }
    .vexp-body   { padding: 14px 18px 18px; }
    .vexp-format-grid { gap: 6px; }
    .vexp-format-opt  { padding: 10px 4px 8px; }
    .vexp-preview-9-16 { width: 30px; height: 54px; }
    .vexp-preview-16-9 { width: 64px; height: 36px; }
    .vexp-preview-1-1  { width: 46px; height: 46px; }
    .vexp-format-label strong { font-size: 13px; }
    .vexp-actions { flex-wrap: wrap; }
    .vexp-actions .vexp-btn { flex: 1; min-width: 120px; }
}

/* ═══════════════════════════════════════════════════════════════
 * BG PICKER (sélecteur de thème de fond avec aperçus visuels)
 * ═══════════════════════════════════════════════════════════════ */

/* Bouton trigger (visible dans la modale) */
.vexp-bg-picker {
    flex: 1;
    min-width: 0;
}
.vexp-bg-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px 7px 8px;
    background: #ffffff;
    border: 1px solid #d0d8e0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #1a1a1a;
    transition: border-color 0.15s, background 0.15s;
}
@media (hover: hover) {
    .vexp-bg-trigger:hover {
        border-color: #006699;
        background: #fafdff;
    }
}
.vexp-bg-trigger:focus-visible {
    outline: 2px solid #006699;
    outline-offset: 1px;
}
.vexp-bg-swatch-mini {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.15);
    background: #FFFFFF;
}
.vexp-bg-name {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vexp-bg-arrow {
    flex-shrink: 0;
    color: #8090a0;
    font-size: 11px;
}

/* ═══════════════════════════════════════════════════════════════
 * BG PICKER : overlay modal (carte centrée + backdrop)
 *
 * Architecture refactorisée vs. l'ancien dropdown panel positionné
 * en absolu sous le trigger : ce dernier se faisait couper sur écrans
 * étroits/courts (iPad portrait, fenêtre desktop ~700px de haut), avec
 * les catégories en bas (dark) hors viewport. Le nouvel overlay garantit
 * l'accès à tous les thèmes via un body scrollable de hauteur bornée,
 * et reste cohérent avec le paradigme de la modale principale vexp-modal.
 * ═══════════════════════════════════════════════════════════════ */
.vexp-bg-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    background: rgba(15, 25, 40, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    animation: vexp-bg-fade-in 0.18s ease-out;
}
.vexp-bg-overlay-hidden {
    display: none;
}

@keyframes vexp-bg-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.vexp-bg-modal {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    width: min(720px, 100%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.vexp-bg-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 12px;
    border-bottom: 1px solid #eaeef2;
    flex: 0 0 auto;
}
.vexp-bg-modal-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1a2530;
    letter-spacing: 0.01em;
}
.vexp-bg-modal-close {
    background: transparent;
    border: 0;
    font-size: 22px;
    line-height: 1;
    padding: 4px 8px;
    cursor: pointer;
    color: #5d6770;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
@media (hover: hover) {
    .vexp-bg-modal-close:hover {
        background: #f0f3f6;
        color: #1a2530;
    }
}

.vexp-bg-modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 18px 18px;
}

.vexp-bg-cat-header {
    font-size: 11px;
    font-weight: 600;
    color: #5d6770;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 14px 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid #eaeef2;
}
.vexp-bg-cat-header:first-child {
    margin-top: 6px;
}

.vexp-bg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 6px;
    margin-bottom: 4px;
}

.vexp-bg-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 4px 6px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    text-align: center;
}
@media (hover: hover) {
    .vexp-bg-option:hover {
        border-color: #c5d2dd;
        background: #f5f8fb;
    }
}
.vexp-bg-option-active {
    border-color: #006699 !important;
    background: #e8f2fa !important;
}

.vexp-bg-swatch {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background-size: cover;
    background-position: center;
}
.vexp-bg-option-label {
    font-size: 11.5px;
    font-weight: 500;
    color: #1a1a1a;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Scroll bar slim dans le body de l'overlay */
.vexp-bg-modal-body::-webkit-scrollbar {
    width: 8px;
}
.vexp-bg-modal-body::-webkit-scrollbar-thumb {
    background: #c5d2dd;
    border-radius: 4px;
}
.vexp-bg-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

/* Mobile : grille plus dense, swatches réduits, padding compact.
 * Sous 540px de large, on densifie pour exposer plus de presets par
 * écran sans scroll, et on autorise jusqu'à 95vh pour l'overlay. */
@media (max-width: 540px) {
    .vexp-bg-overlay {
        padding: 10px;
    }
    .vexp-bg-modal {
        max-height: 95vh;
        border-radius: 10px;
    }
    .vexp-bg-modal-header {
        padding: 12px 14px 10px;
    }
    .vexp-bg-modal-title {
        font-size: 14px;
    }
    .vexp-bg-modal-body {
        padding: 6px 12px 14px;
    }
    .vexp-bg-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 4px;
    }
    .vexp-bg-swatch {
        width: 48px;
        height: 48px;
    }
    .vexp-bg-option-label {
        font-size: 11px;
    }
}


/* ═══════════════════════════════════════════════════════════════
 * URL/CTA MODE : système à 3 modes (cta / url / custom)
 * ═══════════════════════════════════════════════════════════════ */

/* Rangée du label + groupe de radios */
.vexp-urlmode-row {
    align-items: flex-start;
}
.vexp-urlmode-row > label {
    padding-top: 6px;
}
.vexp-urlmode-radios {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.vexp-urlmode-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #2c3e50;
    transition: background 120ms;
}
@media (hover: hover) {
    .vexp-urlmode-radio:hover {
        background: #f0f7fd;
    }
}
.vexp-urlmode-radio > input[type="radio"] {
    margin: 0;
    accent-color: #006699;
    cursor: pointer;
}

/* État désactivé : appliqué via JS quand l'option n'a pas de sens pour la
   partition courante. Cas d'usage : partition privée upload pur (pas
   d'équivalent free-scores.com), les modes "Lien gratuit" et "URL de la
   partition" sont désactivés et seul "Texte personnalisé" reste disponible.
   Grisé simple : opacité réduite + cursor not-allowed + pas de hover. */
.vexp-urlmode-radio-disabled,
.vexp-urlmode-radio-disabled > input[type="radio"] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}
@media (hover: hover) {
    .vexp-urlmode-radio-disabled:hover {
        background: transparent;
    }
}

/* Contenu conditionnel par mode (caché/affiché par JS via style.display) */
.vexp-urlmode-content {
    margin-left: 110px;    /* aligne avec les inputs après les labels 90px + 10px gap + padding */
    margin-top: -4px;
    margin-bottom: 4px;
}
.vexp-urlmode-content > input[type="text"] {
    width: 100%;
    padding: 7px 10px;
    font-size: 13px;
    color: #2c3e50;
    background: #f7faff;
    border: 1px solid #d6e2ed;
    border-radius: 4px;
}
.vexp-urlmode-content > input[type="text"]:focus {
    outline: none;
    border-color: #006699;
    background: #ffffff;
}

/* Rappel "Lien en description" : encart bleu doux */
.vexp-cta-reminder {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: #f0f7fd;
    border: 1px solid #cfe1f0;
    border-radius: 6px;
}
.vexp-cta-reminder-icon {
    flex-shrink: 0;
    font-size: 18px;
    color: #006699;
    line-height: 1;
    margin-top: 1px;
}
.vexp-cta-reminder-body {
    flex: 1;
    min-width: 0;
}
.vexp-cta-reminder-text {
    font-size: 12px;
    color: #2c3e50;
    margin-bottom: 6px;
    line-height: 1.4;
}
.vexp-cta-url-row {
    display: flex;
    gap: 6px;
    align-items: stretch;
}
.vexp-cta-url-row > input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 6px 9px;
    font-size: 12px;
    color: #006699;
    background: #ffffff;
    border: 1px solid #cfe1f0;
    border-radius: 4px;
    font-family: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Consolas, monospace;
    user-select: all;
}
.vexp-cta-url-row > input[type="text"]:focus {
    outline: none;
    border-color: #006699;
}
.vexp-cta-copy-btn {
    flex-shrink: 0;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    background: #006699;
    border: 1px solid #006699;
    border-radius: 4px;
    cursor: pointer;
    transition: background 120ms, transform 80ms;
}
@media (hover: hover) {
    .vexp-cta-copy-btn:hover {
        background: #00557f;
    }
}
.vexp-cta-copy-btn:active {
    transform: scale(0.97);
}
.vexp-cta-copy-btn-success {
    background: #1f9d55 !important;
    border-color: #1f9d55 !important;
}


/* ═══════════════════════════════════════════════════════════════
 * AUDIO SOURCE SELECT
 * ═══════════════════════════════════════════════════════════════ */

.vexp-audio-source-select {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 10px;
    margin-top: 6px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #2c3e50;
    background: #ffffff;
    border: 1px solid #d0d8e0;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 120ms;
}
.vexp-audio-source-select:focus {
    outline: none;
    border-color: #006699;
}
.vexp-audio-source-select:hover {
    border-color: #006699;
}

/* ═══════════════════════════════════════════════════════════════
 * UPLOAD MP3 TEMPORAIRE — Phase A audio sync
 * ═══════════════════════════════════════════════════════════════ */

/* Row : select + bouton upload côte à côte */
.vexp-audio-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
}
.vexp-audio-row .vexp-audio-source-select {
    margin-top: 0;
    margin-bottom: 0;
}

/* Bouton "Uploader un MP3" — style ghost discret, cohérent avec
   le palette monochrome bleu de la modale (#006699). */
.vexp-upload-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: #006699;
    background: #ffffff;
    border: 1px solid #d0d8e0;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 120ms, background 120ms;
}
.vexp-upload-btn:hover {
    border-color: #006699;
    background: #f0f7fb;
}
.vexp-upload-btn:focus {
    outline: none;
    border-color: #006699;
    box-shadow: 0 0 0 2px rgba(0, 102, 153, 0.15);
}
.vexp-upload-btn .vexp-upload-icon {
    font-size: 14px;
    line-height: 1;
}

/* Bandeau affichant le fichier uploadé (nom + taille/durée + bouton ✕).
   Discret, ton bleu-gris pour ne pas s'imposer face au reste de l'UI. */
.vexp-uploaded-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 10px;
    font-size: 12px;
    color: #2c3e50;
    background: #f0f7fb;
    border: 1px solid #d0e0ec;
    border-radius: 6px;
}
.vexp-uploaded-icon {
    font-size: 14px;
    flex: 0 0 auto;
}
.vexp-uploaded-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}
.vexp-uploaded-meta {
    flex: 0 0 auto;
    color: #7a8794;
    font-size: 11px;
}
.vexp-uploaded-remove {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    padding: 0;
    font-size: 12px;
    line-height: 1;
    color: #7a8794;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: color 120ms, background 120ms, border-color 120ms;
}
.vexp-uploaded-remove:hover {
    color: #c0392b;
    background: #fdf0ee;
    border-color: #f5c8c0;
}
.vexp-uploaded-remove:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.15);
}

/* État erreur : fond amber discret, le texte du nom devient le message. */
.vexp-uploaded-info.vexp-uploaded-error {
    background: #fdf6ec;
    border-color: #f5d8b8;
    color: #8b5e2b;
}
.vexp-uploaded-info.vexp-uploaded-error .vexp-uploaded-icon {
    color: #d68910;
}

/* Slider start-offset — visible uniquement quand source = mp3_upload */
.vexp-start-offset {
    margin-top: 10px;
    padding: 10px 12px;
    background: #fafbfc;
    border: 1px solid #e5e9ed;
    border-radius: 6px;
}
.vexp-start-offset > label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 12px;
    color: #2c3e50;
    margin-bottom: 6px;
    font-weight: 500;
}
.vexp-start-offset-value {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 12px;
    color: #006699;
    font-weight: 600;
    min-width: 70px;
    text-align: right;
}
.vexp-start-offset input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: #d0d8e0;
    border-radius: 2px;
    outline: none;
    margin: 0;
}
.vexp-start-offset input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #006699;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 120ms;
}
.vexp-start-offset input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}
.vexp-start-offset input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #006699;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.vexp-start-offset-hint {
    margin-top: 8px;
    font-size: 11px;
    color: #7a8794;
    line-height: 1.4;
}

/* ─── Adaptations mobiles ──────────────────────────────────────── */
@media (max-width: 600px) {
    .vexp-audio-row {
        flex-wrap: wrap;
    }
    .vexp-upload-btn {
        width: 100%;
        justify-content: center;
    }
    .vexp-uploaded-meta {
        display: none;  /* gain de place ; durée déjà décodée côté JS */
    }
    .vexp-start-offset {
        padding: 8px 10px;
    }
}


/* ═══════════════════════════════════════════════════════════════
 * PHASE B — Bouton "Synchroniser…" dans la modale d'export
 * ═══════════════════════════════════════════════════════════════ */

.vexp-sync-section {
    margin-top: 10px;
    padding: 10px 12px;
    background: #fafbfc;
    border: 1px solid #e5e9ed;
    border-radius: 6px;
}
.vexp-sync-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
    background: #006699;
    border: 1px solid #006699;
    border-radius: 6px;
    cursor: pointer;
    transition: background 120ms, transform 120ms;
}
.vexp-sync-open-btn:hover:not(:disabled) {
    background: #005580;
}
.vexp-sync-open-btn:active:not(:disabled) {
    transform: translateY(1px);
}
.vexp-sync-open-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.vexp-sync-open-icon {
    font-size: 15px;
    line-height: 1;
}
.vexp-sync-status {
    margin-top: 8px;
    font-size: 12px;
}
.vexp-sync-status-empty {
    color: #7a8794;
    font-style: italic;
}
.vexp-sync-status-active {
    color: #1e7e34;
    font-weight: 500;
}
.vexp-sync-status-clear {
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 11px;
    color: #7a8794;
    background: transparent;
    border: 1px solid #d0d8e0;
    border-radius: 4px;
    cursor: pointer;
    transition: color 120ms, border-color 120ms;
}
.vexp-sync-status-clear:hover {
    color: #c0392b;
    border-color: #c0392b;
}
.vexp-sync-mobile-warn {
    margin-top: 8px;
    padding: 8px 10px;
    font-size: 11px;
    color: #8b5e2b;
    background: #fdf6ec;
    border: 1px solid #f5d8b8;
    border-radius: 4px;
    line-height: 1.4;
}


/* ═══════════════════════════════════════════════════════════════
 * PHASE B — Panneau flottant de synchronisation
 * ═══════════════════════════════════════════════════════════════ */

.vexp-sync-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2147483646;  /* Au-dessus de la plupart des choses, sous la modale parent */
    background: #ffffff;
    border-top: 2px solid #006699;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #2c3e50;
    animation: vexpSyncSlideUp 250ms cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 65vh;
    display: flex;
    flex-direction: column;
}
@keyframes vexpSyncSlideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

/* ─── Poignée de redimensionnement ──────────────────────────────────────
   Barre fine en haut du panneau, permet de drag verticalement pour
   ajuster la hauteur. Double-clic = reset à la hauteur par défaut.
   La grip centrale est juste visuelle (la zone cliquable est tout le
   bandeau de 10px de haut pour faciliter la prise en main souris/tactile).
   ─────────────────────────────────────────────────────────────────── */
.vexp-sync-resize-handle {
    height: 10px;
    background: #f5f7f9;
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-bottom: 1px solid #e0e6ea;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: background 120ms;
}
.vexp-sync-resize-handle:hover {
    background: #e8f1f6;
}
.vexp-sync-resize-handle.dragging {
    background: #cfe3ee;
}
.vexp-sync-resize-grip {
    width: 56px;
    height: 4px;
    border-radius: 2px;
    background: #b0bcc6;
    transition: background 120ms;
    pointer-events: none;  /* clics passent à travers vers la poignée */
}
.vexp-sync-resize-handle:hover .vexp-sync-resize-grip,
.vexp-sync-resize-handle.dragging .vexp-sync-resize-grip {
    background: #006699;
}

.vexp-sync-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #006699;
    color: #ffffff;
    flex: 0 0 auto;
}
.vexp-sync-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}
.vexp-sync-icon {
    font-size: 16px;
}
.vexp-sync-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.vexp-sync-close {
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 14px;
    line-height: 1;
    color: #ffffff;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    margin-left: 8px;
    transition: background 120ms;
}
.vexp-sync-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.vexp-sync-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px 16px;
    background: #ffffff;
}

/* Transport */
.vexp-sync-transport {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.vexp-sync-play {
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 14px;
    line-height: 1;
    color: #ffffff;
    background: #006699;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 120ms;
    flex: 0 0 auto;
}
.vexp-sync-play:hover {
    background: #005580;
}
.vexp-sync-tc {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 13px;
    color: #2c3e50;
    min-width: 80px;
    text-align: center;
}
.vexp-sync-tc-sep {
    color: #7a8794;
    font-size: 13px;
}
.vexp-sync-spacer {
    flex: 1 1 auto;
}

/* Boutons génériques */
.vexp-sync-btn {
    padding: 6px 12px;
    font-size: 12px;
    color: #2c3e50;
    background: #ffffff;
    border: 1px solid #d0d8e0;
    border-radius: 4px;
    cursor: pointer;
    transition: background 120ms, border-color 120ms;
    white-space: nowrap;
}
.vexp-sync-btn:hover {
    background: #f0f7fb;
    border-color: #006699;
}
.vexp-sync-btn-ghost {
    color: #006699;
}
.vexp-sync-btn-primary {
    color: #ffffff;
    background: #006699;
    border-color: #006699;
    font-weight: 500;
}
.vexp-sync-btn-primary:hover {
    background: #005580;
    border-color: #005580;
}
.vexp-sync-btn-secondary {
    color: #006699;
    background: #ffffff;
    border-color: #006699;
    font-weight: 500;
}
.vexp-sync-btn-secondary:hover {
    background: #e6f0f6;
}

/* Waveform */
.vexp-sync-waveform-wrap {
    position: relative;
    margin-bottom: 12px;
    background: #fafbfc;
    border: 1px solid #e5e9ed;
    border-radius: 4px;
    overflow: hidden;
}
.vexp-sync-waveform {
    display: block;
    width: 100%;
    height: 120px;
    cursor: crosshair;
}
.vexp-sync-cursor {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ff9900;
    pointer-events: none;
    transform: translateX(-1px);
    box-shadow: 0 0 6px rgba(255, 153, 0, 0.5);
}
.vexp-sync-anchors-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}
.vexp-sync-anchor-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #1e7e34;
    transform: translateX(-1px);
    pointer-events: auto;
    cursor: pointer;
}
.vexp-sync-anchor-marker::before {
    content: '';
    position: absolute;
    top: 0;
    left: -4px;
    width: 10px;
    height: 10px;
    background: #1e7e34;
    transform: rotate(45deg);
    transform-origin: center;
    top: 4px;
}
.vexp-sync-anchor-label {
    position: absolute;
    top: 16px;
    left: -8px;
    width: 18px;
    height: 18px;
    background: #1e7e34;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 50%;
    text-align: center;
    line-height: 18px;
    pointer-events: none;
}
.vexp-sync-wf-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 8px 16px;
    background: rgba(0, 102, 153, 0.9);
    color: #ffffff;
    font-size: 12px;
    border-radius: 4px;
}
.vexp-sync-wf-loading.vexp-sync-wf-error {
    background: rgba(192, 57, 43, 0.9);
}

/* Instructions */
.vexp-sync-instructions {
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #f0f7fb;
    border: 1px solid #d0e0ec;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.5;
    color: #2c3e50;
}

/* Liste des anchors */
.vexp-sync-anchors-list {
    max-height: 160px;
    overflow-y: auto;
    border: 1px solid #e5e9ed;
    border-radius: 4px;
    background: #ffffff;
}
.vexp-sync-anchors-empty {
    padding: 16px;
    text-align: center;
    color: #7a8794;
    font-size: 12px;
    font-style: italic;
}
.vexp-sync-anchor-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #f0f2f4;
    font-size: 12px;
}
.vexp-sync-anchor-item:last-child {
    border-bottom: none;
}
.vexp-sync-anchor-item.vexp-sync-anchor-invalid {
    background: #fdeeee;
    color: #c0392b;
}
.vexp-sync-anchor-idx {
    width: 22px;
    height: 22px;
    background: #1e7e34;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 50%;
    text-align: center;
    line-height: 22px;
    flex: 0 0 auto;
}
.vexp-sync-anchor-invalid .vexp-sync-anchor-idx {
    background: #c0392b;
}
.vexp-sync-anchor-meas {
    font-weight: 500;
    color: #2c3e50;
    min-width: 50px;
}
.vexp-sync-anchor-arrow {
    color: #7a8794;
}
.vexp-sync-anchor-tc {
    flex: 1 1 auto;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    color: #006699;
}
.vexp-sync-anchor-jump,
.vexp-sync-anchor-del {
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 13px;
    line-height: 1;
    color: #7a8794;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    flex: 0 0 auto;
    transition: color 120ms, background 120ms, border-color 120ms;
}
.vexp-sync-anchor-jump:hover {
    color: #006699;
    background: #f0f7fb;
    border-color: #d0e0ec;
}
.vexp-sync-anchor-del:hover {
    color: #c0392b;
    background: #fdeeee;
    border-color: #f5c8c0;
}

/* Footer */
.vexp-sync-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fafbfc;
    border-top: 1px solid #e5e9ed;
    flex: 0 0 auto;
}
.vexp-sync-anchors-count {
    font-size: 12px;
    color: #7a8794;
    font-weight: 500;
}
.vexp-sync-footer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Mesure courante surlignée pendant la preview / jump */
.measure.vexp-sync-current-measure rect,
.measure.vexp-sync-current-measure path {
    stroke: #ff9900;
    stroke-width: 2;
}
.measure.vexp-sync-current-measure {
    filter: drop-shadow(0 0 4px rgba(255, 153, 0, 0.6));
}

/* SVG actif (sync mode) — curseur custom pour bien indiquer "clique pour ancrer" */
.vexp-sync-svg-active .click-area {
    cursor: crosshair !important;
}

/* Toasts inline */
.vexp-sync-flash {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    background: #1e7e34;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 100;
    animation: vexpSyncFlashIn 200ms ease-out;
}
.vexp-sync-flash-warn {
    background: #d68910;
}
.vexp-sync-flash-out {
    opacity: 0;
    transition: opacity 300ms;
}
@keyframes vexpSyncFlashIn {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Adaptations mobiles : panneau encore plus compact, certains éléments cachés */
@media (max-width: 600px) {
    .vexp-sync-panel {
        max-height: 80vh;
    }
    .vexp-sync-transport {
        gap: 4px;
    }
    .vexp-sync-transport .vexp-sync-btn {
        padding: 6px 8px;
    }
    .vexp-sync-instructions {
        font-size: 11px;
    }
    .vexp-sync-footer {
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* ─── Navigation par pages dans le header du panneau sync ─── */
.vexp-sync-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
    padding-right: 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}
.vexp-sync-nav .vexp-sync-btn {
    color: #ffffff;
    background: transparent;
    border-color: rgba(255, 255, 255, 0.3);
    padding: 4px 8px;
    font-size: 11px;
}
.vexp-sync-nav .vexp-sync-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}
.vexp-sync-nav .vexp-sync-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.vexp-sync-page-info {
    font-size: 12px;
    color: #ffffff;
    font-weight: 500;
    min-width: 36px;
    text-align: center;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}
/* ═══════════════════════════════════════════════════════════════════════
 * REPRISES / VOLTAS — badge de passage pour les ancres situées dans
 * une zone répétée du timemap Verovio. Affiché à droite du label de
 * mesure dans la liste des ancres (ex: "M12 1/2", "M14 2/3").
 * ═══════════════════════════════════════════════════════════════════════ */
.vexp-sync-anchor-pass {
    display: inline-block;
    margin-left: 4px;
    padding: 0 6px;
    border-radius: 8px;
    background: #006699;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    line-height: 14px;
    vertical-align: middle;
    letter-spacing: 0.3px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}
.vexp-sync-anchor-repeated .vexp-sync-anchor-meas {
    /* Léger soulignement bleu discret pour distinguer d'un coup d'œil
       les ancres situées dans une zone de reprise — sans alourdir la
       densité visuelle de la liste. */
    border-bottom: 1px dotted rgba(0, 102, 153, 0.45);
    padding-bottom: 1px;
}