/* ============================= */
/* 1. GENERAL */
/* ============================= */

body {
    font-family: Arial, sans-serif;
    margin: 20px;
    background: #111;
    color: #fff;
}

.editor-layout {
    display: grid;
    grid-template-columns: 180px 1fr 320px;
    gap: 15px;
}

.herramientas button {
    width: 100%;
    margin-bottom: 6px;
    padding: 8px;
    cursor: pointer;
    background: #222;
    border: 1px solid #333;
    color: white;
    transition: 0.2s;
}

.herramientas button:hover {
    background: #00aaff;
}

.zona-video {
    text-align: center;
}

#videoBox {
    position: relative;
    width: 600px;
    max-width: 100%;
    margin: 15px auto;
    background: #000;
    border: 2px solid #222;
    overflow: hidden;
}

#previewVideo {
    width: 100%;
    display: block;
}


/* ============================= */
/* 2. TEXTO - OVERLAY */
/* ============================= */

#textoOverlay {
    position: absolute;
    top: 30px;
    left: 50px;
    color: white;
    background: rgba(0,0,0,0.7);
    padding: 10px 18px;
    font-size: 32px;
    line-height: 1.2;
    font-family: "DejaVu Sans", Arial, sans-serif;
    font-weight: 700;
    cursor: move;
    display: none;
    user-select: none;
    touch-action: none;
    border: none;
    outline: 2px dashed #00aaff;
    outline-offset: 0;
    border-radius: 6px;
    z-index: 10;
    max-width: 90%;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: break-word;
    transition:
        opacity 0.3s ease,
        transform 0.3s ease,
        box-shadow 0.2s,
        left 0.1s,
        top 0.1s,
        font-size 0.1s;
}

#textoOverlay:hover {
    box-shadow: 0 0 10px #00aaff;
}

#textoContenido {
    white-space: pre-line;
    display: inline;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

#resizeHandle {
    position: absolute;
    width: 16px;
    height: 16px;
    right: -8px;
    bottom: -8px;
    background: #00aaff;
    border-radius: 50%;
    cursor: nwse-resize;
    touch-action: none;
}


/* ============================= */
/* 3. EFECTOS TEXTO Y ADHESIVO */
/* ============================= */

.efecto-normal {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.efecto-fade {
    opacity: 0;
}

.efecto-slide-left {
    opacity: 0;
    transform: translateX(-80px);
}

.efecto-slide-right {
    opacity: 0;
    transform: translateX(80px);
}

.efecto-zoom {
    opacity: 0;
    transform: scale(0.3);
}


/* ============================= */
/* 4. PANELES */
/* ============================= */

.panel {
    display: none;
    padding: 12px;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 6px;
}

.panel.activo {
    display: block;
}

.panel input,
.panel textarea,
.panel button,
.panel select {
    width: 100%;
    margin-bottom: 8px;
    padding: 7px;
    box-sizing: border-box;
    background: #2a2a2a;
    border: 1px solid #444;
    color: white;
}

.panel button {
    cursor: pointer;
    transition: 0.2s;
}

.panel button:hover {
    background: #00aaff;
}

.panel textarea {
    height: 90px;
}


/* ============================= */
/* 5. TIEMPOS Y TIMELINE */
/* ============================= */

.tiempos {
    display: flex;
    justify-content: space-between;
    max-width: 700px;
    margin: 10px auto;
    font-size: 14px;
}

#timeline {
    position: relative;
    min-height: 82px;
    height: auto;
    max-width: 700px;
    margin: 10px auto 6px auto;
    background: #2b2b2b;
    border: 1px solid #555;
    overflow: visible;
    border-radius: 6px;
}

#timeline::before {
    content: "Texto / Adhesivos / Video";
    position: absolute;
    left: 8px;
    top: 5px;
    font-size: 11px;
    color: #aaa;
    z-index: 1;
    pointer-events: none;
}

#timelineItems {
    position: relative;
    left: 0;
    right: 0;
    top: 28px;
    min-height: 44px;
    height: auto;
    overflow: visible;
    padding-bottom: 8px;
}

.timeline-item {
    position: absolute;
    height: 34px;
    min-width: 72px;
    background: linear-gradient(90deg, #007bff, #00aaff);
    color: white;
    font-size: 12px;
    line-height: 34px;
    border-radius: 5px;
    padding: 0 16px;
    overflow: hidden;
    white-space: nowrap;
    cursor: grab;
    box-sizing: border-box;
    transition: background 0.2s, box-shadow 0.2s, top 0.15s ease;
    touch-action: none;
    user-select: none;
    z-index: 8;
}

.timeline-item:active {
    cursor: grabbing;
}

.timeline-item:hover {
    background: #00aaff;
    box-shadow: 0 0 8px rgba(0,170,255,0.8);
}

.timeline-item.activo {
    background: #ff9800;
    z-index: 15;
    border: 1px solid #fff;
}

.timeline-item.adhesivo {
    background: linear-gradient(90deg, #8e24aa, #d500f9);
}

.timeline-carril-item {
    position: absolute !important;
    height: 34px !important;
    line-height: 34px !important;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-carril-item span {
    pointer-events: none;
    display: block;
    width: 100%;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#timeline.timeline-multicarril,
#timelineItems.timeline-multicarril {
    overflow: visible !important;
}


.timeline-handle {
    position: absolute;
    top: 0;
    width: 12px;
    height: 100%;
    background: rgba(255,255,255,0.95);
    cursor: ew-resize;
    z-index: 30;
    touch-action: none;
}

.timeline-handle.left {
    left: 0;
}

.timeline-handle.right {
    right: 0;
}


/* VIDEO CLIP DIVIDIDO */

.segmento-video-item {
    background: linear-gradient(90deg, #ff9800, #ffb300);
    cursor: grab;
    position: absolute;
    overflow: hidden;
    user-select: none;
    touch-action: none;
    padding: 0 18px;
    border: 1px solid rgba(255,255,255,0.35);
    min-width: 86px;
    z-index: 12;
}

.segmento-video-item:hover {
    background: linear-gradient(90deg, #ffa726, #ffc107);
    box-shadow: 0 0 8px rgba(255,152,0,0.7);
}

.segmento-video-item.activo {
    background: linear-gradient(90deg, #ff9800, #ffc107);
    border: 1px solid #fff;
    box-shadow: 0 0 8px rgba(255,255,255,0.75);
    z-index: 20;
}

.segmento-video-nombre {
    pointer-events: none;
    display: block;
    width: 100%;
    text-align: left;
    padding-left: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resize-video-left,
.resize-video-right {
    position: absolute;
    top: 0;
    width: 14px;
    height: 100%;
    background: rgba(255,255,255,0.85);
    z-index: 25;
    cursor: ew-resize;
    touch-action: none;
}

.resize-video-left {
    left: 0;
    border-radius: 5px 0 0 5px;
}

.resize-video-right {
    right: 0;
    border-radius: 0 5px 0 0;
}

.resize-video-left:hover,
.resize-video-right:hover {
    background: #fff;
}

#playhead {
    position: absolute;
    top: 28px;
    bottom: auto;
    width: 2px;
    min-height: 44px;
    background: red;
    left: 0%;
    z-index: 999;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(255,0,0,0.9);
}


/* ============================= */
/* 6. LISTA TEXTO / ADHESIVO */
/* ============================= */

#listaTextos,
#listaAdhesivos {
    max-height: 300px;
    overflow-y: auto;
}

.texto-lista-item,
.adhesivo-lista-item {
    background: #2c2c2c;
    padding: 8px;
    margin-bottom: 8px;
    border-radius: 4px;
    font-size: 13px;
}

.texto-lista-item button,
.adhesivo-lista-item button {
    margin-top: 5px;
}


/* ============================= */
/* 7. ADHESIVOS */
/* ============================= */

#adhesivoOverlay {
    position: absolute;
    top: 50px;
    left: 60px;
    width: 120px;
    display: none;
    z-index: 9;
    cursor: move;
    user-select: none;
    touch-action: none;
    opacity: 1;
    transform: translateX(0) scale(1);
    transition:
        opacity 0.3s ease,
        transform 0.3s ease,
        left 0.1s,
        top 0.1s,
        width 0.1s,
        box-shadow 0.2s;
}

#adhesivoOverlay:hover {
    box-shadow: 0 0 10px #d500f9;
}

#adhesivoImagen {
    display: none;
    width: 100%;
    height: auto;
    pointer-events: none;
}

#resizeHandleAdhesivo {
    position: absolute;
    width: 16px;
    height: 16px;
    right: -8px;
    bottom: -8px;
    background: #00aaff;
    border-radius: 50%;
    cursor: nwse-resize;
    display: none;
}

#adhesivoOverlay.activo #resizeHandleAdhesivo {
    display: block;
}


/* ============================= */
/* 8. LONA */
/* ============================= */

#videoBox.lona-activa {
    background: #000;
}

#videoBox.lona-16-9 {
    aspect-ratio: 16 / 9;
}

#videoBox.lona-9-16 {
    width: 360px;
    aspect-ratio: 9 / 16;
}

#videoBox.lona-1-1 {
    width: 500px;
    aspect-ratio: 1 / 1;
}

#videoBox.lona-4-5 {
    width: 450px;
    aspect-ratio: 4 / 5;
}

#videoBox.lona-contain #previewVideo {
    object-fit: contain;
    width: 100%;
    height: 100%;
}

#videoBox.lona-cover #previewVideo {
    object-fit: cover;
    width: 100%;
    height: 100%;
}


/* ============================= */
/* 9. AUDIO PRO */
/* ============================= */

#panelAudio hr {
    border: none;
    border-top: 1px solid #333;
    margin: 12px 0;
}

#panelAudio label {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
    color: #ddd;
}

