/* Eliminar el recuadro azul de toque nativo de móviles */
        * { -webkit-tap-highlight-color: transparent; outline: none !important; }

        body { margin: 0; padding: 0; background-color: #2c2c2c; overflow: hidden; touch-action: none; font-family: sans-serif; transition: background-color 0.3s; }
        canvas { background-color: #2c2c2c; background-image: radial-gradient(#4a4a4a 1px, transparent 1px); background-size: 20px 20px; display: block; }
        
        /* Botones Globales */
        button { background: #444; color: #fff; border: 2px solid transparent; padding: 8px 12px; border-radius: 8px; font-size: 13px; cursor: pointer; font-weight: bold; transition: all 0.2s; touch-action: manipulation; display: flex; align-items: center; justify-content: center; gap: 4px; }
        button:active { transform: scale(0.95); }
        button:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }
        button.active { background: #007BFF; border: 2px solid #66b0ff; box-shadow: 0 0 10px rgba(0, 123, 255, 0.5); }

        /* Barra Inferior Secundaria (Atajos a la derecha) */
        .bottom-bar { position: absolute; bottom: 105px; right: 15px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; background: rgba(30, 30, 30, 0.85); padding: 10px 16px; border-radius: 20px; box-shadow: 0 8px 24px rgba(0,0,0,0.7); backdrop-filter: blur(8px); align-items: center; width: max-content; max-width: 98vw; z-index: 30; transition: opacity 0.3s, visibility 0.3s; }
        .divider { width: 2px; height: 25px; background: #555; margin: 0 4px; }
        
        /* Línea de tiempo (Strip con Scroll Arriba) */
        .timeline-strip { position: absolute; bottom: 15px; left: 50%; transform: translateX(-50%) rotateX(180deg); width: 95vw; background: rgba(20, 20, 20, 0.9); border-radius: 8px; padding: 10px 50% 30px 50%; display: flex; gap: 6px; overflow-x: auto; box-shadow: 0 8px 24px rgba(0,0,0,0.8); backdrop-filter: blur(8px); z-index: 10; scroll-behavior: smooth; border: 1px solid #444; box-sizing: border-box; }
        .timeline-strip::-webkit-scrollbar { height: 12px; }
        .timeline-strip::-webkit-scrollbar-thumb { background: #666; border-radius: 6px; }
        .kf-block { display: flex; gap: 2px; background: #333; padding: 4px; border-radius: 6px; border: 2px solid #555; align-items: center; margin-top: 5px; transform: rotateX(180deg); }
        .kf-block.active-block { border-color: #00ffcc; background: #223a54; box-shadow: 0 0 8px #00ffcc; }
        .kf-block.has-content { background: rgba(0, 123, 255, 0.25); border-color: #007BFF; }
        .exposure-cell { position: relative; width: 20px; height: 30px; background: #111; border-radius: 3px; border: 1px dashed #444; transition: all 0.1s; cursor: pointer; }
        .exposure-cell.is-key { background: #555; border: 1px solid #777; }
        .exposure-cell.has-content-cell { background: #1e4b6d; }
        .exposure-cell.active-frame { background: #00ffcc; border: 1px solid #fff; box-shadow: 0 0 8px #00ffcc; }

        /* Regla de tiempo (Ticks) */
        .tick-marker { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); width: 2px; height: 8px; background: #666; pointer-events: none; }
        .tick-marker.sec { top: -18px; height: 14px; background: #aaa; }
        .sec-label { position: absolute; top: -32px; left: 50%; transform: translateX(-50%); color: #ccc; font-size: 11px; font-family: monospace; font-weight: bold; pointer-events: none; }

        /* Aguja Central Timeline */
        .timeline-needle { position: absolute; bottom: 15px; left: 50%; transform: translateX(-50%); width: 3px; height: 75px; background: #ff3366; z-index: 15; pointer-events: none; box-shadow: 0 0 5px rgba(255, 51, 102, 0.8); border-radius: 2px; }

        /* Panel Central de Transporte (Play, Prev, Next) */
        .transport-panel { position: absolute; bottom: 115px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; z-index: 20; transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
        
        .transport-btn { width: 46px; height: 46px; border-radius: 50%; background: #333; color: white; border: 2px solid #555; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 15px rgba(0,0,0,0.5); transition: opacity 0.3s, visibility 0.3s, transform 0.2s; padding: 0;}
        .transport-btn:active { transform: scale(0.9); }
        .transport-btn:hover { background: #444; border-color: #777; }

        .play-fab { width: 64px; height: 64px; border-radius: 50%; background: #007BFF; border: none; box-shadow: 0 6px 20px rgba(0, 123, 255, 0.5); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s ease; padding: 0; }
        .play-fab:active { transform: scale(0.9); }
        .play-fab:hover { background: #1a8bff; box-shadow: 0 8px 25px rgba(0, 123, 255, 0.6); }
        .play-fab.active { background: #ff3366; box-shadow: 0 6px 20px rgba(255, 51, 102, 0.5); }
        .play-fab svg { width: 32px; height: 32px; fill: white; }

        /* Controles Superpuestos a la Izquierda (NUEVA BARRA COMPLETA FPS + DUR) */
        .fps-floating { position: absolute; bottom: 105px; left: 15px; z-index: 20; transition: opacity 0.3s, visibility 0.3s; display: flex; align-items: center; gap: 8px; background: rgba(30, 30, 30, 0.85); padding: 8px 12px; border-radius: 16px; box-shadow: 0 8px 24px rgba(0,0,0,0.7); backdrop-filter: blur(8px); border: 1px solid #444; }
        .fps-floating .fps-select { width: 45px; height: 28px; background: #222; color: #fff; border: 1px solid #555; border-radius: 6px; padding: 0; font-family: monospace; font-size: 14px; font-weight: bold; cursor: text; outline: none; text-align: center; }
        .fps-floating .fps-select:focus { border-color: #007BFF; }

        #floatingStatus { position: absolute; bottom: 160px; left: 15px; background: rgba(17, 17, 17, 0.9); padding: 8px 16px; border-radius: 12px; font-family: monospace; font-size: 16px; color: #00ffcc; font-weight: bold; border: 1px solid #444; box-shadow: 0 4px 12px rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 20; transition: opacity 0.3s, visibility 0.3s; pointer-events: none; }

        /* Controles Esquina Inferior Derecha (Flip, Grid y Ojo) */
        .bottom-right-controls { position: absolute; bottom: 20px; right: 15px; display: flex; gap: 10px; z-index: 20; transition: opacity 0.3s, visibility 0.3s; }
        .bottom-right-controls button { width: 45px; height: 45px; border-radius: 50%; font-size: 20px; padding: 0; background: rgba(30, 30, 30, 0.85); box-shadow: 0 4px 12px rgba(0,0,0,0.6); backdrop-filter: blur(4px); border: 1px solid #555; }
        .bottom-right-controls button.active { background: #007BFF; border-color: #66b0ff; color: white; }
        .bottom-right-controls button#btnToggleInterp.active { background: #ff3366; border-color: #ff6688; } /* Color especial pal ojo */

        /* Dimensiones del Lienzo (Esquina Inferior Izquierda) */
        #canvasDimensions { position: absolute; bottom: 20px; left: 15px; background: rgba(17, 17, 17, 0.9); padding: 6px 12px; border-radius: 12px; font-family: monospace; font-size: 14px; color: #888; border: 1px solid #444; box-shadow: 0 4px 12px rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 20; pointer-events: none; transition: opacity 0.3s, visibility 0.3s; }

        /* Barra Lateral Izquierda (Herramientas) */
        .sidebar-left { position: absolute; left: 10px; top: 30%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 10px; background: rgba(30, 30, 30, 0.85); padding: 10px; border-radius: 15px; box-shadow: 0 8px 24px rgba(0,0,0,0.7); backdrop-filter: blur(8px); z-index: 10; transition: opacity 0.3s; }
        .sidebar-left .drag-handle-vertical { width: 100%; height: 20px; font-size: 14px; margin-bottom: 5px; cursor: grab; display: flex; justify-content: center; align-items: center; color: #888; touch-action: none; }
        .sidebar-left .drag-handle-vertical:active { cursor: grabbing; }
        .sidebar-left button { width: 50px; height: 50px; border-radius: 12px; font-size: 20px; padding: 0; }
        
        /* Menús Flotantes de Herramientas */
        .tool-settings { position: absolute; left: 75px; top: 30%; transform: translateY(-50%); background: rgba(40, 40, 40, 0.95); padding: 15px; border-radius: 12px; border: 1px solid #555; box-shadow: 0 5px 15px rgba(0,0,0,0.8); display: flex; flex-direction: column; gap: 15px; z-index: 9; transition: opacity 0.2s, visibility 0.2s; }
        .tool-settings.hidden { opacity: 0; pointer-events: none; visibility: hidden; }
        .tool-settings h4 { margin: 0; color: white; font-size: 14px; text-align: center; border-bottom: 1px solid #666; padding-bottom: 5px; }
        
        /* Sliders anchos tipo Volumen iOS/Android */
        .volume-slider {
            -webkit-appearance: none; width: 100%; height: 32px; background: #111;
            border-radius: 16px; outline: none; border: 1px solid #444; overflow: hidden; cursor: ew-resize; margin: 0;
        }
        .volume-slider::-webkit-slider-runnable-track { width: 100%; height: 32px; background: transparent; }
        .volume-slider::-webkit-slider-thumb {
            -webkit-appearance: none; width: 16px; height: 32px; background: #fff; border-radius: 8px;
            box-shadow: -100vw 0 0 100vw #007BFF;
        }

        .range-control { display: flex; align-items: center; gap: 8px; background: none; padding: 0; border-radius: 8px; }
        .range-control button { width: 28px; height: 28px; padding: 0; font-size: 18px; background: #555; border-radius: 6px; }
        .range-control span { color: white; min-width: 45px; text-align: center; font-size: 12px; font-family: monospace; background: #333; padding: 6px; border-radius: 8px; }
        
        input[type="color"] { -webkit-appearance: none; border: 2px solid #555; width: 40px; height: 40px; border-radius: 6px; cursor: pointer; padding: 0; background: none; }
        input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
        input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }

        /* Ocultar flechitas nativas de los inputs numéricos */
        input[type=number]::-webkit-inner-spin-button, 
        input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
        input[type=number] { -moz-appearance: textfield; }

        /* Barras Flotantes Arrastrables (Undo, Selection, Interpolation) */
        .floating-bar { position: absolute; display: flex; gap: 8px; background: rgba(30, 30, 30, 0.95); padding: 8px 12px; border-radius: 25px; border: 1px solid #666; box-shadow: 0 8px 20px rgba(0,0,0,0.8); z-index: 20; align-items: center; transition: opacity 0.3s; }
        .drag-handle { width: 25px; height: 30px; cursor: grab; background: transparent; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #aaa; font-size: 18px; touch-action: none; }
        .drag-handle:active { cursor: grabbing; }

        .action-fab { height: 38px; border-radius: 19px; padding: 0 14px; background: #2a2a2a; color: white; border: 1px solid #444; font-size: 13px; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; box-shadow: 0 4px 10px rgba(0,0,0,0.5); transition: all 0.2s; }
        .action-fab:active { transform: scale(0.95); }
        .action-fab:hover:not(:disabled) { background: #3a3a3a; border-color: #666; box-shadow: 0 6px 14px rgba(0,0,0,0.7); }
        .action-fab:disabled { opacity: 0.3; cursor: not-allowed; box-shadow: none; border-color: #333; }

        #selectionBar button:not(.drag-handle), #interpolateBar button:not(.drag-handle):not(#btnIntReset) { width: 40px; height: 40px; border-radius: 10px; padding: 0; font-size: 18px; }
        #selectionBar, #interpolateBar { display: none; top: 80px; left: 50%; transform: translateX(-50%); } 
        .btn-confirm { background: #28a745 !important; border-color: #28a745 !important; }
        .btn-cancel { background: #dc3545 !important; border-color: #dc3545 !important; }

        /* Configuración Top Right */
        .top-right-controls { position: absolute; top: 15px; right: 15px; display: flex; gap: 10px; z-index: 10; transition: opacity 0.3s; }
        .top-right-controls button { width: 45px; height: 45px; border-radius: 50%; font-size: 20px; padding: 0; }

        /* Menú Desplegable (Dropdown) con Z-Index muy alto */
        .dropdown { position: relative; display: inline-block; }
        .dropdown-content { display: none; position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%); background-color: #333; min-width: 140px; box-shadow: 0px 8px 24px rgba(0,0,0,0.9); border-radius: 10px; border: 1px solid #666; z-index: 99; flex-direction: column; padding: 8px; gap: 6px; }
        .dropdown-content.show { display: flex; }
        .dropdown-content button { width: 100%; text-align: left; justify-content: flex-start; padding: 10px 12px; }

        /* Switch UI */
        .switch-container { display: flex; align-items: center; gap: 8px; color: white; font-size: 13px; font-weight: bold; background: #444; padding: 6px 10px; border-radius: 8px; cursor: pointer;}
        .switch { position: relative; display: inline-block; width: 34px; height: 20px; }
        .switch input { opacity: 0; width: 0; height: 0; }
        .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #222; transition: .4s; border-radius: 20px; border: 1px solid #555; }
        .slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 2px; bottom: 2px; background-color: white; transition: .4s; border-radius: 50%; }
        input:checked + .slider { background-color: #007BFF; }
        input:checked + .slider:before { transform: translateX(14px); }

        /* Modals */
        .modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 1000; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
        .modal-content { background: #222; width: 450px; max-width: 90%; border-radius: 12px; padding: 20px; color: white; box-shadow: 0 10px 40px rgba(0,0,0,0.9); border: 1px solid #444; }
        .modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #444; padding-bottom: 10px; margin-bottom: 15px; }
        .modal-header h3 { margin: 0; font-size: 18px; }
        .close-btn { background: none; border: none; color: white; font-size: 24px; cursor: pointer; transition: color 0.2s; }
        .close-btn:hover { color: #ff5555; }
        .setting-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; cursor: pointer; }
        .setting-desc { color: #aaa; font-size: 12px; display: block; margin-top: 4px; }

        /* MODO TEATRO (Oculta todo en reproducción) */
        body.is-playing #canvasDimensions,
        body.is-playing .sidebar-left,
        body.is-playing #undoBar,
        body.is-playing #selectionBar,
        body.is-playing #interpolateBar,
        body.is-playing .tool-settings,
        body.is-playing .top-right-controls,
        body.is-playing #btnPrev,
        body.is-playing #btnNext {
            opacity: 0 !important;
            pointer-events: none !important;
            visibility: hidden;
        }


/* ========================================================= */
/* --- NUEVO: RESPONSIVIDAD Y OPTIMIZACIÓN MULTIPANTALLA --- */
/* ========================================================= */
/* ========================================================= */
/* --- OPTIMIZACIÓN DE INTERFAZ: ESCALADO Y SELECCIÓN --- */
/* ========================================================= */

/* 1. Bloquear la selección de texto fea en toda la app */
body {
    -webkit-user-select: none; /* Safari / Chrome */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* IE/Edge */
    user-select: none;         /* Estándar */
}

/* Permitir selección de texto SOLO en los inputs y en el título del proyecto */
input, .project-title, .fps-select {
    -webkit-user-select: auto;
    -moz-user-select: auto;
    -ms-user-select: auto;
    user-select: auto;
}

/* 2. Escalar la interfaz en pantallas medianas (Tablets) */
@media (max-width: 900px), (max-height: 700px) {
    .sidebar-left { transform: translateY(-50%) scale(0.85); transform-origin: left center; left: 5px; }
    .transport-panel { transform: translateX(-50%) scale(0.85); transform-origin: center bottom; bottom: 105px; }
    .fps-floating { transform: scale(0.85); transform-origin: left bottom; left: 10px; bottom: 95px; }
    .bottom-bar { transform: scale(0.85); transform-origin: right bottom; right: 10px; bottom: 95px; }
    .bottom-right-controls { transform: scale(0.85); transform-origin: right bottom; bottom: 15px; }
    .top-right-controls { transform: scale(0.85); transform-origin: right top; top: 40px !important; }
    .tool-settings, .selectSettingsMenu { transform: translateY(-50%) scale(0.85); transform-origin: left center; left: 65px; }
}

/* 3. Escalar la interfaz en pantallas pequeñas (Móviles) */
@media (max-width: 600px), (max-height: 500px) {
    .sidebar-left { transform: translateY(-50%) scale(0.7); }
    .transport-panel { transform: translateX(-50%) scale(0.7); bottom: 95px; }
    .fps-floating { transform: scale(0.7); bottom: 85px; }
    .bottom-bar { transform: scale(0.7); bottom: 85px; }
    .bottom-right-controls { transform: scale(0.7); }
    .top-right-controls { transform: scale(0.7); top: 35px !important; }
    .tool-settings, .selectSettingsMenu { transform: translateY(-50%) scale(0.7); left: 55px; }
    
    /* Achicamos un poco la barra superior y la línea de tiempo */
    .top-menubar { font-size: 11px; height: 30px; }
    .timeline-strip { padding: 8px 50% 25px 50%; bottom: 10px; }
    .timeline-needle { height: 65px; bottom: 10px; }
}











/* ========================================================= */
/* --- PANEL DE CAPAS AVANZADO (DISEÑO, NÚMEROS Y ARRASTRE)  */
/* ========================================================= */

/* Contenedor principal flotante a la derecha */
.layers-panel-wrapper { 
    position: absolute; 
    right: 15px; 
    top: 110px; 
    bottom: 180px; 
    display: flex; 
    flex-direction: column; 
    align-items: flex-end; 
    z-index: 25; 
    pointer-events: none; 
}

/* Botón superior para Expandir/Contraer */
.layers-toggle-btn { 
    background: rgba(40, 40, 40, 0.95); 
    border: 1px solid #555; 
    border-radius: 8px; 
    width: 44px; 
    height: 44px; 
    color: white; 
    cursor: pointer; 
    pointer-events: auto; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.6); 
    margin-bottom: 8px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: all 0.2s; 
    flex-shrink: 0; 
}
.layers-toggle-btn:hover { background: #555; } 
.layers-toggle-btn.active { background: #007BFF; border-color: #66b0ff; box-shadow: 0 0 10px rgba(0, 123, 255, 0.5); }

/* El cuerpo del panel (Ahora más ancho: 320px) */
.layers-panel { 
    width: 320px; 
    background: rgba(30, 30, 30, 0.95); 
    border: 1px solid #444; 
    border-radius: 12px; 
    display: flex; 
    flex-direction: column; 
    box-shadow: 0 8px 24px rgba(0,0,0,0.8); 
    backdrop-filter: blur(8px); 
    pointer-events: auto; 
    overflow: hidden; 
    height: 100%; 
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s; 
    position: relative; 
}
.layers-panel.collapsed { width: 0px; opacity: 0; border: none; pointer-events: none; }

/* Cabecera del Panel */
.layers-header { 
    background: #222; 
    padding: 10px 15px; 
    border-bottom: 1px solid #555; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-shrink: 0; 
}
.layers-header h3 { margin: 0; color: white; font-size: 14px; font-weight: bold; letter-spacing: 1px;}
.layers-actions { display: flex; gap: 6px; }
.layers-actions button { 
    background: transparent; border: 1px solid #555; padding: 4px 8px; border-radius: 6px; 
    color: #ccc; cursor: pointer; transition: all 0.2s; box-shadow: none; width: auto; height: auto; 
}
.layers-actions button:hover { background: #444; color: white; border-color: #777;}

/* Lista deslizable de Capas */
.layers-list { 
    flex-grow: 1; overflow-y: auto; overflow-x: hidden; padding: 8px; display: flex; flex-direction: column; position: relative; 
}
/* Barra de scroll customizada */
.layers-list::-webkit-scrollbar { width: 8px; } 
.layers-list::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); border-radius: 4px; margin: 4px 0; } 
.layers-list::-webkit-scrollbar-thumb { background: #555; border-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.2); } 
.layers-list::-webkit-scrollbar-thumb:hover { background: #007BFF; }

/* Contenedores de Nodos (Crucial para jerarquía) */
.layer-node { display: flex; flex-direction: column; width: 100%; }

/* Estilo de la Fila (Cada capa/carpeta) */
.layer-row { 
    display: flex; align-items: center; background: #333; padding: 6px 8px 6px 4px; 
    border-radius: 8px; border: 1px solid transparent; transition: background 0.2s, border-color 0.2s; 
    position: relative; flex-shrink: 0; margin-bottom: 4px; 
}
.layer-row:hover { background: #3a3a3a; }
.layer-row.active-layer { background: #1e4b6d; border-color: #007BFF; box-shadow: inset 0 0 10px rgba(0,123,255,0.2); }
.layer-row.is-folder { background: #2a2a2a; border-left: 3px solid #ffca28; }

/* ESTADO: Capa apagada (Negro) */
.layer-row.is-disabled { background: #111 !important; border-color: #222 !important; color: #666; opacity: 0.7; }
.layer-row.is-disabled .layer-icon { filter: grayscale(1) brightness(0.5); }
.layer-row.is-disabled .layer-name { color: #777; }

/* NUEVO: Números de las capas (1, 1.1, 2) */
.layer-number { 
    font-size: 11px; color: #888; font-family: monospace; font-weight: bold;
    min-width: 20px; text-align: right; margin-right: 8px; user-select: none; 
}

/* Nombre de la capa y estado de edición */
.layer-name { 
    flex-grow: 1; color: #eee; font-size: 14px; white-space: nowrap; overflow: hidden; 
    text-overflow: ellipsis; cursor: pointer; user-select: none; 
}
.layer-name.editing { 
    background: #000; color: #00ffcc; outline: 1px solid #007BFF; cursor: text; 
    user-select: text; -webkit-user-select: text; padding: 2px 4px; border-radius: 4px; 
    box-shadow: inset 0 0 5px rgba(0,123,255,0.5); 
}

/* Interior de la Carpeta (Hijos) */
.folder-content { 
    display: flex; flex-direction: column; padding-left: 15px; margin-top: -2px; 
    margin-bottom: 2px; border-left: 2px dashed #555; margin-left: 12px; flex-shrink: 0; 
}
.folder-content.collapsed { display: none; }

/* Iconos y Botones internos */
.layer-drag-handle { color: #666; cursor: grab; padding: 0 4px; display: flex; align-items: center; touch-action: none; }
.layer-drag-handle:active { cursor: grabbing; color: #fff; }
.layer-chevron { background: none; border: none; color: #aaa; padding: 0; margin-right: 4px; cursor: pointer; box-shadow: none; width: auto; height: auto; }
.layer-chevron:hover { color: #fff; } 
.layer-chevron.closed svg { transform: rotate(-90deg); transition: transform 0.2s; }
.layer-icon { display: flex; align-items: center; margin-right: 4px; }

.layer-btn-icon { 
    background: none; border: none; color: #888; padding: 4px; margin-left: 2px; cursor: pointer; 
    box-shadow: none; width: auto; height: auto; border-radius: 4px; display: flex; 
    align-items: center; justify-content: center; transition: color 0.2s, background 0.2s; 
}
.layer-btn-icon:hover { color: #fff; background: rgba(255,255,255,0.1); }
.layer-btn-icon.is-hidden { color: #555; }

/* ---------------------------------------------------- */
/* MAGIA DE DRAG AND DROP (FANTASMA Y LÍNEA AZUL)       */
/* ---------------------------------------------------- */

/* El Fantasma flotante que sigue al dedo */
.ghost-layer { 
    position: fixed; pointer-events: none; z-index: 9999; opacity: 0.85; 
    transform: scale(1.02) rotate(2deg); box-shadow: 0 15px 30px rgba(0,0,0,0.6); 
    border: 1px solid #007BFF; border-radius: 8px; background: rgba(40,40,40,0.9); 
}

/* El Hueco en blanco donde estaba la capa */
.layer-placeholder { opacity: 0 !important; pointer-events: none !important; }

/* La Línea Neón Azul */
.drag-drop-line { 
    position: fixed; height: 3px; background: #00ffcc; pointer-events: none; 
    z-index: 10000; box-shadow: 0 0 10px #00ffcc; 
    transition: top 0.1s ease-out, left 0.1s ease-out, width 0.1s ease-out; border-radius: 2px; 
}
.drag-drop-line::before { 
    content: ''; position: absolute; left: -4px; top: -3px; width: 9px; height: 9px; 
    background: #00ffcc; border-radius: 50%; box-shadow: 0 0 8px #00ffcc; 
}

/* Brillo en carpeta (por si arrastras desde la orilla) */
.drop-target-folder { border-color: #ffca28 !important; background: rgba(255, 202, 40, 0.15) !important; box-shadow: 0 0 12px rgba(255, 202, 40, 0.4); }
.drop-target-out { border-bottom: 2px solid #ff3366 !important; }

/* Ocultar en modo Play */
body.is-playing .layers-panel-wrapper { display: none !important; }

/* Ajuste Responsivo para Tablets/Móviles */
@media (max-width: 900px), (max-height: 700px) { 
    .layers-panel-wrapper { top: 75px; right: 5px; transform: scale(0.85); transform-origin: top right; } 
}
@media (max-width: 600px), (max-height: 500px) { 
    .layers-panel-wrapper { top: 65px; transform: scale(0.75); } 
}