	:root {
        --bg: #0f172a;
        --card: #ffffff;
        --muted: #6b7280;
        --text: #0b1220;
        --primary: #6a11cb;
        --primary2: #2575fc;
        --ok: #16a34a;
        --warn: #f59e0b;
        --bad: #ef4444;
        --shadow: 0 10px 25px rgba(0,0,0,0.12);
        --radius: 18px;
    }
    
    * { box-sizing: border-box; }
    
    body {
        margin: 0;
        font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Helvetica Neue", sans-serif;
        background: radial-gradient(1200px 900px at 15% 10%, rgba(106,17,203,0.24), transparent 60%),
                    radial-gradient(1200px 900px at 85% 10%, rgba(37,117,252,0.22), transparent 60%),
                    #f6f8ff;
        color: var(--text);
    }
    
    .container {
        max-width: 1400px;
        margin: 0 auto;
        padding: 0 20px 40px;
    }
    
    .tool-container {
        background: rgba(255,255,255,0.85);
        border: 1px solid rgba(0,0,0,0.06);
        border-radius: 22px;
        box-shadow: var(--shadow);
        overflow: hidden;
        margin-top: 30px;
    }
    
    .tool-inner {
        padding: 22px;
        position: relative;
    }
    
    /* Header */
    header.header {
        text-align: center;
        margin-bottom: 30px;
        padding: 30px;
        background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
        color: white;
        border-radius: 0 0 25px 25px;
        box-shadow: var(--shadow);
        transition: all 0.65s ease;
        overflow: hidden;
        max-height: 500px;
        will-change: transform, max-height, padding, margin, opacity;
    }
    
    header.header.collapsed {
        transform: translateY(-100%);
        opacity: 0;
        max-height: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
        pointer-events: none;
    }
    
    header.header h1 {
        margin: 0;
        font-size: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }
    
    header.header .tagline {
        margin: 10px 0 0;
        font-size: 1.2em;
        opacity: 0.9;
    }
    
    /* Auto-process */
    .auto-process {
        position: absolute;
        top: 10px;
        right: 10px;
        z-index: 50;
    }
    
    .auto-toggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 8px 10px;
        border-radius: 999px;
        border: 1px solid rgba(0,0,0,0.10);
        background: rgba(255,255,255,0.92);
        box-shadow: 0 8px 18px rgba(0,0,0,0.08);
        font-weight: 1000;
        cursor: pointer;
        font-size: 12px;
        transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
    }
    
    .auto-toggle:hover {
        transform: translateY(-1px);
    }
    
    .auto-toggle .auto-state {
        padding: 5px 9px;
        border-radius: 999px;
        border: 1px solid rgba(0,0,0,0.12);
        background: rgba(0,0,0,0.04);
        font-weight: 1100;
    }
    
    .auto-toggle.on {
        color: #fff;
        border: none;
        background: linear-gradient(135deg, var(--primary), var(--primary2));
        box-shadow: 0 12px 26px rgba(106, 17, 203, 0.25);
    }
    
    .auto-toggle.on .auto-state {
        background: rgba(255,255,255,0.18);
        border-color: rgba(255,255,255,0.35);
        color: #fff;
    }
    
    /* Upload boxes */
    .upload-section {
        margin-top: 18px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    
    .upload-box {
        position: relative;
        background: #fff;
        border: 2px dashed rgba(106,17,203,0.35);
        border-radius: 18px;
        padding: 26px 18px;
        text-align: center;
        box-shadow: var(--shadow);
        transition: all .25s ease;
        min-height: 250px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }
    
    .upload-box:hover {
        border-color: var(--primary);
        background: #f0f4ff;
    }
    
    .upload-box.dragover {
        border-color: var(--primary);
        background: #e3f2fd;
    }
    
    .upload-content {
        position: relative;
        z-index: 2;
        pointer-events: none;
        text-shadow: 0 2px 4px rgba(255,255,255,0.8);
        background: rgba(255,255,255,0.7);
        padding: 15px;
        border-radius: 12px;
        backdrop-filter: blur(2px);
    }
    
    .upload-preview {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        opacity: 0.3;
        z-index: 1;
    }
    
    .upload-icon {
        font-size: 40px;
        color: rgba(106,17,203,0.9);
        display: flex;
        justify-content: center;
        gap: 10px;
    }
    
    .upload-box h3 {
        margin: 10px 0 6px;
        font-size: 20px;
    }
    
    .upload-box p {
        margin: 6px 0;
        color: var(--muted);
    }
    
    .upload-box input[type=file] {
        position: absolute;
        inset: 0;
        opacity: 0;
        cursor: pointer;
        z-index: 3;
    }
    
    .file-info {
        margin-top: 10px;
        font-size: 12px;
        color: var(--muted);
        display: flex;
        gap: 8px;
        justify-content: center;
        align-items: center;
    }
    
    kbd {
        padding: 2px 6px;
        border-radius: 6px;
        background: #111827;
        color: #fff;
        font-weight: 900;
        font-size: 12px;
    }
    
    .paste-hint {
        font-size: 14px;
        margin-top: 10px;
    }
    
    /* Panel principal */
    .main-panel {
        display: grid;
        grid-template-columns: 350px 1fr;
        gap: 20px;
        margin-top: 20px;
    }
    
    /* Controles */
    .control-panel {
        background: white;
        border-radius: 15px;
        padding: 20px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        overflow-y: auto;
        max-height: 700px;
    }
    
    .panel-section {
        margin-bottom: 25px;
        padding-bottom: 20px;
        border-bottom: 1px solid #eee;
    }
    
    .panel-section:last-child {
        border-bottom: none;
    }
    
    .panel-section h3 {
        color: #333;
        margin-bottom: 15px;
        font-size: 1.1em;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .slider-container {
        margin-bottom: 15px;
    }
    
    .slider-container label {
        display: flex;
        justify-content: space-between;
        margin-bottom: 5px;
        color: #666;
        font-size: 0.9em;
    }
    
    input[type="range"] {
        width: 100%;
        height: 6px;
        background: linear-gradient(90deg, var(--primary), var(--primary2));
        border-radius: 3px;
        -webkit-appearance: none;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 18px;
        height: 18px;
        background: white;
        border-radius: 50%;
        box-shadow: 0 2px 6px rgba(0,0,0,0.3);
        cursor: pointer;
        border: 2px solid var(--primary);
        transition: all 0.1s ease;
    }
    
    /* Slider de rotación */
    #rotation {
        background: linear-gradient(90deg, 
            var(--primary) 0%, 
            var(--primary) 48%, 
            #ff6b6b 48%,
            #ff6b6b 52%,
            var(--primary2) 52%,
            var(--primary2) 100%);
    }
    
    #rotation.sticky::-webkit-slider-thumb {
        transform: scale(1.5);
        border-color: #ff6b6b;
        box-shadow: 0 0 15px rgba(255,107,107,0.8);
        background: #ff6b6b;
    }
    
    select, input[type="number"] {
        width: 100%;
        padding: 10px;
        border: 1px solid #ddd;
        border-radius: 8px;
        font-size: 0.9em;
        margin-bottom: 10px;
        background: white;
    }
    
    select:focus, input:focus {
        outline: none;
        border-color: var(--primary);
    }
    
    .position-controls {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
        margin-bottom: 15px;
    }
    
    .position-btn {
        padding: 8px;
        border: 1px solid #ddd;
        background: white;
        border-radius: 4px;
        cursor: pointer;
        font-size: 0.8em;
        transition: all 0.3s;
    }
    
    .position-btn:hover {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
    }
    
    .position-btn.active {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
    }
    
    .btn {
        padding: 12px 20px;
        border: none;
        border-radius: 8px;
        font-size: 0.9em;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }
    
    .btn-primary {
        background: linear-gradient(135deg, var(--primary), var(--primary2));
        color: white;
        width: 100%;
    }
    
    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    }
    
    .btn-success {
        background: #10b981;
        color: white;
        width: 100%;
    }
    
    .btn-success:hover {
        background: #059669;
    }
    
    .button-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-top: 15px;
    }
    
    /* Vista previa */
    .preview-panel {
        background: white;
        border-radius: 15px;
        padding: 20px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        display: flex;
        flex-direction: column;
    }
    
    .preview-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
    }
    
    .preview-container {
        background: #1a1a1a;
        border-radius: 10px;
        height: 500px;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        position: relative;
    }
    
    #previewCanvas {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        cursor: default;
    }
    
    /* Toast */
    #pasteNotification {
        display: none;
        position: fixed;
        top: 20px;
        right: 20px;
        background: #111827;
        color: #fff;
        padding: 12px 14px;
        border-radius: 12px;
        z-index: 10000;
        box-shadow: 0 12px 26px rgba(0,0,0,0.35);
        align-items: center;
        gap: 10px;
        font-weight: 900;
    }
    
    #pasteNotification.visible {
        display: flex;
    }
    
    #pasteNotification.ok {
        background: rgba(22,163,74,0.95);
    }
    
    #pasteNotification.bad {
        background: rgba(239,68,68,0.95);
    }
    
    /* Global drop overlay */
    #globalDropOverlay {
        position: fixed;
        inset: 0;
        background: rgba(106,17,203,0.12);
        backdrop-filter: blur(4px);
        display: none;
        align-items: center;
        justify-content: center;
        z-index: 15000;
        pointer-events: none;
    }
    
    #globalDropOverlay.visible {
        display: flex;
    }
    
    #globalDropOverlay .inner {
        background: rgba(255,255,255,0.85);
        border: 2px dashed rgba(106,17,203,0.55);
        border-radius: 22px;
        padding: 22px 24px;
        box-shadow: var(--shadow);
        font-weight: 1000;
        display: flex;
        align-items: center;
        gap: 10px;
        pointer-events: none;
    }
    
    /* Mensaje de error */
    .error-message {
        background: #fee2e2;
        color: #991b1b;
        padding: 12px;
        border-radius: 8px;
        margin-bottom: 15px;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    /* Responsive */
    @media (max-width: 768px) {
        .upload-section {
            grid-template-columns: 1fr;
        }
        
        .main-panel {
            grid-template-columns: 1fr;
        }
        
        .preview-container {
            height: 400px;
        }
        
        .auto-process {
            top: 10px;
            right: 10px;
        }
    }
    
    /* Animaciones */
    @keyframes slideInRight {
        from { transform: translate3d(110%, 0, 0); }
        to { transform: translate3d(0, 0, 0); }
    }
    
    @keyframes slideOutRight {
        from { transform: translate3d(0, 0, 0); }
        to { transform: translate3d(110%, 0, 0); }
    }
    
    .paste-notification.hiding {
        animation: slideOutRight 0.3s ease-out forwards;
    }
    
    body.ctrl-active::after {
        content: 'Ctrl+V activo - Pega una imagen';
        position: fixed;
        bottom: 20px;
        right: 20px;
        background: #6a11cb;
        color: white;
        padding: 10px 15px;
        border-radius: 5px;
        font-size: 12px;
        z-index: 10000;
        animation: fadeInOut 2s ease-in-out;
    }
    
    @keyframes fadeInOut {
        0%, 100% { opacity: 0; }
        50% { opacity: 1; }
    }
    
    @keyframes blinkCaret {
        0%, 49% { opacity: 1; }
        50%, 100% { opacity: 0; }
    }
    
    .type-cursor {
        border-right: 2px solid rgba(255,255,255,0.95);
        padding-right: 2px;
        animation: blinkCaret 0.7s steps(1) infinite;
    }