#panelAudio input[type="range"] {
    padding: 0;
}

#audioVolumenTexto {
    display: block;
    margin-top: -4px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #00d084;
}

#audioTimeline {
    position: relative;
    height: 188px;
    max-width: 700px;
    margin: 0 auto 12px auto;
    background: #171717;
    border: 1px solid #444;
    border-radius: 6px;
    overflow: hidden;
}

#audioTimeline::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 62px;
    height: 1px;
    background: rgba(255,255,255,0.12);
    z-index: 1;
}

#audioTimeline::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 101px;
    height: 1px;
    background: rgba(255,255,255,0.10);
    z-index: 1;
}

.audio-titulo-timeline {
    position: absolute;
    left: 8px;
    top: 5px;
    font-size: 11px;
    color: #aaa;
    z-index: 5;
    pointer-events: none;
}

.audio-carril-label {
    position: absolute;
    left: 8px;
    font-size: 11px;
    font-weight: bold;
    z-index: 5;
    pointer-events: none;
    text-shadow: 0 1px 2px #000;
}

.audio-carril-label-efectos {
    top: 34px;
    color: #ffc107;
}

.audio-carril-label-video {
    top: 73px;
    color: #00e676;
}

.audio-carril-label-local {
    top: 112px;
    color: #00b0ff;
}

.audio-carril-label-microfono {
    top: 151px;
    color: #d500f9;
}

.audio-carril-label-local::before,
.audio-carril-label-microfono::before {
    content: "";
    position: absolute;
    left: -8px;
    right: -680px;
    top: -8px;
    height: 1px;
    background: rgba(255,255,255,0.08);
    z-index: -1;
}

#audioTimelineItems {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 188px;
    overflow: visible;
    z-index: 3;
}

.audio-timeline-item {
    position: absolute;
    min-width: 92px;
    color: #fff;
    font-size: 12px;
    border-radius: 5px;
    padding: 0 20px;
    overflow: hidden;
    white-space: nowrap;
    cursor: grab;
    box-sizing: border-box;
    transition:
        box-shadow 0.2s,
        border 0.2s,
        opacity 0.2s;
    touch-action: none;
    border: 1px solid rgba(255,255,255,0.25);
    z-index: 10;
}

.audio-timeline-item span {
    pointer-events: none;
    display: block;
    text-align: left;
    padding-left: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audio-timeline-item:hover {
    box-shadow: 0 0 8px #00e676;
}

.audio-timeline-item:active,
.audio-timeline-item.arrastrando {
    cursor: grabbing;
    opacity: 0.92;
    z-index: 40 !important;
}

.audio-timeline-item.activo {
    border: 1px solid #fff;
    box-shadow: 0 0 8px rgba(255,255,255,0.7);
    z-index: 35 !important;
}

.audio-timeline-item.efecto,
.audio-timeline-item.track-efecto {
    box-shadow: 0 0 8px rgba(255, 193, 7, 0.6);
}

.audio-timeline-item.efecto:hover,
.audio-timeline-item.track-efecto:hover {
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.9);
}

.audio-timeline-item.track-video:hover {
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.9);
}

.audio-timeline-item.track-local:hover {
    box-shadow: 0 0 10px rgba(0, 176, 255, 0.9);
}

.audio-timeline-item.track-microfono:hover {
    box-shadow: 0 0 10px rgba(213, 0, 249, 0.9);
}

.audio-timeline-item.silenciado {
    background: linear-gradient(90deg, #555, #777) !important;
    opacity: 0.65;
    text-decoration: line-through;
}

.audio-handle {
    position: absolute;
    top: 0;
    width: 14px;
    height: 100%;
    background: rgba(255,255,255,0.95);
    cursor: ew-resize;
    z-index: 50;
    touch-action: none;
}

.audio-handle.left {
    left: 0;
    border-radius: 5px 0 0 5px;
}

.audio-handle.right {
    right: 0;
    border-radius: 0 5px 5px 0;
}

.audio-handle:hover {
    background: #fff;
}

.audio-lista-item {
    background: #252525;
    border: 1px solid #383838;
    padding: 8px;
    margin-bottom: 8px;
    border-radius: 5px;
    font-size: 13px;
    line-height: 1.4;
}

.audio-lista-item.activo {
    border-color: #ff9800;
    box-shadow: 0 0 6px rgba(255,152,0,0.45);
}

.audio-lista-item strong {
    color: #00e676;
}

.audio-lista-item button {
    margin-top: 6px;
}


/* ============================= */
/* 10. BOTÓN GENERAR */
/* ============================= */

.btn-generar {
    padding: 10px 18px;
    background: #00aaff;
    color: white;
    border: none;
    cursor: pointer;
    margin-top: 10px;
    transition: 0.2s;
}

.btn-generar:hover {
    background: #008ecc;
}


/* ============================= */
/* 11. RESPONSIVE */
/* ============================= */

@media (max-width: 900px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }

    #videoBox {
        width: 100%;
    }

    #timeline,
    #audioTimeline {
        max-width: 100%;
    }
}


/* ============================= */
/* 12. INVERSO + ANIMACIÓN PRO */
/* ============================= */

#previewVideo.animacion-video-activa,
#previewVideo.video-inverso-activo {
    will-change: transform, opacity, filter;
    transform-origin: center center;
}

#previewVideo.video-inverso-activo {
    outline: 4px solid #ff1744;
    box-shadow: 0 0 18px rgba(255, 23, 68, 0.85);
}

.segmento-video-item.clip-inverso {
    background: linear-gradient(90deg, #d50000, #ff1744) !important;
    box-shadow: 0 0 10px rgba(255, 23, 68, 0.9);
}

.segmento-video-item.clip-inverso .segmento-video-nombre::before {
    content: "⇄ ";
}

.segmento-video-item.clip-animacion {
    border: 2px solid #00e5ff !important;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.9);
}

.segmento-video-item.clip-animacion .segmento-video-nombre::after {
    content: " ✨";
}

.panel .btn-activo-pro {
    background: #ff1744 !important;
    border-color: #ff8a80 !important;
    color: #fff !important;
}

.animacion-preview-flash {
    animation: flashPreviewPro 0.18s linear infinite alternate;
}

@keyframes flashPreviewPro {
    from {
        box-shadow: 0 0 10px rgba(255,255,255,0.3);
    }
    to {
        box-shadow: 0 0 28px rgba(255,255,255,1);
    }
}


/* ============================= */
/* 13. SCROLL / RECORTE + CAPTURA */
/* ============================= */

#overlayRecorteScroll {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 80;
    pointer-events: auto;
}

#cropBoxScroll {
    position: absolute;
    border: 3px solid #7c4dff;
    box-shadow:
        0 0 0 9999px rgba(0,0,0,0.45),
        0 0 14px rgba(124,77,255,0.9);
    background: rgba(124,77,255,0.08);
    cursor: move;
    touch-action: none;
    box-sizing: border-box;
}

#cropBoxScroll::before,
#cropBoxScroll::after {
    content: "";
    position: absolute;
    background: #7c4dff;
    border-radius: 50%;
    width: 12px;
    height: 12px;
}

#cropBoxScroll::before {
    left: -7px;
    top: 50%;
    transform: translateY(-50%);
}

#cropBoxScroll::after {
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
}

#cropResizeHandleScroll {
    position: absolute;
    right: -9px;
    bottom: -9px;
    width: 18px;
    height: 18px;
    background: #7c4dff;
    border: 2px solid white;
    border-radius: 50%;
    cursor: nwse-resize;
    z-index: 90;
}

#previewVideo {
    transition:
        clip-path 0.25s ease,
        transform 0.25s ease,
        opacity 0.25s ease,
        filter 0.25s ease;
}


/* ============================= */
/* 14. CONGELACIÓN + REINICIAR */
/* ============================= */

.congelacion-timeline-item {
    background: linear-gradient(90deg, #00bcd4, #00e5ff) !important;
    border: 1px solid rgba(255,255,255,0.8);
    box-shadow: 0 0 10px rgba(0,229,255,0.65);
    z-index: 22;
}

.congelacion-timeline-item.activo {
    background: linear-gradient(90deg, #00e5ff, #18ffff) !important;
    border: 2px solid #fff;
    box-shadow: 0 0 14px rgba(0,229,255,1);
    z-index: 40;
}

.congelacion-timeline-item span {
    pointer-events: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#congelacionPreviewOverlay {
    position: absolute;
    inset: 0;
    z-index: 75;
    background: #000;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

#congelacionPreviewImagen {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#playhead.playhead-congelacion {
    background: #00e5ff !important;
    background-color: #00e5ff !important;
    width: 3px !important;
    box-shadow: 0 0 12px rgba(0,229,255,1) !important;
}


/* ============================= */
/* 15. LOADER PRO - QUITAR FONDO */
/* ============================= */

.loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.82);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 18px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.loader-overlay.activo {
    display: flex;
}

.loader-box {
    width: 100%;
    max-width: 450px;
    background: #181818;
    border: 1px solid rgba(0,170,255,0.45);
    border-radius: 18px;
    padding: 26px 24px;
    text-align: center;
    box-shadow:
        0 22px 60px rgba(0,0,0,0.55),
        0 0 24px rgba(0,170,255,0.18);
    animation: loaderEntradaPro 0.35s ease both;
}

.loader-box h3 {
    margin: 0 0 8px 0;
    color: #fff;
    font-size: 22px;
}

.loader-box p {
    margin: 0 0 18px 0;
    color: #cfcfcf;
    font-size: 14px;
}

.loader-track {
    width: 100%;
    height: 20px;
    background: #2b2b2b;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #3d3d3d;
}

.loader-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #007bff, #00c6ff, #00e5ff);
    border-radius: 999px;
    transition: width 0.25s ease;
    box-shadow: 0 0 14px rgba(0,198,255,0.8);
}

