/* ═══════════════════════════════════════════════════════════════════ */

        .form-group { margin-bottom: 8px; }
        
        .form-group label {
            display: block;
            margin-bottom: 4px;
            font-size: 10px;
            color: var(--text-secondary);
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.3px;
        }
        
        .form-group input,
        .form-group select,
        .form-group textarea {
            width: 100%;
            padding: 6px 8px;
            border: 1px solid var(--border-light);
            border-radius: 5px;
            font-size: 12px;
            background: var(--bg-surface-3);
            color: var(--text-primary);
            transition: border-color 0.2s;
        }
        
        .form-group input:focus,
        .form-group select:focus,
        .form-group textarea:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 2px var(--accent-glow);
        }
        
        .form-group textarea { resize: vertical; min-height: 50px; font-family: inherit; }
        
        .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
        
        .json-section { margin-top: 15px; flex-shrink: 0; }
        
        .json-output {
            background: #2c3e50;
            color: #2ecc71;
            padding: 15px;
            border-radius: 6px;
            font-family: 'Courier New', monospace;
            font-size: 10px;
            overflow-x: auto;
            position: relative;
            max-height: 250px;
            overflow-y: auto;
            border: 1px solid #1a252f;
        }
        
        .copy-btn {
            background: var(--accent);
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 12px;
            font-weight: 600;
            transition: all 0.2s;
        }
        
        .copy-btn:hover {
            background: #6a5bf0;
            transform: translateY(-1px);
            box-shadow: 0 4px 14px rgba(124,110,255,0.4);
        }
        
        h3 { margin-bottom: 10px; color: var(--text-primary); font-size: 14px; font-weight: 600; }
        
        .help-text { font-size: 11px; color: var(--text-muted); margin-top: 4px; font-style: italic; }
        
        .calc-info {
            background: var(--bg-surface-3);
            border: 1px solid var(--border-light);
            border-radius: 6px;
            padding: 10px;
            margin-bottom: 10px;
            font-size: 11px;
            line-height: 1.6;
            color: var(--text-secondary);
        }
        
        .guide-line {
            position: absolute;
            pointer-events: none;
            z-index: 5;
        }
        
        /* ── Guías de distancia inteligentes ─────────────────────────────── */
        #distance-overlay { position:absolute; top:0; left:0; width:100%; height:100%; pointer-events:none; z-index:150; }
        .dist-line { position:absolute; background:#e85d04; pointer-events:none; }
        .dist-line.dist-h { height:1px; }
        .dist-line.dist-v { width:1px; }
        .image-overlay-wrap { position:absolute; cursor:move; user-select:none; -webkit-user-select:none; touch-action:none; box-sizing:border-box; transform-origin:center center; }
        .image-overlay-wrap.active-overlay { outline:2px solid #f59e0b; outline-offset:2px; }
        .image-overlay-wrap img { width:100%; height:100%; display:block; object-fit:cover; pointer-events:none; }
        .ov-rh { position:absolute; width:10px; height:10px; background:#f59e0b; border:1.5px solid #fff; border-radius:2px; z-index:25; box-sizing:border-box; }
        .ov-rh[data-dir="nw"] { top:-5px;  left:-5px;              cursor:nw-resize; }
        .ov-rh[data-dir="n"]  { top:-5px;  left:calc(50% - 5px);   cursor:n-resize;  }
        .ov-rh[data-dir="ne"] { top:-5px;  right:-5px;             cursor:ne-resize; }
        .ov-rh[data-dir="e"]  { top:calc(50% - 5px); right:-5px;   cursor:e-resize;  }
        .ov-rh[data-dir="se"] { bottom:-5px; right:-5px;           cursor:se-resize; }
        .ov-rh[data-dir="s"]  { bottom:-5px; left:calc(50% - 5px); cursor:s-resize;  }
        .ov-rh[data-dir="sw"] { bottom:-5px; left:-5px;            cursor:sw-resize; }
        .ov-rh[data-dir="w"]  { top:calc(50% - 5px); left:-5px;    cursor:w-resize;  }
        .overlay-delete-btn { position:absolute; top:-10px; left:-10px; width:18px; height:18px; background:#e74c3c; color:white; border:none; border-radius:50%; font-size:11px; cursor:pointer; display:flex; align-items:center; justify-content:center; z-index:30; line-height:1; }
        .ov-rot-handle { position:absolute; top:-28px; right:-28px; width:22px; height:22px; background:#7c3aed; color:#fff; border-radius:50%; font-size:14px; cursor:grab; display:flex; align-items:center; justify-content:center; z-index:35; user-select:none; box-shadow:0 2px 6px rgba(0,0,0,0.25); }
        .ov-rot-handle:active { cursor:grabbing; }
        .ov-rot-tooltip { position:absolute; top:-52px; right:-28px; background:rgba(0,0,0,0.78); color:#fff; font-size:11px; font-weight:700; padding:3px 8px; border-radius:5px; white-space:nowrap; pointer-events:none; display:none; z-index:40; }
        .image-overlay-wrap.rotating .ov-rot-tooltip { display:block; }
        .brand-swatch { width:20px; height:20px; border-radius:50%; border:1.5px solid rgba(0,0,0,0.2); cursor:pointer; flex-shrink:0; transition:transform 0.1s; position:relative; }
        .brand-swatch:hover { transform:scale(1.3); }
        .dist-cap { position:absolute; background:#e85d04; pointer-events:none; }
        .dist-label {
            position:absolute;
            background:#e85d04;
            color:#fff;
            font-size:10px;
            font-weight:700;
            padding:1px 4px;
            border-radius:3px;
            pointer-events:none;
            white-space:nowrap;
            transform:translate(-50%, -50%);
            z-index:151;
        }
        
        .text-bounding-box {
            position: absolute;
            border: 2px solid #0080FF;
            pointer-events: none;
            z-index: 7;
            box-sizing: border-box;
        }
        
        .text-control-point {
            position: absolute;
            width: 8px;
            height: 8px;
            background: #FFFFFF;
            border: 2px solid #0080FF;
            pointer-events: none;
            z-index: 8;
            box-sizing: border-box;
        }
        .txt-rot-handle {
            position: absolute; width: 22px; height: 22px;
            background: #7c3aed; color: #fff; border-radius: 50%;
            font-size: 14px; cursor: grab; display: flex;
            align-items: center; justify-content: center;
            z-index: 35; user-select: none;
            box-shadow: 0 2px 6px rgba(0,0,0,0.25);
            pointer-events: auto;
        }
        .txt-rot-handle:active { cursor: grabbing; }
        .txt-rot-tooltip {
            position: absolute; background: rgba(0,0,0,0.78); color: #fff;
            font-size: 11px; font-weight: 700; padding: 3px 8px;
            border-radius: 5px; white-space: nowrap; pointer-events: none;
            display: none; z-index: 40;
        }
        .txt-rot-tooltip.visible { display: block; }
        .txt-opacity-row {
            position: absolute; display: flex; align-items: center; gap: 3px;
            background: rgba(0,0,0,0.38); border-radius: 3px;
            padding: 2px 5px; pointer-events: auto; z-index: 30;
        }
        
        .calc-info strong { color: #2e7d32; }
        
        /* Details/Summary para secciones desplegables */
        details summary {
            position: relative;
            padding-left: 18px;
        }
        
        details summary::before {
            content: '▶';
            position: absolute;
            left: 0;
            font-size: 10px;
            transition: transform 0.2s;
        }
        
        details[open] summary::before {
            transform: rotate(90deg);
        }
        
        
        /* Custom fields buttons */
        .custom-fields {
            display: flex;
            flex-wrap: nowrap;
            gap: 3px;
            margin-top: 8px;
        }
        
        /* ── Panel de variables ManyChat ───────────────────────────── */
        .vars-panel {
            margin-top: 8px;
            background: rgba(30,30,50,0.7);
            border: 1px solid rgba(100,100,180,0.25);
            border-radius: 8px;
            padding: 8px 10px;
        }
        .vars-panel-header {
            display: flex;
            align-items: center;
            gap: 5px;
            font-size: 10px;
            color: #7c80a0;
            margin-bottom: 7px;
            font-style: italic;
            font-family: -apple-system, 'Segoe UI', sans-serif;
        }
        .vars-panel-header code {
            background: rgba(79,70,229,0.2);
            color: #a5b4fc;
            padding: 1px 4px;
            border-radius: 3px;
            font-family: 'Courier New', monospace;
            font-style: normal;
            font-size: 10px;
        }
        .vars-panel-section-label {
            font-size: 10px;
            font-weight: 700;
            color: #8890b0;
            margin-bottom: 5px;
            text-transform: uppercase;
            letter-spacing: 0.4px;
            font-family: -apple-system, 'Segoe UI', sans-serif;
        }
        .vars-panel-chips {
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
        }

        /* Chip sistema (azul/morado) — dark theme */
        .var-chip {
            display: inline-flex;
            align-items: center;
            gap: 3px;
            padding: 3px 8px;
            border-radius: 999px;
            font-size: 11px !important;
            font-family: 'Courier New', monospace !important;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.15s;
            white-space: nowrap;
            border: 1px solid transparent;
            line-height: 1.4;
        }
        .var-chip-sys {
            background: rgba(79,70,229,0.15);
            color: #a5b4fc;
            border-color: rgba(79,70,229,0.35);
        }
        .var-chip-sys:hover {
            background: #4f46e5;
            color: #fff;
            border-color: #4f46e5;
            transform: translateY(-1px);
            box-shadow: 0 2px 6px rgba(79,70,229,0.4);
        }

        /* Chip usuario (naranja) — dark theme */
        .var-chip-user {
            background: rgba(194,65,12,0.15);
            color: #fb923c;
            border-color: rgba(194,65,12,0.35);
            position: relative;
        }
        .var-chip-user:hover {
            background: #c2410c;
            color: #fff;
            border-color: #c2410c;
            transform: translateY(-1px);
        }
        .var-chip-user .del-field {
            display: none;
            position: absolute;
            top: -5px;
            right: -5px;
            width: 13px;
            height: 13px;
            background: #e53935;
            color: white;
            border-radius: 50%;
            font-size: 9px;
            line-height: 13px;
            text-align: center;
            font-family: sans-serif;
            font-weight: 700;
            cursor: pointer;
        }
        .var-chip-user:hover .del-field { display: block; }

        /* Chip "+ Nuevo" — dark theme */
        .var-chip-add {
            background: transparent;
            color: #6b7280;
            border: 1.5px dashed rgba(100,100,150,0.4);
            font-family: -apple-system, 'Segoe UI', sans-serif !important;
            font-weight: 700;
            font-size: 11px !important;
        }
        .var-chip-add:hover {
            background: rgba(22,163,74,0.12);
            color: #4ade80;
            border-color: rgba(22,163,74,0.4);
            transform: translateY(-1px);
        }

        /* Clases legacy (por si hay código antiguo que las usa) */
        .custom-field-btn {
            padding: 4px 9px;
            background: #ede9fe;
            border: 1.5px solid #c4b5fd;
            border-radius: 999px;
            font-size: 11px;
            color: #4f46e5;
            cursor: pointer;
            transition: all 0.15s;
            font-family: 'Courier New', monospace;
            font-weight: 700;
            white-space: nowrap;
        }
        .custom-field-btn:hover {
            background: #4f46e5;
            color: white;
            transform: translateY(-1px);
        }
        .user-field-btn {
            padding: 4px 9px;
            background: #fff7ed;
            border: 1.5px solid #fdba74;
            border-radius: 999px;
            font-size: 11px;
            color: #c2410c;
            cursor: pointer;
            transition: all 0.15s;
            font-family: 'Courier New', monospace;
            font-weight: 700;
            white-space: nowrap;
            position: relative;
        }
        .user-field-btn:hover {
            background: #c2410c;
            color: #fff;
            border-color: #c2410c;
        }
        .user-field-btn .del-field {
            display: none;
            position: absolute;
            top: -6px;
            right: -6px;
            width: 14px;
            height: 14px;
            background: #e53935;
            color: white;
            border-radius: 50%;
            font-size: 9px;
            line-height: 14px;
            text-align: center;
            font-family: sans-serif;
            font-weight: 700;
            cursor: pointer;
        }
        .user-field-btn:hover .del-field { display: block; }
        .add-field-btn {
            padding: 4px 9px;
            background: #fff;
            border: 1.5px dashed #d1d5db;
            border-radius: 999px;
            font-size: 11px;
            color: #6b7280;
            cursor: pointer;
            font-weight: 700;
            white-space: nowrap;
            transition: all 0.2s;
        }
        .add-field-btn:hover { background: #f0fdf4; color: #16a34a; border-color: #86efac; }
        
        /* Modal personalizado */
        .modal-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            z-index: 10000;
            align-items: center;
            justify-content: center;
        }
        
        .modal-overlay.active {
            display: flex;
        }
        
        .modal-box {
            background: var(--bg-surface-2);
            border: 1px solid var(--border-light);
            padding: 30px;
            border-radius: 14px;
            box-shadow: 0 16px 56px rgba(0,0,0,0.7);
            max-width: 400px;
            width: 90%;
            animation: modalSlideIn 0.3s ease;
        }
        
        @keyframes modalSlideIn {
            from {
                transform: translateY(-50px);
                opacity: 0;
            }
            to {
                transform: translateY(0);
                opacity: 1;
            }
        }
        
        .modal-title {
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 15px;
            color: var(--text-primary);
        }
        
        .modal-message {
            font-size: 14px;
            color: var(--text-secondary);
            margin-bottom: 25px;
            line-height: 1.5;
            white-space: pre-line;
        }
        
        .modal-buttons {
            display: flex;
            gap: 10px;
            justify-content: flex-end;
        }
        
        .modal-btn {
            padding: 10px 20px;
            border: none;
            border-radius: 7px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }
        
        .modal-btn-cancel {
            background: var(--bg-surface-3);
            color: var(--text-secondary);
            border: 1px solid var(--border-light);
        }
        
        .modal-btn-cancel:hover {
            background: var(--border);
            color: var(--text-primary);
        }
        
        .modal-btn-confirm {
            background: #ef4444;
            color: white;
        }
        
        .modal-btn-confirm:hover {
            background: #dc2626;
        }

        /* ===== EMOJI PICKER ===== */
        .emoji-btn {
            position: absolute;
            right: 6px;
            bottom: 6px;
            background: none;
            border: none;
            font-size: 18px;
            cursor: pointer;
            line-height: 1;
            padding: 2px;
            border-radius: 4px;
            opacity: 0.7;
            transition: opacity 0.15s, background 0.15s;
            z-index: 2;
        }
        .emoji-btn:hover { opacity: 1; background: rgba(0,0,0,0.07); }

        .textarea-wrap { position: relative; }

        /* Reset fuente del textarea — evita que herede la fuente del canvas */
        .textarea-wrap textarea,
        .form-group textarea {
            font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif !important;
            font-size: 13px !important;
            font-weight: 400 !important;
            line-height: 1.5 !important;
        }

        .emoji-picker-popup {
            display: none;
            position: fixed;
            width: 380px;
            max-height: 70vh;
            background: var(--bg-surface-2);
            border: 1px solid var(--border-light);
            border-radius: 12px;
            box-shadow: 0 12px 48px rgba(0,0,0,0.65);
            z-index: 99999;
            flex-direction: column;
            overflow: hidden;
        }
        .emoji-picker-popup.open { display: flex; }

        .emoji-recent-bar {
            display: flex;
            align-items: center;
            gap: 2px;
            padding: 6px 8px 4px;
            border-bottom: 1px solid var(--border);
            flex-wrap: wrap;
            min-height: 36px;
        }
        .emoji-recent-label {
            font-size: 9px;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.4px;
            margin-right: 4px;
        }
        .emoji-recent-item {
            font-size: 20px;
            cursor: pointer;
            padding: 2px 4px;
            border-radius: 4px;
            line-height: 1.2;
            transition: background 0.1s;
        }
        .emoji-recent-item:hover { background: var(--bg-surface-3); }

        .emoji-cat-tabs {
            display: flex;
            border-bottom: 1px solid var(--border);
            background: var(--bg-surface-1);
            overflow-x: auto;
            scrollbar-width: none;
        }
        .emoji-cat-tabs::-webkit-scrollbar { display: none; }
        .emoji-cat-tab {
            flex-shrink: 0;
            padding: 6px 10px;
            font-size: 17px;
            cursor: pointer;
            border-bottom: 2px solid transparent;
            transition: border-color 0.15s, background 0.15s;
            line-height: 1;
        }
        .emoji-cat-tab:hover { background: var(--bg-surface-3); }
        .emoji-cat-tab.active { border-bottom-color: var(--accent); background: var(--bg-surface-2); }

        .emoji-grid {
            display: grid;
            grid-template-columns: repeat(10, 1fr);
            gap: 2px;
            padding: 6px 8px;
            overflow-y: auto;
            max-height: calc(70vh - 130px);
            min-height: 180px;
        }
        .emoji-item {
            font-size: 20px;
            cursor: pointer;
            text-align: center;
            padding: 3px 2px;
            border-radius: 4px;
            line-height: 1.2;
            transition: background 0.1s;
            user-select: none;
        }
        .emoji-item:hover { background: var(--bg-surface-3); }

        /* ── Font Picker ─────────────────────────────────────────── */
        .font-picker { position: relative; width: 100%; }
        .font-picker-btn {
            width: 100%; padding: 6px 10px;
            border: 1px solid var(--border-light); border-radius: 5px;
            background: var(--bg-surface-3); color: var(--text-primary); cursor: pointer;
            display: flex; align-items: center; justify-content: space-between;
            font-size: 14px; text-align: left;
            min-height: 34px;
        }
        .font-picker-btn:hover { border-color: var(--accent); }
        .font-picker-btn .fp-arrow { font-size: 10px; color: var(--text-muted); flex-shrink: 0; margin-left: 6px; }
        .font-picker-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .font-picker-dropdown {
            display: none; position: absolute; z-index: 9999;
            top: calc(100% + 3px); left: 0; right: auto;
            min-width: 280px;
            background: var(--bg-surface-2); border: 1px solid var(--border-light);
            border-radius: 8px; box-shadow: 0 8px 28px rgba(0,0,0,0.5);
            max-height: 280px; overflow-y: auto;
        }
        .font-picker-dropdown.open { display: block; }
        .font-picker-option {
            padding: 5px 12px; cursor: pointer;
            border-bottom: 1px solid var(--border);
            color: var(--text-primary);
            display: flex; flex-direction: column; gap: 1px;
            min-height: 46px; justify-content: center;
        }
        .font-picker-option:last-child { border-bottom: none; }
        .font-picker-option:hover { background: var(--bg-surface-3); }
        .font-picker-option.selected { background: var(--accent-glow); color: var(--accent); }
        .fp-opt-name {
            font-size: 9px; color: #585870; letter-spacing: .3px; line-height: 1.3;
            pointer-events: none; font-family: system-ui, sans-serif !important;
            font-weight: normal !important; font-style: normal !important;
        }
        .fp-opt-prev {
            font-size: 17px; line-height: 1.25; pointer-events: none; color: inherit;
        }
        .font-picker-option.selected .fp-opt-name { color: var(--accent); opacity: .75; }
        .font-picker-divider {
            padding: 4px 10px; font-size: 10px; color: var(--text-muted);
            text-transform: uppercase; letter-spacing: 0.5px;
            background: var(--bg-surface-1); border-bottom: 1px solid var(--border);
        }
        .font-picker-divider-brand {
            background: linear-gradient(90deg, rgba(79,70,229,0.18), rgba(124,58,237,0.10));
            color: #a5b4fc !important;
            border-top: 1px solid rgba(99,102,241,0.3);
            border-bottom: 1px solid rgba(99,102,241,0.2) !important;
            font-weight: 800;
            letter-spacing: 1px;
            padding: 6px 10px !important;
        }

        /* ── Equidistance snap indicator ───────────────────────────────── */
        .equi-label {
            position: absolute;
            background: #10b981;
            color: #fff;
            font-size: 10px;
            font-weight: 800;
            padding: 2px 5px;
            border-radius: 3px;
            pointer-events: none;
            white-space: nowrap;
            transform: translate(-50%, -50%);
            z-index: 155;
            letter-spacing: 1px;
        }
        .equi-line {
            position: absolute;
            background: #10b981;
            pointer-events: none;
            z-index: 154;
        }

        /* ══ RESPONSIVE MÓVIL — ver bloque @media principal al final del archivo ══ */
        /* Desplegable tip consistente — oculta el triángulo nativo */
        details.tip-collapsible > summary { list-style: none; cursor: pointer; }
        details.tip-collapsible > summary::-webkit-details-marker { display: none; }
        details.tip-collapsible > summary::before { display: none; }
        details.tip-collapsible > summary .tip-arrow { transition: transform 0.15s; display: inline-block; font-style: normal; }
        details.tip-collapsible[open] > summary .tip-arrow { transform: rotate(180deg); }
        @keyframes spin { to { transform: rotate(360deg); } }
        .gen-spinner {
            display: inline-block;
            width: 14px; height: 14px;
            border: 2px solid rgba(12,84,96,0.25);
            border-top-color: #0c5460;
            border-radius: 50%;
            animation: spin 0.75s linear infinite;
            vertical-align: middle;
            margin-right: 6px;
        }
        @keyframes btnPulse { 0%,100%{opacity:1} 50%{opacity:0.7} }
        #generate-btn.loading { animation: btnPulse 1.4s ease-in-out infinite; }

        /* ══ SPLASH SCREEN ══ */
        #splash-screen {
            position: fixed;
            inset: 0;
            background: #0f0f1a;
            z-index: 9000;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: none;
        }
        #splash-screen.fade-out {
            opacity: 0;
            pointer-events: none;
        }
        .splash-inner {
            text-align: center;
            max-width: 780px;
            width: 92%;
            padding: 0 20px;
            max-height: 88vh;
            overflow-y: auto;
            scrollbar-width: thin;
            scrollbar-color: #333 transparent;
        }
        .splash-logo {
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 4px;
            text-transform: uppercase;
            color: #667eea;
            margin-bottom: 36px;
        }
        .splash-title {
            font-size: 32px;
            font-weight: 900;
            color: #fff;
            line-height: 1.1;
            margin-bottom: 14px;
            letter-spacing: -0.5px;
            white-space: nowrap;
        }
        .splash-subtitle {
            font-size: 15px;
            color: #666;
            margin-bottom: 36px;
        }
        .splash-input-row {
            display: flex;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 0 0 1px rgba(102,126,234,0.35), 0 20px 60px rgba(0,0,0,0.5);
            margin-bottom: 18px;
        }
        .splash-input-row input {
            flex: 1;
            padding: 16px 20px;
            background: #1a1a2e;
            border: none;
            color: #fff;
            font-size: 14px;
            outline: none;
            min-width: 0;
            transition: background 0.2s, border-color 0.2s;
        }
        .splash-input-row input::placeholder { color: #444; }
        .splash-input-row input:focus { background: #1e1e38; }
        .splash-input-row button {
            padding: 16px 28px;
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: #fff;
            border: none;
            font-size: 14px;
            font-weight: 700;
            cursor: pointer;
            white-space: nowrap;
            transition: opacity 0.2s;
            flex-shrink: 0;
        }
        .splash-input-row button:hover { opacity: 0.88; }
        .splash-input-row button:active { opacity: 0.75; }
        .splash-hint {
            font-size: 12px;
            color: #444;
        }
        .splash-hint a { color: #667eea; text-decoration: none; }
        .splash-hint a:hover { text-decoration: underline; }

        /* ── AI MODE ── */
        .splash-mode-tabs {
            display: flex; gap: 8px; justify-content: center;
            margin-bottom: 22px;
        }
        .splash-tab {
            padding: 9px 24px; border-radius: 30px; border: 1.5px solid #2a2a45;
            background: transparent; color: #888; font-size: 13px; font-weight: 600;
            cursor: pointer; transition: all 0.2s;
        }
        .splash-tab:hover { border-color: #667eea; color: #fff; }
        .splash-tab.active { display: none; }
        #splash-drop-zone.dragover { border-color: #667eea; background: rgba(102,126,234,0.08); transform: scale(1.01); }
        #splash-drop-zone:hover { border-color: #888; }

        .ai-section-label {
            font-size: 13px; font-weight: 700; letter-spacing: 1.2px;
            text-transform: uppercase; color: #ffffff; margin-bottom: 12px; text-align: left;
        }
        .ai-optional { font-size: 11px; color: rgba(255,255,255,0.45); text-transform: none; letter-spacing: 0; font-weight: 400; }

        /* Ratio grid */
        .ai-ratio-grid {
            display: flex; gap: 8px; flex-wrap: nowrap; justify-content: center;
            margin-bottom: 4px; overflow-x: auto; padding-bottom: 2px;
        }
        .ai-ratio-card {
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            gap: 5px; padding: 8px 12px; min-width: 68px;
            border-radius: 10px; border: 1.5px solid #2a2a45;
            background: #13131f; color: #aaa; cursor: pointer; transition: all 0.18s;
        }
        .ai-ratio-card:hover { border-color: #667eea; color: #fff; }
        .ai-ratio-card.selected { border-color: #667eea; background: rgba(102,126,234,0.15); color: #fff; }
        .ai-ratio-thumb {
            background: #667eea; border-radius: 3px; opacity: 0.7;
        }
        .ai-ratio-label { font-size: 11px; font-weight: 700; }
        .ai-ratio-desc { font-size: 9px; color: rgba(255,255,255,0.45); text-align: center; line-height: 1.2; }

        /* Prompt */
        .ai-prompt {
            width: 100%; box-sizing: border-box; padding: 12px 14px;
            background: #1a1a2e; border: 1.5px solid #2a2a45; border-radius: 10px;
            color: #fff; font-size: 14px; font-family: inherit; resize: none; outline: none;
            transition: border-color 0.2s; line-height: 1.5;
        }
        .ai-prompt:focus { border-color: #667eea; }
        .ai-prompt::placeholder { color: rgba(255,255,255,0.25); }

        /* Style grid */
        .ai-style-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 8px;
            margin-bottom: 6px;
        }
        .ai-style-card {
            position: relative; border-radius: 10px; overflow: hidden;
            aspect-ratio: 1 / 0.72; cursor: pointer;
            border: 2px solid transparent;
            transition: border-color 0.18s, transform 0.15s, box-shadow 0.18s;
            box-shadow: 0 2px 8px rgba(0,0,0,0.4);
        }
        .ai-style-card:hover {
            border-color: rgba(102,126,234,0.6);
            transform: scale(1.03);
            box-shadow: 0 4px 16px rgba(102,126,234,0.3);
        }
        .ai-style-card.selected {
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102,126,234,0.35), 0 4px 16px rgba(102,126,234,0.4);
        }
        .ai-style-card.selected::after {
            content: '✓';
            position: absolute; top: 5px; right: 6px;
            width: 18px; height: 18px; border-radius: 50%;
            background: #667eea; color: #fff;
            font-size: 11px; font-weight: 700; line-height: 18px;
            text-align: center; z-index: 3;
        }
        .ai-style-card-bg {
            position: absolute; inset: 0; width: 100%; height: 100%;
            object-fit: cover; display: block; pointer-events: none;
            user-select: none;
        }
        .ai-style-card-overlay {
            position: absolute; bottom: 0; left: 0; right: 0;
            padding: 18px 6px 5px;
            background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, transparent 100%);
            z-index: 2; pointer-events: none;
        }
        .ai-style-card-name {
            color: #fff; font-size: 10px; font-weight: 700; text-align: center;
            text-shadow: 0 1px 4px rgba(0,0,0,0.8); line-height: 1.2;
        }

        /* Generate button */
        .ai-generate-btn {
            position: relative; overflow: hidden;
            width: 100%; margin-top: 18px; padding: 14px; border-radius: 12px; border: none;
            background: linear-gradient(135deg,#667eea,#764ba2); color: #fff;
            font-size: 15px; font-weight: 700; cursor: pointer; transition: opacity 0.2s;
        }
        .ai-generate-btn:hover { opacity: 0.88; }
        .ai-generate-btn:disabled { opacity: 0.65; cursor: not-allowed; }

        /* ── Botón "Mejorar prompt" ─────────────────────────────────────── */
        .ai-enhance-btn {
            display: inline-flex; align-items: center; gap: 5px;
            padding: 6px 12px; border-radius: 20px; border: 1.5px solid #a78bfa;
            background: linear-gradient(135deg, #1e1040 0%, #2d1b6e 100%);
            color: #c4b5fd; font-size: 11px; font-weight: 700;
            cursor: pointer; letter-spacing: 0.3px;
            transition: all 0.18s; white-space: nowrap;
        }
        .ai-enhance-btn:hover:not(:disabled) {
            background: linear-gradient(135deg, #2d1b6e 0%, #4c1d95 100%);
            border-color: #c4b5fd; color: #ede9fe;
            box-shadow: 0 0 12px rgba(167,139,250,0.35);
        }
        .ai-enhance-btn:disabled { opacity: 0.5; cursor: not-allowed; }
        .ai-enhance-btn.loading #ai-enhance-icon { animation: spin-gem 0.8s linear infinite; display: inline-block; }
        @keyframes spin-gem { to { transform: rotate(360deg); } }

        /* Botón "Sin textos" — variante roja/naranja */
        .ai-notxt-btn {
            display: inline-flex; align-items: center; gap: 5px;
            padding: 6px 12px; border-radius: 20px; border: 1.5px solid #f97316;
            background: linear-gradient(135deg, #1c0a00 0%, #431407 100%);
            color: #fdba74; font-size: 11px; font-weight: 700;
            cursor: pointer; letter-spacing: 0.3px;
            transition: all 0.18s; white-space: nowrap;
        }
        .ai-notxt-btn:hover:not(:disabled) {
            background: linear-gradient(135deg, #431407 0%, #7c2d12 100%);
            border-color: #fb923c; color: #fed7aa;
            box-shadow: 0 0 12px rgba(249,115,22,0.35);
        }
        .ai-notxt-btn:disabled { opacity: 0.5; cursor: not-allowed; }
        .ai-notxt-btn.loading #ai-notxt-icon { animation: spin-gem 0.8s linear infinite; display: inline-block; }

        .ai-revert-btn {
            display: inline-flex; align-items: center; gap: 4px;
            padding: 5px 10px; border-radius: 20px; border: 1px solid #555;
            background: transparent; color: #aaa;
            font-size: 11px; font-weight: 600; cursor: pointer;
            transition: all 0.15s; white-space: nowrap;
        }
        .ai-revert-btn:hover { border-color: #888; color: #ddd; }

        .ai-enhance-hint {
            font-size: 10px; color: #6ee7b7; font-style: italic;
            flex: 1; text-align: right; opacity: 0.85;
        }
        /* Parpadeo al reemplazar el texto */
        @keyframes flash-prompt {
            0%   { background: rgba(167,139,250,0.18); }
            100% { background: transparent; }
        }
        .ai-prompt.enhanced { animation: flash-prompt 0.8s ease-out; }
        