.loader-percent {
    margin-top: 14px;
    font-size: 28px;
    font-weight: bold;
    color: #00c6ff;
    text-shadow: 0 0 10px rgba(0,198,255,0.45);
}

.loader-status {
    margin-top: 6px;
    color: #ddd;
    font-size: 14px;
}

.loader-spinner {
    width: 54px;
    height: 54px;
    margin: 0 auto 16px auto;
    border-radius: 50%;
    border: 5px solid rgba(255,255,255,0.15);
    border-top-color: #00c6ff;
    animation: loaderGirarPro 0.8s linear infinite;
}

@keyframes loaderEntradaPro {
    from {
        opacity: 0;
        transform: translateY(22px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes loaderGirarPro {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 600px) {
    .loader-box {
        max-width: 92%;
        padding: 22px 18px;
        border-radius: 15px;
    }

    .loader-box h3 {
        font-size: 19px;
    }

    .loader-percent {
        font-size: 24px;
    }
}

/* rotaci */

#textoOverlay,
#adhesivoOverlay {
    transform-origin: center center;
    backface-visibility: hidden;
    will-change: transform, opacity;
}

.overlay-flip-x {
    transform: scaleX(-1);
}

.overlay-flip-y {
    transform: scaleY(-1);
}

.overlay-flip-xy {
    transform: scaleX(-1) scaleY(-1);
}



/* =========================================
   ROTACION TEXTO / ADHESIVO
========================================= */

#textoOverlay,
#adhesivoOverlay{
    transform-origin:center center;
    touch-action:none;
    user-select:none;
    -webkit-user-select:none;
}

.rotate-handle-editor{
    position:absolute;
    left:50%;
    top:-34px;
    width:18px;
    height:18px;
    margin-left:-9px;
    border-radius:50%;
    border:2px solid #fff;
    z-index:99999;
    cursor:grab;
    touch-action:none;
    box-shadow:0 0 10px rgba(255,255,255,.7);
}

.rotate-handle-editor:active{
    cursor:grabbing;
}

.rotate-handle-editor::after{
    content:"";
    position:absolute;
    left:50%;
    top:18px;
    width:2px;
    height:18px;
    margin-left:-1px;
    background:rgba(255,255,255,.8);
}

/* color handle texto */
#textoOverlay .rotate-handle-editor{
    background:#00aaff;
}

/* color handle adhesivo */
#adhesivoOverlay .rotate-handle-editor{
    background:#d500f9;
}

/* mejora visual */
#textoOverlay.activo,
#adhesivoOverlay.activo{
    outline:2px dashed rgba(255,255,255,.5);
    outline-offset:4px;
}

/* evita bugs touch android */
#videoBox{
    touch-action:none;
}


/* =========================================
   FIX ROTACION SIN RECORTE
   Texto / Adhesivo rotados completos
========================================= */

#textoOverlay,
#adhesivoOverlay {
    overflow: visible !important;
    transform-origin: center center !important;
}

#textoContenido {
    overflow: visible !important;
}

#adhesivoImagen,
#adhesivoOverlay img {
    overflow: visible !important;
}

/* Permite ver el contenido rotado en la vista previa */
#videoBox {
    overflow: visible !important;
}

/* Mantiene el video debajo y evita que tape overlays */
#previewVideo {
    position: relative;
    z-index: 1;
}

#textoOverlay {
    z-index: 30 !important;
}

#adhesivoOverlay {
    z-index: 29 !important;
}

/* Control circular de rotación */
.rotate-handle-editor {
    position: absolute;
    left: 50%;
    top: -34px;
    width: 18px;
    height: 18px;
    margin-left: -9px;
    border-radius: 50%;
    border: 2px solid #fff;
    z-index: 99999;
    cursor: grab;
    touch-action: none;
    box-shadow: 0 0 10px rgba(255,255,255,.7);
}

.rotate-handle-editor:active {
    cursor: grabbing;
}

.rotate-handle-editor::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 18px;
    width: 2px;
    height: 18px;
    margin-left: -1px;
    background: rgba(255,255,255,.8);
}

#textoOverlay .rotate-handle-editor {
    background: #00aaff;
}

#adhesivoOverlay .rotate-handle-editor {
    background: #d500f9;
}



/* =========================================
   TIMELINE MULTICARRIL TEXTO / ADHESIVOS
   Evita conflictos cuando un clip ocupa todo el tiempo
========================================= */

#timeline {
    overflow: visible !important;
}

#timelineItems {
    overflow: visible !important;
}

.timeline-item,
.timeline-carril-item {
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.timeline-item.activo,
.timeline-carril-item.activo {
    z-index: 999 !important;
}

@media (max-width: 900px) {
    #timeline {
        overflow-x: auto !important;
        overflow-y: visible !important;
    }

    #timelineItems {
        min-width: 100%;
    }

    .timeline-item {
        min-width: 64px;
        font-size: 11px;
        padding-left: 14px;
        padding-right: 14px;
    }
}





.audio-timeline-contenido{
    display:flex;
    align-items:center;
    gap:6px;
    width:100%;
    height:100%;
    padding:0 6px;
    box-sizing:border-box;
    overflow:hidden;
}

.audio-btn-silencio{
    border:none;
    background:rgba(0,0,0,0.25);
    color:#fff;
    width:18px;
    height:18px;
    border-radius:50%;
    cursor:pointer;
    font-size:11px;
    display:flex;
    align-items:center;
    justify-content:center;
    flex-shrink:0;
    padding:0;
}

.audio-btn-silencio:hover{
    transform:scale(1.08);
}

.audio-btn-silencio.activo{
    background:#ff5252;
}

.audio-timeline-texto{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    flex:1;
}

/* =========================================
   SILENCIO CLICK EN CLIPS DEL VIDEO PRINCIPAL
   Sin icono, solo cambio visual
========================================= */

.segmento-video-item {
    cursor: pointer !important;
    pointer-events: auto !important;
}

.segmento-video-item .segmento-video-nombre {
    pointer-events: none !important;
}

.segmento-video-item.clip-video-silenciado {
    opacity: 0.55 !important;
    filter: grayscale(0.65) !important;
    box-shadow: 0 0 14px rgba(255,0,0,0.95) !important;
    border-color: #ff5252 !important;
}

.segmento-video-item.clip-video-silenciado .segmento-video-nombre {
    text-decoration: line-through !important;
    opacity: 0.85 !important;
}

.resize-video-left,
.resize-video-right {
    pointer-events: auto !important;
}




/* =========================================================
   17. MODO UNIVERSAL APP - PC Y CELULAR IGUAL
   La computadora usa la misma interfaz tipo móvil/app,
   pero centrada y más grande. No toca render ni JS.
========================================================= */

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0 !important;
    padding: 0 !important;
    background: #202020 !important;
    color: #fff !important;
    overflow-x: hidden;
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: Arial, sans-serif;
    touch-action: manipulation;
}

.titulo-editor,
h2 {
    display: none !important;
}

.editor-layout,
.editor-layout-movil-ready {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 1180px;
    min-height: 100vh;
    gap: 0 !important;
    padding: 0 !important;
    margin: 0 auto !important;
    background: #202020 !important;
}

.zona-video {
    order: 1;
    position: relative;
    width: 100%;
    min-height: auto;
    padding: 64px 14px 8px 14px;
    box-sizing: border-box;
    text-align: center;
    background: #202020;
}

.editor-topbar-movil {
    position: absolute;
    top: 12px;
    left: 14px;
    right: 14px;
    height: 42px;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    z-index: 80;
}

#videoInput {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

.btn-seleccionar-video-movil {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 150px;
    height: 42px;
    padding: 0 14px;
    border-radius: 13px;
    background: #2b2b2b;
    border: 1px solid #3a3a3a;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-sizing: border-box;
    white-space: nowrap;
}

.btn-generar-movil,
.btn-generar {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 130px;
    height: 42px;
    margin: 0 !important;
    padding: 0 14px !important;
    border-radius: 13px;
    border: 0 !important;
    background: #ff2f5f !important;
    color: #fff !important;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.1;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(255, 47, 95, 0.25);
    transition: transform 0.15s ease;
}

.btn-generar:hover,
.btn-generar:active {
    background: #ff2f5f !important;
    transform: scale(0.98);
}

.btn-generar-desktop {
    display: none !important;
}

/* Preview: sin mensaje "Sin señal" para evitar conflicto con el video */
.sin-senal-video,
#sinSenalVideo,
#videoBox::before {
    display: none !important;
    content: none !important;
}

#videoBox,
.video-box-movil-ready {
    position: relative;
    width: min(100%, 430px) !important;
    max-width: 430px !important;
    min-height: 48vh;
    max-height: 68vh;
    margin: 0 auto 8px auto !important;
    background: #000;
    border: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    box-shadow: 0 14px 38px rgba(0,0,0,0.35);
    display: flex !important;
    align-items: center;
    justify-content: center;
}

#previewVideo {
    position: relative;
    width: 100% !important;
    max-width: 100%;
    max-height: 68vh;
    height: auto;
    min-height: 220px;
    display: block !important;
    background: #000;
    object-fit: contain;
    z-index: 1;
    opacity: 1 !important;
    pointer-events: auto !important;
}

#videoBox.lona-9-16,
#videoBox.lona-1-1,
#videoBox.lona-4-5,
#videoBox.lona-16-9 {
    max-width: min(100%, 430px) !important;
}

#videoBox.lona-9-16 {
    width: min(100%, 390px) !important;
    aspect-ratio: 9 / 16;
    min-height: auto;
}

#videoBox.lona-16-9 {
    width: min(100%, 760px) !important;
    max-width: 760px !important;
    aspect-ratio: 16 / 9;
    min-height: auto;
}

#videoBox.lona-1-1 {
    width: min(100%, 500px) !important;
    max-width: 500px !important;
    aspect-ratio: 1 / 1;
    min-height: auto;
}

#videoBox.lona-4-5 {
    width: min(100%, 420px) !important;
    aspect-ratio: 4 / 5;
    min-height: auto;
}

.tiempos {
    display: flex;
    justify-content: space-between;
    width: min(100%, 760px) !important;
    max-width: 760px !important;
    margin: 6px auto 0 auto !important;
    padding: 0 4px;
    box-sizing: border-box;
    color: #bdbdbd;
    font-size: 12px;
}

.herramientas,
.herramientas-movil {
    order: 2;
    width: 100%;
    max-width: 1180px;
    display: flex !important;
    flex-direction: row !important;
    gap: 12px;
    padding: 12px 14px 10px 14px;
    margin: 0 auto !important;
    box-sizing: border-box;
    background: #242424;
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.herramientas::-webkit-scrollbar {
    display: none;
}

.herramientas button {
    flex: 0 0 auto;
    width: 82px !important;
    min-width: 82px;
    height: 68px;
    margin: 0 !important;
    padding: 8px 6px 6px 6px !important;
    border: none !important;
    border-radius: 14px;
    background: transparent !important;
    color: #d8d8d8 !important;
    font-size: 12px;
    line-height: 1.15;
    text-align: center;
    scroll-snap-align: start;
    cursor: pointer;
    white-space: normal;
}

.herramientas button::before {
    display: block;
    margin: 0 auto 5px auto;
    font-size: 25px;
    line-height: 26px;
    color: #fff;
}

.herramientas button:nth-child(1)::before { content: "T"; font-weight: 900; font-size: 29px; }
.herramientas button:nth-child(2)::before { content: "☻"; }
.herramientas button:nth-child(3)::before { content: "▣"; }
.herramientas button:nth-child(4)::before { content: "♪"; }
.herramientas button:nth-child(5)::before { content: "✂"; }
.herramientas button:nth-child(6)::before { content: "▰"; }
.herramientas button:nth-child(7)::before { content: "⏩"; font-size: 22px; }
.herramientas button:nth-child(8)::before { content: "◐"; }
.herramientas button:nth-child(9)::before { content: "●"; }
.herramientas button:nth-child(10)::before { content: "✦"; }
.herramientas button:nth-child(11)::before { content: "⇄"; }
.herramientas button:nth-child(12)::before { content: "✨"; }
.herramientas button:nth-child(13)::before { content: "↔"; }
.herramientas button:nth-child(14)::before { content: "📷"; font-size: 21px; }
.herramientas button:nth-child(15)::before { content: "❄"; }
.herramientas button:nth-child(16)::before { content: "↺"; }

.herramientas button:hover,
.herramientas button:active {
    background: rgba(255,255,255,0.08) !important;
    color: #fff !important;
}

.timeline-movil-wrapper {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.timeline-movil-wrapper::-webkit-scrollbar {
    display: none;
}

#timeline,
#audioTimeline {
    width: calc(100vw - 28px) !important;
    max-width: 1150px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    border-radius: 0 !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x;
}

#timeline::-webkit-scrollbar,
#audioTimeline::-webkit-scrollbar {
    display: none;
}

#timeline {
    min-height: 96px;
    margin-top: 10px !important;
    margin-bottom: 8px !important;
    background: #282828 !important;
    border: none !important;
}

#timelineItems {
    min-width: 920px !important;
    width: 920px !important;
    min-height: 56px;
    padding-bottom: 14px;
    overflow: visible !important;
}

#timeline::before {
    top: 6px;
    left: 10px;
    font-size: 10px;
    color: #9d9d9d;
}

#playhead {
    top: 26px;
    width: 4px;
    min-height: 70px;
    border-radius: 999px;
    background: #fff !important;
    box-shadow: 0 0 10px rgba(255,255,255,0.85);
}

.paneles {
    order: 3;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    background: #202020;
    box-sizing: border-box;
}

.panel {
    width: calc(100% - 28px) !important;
    max-width: 1150px;
    max-height: 40vh;
    margin: 8px auto 0 auto !important;
    padding: 12px !important;
    box-sizing: border-box;
    background: #181818 !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 16px !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.24);
}

.panel h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.panel label {
    font-size: 12px;
    color: #ddd;
}

.panel input,
.panel textarea,
.panel button,
.panel select {
    min-height: 40px;
    border-radius: 10px;
    font-size: 14px;
}

.panel button {
    background: #2f2f2f;
    border-color: #454545;
}

.panel textarea {
    min-height: 74px;
}

#listaTextos,
#listaAdhesivos {
    max-height: 180px;
}

/* Audio timeline visible y ancho para todos los carriles */
#audioTimeline {
    display: block !important;
    height: 210px;
    margin-top: 8px !important;
    margin-bottom: 12px !important;
    background: #161616 !important;
    border: none !important;
}

#audioTimelineItems {
    width: 920px !important;
    min-width: 920px !important;
    height: 210px;
}

.audio-titulo-timeline,
.audio-carril-label,
.audio-carril-label-efectos,
.audio-carril-label-video,
.audio-carril-label-local,
.audio-carril-label-microfono {
    display: block !important;
    visibility: visible !important;
}

.audio-carril-label-local::before,
.audio-carril-label-microfono::before {
    right: -920px;
}

.timeline-item,
.timeline-carril-item,
.segmento-video-item,
.audio-timeline-item {
    min-height: 38px;
    min-width: 78px;
    border-radius: 6px;
    font-size: 11px;
    touch-action: none;
}

.timeline-handle,
.audio-handle,
.resize-video-left,
.resize-video-right {
    width: 18px !important;
    min-width: 18px;
}

#textoOverlay {
    font-size: 25px;
    padding: 8px 13px;
    max-width: 86%;
}

#resizeHandle,
#resizeHandleAdhesivo {
    width: 24px !important;
    height: 24px !important;
    right: -12px !important;
    bottom: -12px !important;
}

.rotate-handle-editor {
    width: 24px !important;
    height: 24px !important;
    top: -42px !important;
    margin-left: -12px !important;
}

.rotate-handle-editor::after {
    top: 24px !important;
    height: 20px !important;
}

#cropResizeHandleScroll {
    width: 26px !important;
    height: 26px !important;
    right: -13px !important;
    bottom: -13px !important;
}

#cropBoxScroll::before,
#cropBoxScroll::after {
    width: 18px;
    height: 18px;
}

@media (min-width: 900px) {
    .zona-video {
        padding-top: 70px;
    }

    .editor-topbar-movil {
        left: 28px;
        right: 28px;
    }

    #videoBox,
    .video-box-movil-ready {
        width: min(100%, 520px) !important;
        max-width: 520px !important;
        min-height: 520px;
    }

    #previewVideo {
        min-height: 300px;
        max-height: 72vh;
    }

    .herramientas button {
        width: 92px !important;
        min-width: 92px;
        height: 74px;
        font-size: 13px;
    }

    .panel {
        max-height: 42vh;
    }
}

@media (max-width: 420px) {
    .zona-video {
        padding-left: 8px;
        padding-right: 8px;
    }

    .editor-topbar-movil {
        left: 8px;
        right: 8px;
    }

    .btn-seleccionar-video-movil {
        min-width: 132px;
        font-size: 12px;
        padding: 0 10px;
    }

    .btn-generar-movil,
    .btn-generar {
        min-width: 106px;
        font-size: 12px;
        padding: 0 9px !important;
    }

    #videoBox,
    .video-box-movil-ready {
        width: min(100%, 350px) !important;
        max-width: 350px !important;
        min-height: 44vh;
    }

    #previewVideo {
        max-height: 58vh;
    }

    .herramientas {
        gap: 10px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .herramientas button {
        width: 68px !important;
        min-width: 68px;
        height: 64px;
        font-size: 11px;
    }

    #timelineItems,
    #audioTimelineItems {
        min-width: 700px !important;
        width: 700px !important;
    }
}

/* FIN MODO UNIVERSAL APP */

/* =========================================================
   18. PANELES COMO BARRA DE FUNCIONES ARRIBA DEL TIMELINE
   Universal: PC y celular igual. No toca render ni JS.
========================================================= */

/* El panel activo se comporta como una barra horizontal deslizable */
.paneles {
    width: 100% !important;
    max-width: 1180px !important;
    margin: 0 auto !important;
    background: #202020 !important;
    box-sizing: border-box !important;
    z-index: 20;
}

.panel {
    display: none !important;
}

.panel.activo {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: calc(100% - 28px) !important;
    max-width: 1150px !important;
    min-height: 74px !important;
    max-height: none !important;
    margin: 8px auto 8px auto !important;
    padding: 10px 12px !important;
    box-sizing: border-box !important;
    background: #181818 !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 16px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    box-shadow: 0 6px 22px rgba(0,0,0,0.28) !important;
    white-space: nowrap !important;
}

.panel.activo::-webkit-scrollbar {
    display: none !important;
}

.panel.activo h3 {
    flex: 0 0 auto !important;
    min-width: 72px !important;
    margin: 0 4px 0 0 !important;
    padding: 8px 10px !important;
    border-radius: 12px !important;
    background: #242424 !important;
    color: #fff !important;
    font-size: 14px !important;
    line-height: 1.1 !important;
    text-align: center !important;
}

.panel.activo label {
    flex: 0 0 auto !important;
    margin: 0 !important;
    color: #cfcfcf !important;
    font-size: 12px !important;
    line-height: 38px !important;
}

.panel.activo input,
.panel.activo select,
.panel.activo textarea,
.panel.activo button {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 112px !important;
    max-width: none !important;
    height: 40px !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 8px 10px !important;
    box-sizing: border-box !important;
    border-radius: 11px !important;
    background: #2a2a2a !important;
    border: 1px solid #444 !important;
    color: #fff !important;
    font-size: 13px !important;
    white-space: nowrap !important;
}

.panel.activo input[type="color"] {
    min-width: 48px !important;
    width: 48px !important;
    padding: 4px !important;
}

.panel.activo input[type="number"] {
    min-width: 82px !important;
    width: 82px !important;
}

.panel.activo input[type="range"] {
    min-width: 150px !important;
    padding: 0 !important;
}

.panel.activo textarea {
    min-width: 210px !important;
    width: 210px !important;
    height: 42px !important;
    min-height: 42px !important;
    resize: none !important;
    white-space: normal !important;
}

.panel.activo button {
    min-width: 132px !important;
    cursor: pointer !important;
    background: #2f2f2f !important;
    border-color: #454545 !important;
}

.panel.activo button:hover,
.panel.activo button:active {
    background: #00aaff !important;
    color: #fff !important;
}

.panel.activo input[type="file"] {
    min-width: 210px !important;
}

.panel.activo #listaTextos,
.panel.activo #listaAdhesivos,
.panel.activo [id^="lista"] {
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    max-height: 56px !important;
    min-width: 160px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
    scrollbar-width: none !important;
}

.panel.activo #listaTextos::-webkit-scrollbar,
.panel.activo #listaAdhesivos::-webkit-scrollbar,
.panel.activo [id^="lista"]::-webkit-scrollbar {
    display: none !important;
}

.texto-lista-item,
.adhesivo-lista-item,
.audio-lista-item {
    flex: 0 0 auto !important;
    min-width: 150px !important;
    max-width: 240px !important;
    margin: 0 !important;
    padding: 7px 9px !important;
    border-radius: 10px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Timelines siempre quedan debajo de la barra de funciones */
.timeline-movil-wrapper,
#timeline,
#audioTimeline {
    clear: both !important;
}

/* Corrige preview de video en celular: nunca ocultarlo ni dejarlo transparente */
#previewVideo,
#previewVideo.video-cargado {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    background: #000 !important;
    object-fit: contain !important;
}

#previewVideo:not([src]),
#previewVideo[src=""] {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Elimina definitivamente cualquier mensaje o capa Sin señal */
.sin-senal-video,
#sinSenalVideo,
#videoBox::before,
.video-box-movil-ready::before {
    display: none !important;
    content: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* En pantallas pequeñas los controles son más compactos pero siguen horizontales */
@media (max-width: 520px) {
    .panel.activo {
        width: calc(100% - 16px) !important;
        margin-top: 6px !important;
        padding: 9px 9px !important;
        gap: 8px !important;
        border-radius: 14px !important;
    }

    .panel.activo h3 {
        min-width: 62px !important;
        font-size: 13px !important;
        padding: 8px !important;
    }

    .panel.activo input,
    .panel.activo select,
    .panel.activo textarea,
    .panel.activo button {
        min-width: 104px !important;
        height: 38px !important;
        min-height: 38px !important;
        font-size: 12px !important;
        padding: 7px 9px !important;
    }

    .panel.activo textarea {
        min-width: 180px !important;
        width: 180px !important;
    }

    .panel.activo button {
        min-width: 118px !important;
    }
}

/* FIN PANELES COMO BARRA */

/* =========================================================
   19. AJUSTE FINAL - 2 FILAS + SCROLL APP
   PC y celular: misma interfaz tipo app.
   Herramientas y panel activo en 2 filas horizontales.
========================================================= */

html,
body {
    height: auto !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    touch-action: pan-y !important;
}

body {
    overscroll-behavior-y: contain;
}

.editor-layout,
.editor-layout-movil-ready {
    min-height: 100vh !important;
    overflow: visible !important;
}

/* =============================
   MENÚ PRINCIPAL EN 2 FILAS
============================= */
.herramientas,
.herramientas-movil {
    display: grid !important;
    grid-auto-flow: column !important;
    grid-template-rows: repeat(2, 74px) !important;
    grid-auto-columns: 92px !important;
    align-items: stretch !important;
    justify-content: start !important;
    gap: 10px 12px !important;
    height: 166px !important;
    min-height: 166px !important;
    max-height: 166px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(255,255,255,0.28) transparent !important;
    scroll-snap-type: x proximity !important;
    touch-action: pan-x pan-y !important;
}

.herramientas::-webkit-scrollbar,
.herramientas-movil::-webkit-scrollbar {
    height: 7px !important;
    display: block !important;
}

.herramientas::-webkit-scrollbar-track,
.herramientas-movil::-webkit-scrollbar-track {
    background: transparent !important;
}

.herramientas::-webkit-scrollbar-thumb,
.herramientas-movil::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.28) !important;
    border-radius: 999px !important;
}

.herramientas button,
.herramientas-movil button {
    width: 92px !important;
    min-width: 92px !important;
    height: 74px !important;
    min-height: 74px !important;
    margin: 0 !important;
    scroll-snap-align: start !important;
}

/* =============================
   PANEL ACTIVO EN 2 FILAS
   Los controles se acomodan de arriba abajo
   y luego continúan hacia la derecha.
============================= */
.panel.activo {
    display: grid !important;
    grid-auto-flow: column !important;
    grid-template-rows: repeat(2, 44px) !important;
    grid-auto-columns: max-content !important;
    align-items: center !important;
    justify-content: start !important;
    gap: 9px 10px !important;
    min-height: 112px !important;
    max-height: 112px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(255,255,255,0.28) transparent !important;
    scroll-snap-type: x proximity !important;
    touch-action: pan-x pan-y !important;
}

.panel.activo::-webkit-scrollbar {
    height: 7px !important;
    display: block !important;
}

.panel.activo::-webkit-scrollbar-track {
    background: transparent !important;
}

.panel.activo::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.28) !important;
    border-radius: 999px !important;
}

.panel.activo h3,
.panel.activo label,
.panel.activo input,
.panel.activo select,
.panel.activo textarea,
.panel.activo button,
.panel.activo #listaTextos,
.panel.activo #listaAdhesivos,
.panel.activo [id^="lista"] {
    margin: 0 !important;
    scroll-snap-align: start !important;
}

.panel.activo h3 {
    height: 40px !important;
    min-height: 40px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.panel.activo label {
    height: 40px !important;
    line-height: 40px !important;
}

.panel.activo input,
.panel.activo select,
.panel.activo textarea,
.panel.activo button {
    height: 40px !important;
    min-height: 40px !important;
}

.panel.activo textarea {
    height: 40px !important;
    min-height: 40px !important;
}

.panel.activo #listaTextos,
.panel.activo #listaAdhesivos,
.panel.activo [id^="lista"] {
    height: 44px !important;
    max-height: 44px !important;
}

/* =============================
   SCROLL GENERAL VERTICAL DE LA APP
============================= */
.zona-video,
.paneles,
.timeline-movil-wrapper,
#audioTimeline,
#timeline {
    touch-action: pan-x pan-y !important;
}

/* Permite desplazar la página de arriba a abajo con rueda y dedo */
#videoBox,
#previewVideo {
    touch-action: manipulation !important;
}

/* =============================
   AJUSTES CELULAR
============================= */
@media (max-width: 520px) {
    .herramientas,
    .herramientas-movil {
        grid-template-rows: repeat(2, 66px) !important;
        grid-auto-columns: 72px !important;
        height: 150px !important;
        min-height: 150px !important;
        max-height: 150px !important;
        gap: 8px 10px !important;
        padding: 10px 10px 9px 10px !important;
    }

    .herramientas button,
    .herramientas-movil button {
        width: 72px !important;
        min-width: 72px !important;
        height: 66px !important;
        min-height: 66px !important;
    }

    .panel.activo {
        grid-template-rows: repeat(2, 40px) !important;
        min-height: 98px !important;
        max-height: 98px !important;
        gap: 8px 8px !important;
    }

    .panel.activo input,
    .panel.activo select,
    .panel.activo textarea,
    .panel.activo button {
        height: 38px !important;
        min-height: 38px !important;
    }
}

/* FIN AJUSTE FINAL 2 FILAS */


/* =========================================================
   20. FIX FINAL LONA + FUNCIONES VISIBLES
   Permite que el color de lona aplicado por JS se vea en el preview.
========================================================= */

/* No bloquear el color inline que aplica aplicarLona() */
#videoBox.video-box-movil-ready,
#videoBox.lona-activa {
    background-image: none !important;
}

/* En modo contain, el video no debe pintar negro encima de la lona */
#videoBox.lona-contain #previewVideo,
#videoBox.lona-activa.lona-contain #previewVideo {
    background: transparent !important;
}

/* En formatos con barras, deja ver el color de fondo del contenedor */
#videoBox.lona-9-16 #previewVideo,
#videoBox.lona-16-9 #previewVideo,
#videoBox.lona-1-1 #previewVideo,
#videoBox.lona-4-5 #previewVideo {
    background-color: transparent !important;
}

/* Asegura que todas las funciones puedan verse en 2 filas y moverse */
.herramientas,
.herramientas-movil {
    grid-auto-flow: column !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding-bottom: 14px !important;
}

.herramientas button,
.herramientas-movil button {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Evita que el panel de opciones tape o corte visualmente las funciones */
.paneles,
.panel.activo {
    overflow: visible !important;
}

.panel.activo {
    overflow-x: auto !important;
    overflow-y: visible !important;
}

/* Mantiene scroll vertical normal de toda la app con dedo y rueda */
html,
body {
    overflow-y: auto !important;
}

/* FIN FIX FINAL LONA + FUNCIONES */



/* =========================================================
   21. FIX SCROLL VERTICAL APP MOVIL
   Permite subir/bajar toda la app con el dedo.
   Mantiene scroll horizontal en herramientas, paneles y timelines.
========================================================= */

html {
    height: auto !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    touch-action: pan-y !important;
    overscroll-behavior-y: auto !important;
}

body {
    height: auto !important;
    min-height: 100vh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    touch-action: pan-y !important;
    overscroll-behavior-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

/* La app completa debe crecer y dejar que el body haga scroll vertical */
.editor-layout,
.editor-layout-movil-ready,
.zona-video {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Evita que el preview bloquee el desplazamiento vertical de la página */
#videoBox,
.video-box-movil-ready {
    touch-action: pan-y !important;
}

/*
   El video puede seguir recibiendo controles básicos,
   pero no debe secuestrar todo el gesto vertical.
*/
#previewVideo {
    touch-action: pan-y !important;
}

/* Los overlays sí necesitan touch-action none porque se mueven/redimensionan */
#textoOverlay,
#adhesivoOverlay,
#resizeHandle,
#resizeHandleAdhesivo,
.rotate-handle-editor,
#cropBoxScroll,
#cropResizeHandleScroll {
    touch-action: none !important;
}

/* Herramientas: scroll horizontal con dedo */
.herramientas,
.herramientas-movil {
    touch-action: pan-x !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Panel activo: scroll horizontal con dedo */
.panel.activo {
    touch-action: pan-x !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Timeline: scroll horizontal con dedo */
.timeline-movil-wrapper,
#timeline,
#audioTimeline {
    touch-action: pan-x !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Pero el contenedor general puede bajar/subir */
.paneles {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    touch-action: pan-y !important;
}

/* Agrega espacio inferior para poder llegar cómodo al final en celular */
.zona-video {
    padding-bottom: 32px !important;
}

.timeline-movil-wrapper {
    padding-bottom: 36px !important;
}

/* En celulares pequeños reduce un poco el alto del preview para que se pueda ver más interfaz */
@media (max-width: 520px) {
    #videoBox,
    .video-box-movil-ready {
        min-height: 38vh !important;
        max-height: 54vh !important;
    }

    #previewVideo {
        max-height: 54vh !important;
        min-height: 180px !important;
    }

    .zona-video {
        padding-bottom: 48px !important;
    }
}

/* FIN FIX SCROLL VERTICAL APP MOVIL */


/* =========================================================
   22. FIX TOUCH MOVER TEXTO / ADHESIVO + MENU MOVIL
   Permite mover/agrandar overlays y subir/bajar la app desde menú.
========================================================= */

/* Overlays editables: capturan gesto para mover/redimensionar */
#textoOverlay,
#adhesivoOverlay,
#resizeHandle,
#resizeHandleAdhesivo,
.rotate-handle-editor {
    touch-action: none !important;
    -ms-touch-action: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

/* Menú y panel: permiten scroll horizontal, pero no bloquean totalmente el gesto vertical */
.herramientas,
.herramientas-movil,
.panel.activo {
    touch-action: pan-x pan-y !important;
    -ms-touch-action: pan-x pan-y !important;
}

/* Toda la app mantiene scroll vertical */
html,
body,
.editor-layout,
.editor-layout-movil-ready,
.zona-video,
.paneles {
    touch-action: pan-y !important;
    overflow-y: auto !important;
}

/* Timeline mantiene gesto horizontal de edición */
.timeline-movil-wrapper,
#timeline,
#audioTimeline {
    touch-action: pan-x !important;
}

/* Evita que el video bloquee el gesto vertical cuando no se está editando overlay */
#videoBox,
#previewVideo {
    touch-action: pan-y !important;
}

/* FIN FIX TOUCH MOVER TEXTO / ADHESIVO + MENU MOVIL */


/* =========================================================
   23. FIX VIDEO VISIBLE + TIMELINE COMO PC
   El video aparece solo al cargar.
   La línea de tiempo vuelve a usar ancho 100% como escritorio.
========================================================= */

/* Video siempre visible sin tener que tocarlo */
#videoBox,
.video-box-movil-ready {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center !important;
    justify-content: center !important;
    background: #000 !important;
}

#previewVideo {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    background: #000 !important;
    position: relative !important;
    z-index: 1 !important;
}

/*
   Timeline como PC:
   Antes el modo móvil forzaba #timelineItems a 700px/920px.
   Eso hace que los clips no llenen la línea igual que en PC.
   Aquí el timeline vuelve a trabajar con porcentajes reales sobre 100%.
*/
.timeline-movil-wrapper {
    width: 100% !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
}

#timeline {
    width: calc(100% - 28px) !important;
    max-width: 700px !important;
    overflow: visible !important;
    touch-action: pan-y !important;
}

#timelineItems {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    overflow: visible !important;
}

/* Los items usan left/width en %, tal cual PC */
.timeline-item,
.timeline-carril-item,
.segmento-video-item,
.congelacion-timeline-item {
    box-sizing: border-box !important;
}

/* Audio puede seguir horizontal si necesita más espacio */
#audioTimeline {
    overflow-x: auto !important;
    touch-action: pan-x !important;
}

#audioTimelineItems {
    min-width: 700px !important;
}

/* En móvil pequeño sigue ocupando todo el ancho disponible */
@media (max-width: 520px) {
    #timeline {
        width: calc(100% - 16px) !important;
        max-width: calc(100% - 16px) !important;
    }

    #timelineItems {
        width: 100% !important;
        min-width: 100% !important;
    }
}

/* FIN FIX VIDEO VISIBLE + TIMELINE COMO PC */


/* =========================================================
   24. FIX PREVIEW AUTO + BLOQUES TIMELINE VISIBLES
========================================================= */

#videoBox,
.video-box-movil-ready {
    min-height: 220px !important;
    background: #000 !important;
    contain: none !important;
}

#previewVideo {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 180px !important;
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
}

#timeline {
    display: block !important;
    position: relative !important;
    min-height: 96px !important;
    height: auto !important;
    overflow: visible !important;
    background: #282828 !important;
}

#timelineItems {
    display: block !important;
    position: relative !important;
    top: 28px !important;
    width: 100% !important;
    min-width: 100% !important;
    min-height: 56px !important;
    overflow: visible !important;
}

.timeline-item,
.timeline-carril-item,
.segmento-video-item,
.congelacion-timeline-item {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    z-index: 20 !important;
}

.timeline-item.activo,
.timeline-carril-item.activo,
.segmento-video-item.activo {
    z-index: 999 !important;
}

/* FIN FIX PREVIEW AUTO + BLOQUES TIMELINE VISIBLES */


/* =========================================================
   25. FIX ANDROID PRIMER FRAME + VIDEO BASE TIMELINE
========================================================= */

#previewVideo {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    background: #000 !important;
    object-fit: contain !important;
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
}

#videoBox {
    background: #000 !important;
}

.timeline-video-base-editor {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* La línea base del video queda abajo de textos/adhesivos pero visible */
#timelineItems .timeline-video-base-editor {
    z-index: 5 !important;
}

#timelineItems .timeline-item,
#timelineItems .timeline-carril-item,
#timelineItems .segmento-video-item,
#timelineItems .congelacion-timeline-item {
    z-index: 25 !important;
}

/* FIN FIX ANDROID PRIMER FRAME + VIDEO BASE TIMELINE */


/* FIX AUTOPLAY + SILENCIO VIDEO PRINCIPAL TIMELINE */

#previewVideo {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: #000 !important;
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
}

.timeline-video-base-editor {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    pointer-events: auto !important;
}

.timeline-video-base-editor.video-base-silenciado {
    opacity: 0.78 !important;
    filter: grayscale(0.35) !important;
}

.btn-silencio-video-principal {
    pointer-events: auto !important;
    touch-action: manipulation !important;
}

.btn-silencio-video-principal:active {
    transform: scale(0.92);
}


/* =========================================================
   26. FIX FINAL CSS LIMPIO PARA PC + MOVIL
   Este bloque va al final y manda sobre los anteriores.
   Corrige:
   - autoplay visible Android
   - timeline video principal con botón silencio
   - timeline 100% como PC
   - scroll vertical de la app
   - mover texto/adhesivo con dedo
========================================================= */

/* =============================
   BASE APP SCROLL
============================= */
html,
body {
    width: 100% !important;
    height: auto !important;
    min-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    touch-action: pan-y !important;
    overscroll-behavior-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    background: #202020 !important;
}

.editor-layout,
.editor-layout-movil-ready,
.zona-video,
.paneles,
.timeline-movil-wrapper {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* =============================
   VIDEO PREVIEW ESTABLE
============================= */
#videoBox,
.video-box-movil-ready {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: #000 !important;
    contain: none !important;
    overflow: visible !important;
    touch-action: pan-y !important;
}

#previewVideo {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 180px !important;
    object-fit: contain !important;
    background: #000 !important;
    position: relative !important;
    z-index: 1 !important;
    pointer-events: auto !important;
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
    touch-action: pan-y !important;
}

/* =============================
   OVERLAYS EDITABLES
============================= */
#textoOverlay,
#adhesivoOverlay,
#resizeHandle,
#resizeHandleAdhesivo,
.rotate-handle-editor,
#cropBoxScroll,
#cropResizeHandleScroll {
    touch-action: none !important;
    -ms-touch-action: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

#textoOverlay {
    z-index: 30 !important;
}

#adhesivoOverlay {
    z-index: 29 !important;
}

/* =============================
   MENU Y PANELES
============================= */
.herramientas,
.herramientas-movil {
    touch-action: pan-x pan-y !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
}

.paneles {
    touch-action: pan-y !important;
}

.panel.activo {
    touch-action: pan-x pan-y !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
}

/* =============================
   TIMELINE COMO PC
============================= */
.timeline-movil-wrapper {
    width: 100% !important;
    max-width: 1180px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    padding-bottom: 36px !important;
    touch-action: pan-y !important;
}

#timeline {
    display: block !important;
    position: relative !important;
    width: calc(100% - 28px) !important;
    max-width: 700px !important;
    min-height: 138px !important;
    height: auto !important;
    margin-left: auto !important;
    margin-right: auto !important;
    overflow: visible !important;
    background: #282828 !important;
    border: none !important;
    border-radius: 8px !important;
    touch-action: pan-y !important;
}

#timelineItems {
    display: block !important;
    position: relative !important;
    left: 0 !important;
    right: 0 !important;
    top: 28px !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    min-height: 96px !important;
    height: auto;
    overflow: visible !important;
    padding-bottom: 14px !important;
}

.timeline-item,
.timeline-carril-item,
.segmento-video-item,
.congelacion-timeline-item {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    box-sizing: border-box !important;
    z-index: 25 !important;
    touch-action: none !important;
}

.timeline-item.activo,
.timeline-carril-item.activo,
.segmento-video-item.activo {
    z-index: 999 !important;
}

#playhead {
    z-index: 9999 !important;
}

/* =============================
   VIDEO PRINCIPAL EN TIMELINE
============================= */
.timeline-video-base-editor {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 5 !important;
}

.timeline-video-base-editor.video-base-silenciado {
    opacity: 0.78 !important;
    filter: grayscale(0.35) !important;
}

.btn-silencio-video-principal {
    pointer-events: auto !important;
    touch-action: manipulation !important;
    flex: 0 0 auto !important;
}

.btn-silencio-video-principal:active {
    transform: scale(0.92);
}

/* =============================
   AUDIO TIMELINE
============================= */
#audioTimeline {
    overflow-x: auto !important;
    overflow-y: visible !important;
    touch-action: pan-x !important;
    -webkit-overflow-scrolling: touch !important;
}

#audioTimelineItems {
    min-width: 700px !important;
}

/* =============================
   RESPONSIVE MOVIL
============================= */
@media (max-width: 520px) {
    .zona-video {
        padding-left: 8px !important;
        padding-right: 8px !important;
        padding-bottom: 48px !important;
    }

    #videoBox,
    .video-box-movil-ready {
        width: min(100%, 350px) !important;
        max-width: 350px !important;
        min-height: 38vh !important;
        max-height: 54vh !important;
    }

    #previewVideo {
        max-height: 54vh !important;
        min-height: 180px !important;
    }

    #timeline {
        width: calc(100% - 16px) !important;
        max-width: calc(100% - 16px) !important;
        min-height: 138px !important;
    }

    #timelineItems {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        min-height: 96px !important;
    }

    .timeline-item,
    .timeline-carril-item,
    .segmento-video-item,
    .congelacion-timeline-item {
        min-width: 64px !important;
        font-size: 11px !important;
    }
}

/* =============================
   PC AJUSTADO
============================= */
@media (min-width: 900px) {
    #timeline {
        max-width: 760px !important;
    }

    #videoBox,
    .video-box-movil-ready {
        width: min(100%, 520px) !important;
        max-width: 520px !important;
    }
}

/* FIN FIX FINAL CSS LIMPIO PARA PC + MOVIL */

/* =========================================================
   27. FIX DEFINITIVO TIMELINE MOVIL DESPLAZABLE
   Debe quedar al final del CSS.
   Corrige:
   - timeline largo en celular
   - mover timeline a izquierda/derecha con dedo
   - playhead/línea roja visible
   - botón silencio clickeable
   - PC sigue cómodo
========================================================= */

/* El wrapper es quien hace el scroll horizontal */
.timeline-movil-wrapper {
    width: 100% !important;
    max-width: 1180px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin !important;
    touch-action: pan-x pan-y !important;
    padding-bottom: 36px !important;
}

/* Timeline largo para poder desplazarse */
#timeline {
    display: block !important;
    position: relative !important;
    width: 920px !important;
    min-width: 920px !important;
    max-width: none !important;
    min-height: 138px !important;
    height: auto !important;
    margin: 10px auto 8px auto !important;
    overflow: visible !important;
    background: #282828 !important;
    border: none !important;
    border-radius: 8px !important;
    touch-action: pan-x !important;
}

/* Los clips se calculan sobre el ancho largo */
#timelineItems {
    display: block !important;
    position: relative !important;
    left: 0 !important;
    right: auto !important;
    top: 28px !important;
    width: 920px !important;
    min-width: 920px !important;
    max-width: none !important;
    min-height: 96px !important;
    overflow: visible !important;
    padding-bottom: 14px !important;
}

/* En PC grande se ve más centrado y cómodo */
@media (min-width: 1000px) {
    #timeline {
        width: 760px !important;
        min-width: 760px !important;
    }

    #timelineItems {
        width: 760px !important;
        min-width: 760px !important;
    }
}

/* En celular queda largo para navegar el video completo */
@media (max-width: 700px) {
    #timeline {
        width: 920px !important;
        min-width: 920px !important;
        margin-left: 8px !important;
        margin-right: 8px !important;
    }

    #timelineItems {
        width: 920px !important;
        min-width: 920px !important;
    }
}

/* Línea roja / playhead */
#playhead {
    position: absolute !important;
    top: 26px !important;
    width: 4px !important;
    min-height: 96px !important;
    height: 96px !important;
    border-radius: 999px !important;
    background: red !important;
    background-color: red !important;
    box-shadow: 0 0 12px rgba(255,0,0,1) !important;
    z-index: 99999 !important;
    pointer-events: none !important;
    left: 0%;
}

/* Clips de texto, adhesivo, video dividido y congelación */
.timeline-item,
.timeline-carril-item,
.segmento-video-item,
.congelacion-timeline-item {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    box-sizing: border-box !important;
    z-index: 25 !important;
    touch-action: none !important;
}

.timeline-item.activo,
.timeline-carril-item.activo,
.segmento-video-item.activo {
    z-index: 999 !important;
}

/* Video principal en la timeline */
.timeline-video-base-editor {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 5 !important;
    touch-action: manipulation !important;
}

.timeline-video-base-editor.video-base-silenciado {
    opacity: 0.78 !important;
    filter: grayscale(0.35) !important;
}

/* Botón silencio funcional */
.btn-silencio-video-principal {
    pointer-events: auto !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    z-index: 999 !important;
    position: relative !important;
}

.btn-silencio-video-principal:active {
    transform: scale(0.92) !important;
}

/* El audio timeline sigue independiente */
#audioTimeline {
    overflow-x: auto !important;
    overflow-y: visible !important;
    touch-action: pan-x !important;
    -webkit-overflow-scrolling: touch !important;
}

/* FIN FIX DEFINITIVO TIMELINE MOVIL DESPLAZABLE */



/* =========================================================
   28. MEJORA VISUAL PANEL ACTIVO
========================================================= */

.paneles{
    background:#202020 !important;
    padding:10px 0 2px 0 !important;
}

.panel.activo{
    background:#242424 !important;
    border:1px solid rgba(255,255,255,.10) !important;
    border-radius:18px !important;
    box-shadow:
        0 8px 24px rgba(0,0,0,.28),
        inset 0 1px 0 rgba(255,255,255,.03) !important;

    min-height:124px !important;
    max-height:none !important;

    padding:14px 14px !important;
    gap:10px 12px !important;
}

.panel.activo h3{
    background:#1f1f1f !important;
    border:1px solid rgba(255,255,255,.08) !important;
    border-radius:14px !important;
    min-width:96px !important;
    height:46px !important;
    font-size:15px !important;
    font-weight:700 !important;
    box-shadow:0 3px 10px rgba(0,0,0,.18) !important;
}

.panel.activo input,
.panel.activo select,
.panel.activo textarea,
.panel.activo button{
    background:#2e2e2e !important;
    border:1px solid #4a4a4a !important;
    border-radius:12px !important;
    color:#fff !important;
    height:42px !important;
    min-height:42px !important;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.03),
        0 2px 8px rgba(0,0,0,.16) !important;
}

.panel.activo button:hover{
    background:#00aaff !important;
    border-color:#00aaff !important;
}

.panel.activo textarea{
    min-width:240px !important;
}

.herramientas,
.herramientas-movil{
    margin-top:10px !important;
}

@media (max-width:520px){

    .panel.activo{
        width:calc(100% - 12px) !important;
        padding:10px 10px !important;
        border-radius:16px !important;
        min-height:112px !important;
    }

    .panel.activo h3{
        min-width:86px !important;
        height:42px !important;
        font-size:14px !important;
    }

    .panel.activo input,
    .panel.activo select,
    .panel.activo textarea,
    .panel.activo button{
        height:40px !important;
        min-height:40px !important;
        font-size:12px !important;
    }
}

/* FIN MEJORA VISUAL PANEL ACTIVO */

/* =========================================================
   29. PANEL ACTIVO FULL WIDTH COMO MENU
   Debe quedar al final.
   Quita borde tipo cuadro cerrado y cubre todo horizontal.
========================================================= */

.paneles,
.paneles-debajo-video{
    width:100% !important;
    max-width:1180px !important;
    margin:0 auto !important;
    padding:0 !important;
    background:#202020 !important;
    box-sizing:border-box !important;
    overflow:visible !important;
}

/* Panel igual al menú inferior: barra completa horizontal */
.panel.activo{
    width:100% !important;
    max-width:100% !important;
    margin:0 auto !important;

    background:#242424 !important;
    border:none !important;
    border-top:1px solid rgba(255,255,255,0.06) !important;
    border-bottom:1px solid rgba(255,255,255,0.06) !important;
    border-left:none !important;
    border-right:none !important;

    border-radius:0 !important;
    box-shadow:none !important;

    padding:14px 28px 16px 28px !important;

    display:grid !important;
    grid-auto-flow:column !important;
    grid-template-rows:repeat(2, 46px) !important;
    grid-auto-columns:max-content !important;
    align-items:center !important;
    justify-content:start !important;
    gap:10px 12px !important;

    min-height:126px !important;
    max-height:126px !important;

    overflow-x:auto !important;
    overflow-y:hidden !important;
    -webkit-overflow-scrolling:touch !important;
    scrollbar-width:thin !important;
    scrollbar-color:rgba(255,255,255,.28) transparent !important;
    touch-action:pan-x pan-y !important;
}

/* Scroll visible como menú */
.panel.activo::-webkit-scrollbar{
    height:7px !important;
    display:block !important;
}
.panel.activo::-webkit-scrollbar-track{
    background:transparent !important;
}
.panel.activo::-webkit-scrollbar-thumb{
    background:rgba(255,255,255,.28) !important;
    border-radius:999px !important;
}

/* Título de función como tarjeta sin cerrar todo el panel */
.panel.activo h3{
    min-width:96px !important;
    height:46px !important;
    margin:0 !important;
    padding:0 14px !important;

    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;

    background:#303030 !important;
    border:1px solid rgba(255,255,255,.08) !important;
    border-radius:14px !important;

    color:#fff !important;
    font-size:15px !important;
    font-weight:800 !important;
    box-shadow:none !important;
}

/* Labels debajo/ordenados */
.panel.activo label{
    height:40px !important;
    line-height:40px !important;
    color:#ffffff !important;
    opacity:.95 !important;
    font-size:12px !important;
    font-weight:600 !important;
}

/* Inputs y botones limpios */
.panel.activo input,
.panel.activo select,
.panel.activo textarea,
.panel.activo button{
    height:42px !important;
    min-height:42px !important;
    margin:0 !important;

    background:#2e2e2e !important;
    border:1px solid #4a4a4a !important;
    border-radius:12px !important;

    color:#fff !important;
    font-size:13px !important;
    font-weight:600 !important;

    box-shadow:none !important;
}

.panel.activo button{
    background:#303030 !important;
}

.panel.activo button:hover,
.panel.activo button:active{
    background:#3a3a3a !important;
    border-color:#5a5a5a !important;
}

/* Separación limpia entre panel y menú */
.herramientas,
.herramientas-movil{
    margin-top:0 !important;
    border-top:none !important;
}

/* Celular/ventana pequeña */
@media (max-width:700px){
    .panel.activo{
        width:100% !important;
        max-width:100% !important;
        padding:10px 12px 14px 12px !important;
        grid-template-rows:repeat(2, 42px) !important;
        min-height:112px !important;
        max-height:112px !important;
        gap:8px 10px !important;
    }

    .panel.activo h3{
        min-width:86px !important;
        height:42px !important;
        font-size:14px !important;
    }

    .panel.activo input,
    .panel.activo select,
    .panel.activo textarea,
    .panel.activo button{
        height:40px !important;
        min-height:40px !important;
        font-size:12px !important;
    }
}

/* FIN PANEL ACTIVO FULL WIDTH COMO MENU */




/* =========================================================
   FIX VIDEO LIMPIO EDITOR
   Oculta iconos/play overlays nativos móvil/PC
========================================================= */

#previewVideo{
    outline:none !important;
    background:#000 !important;
    object-fit:contain !important;
}

/* Chrome / Android / Edge */
#previewVideo::-webkit-media-controls{
    display:none !important;
    opacity:0 !important;
    visibility:hidden !important;
}

#previewVideo::-webkit-media-controls-overlay-play-button{
    display:none !important;
    opacity:0 !important;
    visibility:hidden !important;
    -webkit-appearance:none !important;
}

#previewVideo::-webkit-media-controls-start-playback-button{
    display:none !important;
    opacity:0 !important;
    visibility:hidden !important;
    -webkit-appearance:none !important;
}

/* Safari iPhone */
#previewVideo::-webkit-media-controls-panel{
    display:none !important;
    opacity:0 !important;
}

/* Firefox */
#previewVideo::-moz-media-controls{
    display:none !important;
}

/* Evita selección azul */
#previewVideo{
    -webkit-tap-highlight-color: transparent !important;
    user-select:none !important;
    -webkit-user-select:none !important;
}



/* =========================================================
   PLAYHEAD PROFESIONAL EN TIMELINE DE AUDIO
   Línea roja + mute + manilla inferior igual al timeline principal
========================================================= */

#audioTimeline,
#audioTimelineItems {
    overflow: visible !important;
}

.audio-playhead-editor {
    position: absolute !important;
    top: 26px !important;
    bottom: 8px !important;
    width: 4px !important;
    min-height: 150px !important;
    transform: translateX(-50%) !important;
    background: #ff001f !important;
    border-radius: 999px !important;
    box-shadow:
        0 0 12px rgba(255, 0, 31, 1),
        0 0 26px rgba(255, 0, 31, 0.75) !important;
    z-index: 100000 !important;
    pointer-events: auto !important;
    cursor: ew-resize !important;
    touch-action: none !important;
}

.btn-mute-audio-playhead-editor,
.btn-mover-audio-playhead-editor {
    position: absolute !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: auto !important;
    touch-action: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    z-index: 100001 !important;
}

.btn-mute-audio-playhead-editor {
    top: 6px !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    border: 2px solid rgba(255,255,255,0.95) !important;
    background: #00c853 !important;
    color: #fff !important;
    font-size: 20px !important;
    line-height: 1 !important;
    box-shadow:
        0 0 12px rgba(0, 200, 83, 0.95),
        0 0 24px rgba(0, 200, 83, 0.55) !important;
    cursor: pointer !important;
}

.btn-mute-audio-playhead-editor.activo {
    background: #ff5252 !important;
    box-shadow:
        0 0 12px rgba(255, 82, 82, 0.95),
        0 0 24px rgba(255, 82, 82, 0.55) !important;
}

.btn-mover-audio-playhead-editor {
    bottom: -16px !important;
    width: 46px !important;
    height: 34px !important;
    min-width: 46px !important;
    padding: 0 !important;
    border-radius: 18px !important;
    border: 2px solid rgba(255,255,255,0.95) !important;
    background: #ff1744 !important;
    color: #fff !important;
    font-size: 18px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    box-shadow:
        0 0 14px rgba(255, 23, 68, 1),
        0 0 30px rgba(255, 23, 68, 0.65) !important;
    cursor: ew-resize !important;
}

#audioTimeline .audio-timeline-item {
    z-index: 100 !important;
}

#audioTimeline .audio-timeline-item.activo,
#audioTimeline .audio-timeline-item.arrastrando {
    z-index: 1000 !important;
}

@media (max-width: 520px) {
    .audio-playhead-editor {
        top: 24px !important;
        bottom: 6px !important;
        width: 5px !important;
    }

    .btn-mute-audio-playhead-editor {
        top: 2px !important;
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        font-size: 21px !important;
    }

    .btn-mover-audio-playhead-editor {
        bottom: -18px !important;
        width: 50px !important;
        height: 36px !important;
        min-width: 50px !important;
        font-size: 19px !important;
    }

    #audioTimeline {
        padding-bottom: 22px !important;
    }
}

/* FIN PLAYHEAD AUDIO */

/* =========================================================
   30. HEADER SUPERIOR ATRÁS - EDITOR VIDEO
========================================================= */

.editor-header-atras-app {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    background: #202020 !important;
    display: block !important;
    position: relative !important;
    z-index: 99998 !important;
}

.editor-header-atras-link {
    display: block !important;
    width: 100% !important;
    height: 126px !important;
    max-width: none !important;
    margin: 0 !important;
    border: 0 !important;
    outline: none !important;
    text-decoration: none !important;
    border-radius: 0 !important;
    background-image: url('../img_editor_video/header_1.png') !important;
    background-repeat: no-repeat !important;
    background-position: center center !important;
    background-size: 100% 100% !important;
    background-color: #202020 !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    transition:
        transform 0.10s ease,
        filter 0.10s ease,
        background-image 0.05s ease !important;
}

.editor-header-atras-link:hover,
.editor-header-atras-link:active,
.editor-header-atras-link.activo {
    background-image: url('../img_editor_video/header_2.png') !important;
    filter: brightness(1.12) saturate(1.12) !important;
}

.editor-header-atras-link:active,
.editor-header-atras-link.activo {
    transform: scale(0.995) !important;
}

.editor-header-atras-texto {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
}

@media (min-width: 1000px) {
    .editor-header-atras-link {
        height: 138px !important;
    }
}

@media (max-width: 700px) {
    .editor-header-atras-link {
        height: 92px !important;
        background-size: 100% 100% !important;
    }
}

@media (max-width: 420px) {
    .editor-header-atras-link {
        height: 76px !important;
    }
}

/* FIN HEADER SUPERIOR ATRÁS */

/* =========================================================
   31. FIX PROFESIONAL SCROLL PANEL VS OVERLAYS
   El scroll horizontal de paneles no debe mover/redimensionar
   texto ni adhesivos del preview.
========================================================= */
.paneles,
.panel.activo,
.herramientas,
.herramientas-movil {
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
}

.panel.activo,
.herramientas,
.herramientas-movil {
    touch-action: pan-x pan-y !important;
}

.panel.activo input,
.panel.activo textarea,
.panel.activo select,
.panel.activo button,
.panel.activo label {
    touch-action: manipulation !important;
}

#textoOverlay,
#adhesivoOverlay,
#resizeHandle,
#resizeHandleAdhesivo,
.rotate-handle-editor {
    touch-action: none !important;
    -ms-touch-action: none !important;
}

/* FIN FIX PROFESIONAL SCROLL PANEL VS OVERLAYS */
